StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ExamineTxtFile.C
1 
2 // HERE, WE USE THE NEW StHbtGeantTxtReader to read Geant-text input files
3 // so no IoMaker
4 // and no StEventMaker (or StEvent!!)
5 
6 // this macro looks at the "blended" event file and makes correlation functions
7 // for proton-proton, (k+)-(k+), (k+)-(k-), <-- for these, look at ALL events
8 // and (pi+)-(pi+), (pi-)-(pi-), (pi+)-(pi-) <-- for these, just look at a few!!
9 
10 
11 #define EXAMINE_LOW_MULT_PARTICLES // this means look at protons and kaons...
12 
13 class StChain;
14 StChain *chain=0;
15 
16 // keep pointers to Correlation Functions global, so you can have access to them...
17 class QvecCorrFctn;
18 #ifdef EXAMINE_LOW_MULT_PARTICLES
19 QvecCorrFctn* QvecCF_kp_kp;
20 QvecCorrFctn* QvecCF_kp_km;
21 QvecCorrFctn* QvecCF_prot_prot;
22 #else
23 QvecCorrFctn* QvecCF_pip_pip;
24 QvecCorrFctn* QvecCF_pip_pim;
25 #endif
26 
27 void ExamineTxtFile(Int_t nevents=1,
28  const char *MainFile="/home/scratch/lisa/blended_events.txt")
29  // const char *MainFile="/star/u2b/lisa/Lanny/code/correl/RUN_AREA/event_hbt_text.out")
30  // const char *MainFile="/direct/star+u2b/lisa/correlated_pions_from_vdgus1.out")
31 
32 {
33 
34  // Dynamically link needed shared libs
35  gSystem->Load("St_base");
36  gSystem->Load("StChain");
37  gSystem->Load("St_Tables");
38  gSystem->Load("StUtilities"); // new addition 22jul99
39  gSystem->Load("StAnalysisUtilities"); // needed by V0dstMaker
40  gSystem->Load("StMagF");
41  gSystem->Load("StIOMaker");
42  gSystem->Load("StarClassLibrary");
43  gSystem->Load("StEvent");
44  gSystem->Load("StEventMaker");
45  gSystem->Load("StHbtMaker");
46  gSystem->Load("StV0MiniDstMaker");
47 
48  cout << "Dynamic loading done" << endl;
49 
50  chain = new StChain("StChain");
51  chain->SetDebug();
52 
53 
54  // Now we add Makers to the chain...
55 
56  // StIOMaker* ioMaker = new StIOMaker("IO","r",MainFile,"bfcTree");
57  // ioMaker->SetDebug();
58  // ioMaker->SetIOMode("r");
59  // ioMaker->SetDebug();
60  // ioMaker->SetBranch("*",0,"0"); //deactivate all branches
61  // ioMaker->SetBranch("dstBranch",0,"r"); //activate EventBranch
62 
63 
64  // StEventMaker* eventMaker = new StEventMaker("events","title");
65  // cout << "Just instantiated StEventMaker... lets go StHbtMaker!" << endl;
66 
67 
68 
69  StHbtMaker* hbtMaker = new StHbtMaker("HBT","title");
70  cout << "StHbtMaker instantiated"<<endl;
71 
72 
73 
74  /* -------------- set up of hbt stuff ----- */
75  cout << "StHbtMaker::Init - setting up Reader and Analyses..." << endl;
76 
77  StHbtManager* TheManager = hbtMaker->HbtManager();
78 
79  // here, we instantiate the appropriate StHbtEventReader
80  // for STAR analyses in root4star, we instantiate StStandardHbtEventReader
81  // StStandardHbtEventReader* Reader = new StStandardHbtEventReader;
82  // Reader->SetTheEventMaker(eventMaker); // gotta tell the reader where it should read from
83 
84 
85  // use the newly written StHbtGeantTxtReader -- reads Geant-text files
87  Reader->SetFileName(MainFile);
88 
89 
90  // UNCOMMENT THIS NEXT LINE OUT IF YOU WANT V0's
91  // Reader->SetTheV0Maker(v0dst); //Gotta tell the reader where to read the v0 stuff from
92 
93  // here would be the palce to plug in any "front-loaded" Event or Particle Cuts...
94  TheManager->SetEventReader(Reader);
95 
96  cout << "READER SET UP.... " << endl;
97 
98  // Hey kids! Let's make a microDST!
99  // in StHbt we do this by instantiating and plugging in a StHbtEventReader as a writer!
100  // the particular StHbtEventReader that we will use will write (and read) ASCII files
101  //
102  // StHbtAsciiReader* Writer = new StHbtAsciiReader;
103  // Writer->SetFileName("FirstMicroDst.asc");
104  // TheManager->SetEventWriter(Writer);
105  // cout << "WRITER SET UP.... " << endl;
106 
107 #ifdef EXAMINE_LOW_MULT_PARTICLES
108  /*---------------- proton-proton analysis ---------------*/
109  // 0) now define an analysis...
110  // This one looks for PROTONS
111  StHbtAnalysis* anal = new StHbtAnalysis;
112  // 1) set the Event cuts for the analysis
113  mikesEventCut* evcut = new mikesEventCut;
114  evcut->SetEventMult(0,10000);
115  evcut->SetVertZPos(-35.0,35.0);
116  anal->SetEventCut(evcut);
117  // 2) set the Track (particle) cuts for the analysis
118  mikesTrackCut* trkcut = new mikesTrackCut;
119  trkcut->SetNSigmaPion(1.0,1000.0);
120  trkcut->SetNSigmaKaon(1.0,1000.0);
121  trkcut->SetNSigmaProton(-1.5,1.5);
122  trkcut->SetNHits(5,50);
123  trkcut->SetPt(0.1,0.8);
124  trkcut->SetRapidity(-1.0,1.0);
125  trkcut->SetDCA(-0.5,0.5);
126  trkcut->SetCharge(1);
127  trkcut->SetMass(0.938);
128  anal->SetFirstParticleCut(trkcut); // this is the track cut for the "first" particle
129  anal->SetSecondParticleCut(trkcut); // NOTE - it is also for the "second" particle -- i.e. identical particle HBT
130  // 3) set the Pair cuts for the analysis
131  mikesPairCut* paircut = new mikesPairCut;
132  anal->SetPairCut(paircut);
133  // 4) set the number of events to mix (per event)
134  anal->SetNumEventsToMix(5);
135  // 5) now set up the correlation functions that this analysis will make
136  QvecCF_prot_prot = new QvecCorrFctn("proton-proton",50,0.0,0.2);
137  anal->AddCorrFctn(QvecCF_prot_prot); // adds the just-defined correlation function to the analysis
138 
139  // now add as many more correlation functions to the Analysis as you like..
140 
141  // 6) add the Analysis to the AnalysisCollection
142  TheManager->AddAnalysis(anal);
143 
144  /*---------------- (k+)-(k+) analysis ---------------*/
145  // 0) now define an analysis...
146  // This one looks for KAONS
147  anal = new StHbtAnalysis;
148  // 1) set the Event cuts for the analysis
149  evcut = new mikesEventCut;
150  evcut->SetEventMult(0,10000);
151  evcut->SetVertZPos(-35.0,35.0);
152  anal->SetEventCut(evcut);
153  // 2) set the Track (particle) cuts for the analysis
154  trkcut = new mikesTrackCut;
155  trkcut->SetNSigmaPion(1.0,1000.0);
156  trkcut->SetNSigmaKaon(-1.5,1.5);
157  trkcut->SetNSigmaProton(-1000.0,-1.0);
158  trkcut->SetNHits(5,50);
159  trkcut->SetPt(0.1,0.8);
160  trkcut->SetRapidity(-1.0,1.0);
161  trkcut->SetDCA(-0.5,0.5);
162  trkcut->SetCharge(1);
163  trkcut->SetMass(0.494);
164  anal->SetFirstParticleCut(trkcut); // this is the track cut for the "first" particle
165  anal->SetSecondParticleCut(trkcut); // NOTE - it is also for the "second" particle -- i.e. identical particle HBT
166  // 3) set the Pair cuts for the analysis
167  mikesPairCut* paircut = new mikesPairCut;
168  anal->SetPairCut(paircut);
169  // 4) set the number of events to mix (per event)
170  anal->SetNumEventsToMix(5);
171  // 5) now set up the correlation functions that this analysis will make
172  QvecCF_kp_kp = new QvecCorrFctn("Kplus-Kplus",50,0.0,0.2);
173  anal->AddCorrFctn(QvecCF_kp_kp); // adds the just-defined correlation function to the analysis
174 
175  // now add as many more correlation functions to the Analysis as you like..
176 
177  // 6) add the Analysis to the AnalysisCollection
178  TheManager->AddAnalysis(anal);
179 
180  /*---------------- (k+)-(k-) analysis ---------------*/
181  // 0) now define an analysis...
182  // This one looks for KAONS
183  anal = new StHbtAnalysis;
184  // 1) set the Event cuts for the analysis
185  evcut = new mikesEventCut;
186  evcut->SetEventMult(0,10000);
187  evcut->SetVertZPos(-35.0,35.0);
188  anal->SetEventCut(evcut);
189  // 2) set the Track (particle) cuts for the analysis
190  trkcut = new mikesTrackCut;
191  trkcut->SetNSigmaPion(1.0,1000.0);
192  trkcut->SetNSigmaKaon(-1.5,1.5);
193  trkcut->SetNSigmaProton(-1000.0,-1.0);
194  trkcut->SetNHits(5,50);
195  trkcut->SetPt(0.1,0.8);
196  trkcut->SetRapidity(-1.0,1.0);
197  trkcut->SetDCA(-0.5,0.5);
198  trkcut->SetCharge(1);
199  trkcut->SetMass(0.494);
200  anal->SetFirstParticleCut(trkcut); // this is the track cut for the "first" particle
201 
202  trkcut = new mikesTrackCut;
203  trkcut->SetNSigmaPion(1.0,1000.0);
204  trkcut->SetNSigmaKaon(-1.5,1.5);
205  trkcut->SetNSigmaProton(-1000.0,-1.0);
206  trkcut->SetNHits(5,50);
207  trkcut->SetPt(0.1,0.8);
208  trkcut->SetRapidity(-1.0,1.0);
209  trkcut->SetDCA(-0.5,0.5);
210  trkcut->SetCharge(-1);
211  trkcut->SetMass(0.494);
212  anal->SetSecondParticleCut(trkcut); // NOTE DIFFERENT 2ND PARTICLE CUT -- NONIDENTICAL HBT
213  // 3) set the Pair cuts for the analysis
214  mikesPairCut* paircut = new mikesPairCut;
215  anal->SetPairCut(paircut);
216  // 4) set the number of events to mix (per event)
217  anal->SetNumEventsToMix(5);
218  // 5) now set up the correlation functions that this analysis will make
219  QvecCF_kp_km = new QvecCorrFctn("Kplus-Kminus",50,0.0,0.2);
220  anal->AddCorrFctn(QvecCF_kp_km); // adds the just-defined correlation function to the analysis
221 
222  // now add as many more correlation functions to the Analysis as you like..
223 
224  // 6) add the Analysis to the AnalysisCollection
225  TheManager->AddAnalysis(anal);
226 
227 
228 #else // look at pions instead of protons and kaons
229 
230  /*---------------- piplus-piplus analysis ---------------*/
231  // 0) now define an analysis...
232  // This one looks for PIONS
233  StHbtAnalysis* anal = new StHbtAnalysis;
234  // 1) set the Event cuts for the analysis
235  mikesEventCut* evcut = new mikesEventCut;
236  evcut->SetEventMult(0,10000);
237  evcut->SetVertZPos(-35.0,35.0);
238  anal->SetEventCut(evcut);
239  // 2) set the Track (particle) cuts for the analysis
240  mikesTrackCut* trkcut = new mikesTrackCut;
241  trkcut->SetNSigmaPion(-1.5,1.5);
242  trkcut->SetNSigmaKaon(-1000.0,-1.0);
243  trkcut->SetNSigmaProton(-1000.0,-1.0);
244  trkcut->SetNHits(5,50);
245  trkcut->SetPt(0.1,0.8);
246  trkcut->SetRapidity(-1.0,1.0);
247  trkcut->SetDCA(-0.5,0.5);
248  trkcut->SetCharge(1);
249  trkcut->SetMass(0.138);
250  anal->SetFirstParticleCut(trkcut); // this is the track cut for the "first" particle
251  anal->SetSecondParticleCut(trkcut); // NOTE - it is also for the "second" particle -- i.e. identical particle HBT
252  // 3) set the Pair cuts for the analysis
253  mikesPairCut* paircut = new mikesPairCut;
254  anal->SetPairCut(paircut);
255  // 4) set the number of events to mix (per event)
256  anal->SetNumEventsToMix(5);
257  // 5) now set up the correlation functions that this analysis will make
258  QvecCF_pip_pip = new QvecCorrFctn("piplus-piplus",50,0.0,0.2);
259  anal->AddCorrFctn(QvecCF_pip_pip); // adds the just-defined correlation function to the analysis
260 
261  // now add as many more correlation functions to the Analysis as you like..
262 
263  // 6) add the Analysis to the AnalysisCollection
264  TheManager->AddAnalysis(anal);
265 
266  /*---------------- piplus-piminus analysis ---------------*/
267  // 0) now define an analysis...
268  // This one looks for PION
269  anal = new StHbtAnalysis;
270  // 1) set the Event cuts for the analysis
271  evcut = new mikesEventCut;
272  evcut->SetEventMult(0,10000);
273  evcut->SetVertZPos(-35.0,35.0);
274  anal->SetEventCut(evcut);
275  // 2) set the Track (particle) cuts for the analysis
276  trkcut = new mikesTrackCut;
277  trkcut->SetNSigmaPion(-1.5,1.5);
278  trkcut->SetNSigmaKaon(-1000.0,-1.0);
279  trkcut->SetNSigmaProton(-1000.0,-1.0);
280  trkcut->SetNHits(5,50);
281  trkcut->SetPt(0.1,0.8);
282  trkcut->SetRapidity(-1.0,1.0);
283  trkcut->SetDCA(-0.5,0.5);
284  trkcut->SetCharge(1);
285  trkcut->SetMass(0.138);
286  anal->SetFirstParticleCut(trkcut); // this is the track cut for the "first" particle
287 
288 
289  trkcut = new mikesTrackCut;
290  trkcut->SetNSigmaPion(-1.5,1.5);
291  trkcut->SetNSigmaKaon(-1000.0,-1.0);
292  trkcut->SetNSigmaProton(-1000.0,-1.0);
293  trkcut->SetNHits(5,50);
294  trkcut->SetPt(0.1,0.8);
295  trkcut->SetRapidity(-1.0,1.0);
296  trkcut->SetDCA(-0.5,0.5);
297  trkcut->SetCharge(-1);
298  trkcut->SetMass(0.138);
299 
300  anal->SetSecondParticleCut(trkcut); // NOTE DIFFERNT CUT for 2nd particle -- nonidentical hbt
301  // 3) set the Pair cuts for the analysis
302  mikesPairCut* paircut = new mikesPairCut;
303  anal->SetPairCut(paircut);
304  // 4) set the number of events to mix (per event)
305  anal->SetNumEventsToMix(5);
306  // 5) now set up the correlation functions that this analysis will make
307  QvecCF_pip_pim = new QvecCorrFctn("piplus-piminus",50,0.0,0.2);
308  anal->AddCorrFctn(QvecCF_pip_pim); // adds the just-defined correlation function to the analysis
309 
310  // now add as many more correlation functions to the Analysis as you like..
311 
312  // 6) add the Analysis to the AnalysisCollection
313  TheManager->AddAnalysis(anal);
314 
315 #endif // EXAMINE_LOW_MULT_PARTICLES
316 
317  /* ------------------ end of setting up hbt stuff ------------------ */
318 
319 
320  // now execute the chain member functions
321 
322  if (chain->Init()){ // This should call the Init() method in ALL makers
323  cout << "Initialization failed \n";
324  goto TheEnd;
325  }
326  chain->PrintInfo();
327 
328 
329  // Event loop
330  int istat=0,iev=1;
331  EventLoop: if (iev <= nevents && !istat) {
332  cout << "StHbtExample -- Working on eventNumber " << iev << " of " << nevents << endl;
333  chain->Clear();
334  istat = chain->Make(iev);
335  if (istat) {cout << "Last event processed. Status = " << istat << endl;}
336  iev++; goto EventLoop;
337  }
338 
339 // good old Cint can't even handle a for-loop
340 // for (Int_t iev=1;iev<=nevents; iev++) {
341 // chain->Clear();
342 // int iret = chain->Make(iev); // This should call the Make() method in ALL makers
343 // if (iret) {
344 // cout << "StHbtExample.C -- chain returned nonzero value " << iret
345 // << " on event " << iev << endl;
346 // break;
347 // }
348 // } // Event Loop
349 
350 
351 
352  cout << "StHbtExample -- Done with event loop" << endl;
353 
354  chain->Finish(); // This should call the Finish() method in ALL makers
355  TheEnd:
356 }
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