StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
RunJetReader.C
1 // Read MuDst, jet and skim trees
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 RunJetReader(int nevents=10,
9  const char* file,
10  const char* jetInFile,
11  const char* dir = "",
12  const char *filter = "")
13 {
14  cout <<"MuDst chain file:\t"<<file<<endl;
15  cout <<"Jet tree file:\t"<<jetInFile<<endl;
16  //abort();
17 
18  gROOT->Macro("loadMuDst.C");
19  gSystem->Load("StTpcDb");
20  gSystem->Load("StDetectorDbMaker");
21  gSystem->Load("StDbUtilities");
22  gSystem->Load("StMcEvent");
23  gSystem->Load("StMcEventMaker");
24  gSystem->Load("StDaqLib");
25  gSystem->Load("StEmcRawMaker");
26  gSystem->Load("StEmcADCtoEMaker");
27  gSystem->Load("StEpcMaker");
28  gSystem->Load("StEmcSimulatorMaker");
29  gSystem->Load("StDbBroker");
30  gSystem->Load("St_db_Maker");
31  gSystem->Load("StEEmcUtil");
32  gSystem->Load("StEEmcDbMaker");
33  gSystem->Load("StSpinDbMaker");
34  gSystem->Load("StEmcTriggerMaker");
35  gSystem->Load("StMCAsymMaker");
36  gSystem->Load("StJets");
37  gSystem->Load("StJetSkimEvent");
38  gSystem->Load("StTriggerUtilities");
39  gSystem->Load("StJetEvent");
40  gSystem->Load("libfastjet.so");
41  gSystem->Load("StJetFinder");
42  gSystem->Load("StJetMaker");
43 
44  cout << " loading done " << endl;
45 
46  double pi = TMath::Pi();
47  cout << " loading done " << endl;
48 
49  chain= new StChain("StChain");
50  chain->SetDebug(1);
51 
52  //Instantiate the MuDstReader
54  StMuDstMaker* muDstMaker = new StMuDstMaker(0,0,dir,file,filter,10000000,"MuDst");
55 
56  //StMuDbReader...
57  StMuDbReader* db = StMuDbReader::instance();
58 
59  //StMuDst2StEventMaker
60  //StMuDst2StEventMaker* eventMaker = new StMuDst2StEventMaker("MuDst2StEvent");
61 
62  //Database
63  St_db_Maker *dbMk = new St_db_Maker("StarDb", "MySQL:StarDb");
64 
65  //EmcAdc2EMaker
67 
68  //PrecEclMaker
69  //StPreEclMaker *pecl = new StPreEclMaker();
70 
71  //EpcMaker
72  //StEpcMaker *epc = new StEpcMaker();
73 
74  //Instantiate the JetReader
75  StJetReader* jetReader = new StJetReader;
76 
77  chain->Init();
78 
79  //Victor, this line works if turned on...
80  if (1) {
81  jetReader->InitFile(jetInFile);
82  }
83 
84  //Victor, these lines don't work if turned on...
85  else {
86  cout <<"\nGet Chain --------"<<endl;
87  TChain* c = muDstMaker->chain();
88 
89  cout <<"\nAdd Friend from file:\t"<<jetInFile<<endl;
90  c->AddFriend("jet",jetInFile);
91 
92  cout <<"\nInitTree()"<<endl;
93  jetReader->InitTree(c);
94  }
95 
96  chain->PrintInfo();
97 
98  for (Int_t iev=0;iev<nevents; iev++) {
99  cout << "****************************************** " << endl;
100  cout << "Working on eventNumber " << iev << endl;
101  cout << "*************************1***************** " << endl;
102  chain->Clear();
103  int iret = chain->Make(iev);
104  total++;
105  if (iret) {
106  cout << "Bad return code!" << endl;
107  break;
108  }
109  //Here's where you can do your analysis, for an example look in this method
110  jetReader->exampleEventAna();
111  }
112  chain->Finish();
113  cout << "****************************************** " << endl;
114  cout << "total number of events " << total << endl;
115  cout << "****************************************** " << endl;
116 }
117 
118 
119 
120 
121 
122 
123 
virtual void InitFile(const char *file)
Recover the TTree from file and prepare for reading.
Definition: StJetReader.cxx:61
void exampleEventAna()
An example analysis method, look here for a demonstration of jet/track histogramming.
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
virtual void InitTree(TTree *tree)
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