StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
RunFastJetReader.C
1 //
2 // Read jet and skim trees (no MuDst)
3 //
4 
5 class StChain;
6 StChain *chain;
7 int total=0;
8 
9 void RunFastJetReader(
10  int nevents=10000,
11  const char* jetInFile = "blah.jets.root",
12  const char* skimInFile = "blah.skim.root"
13  )
14 {
15  cout <<"hello world"<<endl;
16  cout <<"Jet tree file:\t"<<jetInFile<<endl;
17  cout <<"SkimEvent tree file:\t"<<skimInFile<<endl;
18 
19  gSystem->Load("StJetSkimEvent");
20  gSystem->Load("StJets");
21 
22  gROOT->Macro("loadMuDst.C");
23  gSystem->Load("StTpcDb");
24  gSystem->Load("StDetectorDbMaker");
25  gSystem->Load("StDbUtilities");
26  gSystem->Load("StMcEvent");
27  gSystem->Load("StMcEventMaker");
28  gSystem->Load("StMCAsymMaker");
29  gSystem->Load("StDaqLib");
30  gSystem->Load("StEmcRawMaker");
31  gSystem->Load("StEmcADCtoEMaker");
32  gSystem->Load("StEpcMaker");
33  gSystem->Load("StEmcSimulatorMaker");
34  gSystem->Load("StDbBroker");
35  gSystem->Load("St_db_Maker");
36  gSystem->Load("StEEmcUtil");
37  gSystem->Load("StEEmcDbMaker");
38  gSystem->Load("StSpinDbMaker");
39  gSystem->Load("StEmcTriggerMaker");
40  gSystem->Load("StTriggerUtilities");
41  gSystem->Load("libfastjet.so");
42  gSystem->Load("StJetFinder");
43  gSystem->Load("StJetEvent");
44  gSystem->Load("StRandomSelector");
45  gSystem->Load("StJetMaker");
46 
47  cout << " loading done " << endl;
48 
49  chain= new StChain("StChain");
50  // chain->SetDebug(1);
51  chain->SetDebug(5);
52 
53  //Instantiate the JetReader
54  StJetReader* jetReader = new StJetReader;
55 
56  chain->Init();
57 
58  //these 3 lines are critical and must be called after chain->Init()
59  //Call in exactly this order
60  jetReader->InitFile(jetInFile);
61  jetReader->InitJetSkimFile(skimInFile);
62  int ready = jetReader->preparedForDualRead();
63 
64  chain->PrintInfo();
65 
66  TTree* jetTree = jetReader->tree();
67  int ntotal = jetTree->GetEntries();
68 
69  for (Int_t iev=0; iev<nevents && iev<ntotal; iev++) {
70  cout << "------------------------------- Working on eventNumber " << iev << endl;
71  chain->Clear();
72  int iret = chain->Make(iev);
73  total++;
74  if (iret) {
75  cout << "Bad return code!" << endl;
76  break;
77  }
78  //Here's where you can do your analysis, for an example look in this method
79  jetReader->exampleFastAna();
80  }
81  chain->Finish();
82  cout << "****************************************** " << endl;
83  cout << "total number of events " << total << endl;
84  cout << "****************************************** " << endl;
85 
86 }
87 
88 
89 
90 
virtual void InitJetSkimFile(const char *file)
Recover the &quot;fast&quot; tree of StJetSkimEvent.
int preparedForDualRead()
Check if we are all ready to read the Skim and StjJet trees together.
void exampleFastAna()
An example analysis method to read StJetSkimEvent and StJets trees together.
virtual void InitFile(const char *file)
Recover the TTree from file and prepare for reading.
Definition: StJetReader.cxx:61
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
TTree * tree() const
Access to the StJets tree.
Definition: StJetReader.h:65
virtual Int_t Finish()
Definition: StChain.cxx:85
virtual Int_t Make()
Definition: StChain.cxx:110