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("StMagF");
61  gSystem->Load("StUtilities");
62  gSystem->Load("StTreeMaker");
63  gSystem->Load("StIOMaker");
64  gSystem->Load("StarClassLibrary");
65  gSystem->Load("StTpcDb");
66  gSystem->Load("StDbUtilities");
67  gSystem->Load("StEvent");
68  gSystem->Load("StEventUtilities");
69  gSystem->Load("StMcEvent");
70  gSystem->Load("StMcEventMaker");
71  gSystem->Load("StAssociationMaker");
72 
73  //if( mode & 0x2){
74  // EMC specific
75  cout << " EMC mode enabled" << endl;
76  gSystem->Load("StEmcUtil");
77  gSystem->Load("StDbLib");
78  gSystem->Load("StDbBroker");
79  gSystem->Load("St_db_Maker");
80  //}
81 
82  if( mode & 0x4){
83  // RICH
84  cout << " RICH mode enabled" << endl;
85  gSystem->Load("StRrsMaker");
86  gSystem->Load("StRchMaker");
87  gSystem->Load("StRichPIDMaker");
88  gSystem->Load("StRichSpectraMaker");
89  }
90 
91  gSystem->Load("StMcAnalysisMaker");
92  gSystem->Load("StStrangeMuDstMaker");
93  gSystem->Load("StMuDSTMaker");
94 
95  if( mode & 0x2 ){
96  // EMC specific
97  gSystem->Load("StEmcADCtoEMaker"); // analysis maker
98  gSystem->Load("StPreEclMaker"); // analysis maker
99  gSystem->Load("StEpcMaker"); // analysis maker
100  }
101  cout << "Loading done " << endl;
102 
103 
104  chain = new StChain("StChain");
105  chain->SetDebug();
106 
107 
108  StFile *setFiles= new StFile();
109  for (int ifil=0; fileList[ifil]; ifil++)
110  setFiles->AddFile(fileList[ifil]);
111 
112 
113  // ********************************
114  // Now we add Makers to the chain...
115  // ********************************
116 
117  // *************
118  // file handling
119  // *************
120  StIOMaker* ioMaker = new StIOMaker("IOMaker","r",setFiles,"bfcTree");
121  ioMaker->SetDebug();
122 
123  ioMaker->SetIOMode("r");
124  ioMaker->SetDebug();
125  ioMaker->SetBranch("*",0,"0"); //deactivate all branches
126  ioMaker->SetBranch("eventBranch",0,"r"); //activate evt.root Branch
127  ioMaker->SetBranch("emcBranch",0,"r"); //activate evt.root Branch
128  ioMaker->SetBranch("runcoBranch",0,"r"); //activate runcoBranch
129 
130 
131 
132  // ***********************************************
133  // MuDstMaker(s) instantiation / chain activation
134  // ***********************************************
135  // Common MuDST part
136  StStrangeMuDstMaker* v0dst = new StStrangeMuDstMaker("strangeMuDst");
137  v0dst->DoV0(); //Set v0MiniDstMaker to find only v0s
138  v0dst->DoXi(); //Set v0MiniDstMaker to find only v0s
139  v0dst->DoKink(); //Set v0MiniDstMaker to find only v0s
140  v0dst->SetNoKeep();
141 
142  // RICH part
143  if( mode & 0x4 ){
144  StRichSpectraMaker* spectraMaker = new StRichSpectraMaker("spectraMaker");
145  }
146 
147  StAddRunInfoMaker* addRunInfoMaker = new StAddRunInfoMaker();
148 
149  StMuDstMaker* maker = new StMuDstMaker(1,1,dirName);
150  // You can change the PIDTable map using the above method.
151  //maker->setProbabilityPidFile("Path/PIDTable.root");
152  maker->setProbabilityPidFile();
153 
154  StMuL3Filter* l3Filter = new StMuL3Filter(); maker->setL3TrackFilter(l3Filter);
155  StMuFilter* filter = new StMuFilter(); maker->setTrackFilter(filter);
156 
157  // EMC part
158  if( mode & 0x2){
159  St_db_Maker *dbMk = new St_db_Maker("StarDb","MySQL:StarDb");
160  StEmcADCtoEMaker *adc = new StEmcADCtoEMaker();
161  StPreEclMaker *pre = new StPreEclMaker();
162  StEpcMaker *epc = new StEpcMaker();
163  StEmcMicroDstMaker *write = new StEmcMicroDstMaker();
164  write->setOutputDir(dirName);
165  }
166 
167 
168  if ( fsti == 1){
169  //select for Sti tracks
170  filter->addEncodedMethod(263);
171  }
172 
173 
174 
175  // This should call the Init() method in ALL makers
176  chain->Init();
177  chain->PrintInfo();
178 
179  // Event Loop
180  Int_t iev=0;
181  for ( ; iev < nevents ; iev++) {
182  cout << "-----> Working on eventNumber " << iev << endl;
183  chain->Clear();
184  int iret = chain->Make(iev); // This should call the Make() method in ALL makers
185  if (iret) {
186  cout << "Bad return code!" << endl;
187  break;
188  }
189  }
190  chain->Finish(); // This should call the Finish() method in ALL makers
191 
192  iev--;
193  cout << endl << "******************* Last event processed = " << iev << endl;
194 }
195 
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