StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMuDstMaker.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
9 // bit 1 0x1 CMuDST always on regardless of 1st bit
10 // bit 2 0x2 EMC 'MuDST' ON/OFF (different from EMC branch in CMuDst)
11 // bit 3 0x4 RICH mode ON/OFF
12 // bit 4 0x8 V0Finder processing during MuDst production
13 //
14 // nevents
15 // path Path where the InputFile resides ; "-" for local
16 // InputFile Should be an event.root file
17 // OutputDirectory Optional output directory (does not fully work)
18 //
19 //
20 class StChain;
21 StChain *chain=0;
22 void ProcessQQ(const Int_t, const Int_t, const Char_t **, const Char_t*, const Char_t* );
23 
24 
25 
26 //==========================================================================================
27 void StMuDstMaker(const Int_t mode=0,
28  const Int_t nevents=10,
29  const Char_t *path="/star/data13/reco/dev/2001/10/",
30  const Char_t *file="st_physics_2304060_raw_0303.event.root",
31  const Char_t* outDir="./")
32 {
33  cout << "Backward compatibility method. Please, use 6 arguments ... " << endl;
34  StMuDstMaker(mode,0,nevents,path,file,outDir);
35 }
36 
37 void StMuDstMaker(const Int_t mode=0,
38  const Int_t fsti=0,
39  const Int_t nevents=10,
40  const Char_t *path="/star/data13/reco/dev/2001/10/",
41  const Char_t *file="st_physics_2304060_raw_0303.event.root",
42  const Char_t* outDir="./")
43 {
44 
45  const char *fileListQQ[]={0,0};
46 
47  if (path[0]=='-') {
48  fileListQQ[0]=file;
49  } else {
50  fileListQQ[0] = gSystem->ConcatFileName(path,file);
51  }
52  ProcessQQ(mode,fsti,nevents,fileListQQ,outDir);
53 }
54 
55 
56 //==========================================================================================
57 void ProcessQQ(const Int_t mode, const Int_t fsti, const Int_t nevents,
58  const Char_t **fileList, const Char_t* dirName)
59 {
60  cout << "ProcessQQ::Load : Loading libraries ..." << endl;
61  gROOT->Macro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
62  gSystem->Load("StMcEvent");
63  gSystem->Load("StMcEventMaker");
64  gSystem->Load("StAssociationMaker");
65  //New V0 finder
66  if (mode & 0x8){
67  gSystem->Load("StSecondaryVertexMaker");
68  }
69 
70  //if( mode & 0x2){
71  // EMC specific
72  cout << "ProcessQQ::Load : MuDst-EMC mode is ON " << endl;
73  gSystem->Load("StDbBroker");
74  gSystem->Load("St_db_Maker");
75  //}
76 
77  if( mode & 0x4){
78  // RICH
79  cout << "ProcessQQ::Load : RICH mode enabled" << endl;
80  gSystem->Load("StRrsMaker");
81  gSystem->Load("StRchMaker");
82  gSystem->Load("StRichPIDMaker");
83  gSystem->Load("StRichSpectraMaker");
84  }
85 
86  gSystem->Load("StMcAnalysisMaker");
87 
88  if( mode & 0x2 ){
89  // EMC specific
90  gSystem->Load("StEmcADCtoEMaker"); // analysis maker
91  gSystem->Load("StPreEclMaker"); // analysis maker
92  gSystem->Load("StEpcMaker"); // analysis maker
93  }
94  cout << "ProcessQQ::Load : done " << endl;
95 
96 
97  chain = new StChain("StChain");
98  chain->SetDebug();
99 
100 
101  StFile *setFiles= new StFile();
102  for (int ifil=0; fileList[ifil]; ifil++)
103  setFiles->AddFile(fileList[ifil]);
104 
105 
106  // ********************************
107  // Now we add Makers to the chain...
108  // ********************************
109 
110  // *************
111  // file handling
112  // *************
113  StIOMaker* ioMaker = new StIOMaker("IOMaker","r",setFiles,"bfcTree");
114  ioMaker->SetDebug();
115 
116  ioMaker->SetIOMode("r");
117  ioMaker->SetDebug();
118  ioMaker->SetBranch("*",0,"0"); //deactivate all branches
119  ioMaker->SetBranch("eventBranch",0,"r"); //activate evt.root Branch
120  // ioMaker->SetBranch("emcBranch",0,"r"); //activate evt.root Branch
121  ioMaker->SetBranch("runcoBranch",0,"r"); //activate runcoBranch
122 
123  St_db_Maker dbMaker("db","MySQL:StarDb","$STAR/StarDb","StarDb");
124 
125  if (mode & 0x8){
126  cout << " V0Finder mode enabled" << endl;
127  StV0FinderMaker* secondaryFinder = new StV0FinderMaker;
128  }
129 
130  // ***********************************************
131  // MuDstMaker(s) instantiation / chain activation
132  // ***********************************************
133  // Common MuDST part
134  StStrangeMuDstMaker* v0dst = new StStrangeMuDstMaker("strangeMuDst");
135  v0dst->DoV0(); //Set v0MiniDstMaker to find only v0s
136  v0dst->DoXi(); //Set v0MiniDstMaker to find only v0s
137  v0dst->DoKink(); //Set v0MiniDstMaker to find only v0s
138  v0dst->SetNoKeep();
139 
140  // New V0 finder part - specifically for ITTF testing, we will allow
141  // it to consider BOTH pairs of ITTF tracks AND pairs of old tracks
142  // but not mixed pairs (experts can tell difference in MuDst).
143  // Could use kTrackerUseBOTH and kTrackerUseTPT if would <hash>include
144  // StSecondaryMaker/StV0FinderMaker.h but no includes in this macro so
145  // I followed that convention. (LSB)
146  if (mode & 0x8){
147  if ( fsti == 1){
148  secondaryFinder->SetTrackerUsage(2);
149  } else {
150  secondaryFinder->SetTrackerUsage(0);
151  }
152  }
153 
154  // RICH part
155  if( mode & 0x4 ){
156  StRichSpectraMaker* spectraMaker = new StRichSpectraMaker("spectraMaker");
157  }
158 
159  StMuDstMaker* maker = new StMuDstMaker(1,1,dirName);
160  // You can change the PIDTable map using the above method.
161  //maker->setProbabilityPidFile("Path/PIDTable.root");
162  maker->setProbabilityPidFile();
163 
164  StMuL3Filter* l3Filter = new StMuL3Filter(); maker->setL3TrackFilter(l3Filter);
165  StMuFilter* filter = new StMuFilter(); maker->setTrackFilter(filter);
166 
167  // EMC part
168  if( mode & 0x2){
169  //St_db_Maker *dbMk = new St_db_Maker("StarDb","MySQL:StarDb");
170  StEmcADCtoEMaker *adc = new StEmcADCtoEMaker();
171  StPreEclMaker *pre = new StPreEclMaker();
172  StEpcMaker *epc = new StEpcMaker();
173  StEmcMicroDstMaker *write = new StEmcMicroDstMaker();
174  write->setOutputDir(dirName);
175  }
176 
177 
178  if ( fsti == 1){
179  //select for Sti tracks
180  filter->addEncodedMethod(263);
181  }
182 
183 
184 
185  // This should call the Init() method in ALL makers
186  chain->Init();
187  chain->PrintInfo();
188 
189  // Event Loop
190  Int_t iev=0;
191  for ( ; iev < nevents ; iev++) {
192  cout << "-----> Working on eventNumber " << iev << endl;
193  chain->Clear();
194  int iret = chain->Make(iev); // This should call the Make() method in ALL makers
195  if (iret) {
196  cout << "Bad return code!" << endl;
197  break;
198  }
199  }
200  chain->Finish(); // This should call the Finish() method in ALL makers
201 
202  iev--;
203  cout << endl << "******************* Last event processed = " << iev << endl;
204 }
205 
206 //==========================================================================================
207 // $Id: StMuDstMaker.C,v 1.16 2017/11/29 20:29:44 genevb Exp $
208 // $Log: StMuDstMaker.C,v $
209 // Revision 1.16 2017/11/29 20:29:44 genevb
210 // Keep CVS id and log information
211 //
212 //
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