StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
runPeCMaker.C
1 //
3 // $Id: runPeCMaker.C,v 1.10 2010/03/16 16:23:09 fisyak Exp $
4 //
5 // Description:
6 // Chain for StPeCMaker based on doEvents.C. Runs StEventMaker and StPeCMaker.
7 //
8 // Environment:
9 // Software developed for the STAR Detector at Brookhaven National Laboratory
10 //
11 // Ways to run:
12 // If you specify a path, all DST files below that path will be
13 // found, and 'nevents' events from each will be analyzed.
14 // The type of DST files searched for is taken from the 'file' parameter.
15 // If 'file ends in '.xdf', XDF DSTs are searched for.
16 // If 'file ends in '.dst.root', ROOT DSTs are searched for.
17 //
18 // If path begins with '-', 'file' will be taken to be a single file
19 // to be processed.
20 //
21 // example invocation:
22 // .x runPeCMaker.C(10,"-","some_directory/some_dst_file.xdf")
23 //
24 // example ROOT file invocation:
25 // .x runPeCMaker.C(10,"-","some_directory/some_dst_file.root")
26 //
27 // example multi-ROOT file invocation:
28 // .x runPeCMaker.C(9999,"some_directory","*.dst.root")
29 //
30 // Author List: Joakim Nystrand, LBNL 3/00 (+authors of doEvents.C)
31 //
33 //
34 // $Log: runPeCMaker.C,v $
35 // Revision 1.10 2010/03/16 16:23:09 fisyak
36 // StTpcDb requires StDetectorDbMaker
37 //
38 // Revision 1.9 2006/08/15 21:42:49 jeromel
39 // Fix rhic -> rhic.bnl.gov
40 //
41 // Revision 1.8 2005/08/31 15:03:09 fisyak
42 // Add dependence StMagF vs StarMagField
43 //
44 // Revision 1.7 2001/09/21 02:21:57 jeromel
45 // StTpcDb needed by StEventMaker.
46 //
47 // Revision 1.6 2000/05/09 19:38:35 kathy
48 // update to use standard default input files and only process few events by default - to make it easy to run in automatic macro testing script
49 //
50 // Revision 1.5 2000/04/18 20:20:33 nystrand
51 // StFile --> StFileI + updated chain return codes
52 //
53 // Revision 1.4 2000/04/13 21:46:35 kathy
54 // remove loading of libtpc_Tables since l3Track table is now dst_track type from global
55 //
56 // Revision 1.3 2000/04/12 15:06:53 kathy
57 // changed all macros that read DSTs to load Tables from libraries: gen,sim,global,dst instead of ALL Tables (previously loaded St_Tables); currently, if you are using DEV to read a DST in NEW,PRO, you must comment out the loading of libtpc_Tables because of a mismatch with tpt_track table
58 //
59 // Revision 1.2 2000/04/03 20:47:32 nystrand
60 // Bug fix
61 //
62 // Revision 1.1 2000/03/28 23:52:24 nystrand
63 // First version
64 //
65 // Revision 1.0 2000/03/27 18:20:20 ullrich
66 // First version.
67 //
69 Int_t usePath = 0;
70 Int_t nFile = 0;
71 TString thePath;
72 TString theFileName;
73 TString originalPath;
74 class StChain;
75 StChain *chain=0;
76 
77 const char *dstFile = 0;
78 const char *xdfFile = 0;
79 const char *mdcFile = 0;
80 const char *fileList[] = {dstFile,xdfFile,mdcFile,0};
81 
82 //void runPeCMaker()
83 //{
84 // cout << "Usage: runPeCMaker.C(nevents,\"-\",\"some_directory/some_dst_file.xdf\")" << endl;
85 // cout << " runPeCMaker.C(nevents,\"-\",\"some_directory/some_dst_file.root\")" << endl;
86 // cout << " runPeCMaker.C(nevents,\"some_directory\",\"*.dst.root\")" << endl;
87 //}
88 
89 void runPeCMaker(Int_t,const Char_t **,const char *qaflag = "");
90 
91 void runPeCMaker(Int_t nevents=2,
92  const Char_t *path="-",
93  const Char_t *file="/afs/rhic.bnl.gov/star/data/samples/gstar.dst.root",
94  const char *qaflag = "off");
95 
96 
97 void runPeCMaker(Int_t nevents, const Char_t **fileList, const char *qaflag)
98 {
99  // Load shared libraries
100  gSystem->Load("St_base");
101  gSystem->Load("StChain");
102 
103  gSystem->Load("libgen_Tables");
104  gSystem->Load("libsim_Tables");
105  gSystem->Load("libglobal_Tables");
106 
107 
108  gSystem->Load("StUtilities");
109  gSystem->Load("StIOMaker");
110  gSystem->Load("StarClassLibrary");
111  gSystem->Load("StEvent");
112  gSystem->Load("StarMagField");
113  gSystem->Load("StMagF");
114  gSystem->Load("StDetectorDbMaker");
115  gSystem->Load("StTpcDb");
116  gSystem->Load("StEventMaker");
117  gSystem->Load("StPeCMaker");
118  cout<<"Shared Libraries Loaded!"<<endl;
119 
120  chain = new StChain("StChain");
121 
122  StFileI *setFiles= new StFile();
123 
124  for (int ifil=0; fileList[ifil]; ifil++){
125  setFiles->AddFile(fileList[ifil]);
126  }
127  StIOMaker *IOMk = new StIOMaker("IO","r",setFiles,"bfcTree");
128  IOMk->SetIOMode("r");
129  IOMk->SetBranch("*",0,"0"); //deactivate all branches
130  IOMk->SetBranch("dstBranch",0,"r");
131  IOMk->SetBranch("runcoBranch",0,"r");
132  IOMk->SetDebug();
133 
134  // Maker to read events from file or database into StEvent
135  StEventMaker *readerMaker = new StEventMaker("events","title");
136 
137  // The StPeCMaker
138  StPeCMaker *analysisMaker = new StPeCMaker("analysis");
139 
140  // Initialize chain
141  Int_t iInit = chain->Init();
142  if (iInit) chain->Fatal(iInit,"on init");
143  chain->PrintInfo();
144 
145  // Event loop
146  int istat=0,i=1;
147  EventLoop: if (i <= nevents && istat!=2) {
148  cout << "============================ Event " << i
149  << " start ============================" << endl;
150  chain->Clear();
151  istat = chain->Make(i);
152  if (istat==2) {cout << "Last event processed. Status = " << istat << endl;}
153  if (istat==3) {cout << "Error event processed. Status = " << istat << endl;}
154  i++;
155  goto EventLoop;
156  }
157 
158  i--;
159  cout << "============================ Event " << i
160  << " finish ============================" << endl;
161  chain->Clear();
162  chain->Finish();
163 
164 }
165 
166 void runPeCMaker(const Int_t nevents, const Char_t *path, const Char_t *file,const char *qaflag)
167 {
168  const char *fileListQQ[]={0,0};
169  if (path[0]=='-') {
170  fileListQQ[0]=file;
171  } else {
172  fileListQQ[0] = gSystem->ConcatFileName(path,file);
173  }
174  runPeCMaker(nevents,fileListQQ,qaflag);
175 }
176 
177 
178 
179 
180 
181 
182 
183 
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