StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
rdMu2soloPi0.C
1 class StChain;
3 
4 class StEEmcDb;
5 class StMuDstMaker;
6 class TChain;
7 
8 StEEmcDb *myDb;
9 StMuDstMaker* muMk;
10 StChain *chain=0;
11 
12 int rdMu2soloPi0(
13  char* file="R7114062.lis",
14  int nEve=1e3,
15  Int_t nFiles = 999,
16  char* outDir = "out2/"
17  ){
18  char* inDir = "./runList/";
19 
20  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
21  loadSharedLibraries();
22  cout << " loading done " << endl;
23  gSystem->Load("StDbLib");
24  gSystem->Load("StDbBroker");
25  gSystem->Load("St_db_Maker");
26  gSystem->Load("StEEmcUtil");
27  gSystem->Load("StEEmcDbMaker");
28  gSystem->Load("StEEsoloPi0");
29 
30  gROOT->Macro("LoadLogger.C");
31 
32  // create chain
33  chain = new StChain("StChain");
34 
35  printf("adding muDst from '%s' ....\n",file);
36  // Now we add Makers to the chain...
37  muMk = new StMuDstMaker(0,0,inDir,file,"MuDst.root",nFiles);
38  TChain* tree=muMk->chain(); assert(tree);
39  int nEntries=tree->GetEntries();
40  printf("total eve in chain =%d\n",nEntries);
41 
42  St_db_Maker *stDb = new St_db_Maker("StarDb", "MySQL:StarDb");
43 
44  new StEEmcDbMaker("eemcDb");
45  // ->setSectors(5,8);
46 
47  myMk3=new StEEsoloPi0Maker("soloPi0","MuDst");
48  TObjArray HList;
49  myMk3->SetHList(&HList);
50 
51 #if 0 // flags for M-C events
52  stDb->SetDateTime(20031120,0);
53  stDb->SetFlavor("sim","eemcPMTcal");
54  stDb->SetFlavor("sim","eemcPIXcal");
55  stDb->SetFlavor("sim","eemcPMTped");
56  stDb->SetFlavor("sim","eemcPMTstat");
57  stDb->SetFlavor("sim","eemcPMTname");
58  stDb->SetFlavor("sim","eemcADCconf");
59  myMk3->SetMCflag();
60 #endif
61 
62 
63  chain->Init();
64  chain->ls(3);
65  // return;
66  int eventCounter=0;
67  int stat=0;
68  int t1=time(0);
69  //---------------------------------------------------
70  while ( stat==0 ) {// loop over events
71  if(eventCounter>=nEve) break;
72  eventCounter++;
73  chain->Clear();
74  stat = chain->Make();
75 
76  if(eventCounter%300!=0)continue;
77 
78  printf("\n====================%d processing ==============\n", eventCounter);
79 
80  }
81  printf("sorting done, nEve=%d of %d\n",nEve, nEntries);
82  int t2=time(0);
83  float rate=1.*eventCounter/(t2-t1);
84  float nMnts=(t2-t1)/60.;
85  printf("sorting done %d of nEve=%d, CPU rate=%.1f Hz, tot %.1f minutes\n",eventCounter,nEntries,rate,nMnts);
86 
87  chain->Finish();
88  // HList.ls();
89  TString fullName=file; fullName.ReplaceAll(".lis",".hist.root");
90  fullName=outDir+fullName;
91  TFile f( fullName,"recreate");
92  assert(f.IsOpen());
93  printf("%d histos are written to '%s' ...\n",HList.GetEntries(),fullName.Data());
94  HList.Write();
95  f.Close();
96  assert(!f.IsOpen());
97 
98 }
Axample to access muDst and pass it to ezTree analyzis class.
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
virtual Int_t Finish()
Definition: StChain.cxx:85
virtual void ls(Option_t *option="") const
Definition: TDataSet.cxx:495
virtual Int_t Make()
Definition: StChain.cxx:110
TChain * chain()
In read mode, returns pointer to the chain of .MuDst.root files that where selected.
Definition: StMuDstMaker.h:426