StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
doFlowEvents.C
1 //
3 // $Id: doFlowEvents.C,v 1.7 2011/07/25 15:54:47 posk Exp $
4 // Put a link to this at /StRoot/macros/analysis/doFlowEvents.C
5 //
6 // Description:
7 // Chain to read events from files into StFlowEvent and analyze.
8 // It reads dst.root, event.root, MuDst.root, or picoevent.root
9 // files to fill StFlowEvent
10 //
11 // Environment:
12 // Software developed for the STAR Detector at Brookhaven National Laboratory
13 //
14 // Ways to run:
15 // If you specify a path, all DST files below that path will be
16 // found, and 'nEvents' events will be analyzed.
17 // The type of DST files searched for is taken from the 'file' parameter.
18 // If 'file' ends in '.dst.root', ROOT DSTs are searched for.
19 // If 'file' ends in '.event.root' a StEvent file is used.
20 // If 'file' ends in 'MuDst.root' a StMuDST file is used.
21 // If 'file' ends in 'flowpicoevent.root' a StFlowPicoEvent file is used.
22 //
23 // inputs:
24 // nEvents = # events to process
25 // path = a. directory you want files from
26 // b. "-" to get just the one file you want
27 // file = a. file names in directory (takes all files)
28 // b. the one particular full file name (with directory) you want
29 // firstPass = kTRUE runs StFlowPhiWgtMaker or StFlowReCentMaker only
30 //
31 // Usage:
32 // doFlowEvents.C(nEvents, "-", "some_directory/some_dst_file.root")
33 // doFlowEvents.C(nEvents, "some_directory", "*.root")
34 // doFlowEvents.C(nEvents, "some_directory/some_dst_file.root")
35 // doFlowEvents.C(nEvents) // default file
36 // doFlowEvents.C() // 2 events
37 //
38 // Parameters, RunType and OutPicoDir, may be passed from the calling shell script
39 // (see pdsf:: ~posk/doFlowSubmit.pl):
40 // root4star -b << eof >& $LOG
41 // Int_t RunType = $runNo;
42 // const Char_t* OutPicoDir = "./$outPicoDir/";
43 // .L $doFile
44 // doFlowEvents.C
45 // .q
46 //eof
47 //
48 // Author List: Torre Wenaus, BNL 2/99
49 // Victor Perevoztchikov
50 // Art Poskanzer
51 // Raimond Snellings
52 // Kirill Filimonov
53 // Markus Oldenburg
54 //
56 class StChain;
57 StChain *chain = 0;
58 TBrowser *b = 0;
59 Int_t RunType;
60 Char_t* OutPicoDir;
61 class StFileI;
62 StFileI* setFiles = 0;
63 TString mainBranch;
64 
65 const char *dstFile = 0;
66 const char *fileList[] = {dstFile, 0};
67 
68 //--------- Prototypes -----------
69 void doFlowEvents(Int_t nEvents, const Char_t **fileList, Bool_t firstPass = kFALSE);
70 void doFlowEvents(Int_t nEvents, const Char_t *path, const Char_t *file,
71  Bool_t firstPass = kFALSE);
72 void doFlowEvents(Int_t nEvents, const Char_t *path/file, Bool_t firstPass = kFALSE);
73 void doFlowEvents(Int_t nEvents = 2, Bool_t firstPass = kFALSE);
74 
75 // -------- Here is the actual method ----------
76 void doFlowEvents(Int_t nEvents, const Char_t **fileList, Bool_t firstPass)
77 {
78  cout << endl << endl <<" doFlowEvents - input # events = " << nEvents << endl;
79  Int_t ilist = 0;
80  while (fileList[ilist]) {
81  cout << " doFlowEvents - input fileList = " << fileList[ilist] << endl;
82  ilist++;
83  }
84 
85  Int_t maxTheta = 5; // LYZ
86  Int_t nSels = 2;
87  Bool_t reCent = kFALSE;
88 
89  if (firstPass) {
90  cout << " doFlowEvents - firstPass makers = kTRUE" << endl;
91  } else {
92  cout << " doFlowEvents - firstPass makers = kFALSE" << endl;
93  }
94  if (reCent) {
95  cout << " doFlowEvents - reCent = kTRUE" << endl;
96  } else {
97  cout << " doFlowEvents - phiWgt = kTRUE" << endl;
98  }
99  cout << endl << endl;
100 
101  //
102  // First load some shared libraries we need
103  //
104  gROOT->LoadMacro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C");
105  loadSharedLibraries();
106  gSystem->Load("StFlowMaker");
107  gSystem->Load("StFlowAnalysisMaker");
108 
109  // Make a chain with a file list
110  chain = new StChain("StChain");
111  setFiles = new StFile(fileList);
112 
113  //
114  // Make Selection objects
115  //
116  char makerName[30];
117  StFlowSelection flowSelect;
118  // particles:h+, h-, pi+, pi-, pi, k+, k-, k, e-, e+, e, pr-, pr+, pr, d+, d-, and d
119 // flowSelect.SetPidPart("pr-"); // for parts. wrt plane
120 // flowSelect.SetPtPart(0.15, 6.0); // for parts. wrt plane
121 // flowSelect.SetPtPart(0.15, 2.0); // for parts. wrt plane
122 // flowSelect.SetPtBinsPart(60); // for parts. wrt plane
123 // flowSelect.SetPPart(0.15, 5.); // for parts. wrt plane
124 // flowSelect.SetEtaPart(-1.1, 1.1); // for parts. wrt plane
125 // flowSelect.SetFitPtsPart(20, 50); // for parts. wrt plane
126 // flowSelect.SetFitOverMaxPtsPart(0.52, 1.); // for parts. wrt plane
127 // flowSelect.SetChiSqPart(0.1, 1.3); // for parts. wrt plane
128 // flowSelect.SetDcaGlobalPart(0., 2.0); // for parts. wrt plane
129 // flowSelect.SetYPart(-0.5, 0.5); // for parts. wrt plane
130 
131  // Uncomment next line if you make a selection object. Always!
132  sprintf(makerName, "Flow");
133 
134  // Determine the kind of file and instantiate the FlowMaker after the IOMaker
135  StIOMaker *IOMk = new StIOMaker("IO", "r", setFiles, "bfcTree");
136  IOMk->SetIOMode("r");
137  IOMk->SetBranch("*",0,"0"); // deactivate all branches
138  if (!mainBranch.IsNull()) { IOMk->SetBranch(mainBranch,0,"r"); }
139 
140  if (strstr(fileList[0], "MuDst.root")) {
141  // Read mu-DST
142  if (makerName[0]=='\0') {
143  StFlowMaker* flowMaker = new StFlowMaker();
144  } else {
145  StFlowMaker* flowMaker = new StFlowMaker(makerName, flowSelect);
146  }
147  flowMaker->MuEventRead(kTRUE);
148  flowMaker->SetMuEventFileName(setFiles);
149 
150  } else if (strstr(fileList[0], "picoevent.root")) {
151  // Read pico-DST
152  if (makerName[0]=='\0') {
153  StFlowMaker* flowMaker = new StFlowMaker();
154  } else {
155  StFlowMaker* flowMaker = new StFlowMaker(makerName, flowSelect);
156  }
157  flowMaker->PicoEventRead(kTRUE);
158  flowMaker->SetPicoEventFileName(setFiles);
159 
160  } else if (strstr(fileList[0], ".dst.root") ||
161  strstr(fileList[0], ".event.root")) {
162  // Read raw events and make StEvents or read StEvents
163  mainBranch = fileList[0];
164  mainBranch.ReplaceAll(".root","");
165  int idot = strrchr((char*)mainBranch,'.') - mainBranch.Data();
166  mainBranch.Replace(0,idot+1,"");
167  mainBranch += "Branch";
168  printf("*** mainBranch=%s ***\n",mainBranch.Data());
169 
170  // Maker to read events from file or database into StEvent
171  if (!mainBranch.Contains("eventBranch")) {
172  gSystem->Load("StEventMaker");
173  StEventMaker *readerMaker = new StEventMaker("events","title");
174  }
175  if (makerName[0]=='\0') {
176  StFlowMaker* flowMaker = new StFlowMaker();
177  } else {
178  StFlowMaker* flowMaker = new StFlowMaker(makerName, flowSelect);
179  }
180  } else {
181  cout << "##### doFlowEvents: unknown file name = " << fileList[0] << endl;
182  }
183 
185  // Flow Makers
186  // The AnalysisMaker, CumulantMaker, ScalarProdMaker, DirectCumulantMaker, and LeeYangZerosMaker
187  // may be used with a selection object.
188  Bool_t reCentMaker;
189  Bool_t phiWgtMaker;
190  Bool_t anaMaker;
191  Bool_t cumuMaker;
192  Bool_t spMaker;
193  Bool_t lyzMaker;
194  Bool_t dirCumuMaker;
195  if (firstPass) {
196  if (reCent) {
197  reCentMaker = kTRUE;
198  phiWgtMaker = kFALSE;
199  } else {
200  reCentMaker = kFALSE;
201  phiWgtMaker = kTRUE;
202  }
203  anaMaker = kFALSE;
204  cumuMaker = kFALSE;
205  spMaker = kFALSE;
206  lyzMaker = kFALSE;
207  } else {
208  reCentMaker = kFALSE;
209  phiWgtMaker = kFALSE;
210  anaMaker = kTRUE;
211  cumuMaker = kFALSE;
212  spMaker = kFALSE;
213  lyzMaker = kFALSE;
214  dirCumuMaker= kFALSE;
215  }
216  Bool_t includeTpcTracks = kTRUE;
217  Bool_t includeFtpcTracks = kTRUE; // must be kTRUE if sel 1 is FTPC EP
218 
219 // For LYZ and anaMaker
220  Float_t ptRange_for_vEta[2] = {0.15, 2.};
221  Float_t etaRange_for_vPt[2] = {0., 1.1}; // show only TPC particles in v(pt)
222 // Float_t ptRange_for_vEta[2] = {0., 0.}; // integrate over the full pt range
223 // Float_t etaRange_for_vPt[2] = {0., 0.}; // integrate over the full eta range
224 // Float_t etaRange_for_vPt[2] = {2.5, 4.}; // show only FTPC particles in v(pt)
225 
226  // Set recentering FALSE except for ana and LYZ makers
227  // For LYZ: If recentering is TRUE, pass zero will be run to calculate the recentering
228  // parameters
229  // For ana: If recentering is TRUE, first pass will calculate
230  // the recentering parameters and write them to flow.reCentAnaNew.root
231  if (anaMaker) {
232  if (reCent) {
233  flowMaker->SetPhiWgtCalc(kFALSE);
234  flowMaker->SetReCentCalc(kTRUE);
235  } else {
236  flowMaker->SetPhiWgtCalc(kTRUE);
237  flowMaker->SetReCentCalc(kFALSE);
238  }
239  } else if (lyzMaker) {
240  flowMaker->SetReCentCalc();
241  } else {
242  flowMaker->SetPhiWgtCalc();
243  flowMaker->SetReCentCalc(kFALSE);
244  }
245 
246  // To calculate v1{EP1,EP2} use the following switch.
247  // Since v1{EP1} doesn't work very well at RHIC energies, v1{EP1,EP2} is set to be
248  // the default.
249  // To make full use of it, the cuts for Har1 should allow for FTPC tracks only,
250  // while the cuts for Har2 should use TPC tracks only. This method works for
251  // FTPC eta subevents (SetEtaSubs(kTRUE)) and random subevents (SetEtaSubs(kFALSE)).
252  Bool_t v1Ep1Ep2 = kFALSE;
253 
254  if (makerName[0]=='\0') { // blank if there is no selection object
255  if (anaMaker) {
256  StFlowAnalysisMaker* flowAnalysisMaker = new StFlowAnalysisMaker();
257  flowAnalysisMaker->SetHistoRanges(includeFtpcTracks);
258  flowAnalysisMaker->SetPtRange_for_vEta(ptRange_for_vEta[0], ptRange_for_vEta[1]);
259  flowAnalysisMaker->SetEtaRange_for_vPt(etaRange_for_vPt[0], etaRange_for_vPt[1]);
260  flowAnalysisMaker->SetV1Ep1Ep2(v1Ep1Ep2);
261  }
262  if (cumuMaker) {
263  StFlowCumulantMaker* flowCumulantMaker = new StFlowCumulantMaker();
264  flowCumulantMaker->SetHistoRanges(includeFtpcTracks);
265  }
266  if (spMaker) {
267  StFlowScalarProdMaker* flowScalarProdMaker = new StFlowScalarProdMaker();
268  flowScalarProdMaker->SetHistoRanges(includeFtpcTracks);
269  }
270  if (lyzMaker) {
271  StFlowLeeYangZerosMaker* flowLeeYangZerosMaker = new StFlowLeeYangZerosMaker();
272  flowLeeYangZerosMaker->SetHistoRanges(includeFtpcTracks);
273  flowLeeYangZerosMaker->SetPtRange_for_vEta(ptRange_for_vEta[0], ptRange_for_vEta[1]);
274  flowLeeYangZerosMaker->SetEtaRange_for_vPt(etaRange_for_vPt[0], etaRange_for_vPt[1]);
275  }
276  if (dirCumuMaker) {
277  StFlowDirectCumulantMaker* flowDirectCumulantMaker = new StFlowDirectCumulantMaker();
278  }
279  } else {
280  if (anaMaker) {
281  sprintf(makerName, "FlowAnalysis");
282  StFlowAnalysisMaker* flowAnalysisMaker = new
283  StFlowAnalysisMaker(makerName, flowSelect);
284  flowAnalysisMaker->SetHistoRanges(includeFtpcTracks);
285  flowAnalysisMaker->SetPtRange_for_vEta(ptRange_for_vEta[0], ptRange_for_vEta[1]);
286  flowAnalysisMaker->SetEtaRange_for_vPt(etaRange_for_vPt[0], etaRange_for_vPt[1]);
287  flowAnalysisMaker->SetV1Ep1Ep2(v1Ep1Ep2);
288  }
289  if (cumuMaker) {
290  sprintf(makerName, "FlowCumulant");
291  StFlowCumulantMaker* flowCumulantMaker = new
292  StFlowCumulantMaker(makerName, flowSelect);
293  flowCumulantMaker->SetHistoRanges(includeFtpcTracks);
294  }
295  if (spMaker) {
296  sprintf(makerName, "FlowScalarProd");
297  StFlowScalarProdMaker* flowScalarProdMaker = new
298  StFlowScalarProdMaker(makerName, flowSelect);
299  flowScalarProdMaker->SetHistoRanges(includeFtpcTracks);
300  }
301  if (lyzMaker) {
302  sprintf(makerName, "FlowLeeYangZeros");
303  StFlowLeeYangZerosMaker* flowLeeYangZerosMaker = new
304  StFlowLeeYangZerosMaker(makerName, flowSelect);
305  flowLeeYangZerosMaker->SetHistoRanges(includeFtpcTracks);
306  flowLeeYangZerosMaker->SetPtRange_for_vEta(ptRange_for_vEta[0], ptRange_for_vEta[1]);
307  flowLeeYangZerosMaker->SetEtaRange_for_vPt(etaRange_for_vPt[0], etaRange_for_vPt[1]);
308  }
309  if (dirCumuMaker) {
310  sprintf(makerName, "FlowDirectCumulant");
311  StFlowDirectCumulantMaker* flowDirectCumulantMaker = new
312  StFlowDirectCumulantMaker(makerName, flowSelect);
313  }
314  }
315  if (phiWgtMaker) {
316  StFlowPhiWgtMaker* flowPhiWgtMaker = new StFlowPhiWgtMaker();
317  }
318  if (reCentMaker) {
319  StFlowReCentMaker* flowReCentMaker = new StFlowReCentMaker();
320  }
321 
322  // Set write flages and file names
323 // flowMaker->PicoEventWrite(kTRUE);
324 // cout << " doFlowEvents - OutPicoDir = " << OutPicoDir << endl;
325 // flowMaker->SetPicoEventDir(OutPicoDir);
326 // flowMaker->SetPicoEventDir("../");
327 // flowMaker->SetPicoEventDir("./");
328 
329  // Set Debug status
330 // IOMk->SetDebug(1);
331 // flowMaker->SetDebug();
332 // flowAnalysisMaker->SetDebug();
333 // flowPhiWgtMaker->SetDebug();
334 // flowCumulantMaker->SetDebug();
335 // flowScalarProdMaker->SetDebug();
336 // flowLeeYangZerosMaker->SetDebug();
337 // flowDirectCumulantMaker->SetDebug();
338 // chain->SetDebug();
339 // StMuDebug::setLevel(0);
340 
341  //
342  // Initialize chain
343  //
344  Int_t iInit = chain->Init();
345  chain->PrintInfo();
346  if (iInit) {
347  chain->Fatal(iInit, "on init");
348  goto END;
349  }
350 
351  //
352  // Set the parameters
353  //
354 
355  // Get centrality from RunType
356  // For centrality=0 there is no centrality selection
357  if (RunType) {
358  Int_t centrality = RunType % 10 ; // last digit
359  StFlowCutEvent::SetCent(centrality, centrality);
360  }
361 
362  // Set the event cuts
363 // StFlowCutEvent::SetCent(5, 5);
364 // StFlowCutEvent::SetMult(0, 0);
365 // StFlowCutEvent::SetVertexX(0., 0.);
366 // StFlowCutEvent::SetVertexY(0., 0.);
367  StFlowCutEvent::SetVertexZ(-30., 30.);
368 // StFlowCutEvent::SetEtaSymTpc(0., 0.);
369  StFlowCutEvent::SetEtaSymFtpc(0., 0.); // no FTPC eta sym cut
370  if (firstPass) { // all centralities
371  StFlowCutEvent::SetCent(0, 0);
372  }
373 
374  // Set the track cuts
375  StFlowCutTrack::IncludeTpcTracks(includeTpcTracks);
376 // StFlowCutTrack::SetFitPtsTpc(0, 0);
377 // StFlowCutTrack::SetFitOverMaxPts(0., 0.);
378 // StFlowCutTrack::SetChiSqTpc(0., 0.);
379 // StFlowCutTrack::SetPtTpc(0.15, 2.); // for integrated cumulant
380 // StFlowCutTrack::SetEtaTpc(-1.1, 1.1); // for integrated cumulant
381 // StFlowCutTrack::SetChgTpc(0., 0.);
382 
383  StFlowCutTrack::IncludeFtpcTracks(includeFtpcTracks);
384 // StFlowCutTrack::SetFitPtsFtpc(0, 0);
385  StFlowCutTrack::SetChiSqFtpc(0., 4.);
386  StFlowCutTrack::SetDcaFtpc(0., 2.);
387 // StFlowCutTrack::SetDcaGlobalFtpc(0., 0.);
388  StFlowCutTrack::SetPtFtpc(0.15, 2.);
389 // StFlowCutTrack::SetEtaFtpc(-4.0, -2.5, 2.5, 4.0);
390 // StFlowCutTrack::SetChgFtpc(0, 0);
391 
392  // Set the event plane selections
393  // Harmonic 1 means odd, harmonic 2 means even
394  // For selection 1 = FTPC event plane, selection 2 = TPC event plane
395  // (Must include FTPC paticles>):
396  StFlowEvent::SetEtaTpcCut(9., 10., 0, 0); // harmonic 1, selection 1, no TPC
397  StFlowEvent::SetEtaTpcCut(9., 10., 1, 0); // harmonic 2, selection 1, no TPC
398  StFlowEvent::SetEtaFtpcCut(-10., -9., 9., 10., 0, 1); // harmonic 1, selection 2, no FTPC
399  StFlowEvent::SetEtaFtpcCut(-10., -9., 9., 10., 1, 1); // harmonic 2, selection 2, no FTPC
400  // TPC
401 // StFlowEvent::SetEtaTpcCut(0.5, 2., 0, 0); // harmonic 1, selection 1
402 // StFlowEvent::SetEtaTpcCut(0.0, 1., 1, 0); // harmonic 2, selection 1
403 // StFlowEvent::SetPtTpcCut(0.0, 1., 1, 1); // harmonic 2, selection 2
404 // StFlowEvent::SetDcaGlobalTpcCut(0., 1.); // for event plane
405  // FTPC
406 // StFlowEvent::SetPtFtpcCut(0., 10., 0, 0); // harmonic 1, selection 1
407 // StFlowEvent::SetPtFtpcCut(0., 10., 1, 0); // harmonic 2, selection 1
408 // StFlowEvent::SetPtFtpcCut(0., 10., 0, 1); // harmonic 1, selection 2
409 // StFlowEvent::SetPtFtpcCut(0., 10., 1, 1); // harmonic 2, selection 2
410 // StFlowEvent::SetDcaGlobalFtpcCut(0., 1.); // for event plane
411 
412  // particles:h+, h-, pi+, pi-, pi, k+, k-, k, e-, e+, e, pr-, pr+, pr, d+, d-, and d
413 // StFlowEvent::SetPid("h-"); // for event plane
414 
415  // Make Eta or Random subevents
416  // These correlate each particle with the other subevent plane.
417  // With neither flag set the standard method is used, which
418  // corelates each particle with the event plane from the full event
419  // minus the particle of interest, and subevents are made according to eta.
420  // Don't set both of these at the same time.
421 // StFlowEvent::SetEtaSubs();
422 // StFlowEvent::SetRanSubs();
423  // With either of these set the higher harmonics are done with respect to the event planes
424  // of the higher harmonic. This is not a good idea as the second harmonic full event plane
425  // would be better.
426 
427  // Disable weights for the event plane and integrated flow for LYZ
428  if (reCent && lyzMaker) {
429  StFlowEvent::SetPtWgt(kFALSE);
430  }
431 // StFlowEvent::SetPtWgtSaturation(1.);
432  StFlowEvent::SetPtWgt(kTRUE);
433  StFlowEvent::SetEtaWgt(kFALSE);
434 
435  // In LeeYangZeros do not use mixed harmonics for v1
436 // StFlowLeeYangZerosMaker::SetV1Mixed(kFALSE);
437 
438  // use ZDCSMD for the event plane
439 // StFlowEvent::SetUseZDCSMD(kTRUE);
440 
441  // Use Aihong's probability PID method
442 // StFlowEvent::SetProbPid();
443 
444  // Set the PID deviant windows
445 // StFlowEvent::SetPiPlusCut(-3., 3.);
446 // StFlowEvent::SetPiMinusCut(-3., 3.);
447 // StFlowEvent::SetProtonCut(-3., 3.);
448 // StFlowEvent::SetAntiProtonCut(-3., 3.);
449 // StFlowEvent::SetKPlusCut(-3., 3.);
450 // StFlowEvent::SetKMinusCut(-3., 3.);
451 // StFlowEvent::SetDeuteronCut(-3., 3.);
452 // StFlowEvent::SetAntiDeuteronCut(-3., 3.);
453 // StFlowEvent::SetElectronCut(-3., 3.);
454 // StFlowEvent::SetPositronCut(-3., 3.);
455 
456  //
457  // Event loop
458  //
459  int istat = 0, iEvt = 1;
460 EventLoop: if (iEvt <= nEvents && istat != 2) {
461 
462  cout << "===== Event " << iEvt << " start ===== " << endl;
463  chain->Clear();
464  istat = chain->Make(iEvt);
465  if (istat == 2)
466  {cout << "Last event processed. Status = " << istat << endl;}
467  if (istat == 3)
468  {cout << "Error event processed. Status = " << istat << endl;}
469 
470  iEvt++;
471  goto EventLoop;
472  }
473 
474  iEvt--;
475  cout << "============================ Event " << iEvt
476  << " finish ============================" << endl;
477 
478  //
479  // Chain Finish
480  //
481  if (nEvents > 1) {
482  chain->Finish();
483  } else {
484  if (!b) { b = new TBrowser; }
485  }
486 
487  TVectorD* cumulConstants = new TVectorD(30); // temporary fix for a root bug
488  TObjString* cumulMethodTag = new TObjString( "cumulNew" );
489 
490  // Move the flow.cumulant.root, flow.scalar.root, and flow.LeeYangZeros.root files
491  // into the flow.hist.root file.
492  if (cumuMaker) {
493  TFile cumuFile("flow.cumulant.root", "READ");
494  if (cumuFile.IsOpen()) {
495  cumuFile.ReadAll();
496  for (int mm=0; mm<30; mm++) // temporary fix for a root bug
497  (*cumulConstants)(mm) =
498  (*((TVectorD* )cumuFile.Get("CumulConstants")))(mm);
499  } else {
500  cout << "### Can't find file flow.cumulant.root" << endl;
501  }
502  }
503  if (spMaker) {
504  TFile spFile("flow.scalar.root", "READ");
505  if (spFile.IsOpen()) {
506  spFile.ReadAll();
507  } else {
508  cout << "### Can't find file flow.scalar.root" << endl;
509  }
510  }
511  if (lyzMaker) {
512  // combine the zero, first, and second pass outputs
513  TFile lyzFirstPassFile("flow.firstPassLYZ.root", "READ");
514  if (lyzFirstPassFile.IsOpen()) {
515  TFile lyzZeroPassFile("flow.reCent.root", "READ");
516  if (lyzZeroPassFile.IsOpen()) {
517  lyzZeroPassFile.ReadAll();
518  TList* zeroPassList = lyzZeroPassFile.GetList();
519  //zeroPassList->ls();
520  }
521  lyzFirstPassFile.ReadAll();
522  TList* firstPassList = lyzFirstPassFile.GetList();
523  //firstPassList->ls();
524  TString* histTitle; // remove ReG and ImG
525  for (int k = 0; k < nSels; k++) {
526  for (int j = 0; j < 2; j++) { // only 2 harmonics in the first pass file
527  for (int Ntheta = 0; Ntheta < maxTheta; Ntheta++) {
528  histTitle = new TString("FlowImGtheta");
529  *histTitle += Ntheta;
530  *histTitle += "_Sel";
531  *histTitle += k+1;
532  *histTitle += "_Har";
533  *histTitle += j+1;
534  hist = firstPassList->FindObject(histTitle->Data());
535  firstPassList->Remove(hist);
536  delete histTitle;
537  histTitle = new TString("FlowReGtheta");
538  *histTitle += Ntheta;
539  *histTitle += "_Sel";
540  *histTitle += k+1;
541  *histTitle += "_Har";
542  *histTitle += j+1;
543  hist = firstPassList->FindObject(histTitle->Data());
544  firstPassList->Remove(hist);
545  delete histTitle;
546  }
547  }
548  }
549  //firstPassList->ls();
550  TFile lyzFile("flow.LeeYangZeros.root", "UPDATE");
551  if (lyzFile.IsOpen()) {
552  if (lyzZeroPassFile.IsOpen()) {
553  zeroPassList->Write();
554  }
555  firstPassList->Write();
556  lyzFile.Close();
557  }
558  }
559  TFile lyzFile("flow.LeeYangZeros.root", "READ");
560  if (lyzFile.IsOpen()) {
561  lyzFile.ReadAll();
562  } else {
563  cout << "### Can't find file flow.LeeYangZeros.root" << endl;
564  }
565  }
566  if (anaMaker) {
567  TFile anaFile("flow.hist.root", "UPDATE");
568  } else {
569  TFile anaFile("flow.hist.root", "RECREATE");
570  }
571  if (anaFile.IsOpen()) {
572  if (cumuMaker) {
573  cumuFile.GetList()->Write();
574  cumulConstants->Write("CumulConstants",TObject::kOverwrite | TObject::kSingleKey);
575  cumulMethodTag->Write("CumulMethodTag",TObject::kOverwrite | TObject::kSingleKey);
576  }
577  if (spMaker) { spFile.GetList()->Write(); }
578  if (lyzMaker) { lyzFile.GetList()->Write(); }
579  //anaFile.ls();
580  anaFile.Close();
581  } else {
582  cout << "### Can't find file flow.hist.root" << endl;
583  }
584 
585 END:
586 }
587 
588 // ----------- This concatenates the path and the file name ---------------------
589 void doFlowEvents(Int_t nEvents, const Char_t *path, const Char_t *file,
590  Bool_t firstPass)
591 {
592  const char *fileListQQ[] = {0,0};
593  if (path[0] == '-') {
594  fileListQQ[0] = file;
595  } else {
596  fileListQQ[0] = gSystem->ConcatFileName(path,file);
597  }
598  doFlowEvents(nEvents, fileListQQ, firstPass);
599 }
600 
601 // ----------- When only a file is specified ---------------------
602 void doFlowEvents(Int_t nEvents, const char *file, Bool_t firstPass)
603 {
604  printf("*file = %s\n",file);
605  const char *fileListQQ[]={0,0};
606  fileListQQ[0]=file;
607  cout << "Calling (nEvents, fileListQQ, firstPass)" << endl;
608  doFlowEvents(nEvents, fileListQQ, firstPass);
609 }
610 
611 // ----------- This sets default path and file names ---------------------------
612 void doFlowEvents(Int_t nEvents, Bool_t firstPass) {
613 
614 // Char_t* filePath="./";
615 // Char_t* fileExt="*.flowpicoevent.root";
616 // Char_t* fileExt="*.event.root";
617 // Char_t* fileExt="*.MuDst.root";
618 
619  // 200 GeV
620 
621  // run 4 P05ic
622  // muDST files
623 // Char_t* filePath="/eliza9/starprod/reco/productionMinBias/ReversedFullField/P05ic/2004/024/";
624 // if (nEvents < 450) {
625 // Char_t* fileExt="st_physics_5024001_raw_1010001.MuDst.root";
626 // //Char_t* fileExt="st_physics_5024092_raw_1010002.MuDst.root";
627 // } else {
628 // Char_t* fileExt="*.MuDst.root";
629 // }
630 
631  // run 7 P07id
632  // muDST files
633 // Char_t* filePath="/eliza3/starprod/reco/2007ProductionMinBias/FullField/P07id/2007/131/8131027/";
634 // //Char_t* filePath="./outDir/muDST/";
635 // if (nEvents < 450) {
636 // //Char_t* fileExt="st_physics_8102049_raw_1010001.MuDst.root"; // 45 events
637 // Char_t* fileExt="st_physics_8131027_raw_1010001.MuDst.root";
638 // } else {
639 // Char_t* fileExt="*.MuDst.root";
640 // }
641 
642  // run 7 P08ic
643  // muDST files
644  Char_t* filePath="/eliza9/starprod/reco/2007ProductionMinBias/FullField/P08ic/2007/125/";
645  if (nEvents < 450) {
646  Char_t* fileExt="st_physics_8125119_raw_1040090.MuDst.root";
647  } else {
648  Char_t* fileExt="st_physics_*.MuDst.root";
649  }
650 
651  // run 10 39 GeV
652  // muDST files
653 // Char_t* filePath="/eliza17/star/starprod/reco/2010Production/reco/AuAu39_production/ReversedFullField/P10ik/2010/";
654 // if (nEvents < 450) {
655 // Char_t* fileExt="099/11099061/st_physics_11099061_raw_5030001.MuDst.root";
656 // } else {
657 // Char_t* fileExt="st_physics_*.MuDst.root";
658 // }
659 
660  doFlowEvents(nEvents, filePath, fileExt, firstPass);
661 }
662 
664 //
665 // $Log: doFlowEvents.C,v $
666 // Revision 1.7 2011/07/25 15:54:47 posk
667 // Added correction for non-flatness of event plane.
668 //
669 // Revision 1.6 2011/03/10 18:56:28 posk
670 // Added histogram for laboratory azimuthal distribution of particles.
671 //
672 // Revision 1.5 2010/09/30 19:28:15 posk
673 // Instead of reversing the weight for negative pseudrapidity for odd harmonics,
674 // it is now done only for the first harmonic.
675 // Recentering is now done for all harmonics.
676 //
677 // Revision 1.4 2010/07/23 21:01:46 posk
678 // Added a comment about higher harmonics with the subevent method.
679 //
680 // Revision 1.3 2010/06/10 16:33:59 posk
681 // Correction to macro directCumulants_v2.C .
682 //
683 // Revision 1.2 2010/03/08 16:54:49 posk
684 // Added StFlowDirectCumulantMaker written by Dhevan Gangadharan.
685 //
686 // Revision 1.65 2009/11/24 19:40:35 posk
687 // Added reCenter to remove acceptance correlations as an option instead of phiWgt.
688 // Default selection 1 now calculates the event plane from the FTPCs and selection 2 from the main TPC.
689 //
690 // Revision 1.64 2009/07/24 21:00:11 posk
691 // Removed John Wu's Grid Collector.
692 //
693 // Revision 1.61 2006/03/22 22:15:26 posk
694 // Updated to read the flow.firstPassLYZ.root files.
695 //
696 // Revision 1.60 2006/02/22 19:48:08 posk
697 // Added StFlowLeeYangZerosMaker
698 // For MuDsts, the IOMaker is now the default
699 //
700 // Revision 1.59 2005/08/31 15:03:09 fisyak
701 // Add dependence StMagF vs StarMagField
702 //
703 // Revision 1.58 2005/02/10 18:01:38 posk
704 // Option for working with the Grid Collector.
705 //
706 // Revision 1.57 2004/12/17 16:54:13 aihong
707 // temporary fix for a root bug on TVectorD
708 //
709 // Revision 1.56 2004/11/19 18:05:19 posk
710 // A bit more like doEvents.C
711 //
712 // Revision 1.55 2004/06/23 20:06:02 perev
713 // const Int_t replaced by Int_t
714 //
715 // Revision 1.54 2004/03/11 18:01:56 posk
716 // Added Random Subs analysis method.
717 //
718 // Revision 1.53 2003/12/19 21:23:43 posk
719 // Changed File->IsOpen() to File.IsOpen().
720 //
721 // Revision 1.52 2003/12/12 02:29:40 oldi
722 // Minor code clean-ups. Some comments added.
723 //
724 // Revision 1.51 2003/11/14 20:01:22 oldi
725 // Implementation of v1{EP1,EP2}. This method is set to be the default for v1 now!
726 // Minor code clean-ups.
727 //
728 // Revision 1.50 2003/09/05 18:01:37 posk
729 // Updated list of shared libraries.
730 //
731 // Revision 1.49 2003/08/26 21:18:12 posk
732 // update
733 //
734 // Revision 1.48 2003/08/06 20:54:26 oldi
735 // Introduction of possibility to exclude pt ranges for v(eta) and eta regions
736 // for v(pt) histograms. Default behavior stays the same (all available tracks
737 // are included in v(pt) and v(eta)).
738 //
739 // Revision 1.47 2003/07/30 22:09:18 oldi
740 // Eta cuts for event plane selection separated for FTPC east and west.
741 // PtWgtSaturation parameter introduced (default set to 2. -> no change of default behavior).
742 //
743 // Revision 1.46 2003/06/27 21:17:18 posk
744 // Event plane cuts now only odd and even, instead of different for each harmonic.
745 //
746 // Revision 1.45 2003/05/16 20:47:33 posk
747 // Runs only StFlowPhiWgtMaker if called with phiWgtOnly=kTRUE.
748 //
749 // Revision 1.44 2003/01/14 14:12:07 oldi
750 // Possibility to exclude TPC tracks completely (= FTPC only).
751 //
752 // Revision 1.43 2003/01/10 16:42:39 oldi
753 // Several changes to comply with FTPC tracks:
754 // - Switch to include/exclude FTPC tracks introduced.
755 // The same switch changes the range of the eta histograms.
756 // - Eta symmetry plots for FTPC tracks added and separated from TPC plots.
757 // - PhiWgts and related histograms for FTPC tracks split in FarEast, East,
758 // West, FarWest (depending on vertex.z()).
759 // - Psi_Diff plots for 2 different selections and the first 2 harmonics added.
760 // - Cut to exclude mu-events with no primary vertex introduced.
761 // (This is possible for UPC events and FTPC tracks.)
762 // - Global DCA cut for FTPC tracks added.
763 // - Global DCA cuts for event plane selection separated for TPC and FTPC tracks.
764 // - Charge cut for FTPC tracks added.
765 //
766 // Revision 1.42 2002/07/01 16:11:54 posk
767 // Removed StFlowTagMaker.
768 //
769 // Revision 1.41 2002/06/10 22:56:40 posk
770 // pt and eta weighting now default.
771 //
772 // Revision 1.40 2002/06/07 17:29:43 kirill
773 // Introduced MuDst reader
774 //
775 // Revision 1.39 2002/02/13 22:37:09 posk
776 // Added SetEtaWeight(bool) command.
777 //
778 // Revision 1.38 2002/02/05 17:00:37 posk
779 // Added commands for SetPtBinsPart and h+/h-
780 //
781 // Revision 1.37 2002/01/30 13:05:13 oldi
782 // Trigger cut implemented.
783 //
784 // Revision 1.36 2002/01/15 17:36:34 posk
785 // Can instantiate StFlowScalarProdMaker.
786 //
787 // Revision 1.35 2001/12/18 19:32:02 posk
788 // "proton" and "antiproton" replaced with "pr+" and "pr-".
789 //
790 // Revision 1.34 2001/12/11 22:14:33 posk
791 // Combined histogram output files from the CumulantMaker and the AnalysisMaker.
792 //
793 // Revision 1.33 2001/11/09 21:44:34 posk
794 // Added StFlowCumulantMaker.
795 //
796 // Revision 1.32 2001/06/07 20:12:12 posk
797 // Added global dca cut for event plane particles.
798 // Changed SePtWgt() to SetPtWgt(Bool_t).
799 //
800 // Revision 1.31 2001/05/22 19:58:42 posk
801 // Can take centrality from the shell script.
802 // Removed multiple instances feature.
803 //
804 // Revision 1.30 2000/12/12 18:49:18 posk
805 // Moved log comments to the end of the file.
806 //
807 // Revision 1.29 2000/12/08 17:04:36 oldi
808 // Phi weights for both FTPCs included.
809 //
810 // Revision 1.27 2000/11/15 14:41:51 posk
811 // Protected against running Finish() twice.
812 //
813 // Revision 1.26 2000/11/13 01:32:35 snelling
814 // load StEventUtilities
815 //
816 // Revision 1.25 2000/11/09 17:39:14 snelling
817 // Added switch for probability pid
818 //
819 // Revision 1.24 2000/09/16 22:21:15 snelling
820 // Added lines to set selection on P and global DCA
821 //
822 // Revision 1.23 2000/09/15 22:54:44 posk
823 // Added Pt weighting for event plane calculation.
824 //
825 // Revision 1.22 2000/09/15 01:22:27 snelling
826 // Added the new selection options to the macro
827 //
828 // Revision 1.21 2000/09/05 16:29:43 snelling
829 // Added cuts for new particles
830 //
831 // Revision 1.18 2000/08/28 16:15:50 snelling
832 // Added Pt and Eta cuts to macro
833 //
834 // Revision 1.17 2000/08/26 21:39:51 snelling
835 // Modified IO for multiple pico events
836 //
837 // Revision 1.15 2000/06/30 14:57:34 posk
838 // Updated to latest doEvents.C .
839 //
840 // Revision 1.11 2000/05/17 16:20:59 kathy
841 // add some print stmts and also run some IOMaker methods in order to get default input files that are softlinks to other files working correctly
842 //
843 // Revision 1.10 2000/05/16 20:57:31 posk
844 // Voloshin's flownanoevent.root added.
845 //
846 // Revision 1.9 2000/05/11 00:22:28 posk
847 // Can read StEvent files which have extention .event.root .
848 //
849 // Revision 1.8 2000/05/09 19:38:22 kathy
850 // update to use standard default input files and only process few events by default - to make it easy to run in automatic macro testing script
851 //
852 // Revision 1.6 2000/04/13 21:46:34 kathy
853 // remove loading of libtpc_Tables since l3Track table is now dst_track type from global
854 //
855 // Revision 1.5 2000/04/12 15:06:53 kathy
856 // changed all macros that read DSTs to load Tables from libraries: gen,sim,global,dst instead of ALL Tables (previously loaded St_Tables); currently, if you are using DEV to read a DST in NEW,PRO, you must comment out the loading of libtpc_Tables because of a mismatch with tpt_track table
857 //
858 // Revision 1.4 2000/03/28 23:26:46 posk
859 // Allow multiple instances of the AnalysisMaker.
860 //
861 // Revision 1.3 2000/03/15 23:33:54 posk
862 // Added StFlowSelection.
863 //
864 // Revision 1.2 2000/03/07 17:51:23 snelling
865 // Added switch for Nano DST
866 //
867 // Revision 1.1 2000/03/02 23:49:11 posk
868 // Version of doEvents.C for flow analysis which can set cut parameters.
869 //
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