StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMuDstMakerYear1.C
1 //
2 // NOTE - chain needs to be declared global so for StHbtEventReader
3 // Modified from StRoot/StMuDstmaker/COMMON/macros i.e. initially
4 // written by Frank Laue.
5 //
6 // Extend to account for production purposes.
7 // Arguments are
8 // mode bitmaks CMuDST always on regardless of bit 1
9 // bit 2 EMC MuDST ON/OFF
10 // nevents
11 // path Path where the InputFile resides ; "-" for local
12 // InputFile Should be an event.root file
13 // OutputDirectory Optional output directory (does not fully work)
14 //
15 //
16 class StChain;
17 StChain *chain=0;
18 void ProcessQQ(const Int_t, const Int_t, const Char_t **, const Char_t*, const Char_t* );
19 
20 
21 //==========================================================================================
22 void StMuDstMakerYear1(const Int_t mode=0,
23  const Int_t nevents=10,
24  const Char_t *path="/star/data13/reco/dev/2001/10/",
25  const Char_t *file="st_physics_2304060_raw_0303.event.root",
26  const Char_t* outDir="./")
27 {
28  cout << "Backward compatibility method. Please, use 6 arguments ... " << endl;
29  StMuDstMakerYear1(mode,0,nevents,path,file,outDir);
30 }
31 
32 void StMuDstMakerYear1(const Int_t mode=0,
33  const Int_t fsti=0,
34  const Int_t nevents=10,
35  const Char_t *path="/star/data13/reco/dev/2001/10/",
36  const Char_t *file="st_physics_2304060_raw_0303.event.root",
37  const Char_t* outDir="./")
38 {
39 
40  const char *fileListQQ[]={0,0};
41 
42  if (path[0]=='-') {
43  fileListQQ[0]=file;
44  } else {
45  fileListQQ[0] = gSystem->ConcatFileName(path,file);
46  }
47  ProcessQQ(mode,fsti,nevents,fileListQQ,outDir);
48 }
49 
50 
51 //==========================================================================================
52 void ProcessQQ(const Int_t mode, const Int_t fsti, const Int_t nevents,
53  const Char_t **fileList, const Char_t* dirName)
54 {
55  cout << "Loading libraries ..." << endl;
56  gSystem->Load("St_base");
57  gSystem->Load("StChain");
58  gSystem->Load("StDaqLib");
59  gSystem->Load("St_Tables");
60  gSystem->Load("StarMagField");
61  gSystem->Load("StMagF");
62  gSystem->Load("StUtilities");
63  gSystem->Load("StTreeMaker");
64  gSystem->Load("StIOMaker");
65  gSystem->Load("StarClassLibrary");
66  gSystem->Load("StDetectorDbMaker");
67  gSystem->Load("StTpcDb");
68  gSystem->Load("StDbUtilities");
69  gSystem->Load("StBichsel");
70  gSystem->Load("StTriggerDataMaker");
71  gSystem->Load("StEvent");
72  gSystem->Load("StEventUtilities");
73  gSystem->Load("StMcEvent");
74  gSystem->Load("StMcEventMaker");
75  gSystem->Load("StAssociationMaker");
76 
77  //if( mode & 0x2){
78  // EMC specific
79  cout << " EMC mode enabled" << endl;
80  gSystem->Load("StEmcUtil");
81  gSystem->Load("StDbLib");
82  gSystem->Load("StDbBroker");
83  gSystem->Load("St_db_Maker");
84  //}
85 
86  if( mode & 0x4){
87  // RICH
88  cout << " RICH mode enabled" << endl;
89  gSystem->Load("StRrsMaker");
90  gSystem->Load("StRchMaker");
91  gSystem->Load("StRichPIDMaker");
92  gSystem->Load("StRichSpectraMaker");
93  }
94 
95  gSystem->Load("StMcAnalysisMaker");
96  gSystem->Load("StStrangeMuDstMaker");
97  gSystem->Load("StMuDSTMaker");
98 
99  if( mode & 0x2 ){
100  // EMC specific
101  gSystem->Load("StEmcADCtoEMaker"); // analysis maker
102  gSystem->Load("StPreEclMaker"); // analysis maker
103  gSystem->Load("StEpcMaker"); // analysis maker
104  }
105  cout << "Loading done " << endl;
106 
107 
108  chain = new StChain("StChain");
109  chain->SetDebug();
110 
111 
112  StFile *setFiles= new StFile();
113  for (int ifil=0; fileList[ifil]; ifil++)
114  setFiles->AddFile(fileList[ifil]);
115 
116 
117  // ********************************
118  // Now we add Makers to the chain...
119  // ********************************
120 
121  // *************
122  // file handling
123  // *************
124  StIOMaker* ioMaker = new StIOMaker("IOMaker","r",setFiles,"bfcTree");
125  ioMaker->SetDebug();
126 
127  ioMaker->SetIOMode("r");
128  ioMaker->SetDebug();
129  ioMaker->SetBranch("*",0,"0"); //deactivate all branches
130  ioMaker->SetBranch("eventBranch",0,"r"); //activate evt.root Branch
131  ioMaker->SetBranch("emcBranch",0,"r"); //activate evt.root Branch
132  ioMaker->SetBranch("runcoBranch",0,"r"); //activate runcoBranch
133 
134 
135 
136  // ***********************************************
137  // MuDstMaker(s) instantiation / chain activation
138  // ***********************************************
139  // Common MuDST part
140  StStrangeMuDstMaker* v0dst = new StStrangeMuDstMaker("strangeMuDst");
141  v0dst->DoV0(); //Set v0MiniDstMaker to find only v0s
142  v0dst->DoXi(); //Set v0MiniDstMaker to find only v0s
143  v0dst->DoKink(); //Set v0MiniDstMaker to find only v0s
144  v0dst->SetNoKeep();
145 
146  // RICH part
147  if( mode & 0x4 ){
148  StRichSpectraMaker* spectraMaker = new StRichSpectraMaker("spectraMaker");
149  }
150 
151  StAddRunInfoMaker* addRunInfoMaker = new StAddRunInfoMaker();
152 
153  StMuDstMaker* maker = new StMuDstMaker(1,1,dirName);
154  // You can change the PIDTable map using the above method.
155  //maker->setProbabilityPidFile("Path/PIDTable.root");
156  maker->setProbabilityPidFile();
157 
158  StMuL3Filter* l3Filter = new StMuL3Filter(); maker->setL3TrackFilter(l3Filter);
159  StMuFilter* filter = new StMuFilter(); maker->setTrackFilter(filter);
160 
161  // EMC part
162  if( mode & 0x2){
163  St_db_Maker *dbMk = new St_db_Maker("StarDb","MySQL:StarDb");
164  StEmcADCtoEMaker *adc = new StEmcADCtoEMaker();
165  StPreEclMaker *pre = new StPreEclMaker();
166  StEpcMaker *epc = new StEpcMaker();
167  StEmcMicroDstMaker *write = new StEmcMicroDstMaker();
168  write->setOutputDir(dirName);
169  }
170 
171 
172  if ( fsti == 1){
173  //select for Sti tracks
174  filter->addEncodedMethod(263);
175  }
176 
177 
178 
179  // This should call the Init() method in ALL makers
180  chain->Init();
181  chain->PrintInfo();
182 
183  // Event Loop
184  Int_t iev=0;
185  for ( ; iev < nevents ; iev++) {
186  cout << "-----> Working on eventNumber " << iev << endl;
187  chain->Clear();
188  int iret = chain->Make(iev); // This should call the Make() method in ALL makers
189  if (iret) {
190  cout << "Bad return code!" << endl;
191  break;
192  }
193  }
194  chain->Finish(); // This should call the Finish() method in ALL makers
195 
196  iev--;
197  cout << endl << "******************* Last event processed = " << iev << endl;
198 }
199 
void setOutputDir(char *dir)
Set output directory for micro DST&#39;s.
Definition: StTree.h:125
virtual void SetIOMode(Option_t *iomode="w")
number of transactions
Definition: StIOInterFace.h:35
void setProbabilityPidFile(const char *file=NULL)
Set the file from where the PID probability tables should be read.
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StChain.cxx:77
void setL3TrackFilter(StMuCut *c)
Set the track filter used for L3 tracks when creating muDsts from StEvent and writing to disk...
Definition: StMuDstMaker.h:429
virtual Int_t Finish()
Definition: StChain.cxx:85
void setTrackFilter(StMuCut *c)
Set the track filter used for all tracks (except the L3 tracks) when creating muDsts from StEvent and...
Definition: StMuDstMaker.h:428
virtual Int_t Make()
Definition: StChain.cxx:110