StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
rdMu2histoExample.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 rdMu2histoExample( int nEve=5000 ){
13 
14  Int_t nFiles = 1;
15  char* file="st_physics_12108020_raw_1020001.MuDst.root";
16  char* inDir = "/star/data05/scratch/balewski/mu2011/";
17  TString fullName=file;
18 
19  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
20  loadSharedLibraries();
21  cout << " loading done " << endl;
22  gSystem->Load("StDbLib");
23  gSystem->Load("StDbBroker");
24  gSystem->Load("St_db_Maker");
25  gSystem->Load("StEEmcUtil");
26  gSystem->Load("StEEmcDbMaker");
27  gSystem->Load("StEzExample");
28 
29  // create chain
30  chain = new StChain("StChain");
31 
32  printf("adding muDst from run '%s' ....\n",fullName.Data());
33 
34  // Now we add Makers to the chain...
35  muMk = new StMuDstMaker(0,0,inDir,fullName,".MuDst.root",nFiles);
36  //switch on only ETOW branch I need
37  muMk->SetStatus("*",0);
38  muMk->SetStatus("MuEvent",1);
39  muMk->SetStatus("EmcTow",1);
40 
41  TChain* tree=muMk->chain(); assert(tree);
42  int nEntries=tree->GetEntries();
43  printf("total eve in chain =%d\n",nEntries);
44 
45 
46 
47  St_db_Maker *dbMk = new St_db_Maker("StarDb", "MySQL:StarDb");
48  new StEEmcDbMaker("eemcDb");
49  gMessMgr->SwitchOff("D");
50  gMessMgr->SwitchOff("I");
51 
52  TObjArray HList;
53 
54  myMk3=new StEEtowerExampleMaker("eeExample","MuDst");
55  myMk3->Set(&HList);
56 
57  chain->ls();
58  chain->Init();
59  // return;
60 
61  // read one event first to init DB, excluded from timing measurement
62 
63  chain->Clear();
64  stat = chain->Make();
65 
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  if(eventCounter%500==0)
76  printf("\n ====================%d processing ============\n", eventCounter);
77 
78  }
79  printf("sorting done, nEve=%d of %d\n",nEve, nEntries);
80  // return;
81  int t2=time(0);
82  if(t2==t1) t2=t1+1;
83  float rate=1.*nEve/(t2-t1);
84  printf("sorting done %d of nEve=%d, CPU rate=%.1f Hz\n",eventCounter,nEntries,rate);
85 
86  chain->Finish();
87 
88  // save output histograms
89 
90  HList.ls();
91  myMk3->saveHisto("aaa");
92 
93 }
Axample to access EEMC data &amp; DB from muDst in StRoot-framework Only muDst data are decoded by this c...
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