Logo ROOT   6.16/01
Reference Guide
parallelMergeTest.C File Reference

Detailed Description

#include "TMessage.h"
#include "TBenchmark.h"
#include "TSocket.h"
#include "TH2.h"
#include "TTree.h"
#include "TFile.h"
#include "TRandom.h"
#include "TError.h"
void parallelMergeTest(UInt_t nhist, UInt_t ndims = 1, UInt_t nbins = 100)
{
gBenchmark->Start("parallelMergeTest");
TFile *file = TFile::Open("mergedClient.root?pmerge=localhost:1095","RECREATE");
Float_t px, py;
TTree *tree = 0;
switch (ndims) {
case 1: {
for(UInt_t h = 0 ; h < nhist; ++h) {
new TH1F(TString::Format("hpx%d",h),"This is the px distribution",nbins,-4,4);
}
break;
}
case 2: {
for(UInt_t h = 0 ; h < nhist; ++h) {
new TH2F(TString::Format("hpxy%d",h),"py vs px",nbins,-4,4,nbins,-4,-4);
}
break;
}
case 99: {
tree = new TTree("tree","tree");
tree->SetAutoFlush(4000000);
tree->Branch("px",&px);
tree->Branch("py",&py);
}
}
// Fill histogram randomly
const int kUPDATE = 1000000;
for (int i = 0; i < 25000000; ) {
// gRandom->Rannor(px,py);
// if (idx%2 == 0)
// hpx->Fill(px);
// else
// hpx->Fill(px,py);
if(tree) tree->Fill();
++i;
if (i && (i%kUPDATE) == 0) {
file->Write();
}
}
file->Write();
delete file;
gBenchmark->Show("parallelMergeTest");
}
#define h(i)
Definition: RSha256.hxx:106
unsigned int UInt_t
Definition: RtypesCore.h:42
float Float_t
Definition: RtypesCore.h:53
R__EXTERN TBenchmark * gBenchmark
Definition: TBenchmark.h:59
R__EXTERN TRandom * gRandom
Definition: TRandom.h:62
virtual void Start(const char *name)
Starts Benchmark with the specified name.
Definition: TBenchmark.cxx:174
virtual void Show(const char *name)
Stops Benchmark name and Prints results.
Definition: TBenchmark.cxx:157
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Definition: TFile.h:48
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseGeneralPurpose, Int_t netopt=0)
Create / open a file.
Definition: TFile.cxx:3975
1-D histogram with a float per channel (see TH1 documentation)}
Definition: TH1.h:571
2-D histogram with a float per channel (see TH1 documentation)}
Definition: TH2.h:250
virtual void SetSeed(ULong_t seed=0)
Set the random generator seed.
Definition: TRandom.cxx:589
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition: TString.cxx:2286
A TTree object has a header with a name and a title.
Definition: TTree.h:71
Definition: file.py:1
Definition: tree.py:1
Author

Definition in file parallelMergeTest.C.