StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
RunJetSimuReader.C
1 
2 // NOTE - chain needs to be declared global so for StHbtEventReader
3 //=========================================================================================
4 class StChain;
5 StChain *chain;
6 int total=0;
7 
8 void RunJetSimuReader(int nevents=10,
9  const char *dir = "",
10  const char* file = "/star/data19/reco/pp200/pythia6_203/default/pt15/y2004x/gheisha_on/trs_ii/pds1214_02_5000evts.MuDst.root",
11  const char *filter = "",
12  const char* jetInFile = "Jets_out.root",
13  const char* simuInFile = "Simu_out.root")
14 {
15  if (gClassTable->GetID("TTable") < 0) {
16  gSystem->Load("libStar");
17  gSystem->Load("libPhysics");
18  }
19  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
20  loadSharedLibraries();
21  gSystem->Load("StMagF");
22  gSystem->Load("StTpcDb");
23  gSystem->Load("StDbUtilities");
24  gSystem->Load("StDaqLib");
25  gSystem->Load("StEmcADCtoEMaker");
26  gSystem->Load("StEpcMaker");
27  gSystem->Load("StDbLib");
28  gSystem->Load("StDbBroker");
29  gSystem->Load("St_db_Maker");
30  gSystem->Load("StEEmcUtil");// needed by EEMC-Db
31  gSystem->Load("StEEmcDbMaker");
32  gSystem->Load("StJetFinder");
33  gSystem->Load("StJetMaker");
34 
35  double pi = atan(1.0)*4.0;
36  cout << " loading done " << endl;
37 
38  chain= new StChain("StChain");
39  chain->SetDebug(1);
40 
41  //Instantiate the MuDstReader
43  StMuDstMaker* muDstMaker = new StMuDstMaker(0,0,dir,file,filter,10,"MuDst");
44 
45 
46  //Database -- must set flavor correctly for ideal gains
47  St_db_Maker *dbMk =new St_db_Maker("db","MySQL:StarDb","$STAR/StarDb","StarDb");
48  dbMk->SetDateTime(20031120,0);
49  dbMk->SetFlavor("sim","bemcPed");
50  dbMk->SetFlavor("sim","bemcStatus");
51  dbMk->SetFlavor("sim","bemcCalib");
52  dbMk->SetFlavor("sim","bemcGain");
53  dbMk->SetFlavor("sim","eemcPMTcal");
54  dbMk->SetFlavor("sim","eemcPIXcal");
55 
56  //EmcDb
57  StEEmcDbMaker* eemcb = new StEEmcDbMaker("eemcDb");
58 
59  //StMuDst2StEventMaker
60  StMuDst2StEventMaker* eventMaker = new StMuDst2StEventMaker("MuDst2StEvent");
61 
62  //EmcAdc2EMaker
64 
65  //Instantiate the JetReader
66  StJetSimuReader* jetReader = new StJetSimuReader("JetReader",muDstMaker);
67  //Instantiate the JetReader
68  chain->Init();
69 
70  //Victor, this line works if turned on...
71  if (1) {
72  jetReader->InitFile(jetInFile,simuInFile);
73  }
74 
75  //Victor, these lines don't work if turned on...
76  else {
77  cout <<"\nGet Chain --------"<<endl;
78  TChain* c = muDstMaker->chain();
79 
80  cout <<"\nAdd Friend from file:\t"<<jetInFile<<endl;
81  c->AddFriend("jet",jetInFile);
82 
83  cout <<"\nInitTree()"<<endl;
84  jetReader->InitTree(c);
85  }
86 
87  chain->PrintInfo();
88 
89  for (Int_t iev=0;iev<nevents; iev++) {
90  cout << "****************************************** " << endl;
91  cout << "Working on eventNumber " << iev << endl;
92  cout << "*************************1***************** " << endl;
93  chain->Clear();
94  int iret = chain->Make(iev);
95  total++;
96  if (iret) {
97  cout << "Bad return code!" << endl;
98  break;
99  }
100  //Here's where you can do your analysis, for an example look in this method
101  jetReader->exampleEventAna();
102  jetReader->exampleSimuAna();
103  }
104  chain->Finish();
105  cout << "****************************************** " << endl;
106  cout << "total number of events " << total << endl;
107  cout << "****************************************** " << endl;
108 }
109 
110 
111 
112 
113 
114 
115 
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
static void setLevel(unsigned int level)
sets the debug level
Definition: StMuDebug.h:74
virtual Int_t Finish()
Definition: StChain.cxx:85
void exampleSimuAna()
An example analysis method, look here for a demonstration of jet + event info.
virtual Int_t Make()
Definition: StChain.cxx:110
virtual void InitTree(TTree *tree)
TChain * chain()
In read mode, returns pointer to the chain of .MuDst.root files that where selected.
Definition: StMuDstMaker.h:426
virtual void InitFile(const char *file)
Recover the TTree from file and prepare for reading.