StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEventReadTest.C
1 // NOTE - chain needs to be declared global so for StHbtEventReader
2 class StChain;
3 StChain *chain=0;
4 
5 
6 
7 //==========================================================================================
8 //==========================================================================================
9 void StEventReadTest(const Char_t *file="/star/data16/reco/dAuMinBias/ReversedFullField/P03ia/2003/019/st_physics_4019019_raw_0040020.event.root")
10 {
11  // Dynamically link needed shared libs
12  gSystem->Load("libTable");
13  gSystem->Load("libPhysics");
14  gSystem->Load("St_base");
15  gSystem->Load("StChain");
16  gSystem->Load("St_Tables");
17  gSystem->Load("StUtilities"); // new addition 22jul99
18  gSystem->Load("StTreeMaker");
19  gSystem->Load("StIOMaker");
20  gSystem->Load("StarClassLibrary");
21  gSystem->Load("StTriggerDataMaker"); // new starting from April 2003
22  gSystem->Load("StBichsel");
23  gSystem->Load("StEvent");
24  gSystem->Load("StEventUtilities");
25  gSystem->Load("StEmcUtil");
26  gSystem->Load("StPreEclMaker");
27  gSystem->Load("StStrangeMuDstMaker");
28  gSystem->Load("StMuDSTMaker");
29  cout << " loading of shared libraries done" << endl;
30 
31  chain = new StChain("StChain");
32  chain->SetDebug();
33 
34  StFile *setFiles= new StFile();
35  setFiles->AddFile(file);
36 
37  // ********************************
38  // Now we add Makers to the chain...
39  // ********************************
40 
41  // *************
42  // file handling
43  // *************
44  StIOMaker* ioMaker = new StIOMaker("IOMaker","r",setFiles,"bfcTree");
45  ioMaker->SetDebug();
46 
47  ioMaker->SetIOMode("r");
48  ioMaker->SetDebug();
49  ioMaker->SetBranch("*",0,"0"); //deactivate all branches
50  ioMaker->SetBranch("eventBranch",0,"r"); //activate evt.root Branch
51  ioMaker->SetBranch("emcBranch",0,"r"); //activate evt.root Branch
52  ioMaker->SetBranch("runcoBranch",0,"r"); //activate evt.root Branch
53 
54  // *****************
55  // now run the chain
56  // *****************
57  chain->Init(); // This should call the Init() method in ALL makers
58  chain->PrintInfo();
59  int iret=0;
60  int iev=0;
61  while (iret==0 && iev++ <10) {
62  cout << "StExample -- Working on eventNumber " << iev++ << endl;
63  chain->Clear();
64  iret = chain->Make(iev); // This should call the Make() method in ALL makers
65  } // Event Loop
66  chain->Finish(); // This should call the Finish() method in ALL makers
67 
68  cout << " End of Analysis " << endl;
69 }
70 
71 
72 
Definition: StTree.h:125
virtual void SetIOMode(Option_t *iomode="w")
number of transactions
Definition: StIOInterFace.h:35
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
virtual Int_t Finish()
Definition: StChain.cxx:85
virtual Int_t Make()
Definition: StChain.cxx:110