StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMcEventReadMacro.C
1 // $Id: StMcEventReadMacro.C,v 1.2 2006/08/15 21:41:50 jeromel Exp $
2 // $Log: StMcEventReadMacro.C,v $
3 // Revision 1.2 2006/08/15 21:41:50 jeromel
4 // Fix rhic -> rhic.bnl.gov
5 //
6 // Revision 1.1 2004/10/12 18:53:48 mmiller
7 // Added simu macros and some scripts.
8 //
9 // Revision 1.1 2004/10/12 18:20:20 mmiller
10 // *** empty log message ***
11 //
12 // Revision 1.18 2002/08/15 14:49:27 calderon
13 // Go back to loading St_Tables instead of loading each table individually...
14 // (as was the case since revision 1.12 back in April 2000!)
15 //
16 // Revision 1.17 2001/04/09 17:47:15 calderon
17 // load StEmcUtil instead of St_emc_Maker
18 //
19 // Revision 1.16 2000/06/22 23:54:30 calderon
20 // add gSystemLoad->("libglobal_Tables"); because it is needed for year2a
21 //
22 // Revision 1.15 2000/06/06 03:03:30 calderon
23 // Use with new Emc classes.
24 //
25 // Revision 1.14 2000/04/20 17:02:42 calderon
26 // Modified macros to continue looping when status = 3
27 // Pick up maker with name "StMcAnalysisMaker" instead of "McAnalysis"
28 // in StAssociator.C
29 //
30 // Revision 1.13 2000/04/13 22:00:24 calderon
31 // set dst branch and appropriate tables as per Kathy
32 //
33 // Revision 1.12 2000/04/12 17:39:02 kathy
34 // change to only load table libraries needed: lib*_Tables instead of all tables: St_Tables
35 //
36 // Revision 1.11 2000/01/19 21:00:40 kathy
37 // update macros to use standard default xdf files in /afs/rhic.bnl.gov/star/data/samples
38 //
39 // Revision 1.10 2000/01/12 20:29:15 calderon
40 // Changed default file to the one produced weekly by Lidia in
41 // /star/rcf/test/dev/tfs_Linux/Tue/year_2a/hc_standard/
42 //
43 // Revision 1.9 1999/12/14 18:18:01 calderon
44 // using new StMcEvent, StEvent & StAssociationMaker
45 //
46 // Revision 1.8 1999/12/03 01:01:33 calderon
47 // Updated for new StMcEvent 2.0 and StMcEventMaker.
48 // Uses StTpcDb to get the geometry info (calib has some problems still).
49 //
50 // Revision 1.7 1999/11/03 22:47:33 calderon
51 // Changed default file. Previous one no longer existed.
52 //
53 // Revision 1.6 1999/07/28 21:29:34 calderon
54 // Modified event loop: use 'if' and 'goto' to avoid using 'for'
55 //
56 // Revision 1.5 1999/07/28 20:27:46 calderon
57 // Version with SL99f libraries
58 //
59 // Revision 1.4 1999/07/23 19:57:26 calderon
60 // Load StarClassLibrary before loading StMcEvent
61 //
62 // Revision 1.3 1999/07/23 14:35:43 calderon
63 // Updated names of default files and of packages
64 //
65 // Revision 1.2 1999/07/23 10:53:52 kathy
66 // put in header info in Manuel's macros
67 //
68 //
70 // owner: Manuel Calderon de la Barca Sanchez
71 //
72 // what it does: reads .geant.root file,
73 // loads StMcEvent by putting StMcEventMaker in chain
74 //
75 // note: for more info on StMcEvent and StAssociationMaker, do a
76 // cvs checkout and say "make" in the doc/tex directory - you'll
77 // get a ps file with user guide and reference manual.
79 //
80 //
81 //======================================================================
82 class StChain;
83 class St_DataSet;
85 StChain *chain;
86 TBrowser *brow=0;
87 
88 
89 // The acual file to be used is passed as an argument to the macro, or a default can be set
90 
91 void StMcEventReadMacro(Int_t nevents=100,
92  const char *MainFile="/star/data19/reco/pp200/pythia6_203/default/minbias/y2004a/gheisha_on/trs_ii/rcf1210_95_4255evts.geant.root")
93 {
94  // Load all the System libraries
95  gSystem->Load("St_base");
96  gSystem->Load("StChain");
97  gSystem->Load("St_Tables");
98  gSystem->Load("StUtilities");
99  gSystem->Load("StIOMaker");
100  gSystem->Load("StarClassLibrary");
101  gSystem->Load("StDetectorDbMaker");
102  gSystem->Load("StTpcDb");
103  gSystem->Load("StEvent");
104  gSystem->Load("StEmcUtil");
105  gSystem->Load("StMcEvent");
106  gSystem->Load("StMcEventMaker");
107 
108  // TOP maker
109  chain = new StChain("StMcEventMainChain");
110  chain->SetDebug();
111 
112  // IO Maker
113  StIOMaker *IOMk = new StIOMaker("IO","r",MainFile,"bfcTree");
114  IOMk->SetDebug();
115  IOMk->SetIOMode("r");
116  IOMk->SetBranch("*",0,"0"); //deactivate all branches
117  IOMk->SetBranch("geantBranch",0,"r");
118  IOMk->SetBranch("dstBranch",0,"r");
119 
120 
121  // StMcEvent
122  StMcEventMaker *mcEventReader = new StMcEventMaker; // Make an instance...
123  mcEventReader->doPrintEventInfo = true;
124  mcEventReader->doPrintMemoryInfo = false;
125  mcEventReader->doUseTpc = true;
126  mcEventReader->doUseSvt = true;
127  mcEventReader->doUseFtpc = true;
128  mcEventReader->doUseRich = true;
129  mcEventReader->doUseBemc = true;
130  mcEventReader->doUseBsmd = true;
131  mcEventReader->SetDebug();
132  // now execute the chain member functions
133 
134  chain->PrintInfo();
135  Int_t initStat = chain->Init(); // This should call the Init() method in ALL makers
136  if (initStat) chain->Fatal(initStat, "during Init()");
137 
138  int istat=0,iev=1;
139  EventLoop: if (iev<=nevents && istat!=2) {
140  chain->Clear();
141  cout << "---------------------- Processing Event : " << iev << " ----------------------" << endl;
142  istat = chain->Make(iev); // This should call the Make() method in ALL makers
143  if (istat == 2) { cout << "Last Event Processed. Status = " << istat << endl; }
144  if (istat == 3) { cout << "Error Event Processed. Status = " << istat << endl; }
145  iev++; goto EventLoop;
146 
147  // this next part is just for doing the browser:
148  //create browser with name=BName,title=Btitle
149 
150  // Event = chain->GetDataSet("geant");
151  // Event->ls(9);
152  // brow = new TBrowser("BName","BTitle");
153 
154  // // To view tables in Ntuple format
155  // St_DataSetIter geantDstI(Event);
156  // St_g2t_vertex *g2t_vertexTablePointer = (St_g2t_vertex *) geantDstI("g2t_vertex");
157  // St_g2t_track *g2t_trackTablePointer = (St_g2t_track *) geantDstI("g2t_track");
158  // St_g2t_tpc_hit *g2t_tpc_hitTablePointer = (St_g2t_tpc_hit *) geantDstI("g2t_tpc_hit");
159  // St_g2t_svt_hit *g2t_svt_hitTablePointer = (St_g2t_svt_hit *) geantDstI("g2t_svt_hit");
160  // St_g2t_ftp_hit *g2t_ftp_hitTablePointer = (St_g2t_ftp_hit *) geantDstI("g2t_ftp_hit");
161 
162  // gSystem->Load("xdf2root"); // Needed for some reason
163 
164  // St_TableNtuple vertexNtuple(*g2t_vertexTablePointer);
165  // St_TableNtuple trackNtuple(*g2t_trackTablePointer);
166  // St_TableNtuple tpc_hitNtuple(*g2t_tpc_hitTablePointer);
167  // St_TableNtuple svt_hitNtuple(*g2t_svt_hitTablePointer);
168  // St_TableNtuple ftp_hitNtuple(*g2t_ftp_hitTablePointer);
169 
170  // vertexNtuple.Fill(*g2t_vertexTablePointer);
171  // trackNtuple.Fill(*g2t_trackTablePointer);
172  // tpc_hitNtuple.Fill(*g2t_tpc_hitTablePointer);
173  // svt_hitNtuple.Fill(*g2t_svt_hitTablePointer);
174  // ftp_hitNtuple.Fill(*g2t_ftp_hitTablePointer);
175 
176 
177  } // Event Loop
178  //chain->Finish(); // This should call the Finish() method in ALL makers
179  // Comment this line out if you want to access the information
180  // at the command line.
181 }
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
Filling of all StMcEvent classes from g2t tables Transform all the data in the g2t tables into the co...
Bool_t doPrintMemoryInfo
lots of screen output
virtual Int_t Make()
Definition: StChain.cxx:110
Definition: AgUStep.h:26