StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
DoFeeTTreeSimu.C
1 //******************************************************************************
2 
3 class StChain;
4 StChain *chain=0;
5 
6 void DoFeeTTreeSimu(Int_t nevents=100){
7  //char *fname="/star/data22/MC/balewski/pp4run3/minb200-10k.event.root";
8 char *fname="minb200-100.event.root";
9 char *fileT="myFeeMC-minb200-100.root"; // output TTree
10 
11  //
12  // First load some shared libraries we need
13  //
14  gSystem->Load("St_base");
15  gSystem->Load("StChain");
16  gSystem->Load("libglobal_Tables");
17  gSystem->Load("libsim_Tables");
18  gSystem->Load("libgen_Tables");
19  gSystem->Load("St_Tables");
20  gSystem->Load("StDbLib");
21  gSystem->Load("StDbBroker");
22  gSystem->Load("St_db_Maker");
23  gSystem->Load("StUtilities");
24  gSystem->Load("StIOMaker");
25  gSystem->Load("StMagF");
26  gSystem->Load("StarClassLibrary");
27  gSystem->Load("StAnalysisUtilities");
28  gSystem->Load("StEvent");
29  gSystem->Load("StTpcDb");
30  gSystem->Load("StEventMaker");
31  gSystem->Load("StMcEvent");
32  gSystem->Load("StMcEventMaker");
33  gSystem->Load("libgeometry_Tables");
34  gSystem->Load("StEmcUtil");
35 
36 if (0){
37  cout << " StDBLib mode enabled" << endl;
38  gSystem->Load("StDbLib");
39  gSystem->Load("StDbBroker");
40  gSystem->Load("St_db_Maker");
41  }
42 
43  // Load my makers
44  gSystem->Load("EEmc");
45  gSystem->Load("EEfeeRaw");
46  gSystem->Load("SteemcDb");
47 
48  // create chain
49  chain = new StChain("bfc");
50  //chain->SetDebug();
51 
52  // Now we add Makers to the chain...
53 
54  // StIOMaker - to read files ...
55  StIOMaker* ioMaker = new StIOMaker();
56  ioMaker->SetFile(fname);
57  //ioMaker->SetDebug();
58 
59  ioMaker->SetIOMode("r");
60  ioMaker->SetBranch("*",0,"0"); //deactivate all branches
61  ioMaker->SetBranch("geantBranch",0,"r"); //activate geant Branch
62  ioMaker->SetBranch("eventBranch",0,"r"); //activate Event Branch
63  ioMaker->SetIOMode("r");
64 
65  // StMcEventMaker
66  StMcEventMaker *mcEventMaker = new StMcEventMaker();
67 
68  // My Makers 1
69  SteemcDbMaker *myMk1=new SteemcDbMaker("eemcDBio");
70  myMk1->setSectors(1,12);
71  myMk1->setTimeStampDay(20021215); // format: yyyymmdd
72 
73 
74  St_db_Maker *dbMk = new St_db_Maker("StarDb","MySQL:StarDb");
75 
76  // My Makers 2
77  St2eemcFeeRawMaker * myMk3=new St2eemcFeeRawMaker("St2feeTTree");
78 // myMk3->setDb(myMk1);
79 
80  // Output TTree
81  TFile f(fileT,"RECREATE");
82  TTree t("fee","A tree with FEE events"); // define branch
83  myMk3->setOutTTree(&t);
84 
85  // Now execute the chain Init functions
86  chain->PrintInfo();
87  chain->ls(3);
88  Int_t initStat = chain->Init(); // This should call the Init() method in ALL makers
89  if (initStat) chain->Fatal(initStat, "during Init()");
90 
91  int istat=0,iev=1;
92 
93  // Do the event loop
94  EventLoop:
95  if (iev<=nevents && istat!=2)
96  {
97  chain->Clear();
98  cout << "---------------------- Processing Event : " << iev << " ----------------------" << endl;
99  istat = chain->Make(iev); // This should call the Make() method in ALL makers
100  if (istat == 2) { cout << "Last Event Processed. Status = " << istat << endl; }
101  if (istat == 3) { cout << "Error Event Processed. Status = " << istat << endl; }
102  iev++;
103 
104 
105  goto EventLoop;
106  } // Event Loop
107  chain->Finish();
108  t.Print();
109 
110  f.Write();
111  printf("\n\n============== TTree closed =========\n\n");
112 
113  delete myMk3;
114  // delete myMk2;
115  delete myMk1;
116 
117 
118 }
119 //******************************************************************************
120 
121 
122 
123 
virtual void SetIOMode(Option_t *iomode="w")
number of transactions
Definition: StIOInterFace.h:35
void setOutTTree(TTree *t)
TTree must be initialized externaly.
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
virtual Int_t Finish()
Definition: StChain.cxx:85
Filling of all StMcEvent classes from g2t tables Transform all the data in the g2t tables into the co...
virtual void ls(Option_t *option="") const
Definition: TDataSet.cxx:495
virtual Int_t Make()
Definition: StChain.cxx:110