StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StHbtMicroDstMaker.C
1 enum dataFormat {dst, evt};
2 
3 // NOTE - chain needs to be declared global so for StHbtEventReader
4 class StChain;
5 StChain *chain=0;
6 
7 // File-scope stuff needed by setFiles, nextFile. Someone ambitious
8 // can clean this up by putting it all into a nice clean class.
9 Int_t usePath = 0;
10 Int_t nFile = 0;
11 TString thePath;
12 TString theFileName;
13 TString originalPath;
14 //class StChain;
15 //StChain *chain=0;
16 
17 TBrowser *b=0;
18 const char *venusFile ="set*geant.root";
19 const char *venusPath ="/disk00001/star/auau200/venus412/default/b0_3/year_1b/hadronic_on/tfs_4/";
20 const char *dstFile ="/disk00001/star/auau200/two_photon/starlight/twogam/year_1b/hadronic_on/tfs/ric0022_01_14552evts.dst.root";
21 const char *xdfFile ="/afs/rhic.bnl.gov/star/data/samples/psc0054_07_40evts_dst.xdf";
22 const char *mdcFile ="/disk00001/star/auau200/venus412/default/b0_3/year_1b/hadronic_on/tss/psc0081_07_40evts.root";
23 const char *geantFile ="/disk00000/star/auau200/hijing135/jetq_off/b0_3/year_1b/hadronic_on/tfsr/set0041_01_53evts.geant.root";
24 const char *fileList[] = {dstFile,xdfFile,mdcFile,0};
25 
26 void wait(int n=1) {
27  for ( int i=0; i<n*1e6; i++) { /*no-op*/ }
28 }
29 void mess(const char* c="alive") {
30  for ( int i=0; i<10; i++) { cout << c << endl; }
31 }
32 
33 
34 
35 void StHbtExampleQQ(const dataFormat format, const Int_t nevents, const Char_t **fileList, const Char_t*, const Char_t* );
36 
37 
38 //==========================================================================================
39 //==========================================================================================
40 void StHbtMicroDstMaker(const dataFormat format,
41  const Int_t nevents=9999,
42  const Char_t *path=venusPath,
43  const Char_t *file=venusFile,
44  const Char_t* outDir="/star/rcf/pwg/hbt/Laue/Test/SL00hg/",
45  const Char_t* outFile="dummy",
46  const Char_t* appendix="test.microDst")
47 {
48  const char *fileListQQ[]={0,0};
49  if (path[0]=='-') {
50  fileListQQ[0]=file;
51  } else {
52  fileListQQ[0] = gSystem->ConcatFileName(path,file);
53  }
54  StHbtExampleQQ(format,nevents,fileListQQ,outDir,outFile);
55 }
56 //==========================================================================================
57 //==========================================================================================
58 void StHbtExampleQQ(const dataFormat format, const Int_t nevents, const Char_t **fileList, const Char_t* dirName, const Char_t* fileName)
59 {
60 
61 // Dynamically link needed shared libs
62 gSystem->Load("StarRoot");
63 gSystem->Load("St_base");
64 gSystem->Load("StChain");
65 gSystem->Load("St_Tables");
66 gSystem->Load("StMagF");
67 gSystem->Load("StUtilities"); // new addition 22jul99
68 gSystem->Load("StTreeMaker");
69 gSystem->Load("StIOMaker");
70 gSystem->Load("StarClassLibrary");
71 gSystem->Load("xdf2root");
72 gSystem->Load("St_xdfin_Maker");
73 gSystem->Load("StEvent");
74 gSystem->Load("StEventMaker");
75 gSystem->Load("StEventUtilities");
76 gSystem->Load("StMcEvent");
77 gSystem->Load("StMcEventMaker");
78 gSystem->Load("StAssociationMaker");
79 gSystem->Load("StMcAnalysisMaker");
80 gSystem->Load("StStrangeMuDstMaker");
81 gSystem->Load("StHbtMaker");
82 
83 
84 cout << " loading done " << endl;
85 
86 chain = new StChain("StChain");
87 chain->SetDebug();
88 
89 
90 StFile *setFiles= new StFile();
91 for (int ifil=0; fileList[ifil]; ifil++)
92 setFiles->AddFile(fileList[ifil]);
93 
94 
95 // ********************************
96 // Now we add Makers to the chain...
97 // ********************************
98 
99 // *************
100 // file handling
101 // *************
102 StIOMaker* ioMaker = new StIOMaker("IO","r",setFiles,"bfcTree");
103 ioMaker->SetDebug();
104 
105 ioMaker->SetIOMode("r");
106 ioMaker->SetDebug();
107 ioMaker->SetBranch("*",0,"0"); //deactivate all branches
108 // **************
109 // StHbtTagReader
110 // **************
111 //StHbtTagReader* tagReader = new StHbtTagReader(ioMaker);
112 cout << "Just instantiated StHbtTagReader... lets go StHbtMaker!" << endl;
113 
114 // ***********
115 // Event Maker
116 // ***********
117 StEventMaker* eventMaker =0;
118 
119 if (format==dst) {
120  eventMaker = new StEventMaker("events","title");
121  ioMaker->SetBranch("dstBranch",0,"r"); //activate dst.root Branch
122  cout << " dst" << endl;
123 }
124 else if(format==evt) {
125  eventMaker =0;
126  ioMaker->SetBranch("eventBranch",0,"r"); //activate evt.root Branch
127  cout << " evt" << endl;
128 }
129 else return;
130 cout << "Just instantiated StEventMaker... lets go StHbtMaker!" << eventMaker << endl;
131 
132 // Set up the v0muDstMaker
133  StStrangeMuDstMaker* v0dst = new StStrangeMuDstMaker("v0dst");
134  v0dst->DoV0(); //Set v0MiniDstMaker to find only v0s
135  v0dst->DoKink(); //Set v0MiniDstMaker to find only v0s
136  v0dst->SetNoKeep();
137  v0dst->SetWrite(); // Set V0muDStMaker output file and Event output file
138 // v0dst->SetWrite("StrangemuEventHBTPeriphdst.root","Strangemuv0HBTPeriphdst.root"); // Set V0muDStMaker output file and Event output file
139  cout << "Just instantiated StStrangeMuDstMaker... lets go StHbt!" << endl;
140 
141 
142 // *********
143 // Hbt Maker
144 // *********
145 
146 StHbtMaker* hbtMaker = new StHbtMaker("HBT","title");
147 cout << "StHbtMaker instantiated"<<endl;
148 //StHbtTagMaker* hbtTagMaker = new StHbtTagMaker("HBTTAG");
149 //cout << "StHbtMaker instantiated"<<endl;
150 // -------------- set up of hbt stuff ----- //
151 cout << "StHbtMaker::Init - setting up Reader and Analyses..." << endl;
152 
153 StHbtManager* TheManager = hbtMaker->HbtManager();
154 
155 
156 // ***********************
157 // setup HBT event readers
158 // ***********************
159 // *****************************************
160 // set up StHbtMcEventReader as Event Reader
161 // *****************************************
163 Reader->SetTheEventMaker(eventMaker); // gotta tell the reader where it should read from
164 Reader->SetTheV0Maker(v0dst); //Gotta tell the reader where to read the v0 stuff from
165 Reader->SetTheTagReader(0); //Gotta tell the reader where to read the tag stuff from
166 TheManager->SetEventReader(Reader);
167 
168 cout << "READER SET UP.... " << endl;
169 
170 //
171 
172 // ***** set up event cut *****
173  mikesEventCut* EventCut = new mikesEventCut;
174  EventCut->SetEventMult(0,100000); // selected multiplicity range
175  EventCut->SetVertZPos(-75.0,75.0); // selected range of vertex z-position
176 
177 // ***** set up anti track cut *****
178  franksTrackCut* AntiTrackCut = new franksTrackCut;
179  AntiTrackCut->SetNSigmaPion(+1,-1.);
180 // ***** set up all track cut *****
181  franksTrackCut* AllTrackCut = new franksTrackCut;
182  AllTrackCut->SetNSigmaPion(-1000.0,1000.0); // number of Sigma in TPC dEdx away from nominal pion dEdx
183  AllTrackCut->SetNSigmaKaon(-1000.0,1000.0); // number of Sigma in TPC dEdx away from nominal pion dEdx
184  AllTrackCut->SetNSigmaProton(-1000.0,1000.0); // number of Sigma in TPC dEdx away from nominal proton dEdx
185  AllTrackCut->SetNHits(10,1000); // range on number of TPC hits on the track
186  AllTrackCut->SetP(0.0,50.0); // range in P
187  AllTrackCut->SetPt(0.0,50.0); // range in Pt
188  AllTrackCut->SetRapidity(-15,15); // range in rapidity
189  AllTrackCut->SetDCA(0.0,200.); // range in Distance of Closest Approach to primary vertex
190  AllTrackCut->SetCharge(0); // no cut on charge
191  AllTrackCut->SetMass(0.139); // pion mass
192 // ***** set up pion cut *****
193  franksTrackCut* PionTrackCut = new franksTrackCut;
194  PionTrackCut->SetNSigmaPion(-3.0,+3.); // number of Sigma in TPC dEdx away from nominal pion dEdx
195  PionTrackCut->SetNSigmaKaon(-1000.0,1000.0); // number of Sigma in TPC dEdx away from nominal pion dEdx
196  PionTrackCut->SetNSigmaProton(-1000.0,1000.0); // number of Sigma in TPC dEdx away from nominal proton dEdx
197  PionTrackCut->SetNHits(10,1000); // range on number of TPC hits on the track
198  PionTrackCut->SetP(0.0,5.0); // range in P
199  PionTrackCut->SetPt(0.0,5.0); // range in Pt
200  PionTrackCut->SetRapidity(-1.5,1.5); // range in rapidity
201  PionTrackCut->SetDCA(0.0,2.); // range in Distance of Closest Approach to primary vertex
202  PionTrackCut->SetCharge(0); // no cut on charge
203  PionTrackCut->SetMass(0.139); // pion mass
204 // ***** set up pion+ cut *****
205  franksTrackCut* PionPlusTrackCut = new franksTrackCut;
206  PionPlusTrackCut->SetNSigmaPion(-3.0,+3.); // number of Sigma in TPC dEdx away from nominal pion dEdx
207  PionPlusTrackCut->SetNSigmaKaon(-1000.0,1000.0); // number of Sigma in TPC dEdx away from nominal pion dEdx
208  PionPlusTrackCut->SetNSigmaProton(-1000.0,1000.0); // number of Sigma in TPC dEdx away from nominal proton dEdx
209  PionPlusTrackCut->SetNHits(10,1000); // range on number of TPC hits on the track
210  PionPlusTrackCut->SetP(0.0,5.0); // range in P
211  PionPlusTrackCut->SetPt(0.0,5.0); // range in Pt
212  PionPlusTrackCut->SetRapidity(-1.5,1.5); // range in rapidity
213  PionPlusTrackCut->SetDCA(0.0,2.); // range in Distance of Closest Approach to primary vertex
214  PionPlusTrackCut->SetCharge(+1); // no cut on charge
215  PionPlusTrackCut->SetMass(0.139); // pion mass
216 // ***** set up kaon cut *****
217  franksTrackCut* KaonTrackCut = new franksTrackCut;
218  // KaonTrackCut->SetNSigmaPion(+1.0,1000.0); // number of Sigma in TPC dEdx away from nominal pion dEdx
219  KaonTrackCut->SetNSigmaKaon(-3.,3.); // number of Sigma in TPC dEdx away from nominal kaon dEdx
220  // KaonTrackCut->SetNSigmaProton(-1000.0,-1.0); // number of Sigma in TPC dEdx away from nominal proton dEdx
221  KaonTrackCut->SetNHits(10,1000); // range on number of TPC hits on the track
222  KaonTrackCut->SetP(0.0,2.0); // range in P
223  KaonTrackCut->SetPt(0.0,2.0); // range in Pt
224  KaonTrackCut->SetRapidity(-1.5,1.5); // range in rapidity
225  KaonTrackCut->SetDCA(0.0,3.); // range in Distance of Closest Approach to primary vertex
226  KaonTrackCut->SetCharge(0); // no cut on charge
227  KaonTrackCut->SetMass(0.494); // kaon mass
228 // ***** set up kaon cut *****
229  franksTrackCut* KaonMinusTrackCut = new franksTrackCut;
230  KaonMinusTrackCut->SetNSigmaPion(-1000.0,1000.0); // number of Sigma in TPC dEdx away from nominal pion dEdx
231  KaonMinusTrackCut->SetNSigmaKaon(-3.,3.); // number of Sigma in TPC dEdx away from nominal kaon dEdx
232  KaonMinusTrackCut->SetNSigmaProton(-1000.0,1000.0); // number of Sigma in TPC dEdx away from nominal proton dEdx
233  KaonMinusTrackCut->SetNHits(10,1000); // range on number of TPC hits on the track
234  KaonMinusTrackCut->SetP(0.0,5.0); // range in P
235  KaonMinusTrackCut->SetPt(0.0,5.0); // range in Pt
236  KaonMinusTrackCut->SetRapidity(-1.5,1.5); // range in rapidity
237  KaonMinusTrackCut->SetDCA(0.0,2.); // range in Distance of Closest Approach to primary vertex
238  KaonMinusTrackCut->SetCharge(-1); // no cut on charge
239  KaonMinusTrackCut->SetMass(0.494); // kaon mass
240 // ***** set up proton cut ******
241  franksTrackCut* ProtonTrackCut = new franksTrackCut;
242  ProtonTrackCut->SetNSigmaPion(-1000.0,1000.0); // number of Sigma in TPC dEdx away from nominal pion dEdx
243  ProtonTrackCut->SetNSigmaKaon(-1000.,1000.); // number of Sigma in TPC dEdx away from nominal proton dEdx
244  ProtonTrackCut->SetNSigmaProton(-3.0,3.0); // number of Sigma in TPC dEdx away from nominal proton dEdx
245  ProtonTrackCut->SetNHits(10,1000); // range on number of TPC hits on the track
246  ProtonTrackCut->SetP(0.0,5.0); // range in P
247  ProtonTrackCut->SetPt(0.0,5.0); // range in Pt
248  ProtonTrackCut->SetRapidity(-1.5,1.5); // range in rapidity
249  ProtonTrackCut->SetDCA(0.0,2.); // range in Distance of Closest Approach to primary vertex
250  ProtonTrackCut->SetCharge(0); // no cut on charge
251  ProtonTrackCut->SetMass(0.938); // proton mass
252 
253 // ***** set up anti v0 cut *****
254  helensV0Cut* AntiV0Cut = new helensV0Cut;
255  AntiV0Cut->SetV0Type("blabla"); // Which particle do I cut on
256  AntiV0Cut->SetPt(+1,-1);
257 // ***** set up lambda cut *****
258  helensV0Cut* LambdaCut = new helensV0Cut; // use V0 particle cut object
259  LambdaCut->SetV0Type("lambda"); // Which particle do I cut on
260  LambdaCut->SetV0MassRange(1.105,1.125); // Width cut around /\ mass keep it loose as I want k0s too
261  LambdaCut->SetdcaV0daughters(0.,1.0); // DCA between 2 tracks
262  LambdaCut->SetdcaV0ToPrimVertex(0.,1.); // DCA between V0 and event vertex
263  LambdaCut->SetdecayLengthV0(3.0,5000.); // Decay length from prim. vertex
264  LambdaCut->SettpcHitsPos(10,50); // Number of TPC hits on + track
265  LambdaCut->SettpcHitsNeg(10,50); // Number of TPC hits on - track
266  LambdaCut->SetdcaPosToPrimVertex(1.8,50.); // Min. value + track at intersect
267  LambdaCut->SetdcaNegToPrimVertex(3.5,50.); // Min. value - track at intersect
268  LambdaCut->SetptArmV0(0.,0.25); //K0 (0.1,0.25), Lambda (0.,.25)
269  LambdaCut->SetalphaV0(0.0,1.); //K0 (-1,1.), Lambda (0.5,1.0)
270  LambdaCut->SetPt(0.,10.0); // range in Pt
271  LambdaCut->SetRapidity(-50.0,50.0); // range in rapidity
272  LambdaCut->SetMass(1.11567); // /\ mass
273 // ***** set up a K0 cut *****
274  helensV0Cut* K0Cut = new helensV0Cut; // use V0 particle cut object
275  K0Cut->SetV0Type("K0"); // Which particle do I cut on
276  K0Cut->SetV0MassRange(.05,.05); // Width cut around /\ mass keep it loose as I want k0s too
277  K0Cut->SetdcaV0daughters(0.,0.5); // DCA between 2 tracks
278  K0Cut->SetdcaV0ToPrimVertex(0.,.5); // DCA between V0 and event vertex
279  K0Cut->SetdecayLengthV0(4.0,2000.); // Decay length from prim. vertex
280  K0Cut->SetdecayLengthV0(2.676*1.,2.676*5.); // Decay length from prim. vertex | gammaTau K0 = 2.674cm
281  K0Cut->SettpcHitsPos(0,1000); // Number of TPC hits on + track
282  K0Cut->SettpcHitsNeg(0,1000); // Number of TPC hits on - track
283  K0Cut->SetdcaPosToPrimVertex(0.2,1000.); // Min. value + track at intersect
284  K0Cut->SetdcaNegToPrimVertex(0.2,1000.); // Min. value - track at intersect
285  K0Cut->SetptArmV0(0.1,0.25); //K0 (0.1,0.25), Lambda (0.,.25)
286  K0Cut->SetalphaV0(-1.,1.); //K0 (-1,1.), Lambda (0.5,1.0)
287  K0Cut->SetptArmV0(-100.,+100.); //K0 (0.1,0.25), Lambda (0.,.25)
288  K0Cut->SetalphaV0(-100.,+100.); //K0 (-1,1.), Lambda (0.5,1.0)
289  K0Cut->SetPt(0.1,2.0); // range in Pt
290  K0Cut->SetRapidity(-50.0,50.0); // range in rapidity
291  K0Cut->SetMass(0.49762); // /\ mass
292 
293 
294 
295 
296  // set up a microDstWriter
297  StHbtTTreeReader* allWriter = new StHbtTTreeReader(1,ioMaker,"./","",".hbtTTreeMuDst","");
298  // StHbtBinaryReader* allWriter = new StHbtBinaryReader(ioMaker,dirName,"dummy",".microDst");
299  TheManager->AddEventWriter(allWriter);
300  allWriter->SetEventCut(EventCut);
301  allWriter->SetTrackCut(AllTrackCut);
302  allWriter->SetV0Cut(AntiV0Cut);
303  cout << "WRITER SET UP.... " << endl;
304 
305  // set up a microDstWriter
306 // StHbtBinaryReader* sigma1385Writer = new StHbtBinaryReader(ioMaker,dirName,"dummy",".sigma1385.microDst");
307 // TheManager->AddEventWriter(sigma1385Writer);
308 // sigma1385Writer->SetEventCut(EventCut);
309 // sigma1385Writer->SetTrackCut(PionPlusTrackCut);
310 // sigma1385Writer->SetV0Cut(LambdaCut);
311 // cout << "WRITER SET UP.... " << endl;
312 
313  // set up a microDstWriter
314 // StHbtBinaryReader* pionWriter = new StHbtBinaryReader(ioMaker,dirName,"dummy",".pion.microDst");
315 // TheManager->AddEventWriter(pionWriter);
316 // pionWriter->SetEventCut(EventCut);
317 // pionWriter->SetTrackCut(PionTrackCut);
318 // pionWriter->SetV0Cut(AntiV0Cut);
319 // cout << "WRITER SET UP.... " << endl;
320 
321  // set up a microDstWriter
322 // StHbtTTreeReader* kaonWriter = new StHbtTTreeReader(ioMaker,"./",".kaon.hbtTTreeMuDst");
323 // TheManager->AddEventWriter(kaonWriter);
324 // kaonWriter->SetEventCut(EventCut);
325 // kaonWriter->SetTrackCut(KaonTrackCut);
326 // kaonWriter->SetV0Cut(AntiV0Cut);
327 // cout << "WRITER SET UP.... " << endl;
328 
329  // set up a microDstWriter
330 // StHbtBinaryReader* protonWriter = new StHbtBinaryReader(ioMaker,dirName,"dummy",".proton.microDst");
331 // TheManager->AddEventWriter(protonWriter);
332 // protonWriter->SetEventCut(EventCut);
333 // protonWriter->SetTrackCut(ProtonTrackCut);
334 // protonWriter->SetV0Cut(AntiV0Cut);
335 // cout << "WRITER SET UP.... " << endl;
336 
337  // set up a microDstWriter
338 // StHbtBinaryReader* K0Writer = new StHbtBinaryReader(ioMaker,dirName,"dummy",".k0.microDst");
339 // TheManager->AddEventWriter(K0Writer);
340 // K0Writer->SetEventCut(EventCut);
341 // K0Writer->SetTrackCut(AntiTrackCut);
342 // K0Writer->SetV0Cut(K0Cut);
343 // cout << "WRITER SET UP.... " << endl;
344 
345  // set up a microDstWriter
346 // StHbtBinaryReader* LPWriter = new StHbtBinaryReader(ioMaker,dirName,"dummy",".lam.prot.microDst");
347 // TheManager->AddEventWriter(LPWriter);
348 // LPWriter->SetEventCut(EventCut);
349 // LPWriter->SetTrackCut(ProtonTrackCut);
350 // LPWriter->SetV0Cut(LambdaCut);
351 // cout << "WRITER SET UP.... " << endl;
352 
353  // set up a microDstWriter
354 // StHbtBinaryReader* OmegaWriter = new StHbtBinaryReader(ioMaker,dirName,"dummy",".Omega.microDst");
355 // TheManager->AddEventWriter(OmegaWriter);
356 // OmegaWriter->SetEventCut(EventCut);
357 // OmegaWriter->SetTrackCut(KaonMinusTrackCut);
358 // OmegaWriter->SetV0Cut(LambdaCut);
359 // cout << "WRITER SET UP.... " << endl;
360 
361  // set up a microDstWriter with multiple track cuts
362 // StHbtBinaryReader* pionProtonWriter = new StHbtBinaryReader(ioMaker,dirName,"dummy",".pi.prot.microDst");
363 // TheManager->AddEventWriter(pionProtonWriter);
364 // pionProtonWriter->SetEventCut(EventCut);
365 // // set up multi track cut
366 // StHbtMultiTrackCut* multiTrackCut = new StHbtMultiTrackCut();
367 // multiTrackCut->AddTrackCut(PionTrackCut);
368 // multiTrackCut->AddTrackCut(ProtonTrackCut);
369 // pionProtonWriter->SetTrackCut(multiTrackCut);
370 // pionProtonWriter->SetV0Cut(AntiV0Cut);
371 // cout << "WRITER SET UP.... " << endl;
372 
373 
374  // ------------------ end of setting up hbt stuff ------------------ //
375 
376  chain->Init(); // This should call the Init() method in ALL makers
377  chain->PrintInfo();
378  for (Int_t iev=0;iev<nevents; iev++) {
379  cout << "StHbtExample -- Working on eventNumber " << iev << endl;
380  chain->Clear();
381  int iret = chain->Make(iev); // This should call the Make() method in ALL makers
382  if (iret) {
383  cout << "Bad return code!" << endl;
384  break;
385  }
386  } // Event Loop
387  chain->Finish(); // This should call the Finish() method in ALL makers
388 
389  cout << " End of Analysis " << endl;
390 }
391 
392 
393 
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