1 // Settings for the simulation of events 'on the fly':
2 // a) Determine how many events you want to create;
3 // b) Set random or same seed for random generator;
4 // c) Determine multiplicites of events;
5 // d) Parametrize the phi distribution;
6 // d1) Enable/disable uniform event-wise fluctuations of v2;
7 // d2) Enable/diable pt dependence of v2;
8 // e) Parametrize the pt distribution;
9 // f) Determine how many times each sampled particle will be taken (simulating nonflow);
10 // g) Configure detector's:
13 // h) Decide which flow analysis methods you will use;
14 // i) Define simple cuts for Reference Particle (RP) selection;
15 // j) Define simple cuts for Particle of Interest (POI) selection;
16 // k) Define the ranges for two subevents separated with eta gap (needed only for SP method);
17 // l) Enable/disable usage of particle weights.
19 // a) Determine how many events you want to create:
20 Int_t iNevts = 1000; // total statistics
22 // b) Set random or same seed for random generator:
23 Bool_t bSameSeed = kFALSE; // if kTRUE, the created events are the same when re-doing flow analysis 'on the fly'
25 // c) Determine multiplicites of events:
26 // Remark 1: Multiplicity M for each event is sampled uniformly from interval iMinMult <= M < iMaxMult;
27 // Remark 2: For constant M of e.g. 500 for each event, set iMinMult = 500 and iMaxMult = 501.
28 Int_t iMinMult = 500; // uniformly sampled multiplicity is >= iMinMult
29 Int_t iMaxMult = 501; // uniformly sampled multiplicity is < iMaxMult
31 // d) Parametrize the phi distribution:
32 // Remark 1: Hardwired is Fourier-like distribution f(phi) = (1/2pi)(1+sum_{n=1}^{4} 2v_n cos[n(phi-rp)]),
33 // where reaction plane (rp) is sampled uniformly for each event from interval [0,2pi]
34 Double_t dV1 = 0.0; // constant harmonic v1
35 Double_t dV2 = 0.05; // constant harmonic v2
36 Double_t dV3 = 0.0; // constant harmonic v3
37 Double_t dV4 = 0.0; // constant harmonic v4
38 Double_t dV5 = 0.0; // constant harmonic v5
39 Double_t dV6 = 0.0; // constant harmonic v6
40 // Remark 2: By default all harmonics are constant for each event and for each particle. However, for v2
41 // the uniform event-wise fluctuations or pt dependence can be enabled:
42 // d1) Enable/disable uniform event-wise fluctuations of v2:
43 Bool_t bUniformFluctuationsV2 = kFALSE; // enable uniform event-wise flow fluctuations (set than also dMinV2 and dMaxV2 bellow)
44 Double_t dMinV2 = 0.04; // lower boundary on v2, when bUniformFluctuationsV2 = kTRUE
45 Double_t dMaxV2 = 0.06; // upper boundary on v2, when bUniformFluctuationsV2 = kTRUE
46 // d2) Enable/disable pt dependence of v2:
47 Bool_t bPtDependentV2 = kFALSE; // enable pt dependence of v2 (set then also dV2vsPtMax and dV2vsPtCutOff bellow)
48 Double_t dV2vsPtCutOff = 2.0; // up to pt = dV2vsPtCutOff v2 is growing linearly as a function of pt
49 Double_t dV2vsPtMax = 0.20; // for pt >= dV2vsPtCutOff, v2(pt) = dV2vsPtMax
51 // e) Parametrize the pt distribution:
52 // Remark: Hardwired is Boltzmann distribution f(pt) = pt*exp[-sqrt(dMass^2+pt^2)/dT]
53 Double_t dMass = 0.13957; // mass in GeV/c^2 (e.g. m_{pions} = 0.13957)
54 Double_t dTemperature = 0.44; // "temperature" in GeV/c (increase this parameter to get more high pt particles)
56 // f) Determine how many times each sampled particle will be taken in the analysis (simulating nonflow):
57 Int_t nTimes = 1; // e.g. for nTimes = 2, strong 2-particle nonflow correlations are introduced
59 // g1) Configure detector's acceptance:
60 Bool_t uniformAcceptance = kTRUE; // if kTRUE: detectors has uniform azimuthal acceptance.
61 // if kFALSE: you will simulate detector with non-uniform acceptance in one or
62 // two sectors. For each sector you specify phiMin, phiMax and probability p.
63 // Then all particles emitted in direction phiMin < phi < phiMax will be taken
64 // with probability p. If p = 0, that sector is completely blocked. Set bellow
65 // phiMin1, phiMax1, p1 for the first sector and phiMin2, phiMax2, p2 for the second
66 // sector. If you set phiMin2 = phiMax2 = p2 = 0, only first non-uniform sector is
68 // 1st non-uniform sector:
69 Double_t phiMin1 = 60; // first non-uniform sector starts at this azimuth (in degrees)
70 Double_t phiMax1 = 120; // first non-uniform sector ends at this azimuth (in degrees)
71 Double_t p1 = 0.5; // probablitity that particles emitted in [phiMin1,phiMax1] are taken
72 // 2nd non-uniform sector:
73 Double_t phiMin2 = 0.; // first non-uniform sector starts at this azimuth (in degrees)
74 Double_t phiMax2 = 0.; // first non-uniform sector ends at this azimuth (in degrees)
75 Double_t p2 = 0.; // probablitity that particles emitted in [phiMin2,phiMax2] are taken
77 // g2) Configure detector's efficiency:
78 Bool_t uniformEfficiency = kTRUE; // if kTRUE: detectors has uniform pT efficiency
79 // if kFALSE: you will simulate detector with non-uniform pT efficiency.
80 // Then all particles emitted in ptMin <= pt < ptMax will be taken
81 // with probability p, to be specified in lines just below.
82 Double_t ptMin = 0.8; // non-uniform efficiency vs pT starts at pT = fPtMin
83 Double_t ptMax = 1.2; // non-uniform efficiency vs pT ends at pT = fPtMax
84 Double_t p = 0.5; // probablitity that particles emitted in [ptMin,ptMax> are taken
86 // h) Decide which flow analysis methods you will use:
87 Bool_t MCEP = kTRUE; // Monte Carlo Event Plane
88 Bool_t SP = kTRUE; // Scalar Product (a.k.a 'flow analysis with eta gaps')
89 Bool_t GFC = kTRUE; // Generating Function Cumulants
90 Bool_t QC = kTRUE; // Q-cumulants
91 Bool_t FQD = kTRUE; // Fitted q-distribution
92 Bool_t LYZ1SUM = kTRUE; // Lee-Yang Zero (sum generating function), first pass over the data
93 Bool_t LYZ1PROD = kTRUE; // Lee-Yang Zero (product generating function), first pass over the data
94 Bool_t LYZ2SUM = kFALSE; // Lee-Yang Zero (sum generating function), second pass over the data
95 Bool_t LYZ2PROD = kFALSE; // Lee-Yang Zero (product generating function), second pass over the data
96 Bool_t LYZEP = kFALSE; // Lee-Yang Zero Event Plane
97 Bool_t MH = kFALSE; // Mixed Harmonics (used for strong parity violation studies)
98 Bool_t NL = kFALSE; // Nested Loops (neeed for debugging, only for developers)
99 Bool_t MPC = kTRUE; // Multi-particle correlations (NEW!)
101 // i) Define simple cuts for Reference Particle (RP) selection:
102 Double_t ptMinRP = 0.0; // in GeV
103 Double_t ptMaxRP = 10.0; // in GeV
104 Double_t etaMinRP = -1.;
105 Double_t etaMaxRP = 1.;
106 Double_t phiMinRP = 0.0; // in degrees
107 Double_t phiMaxRP = 360.0; // in degrees
108 Bool_t bUseChargeRP = kFALSE; // if kFALSE, RPs with both sign of charges are taken
109 Int_t chargeRP = 1; // +1 or -1
111 // j) Define simple cuts for Particle of Interest (POI) selection:
112 Double_t ptMinPOI = 0.0; // in GeV
113 Double_t ptMaxPOI = 10.0; // in GeV
114 Double_t etaMinPOI = -1.; //
115 Double_t etaMaxPOI = 1.;
116 Double_t phiMinPOI = 0.0; // in degrees
117 Double_t phiMaxPOI = 360.0; // in degrees
118 Bool_t bUseChargePOI = kFALSE; // if kFALSE, POIs with both sign of charges are taken
119 Int_t chargePOI = -1; // +1 or -1
121 // k) Define the ranges for two subevents separated with eta gap (needed only for SP method):
122 Double_t etaMinA = -0.8; // minimum eta of subevent A
123 Double_t etaMaxA = -0.5; // maximum eta of subevent A
124 Double_t etaMinB = 0.5; // minimum eta of subevent B
125 Double_t etaMaxB = 0.8; // maximum eta of subevent B
127 // l) Enable/disable usage of particle weights:
128 Bool_t usePhiWeights = kFALSE; // phi weights
129 Bool_t usePtWeights = kFALSE; // pt weights
130 Bool_t useEtaWeights = kFALSE; // eta weights
132 enum anaModes {mLocal,mLocalSource,mLocalPAR};
133 // mLocal: Analyze data on your computer using aliroot
134 // mLocalPAR: Analyze data on your computer using root + PAR files
135 // mLocalSource: Analyze data on your computer using root + source files
137 #include "TStopwatch.h"
139 #include "Riostream.h"
142 int runFlowAnalysisOnTheFly(Int_t mode=mLocal)
144 // Beging analysis 'on the fly'.
146 // a) Formal necessities....;
147 // b) Initialize the flow event maker 'on the fly';
148 // c) If enabled, access particle weights from external file;
149 // d) Configure the flow analysis methods;
150 // e) Simple cuts for RPs;
151 // f) Simple cuts for POIs;
152 // g) Create and analyse events 'on the fly';
153 // h) Create the output file and directory structure for the final results of all methods;
154 // i) Calculate and store the final results of all methods.
156 // a) Formal necessities....:
163 // b) Initialize the flow event maker 'on the fly':
164 UInt_t uiSeed = 0; // if uiSeed is 0, the seed is determined uniquely in space and time via TUUID
165 if(bSameSeed){uiSeed = 44;}
166 AliFlowEventSimpleMakerOnTheFly* eventMakerOnTheFly = new AliFlowEventSimpleMakerOnTheFly(uiSeed);
167 eventMakerOnTheFly->SetMinMult(iMinMult);
168 eventMakerOnTheFly->SetMaxMult(iMaxMult);
169 eventMakerOnTheFly->SetMass(dMass);
170 eventMakerOnTheFly->SetTemperature(dTemperature);
171 eventMakerOnTheFly->SetV1(dV1);
172 eventMakerOnTheFly->SetV2(dV2);
173 eventMakerOnTheFly->SetV3(dV3);
174 eventMakerOnTheFly->SetV4(dV4);
175 eventMakerOnTheFly->SetV5(dV5);
176 eventMakerOnTheFly->SetV6(dV6);
177 if(bUniformFluctuationsV2)
179 eventMakerOnTheFly->SetUniformFluctuationsV2(bUniformFluctuationsV2);
180 eventMakerOnTheFly->SetMinV2(dMinV2);
181 eventMakerOnTheFly->SetMaxV2(dMaxV2);
185 eventMakerOnTheFly->SetPtDependentV2(bPtDependentV2);
186 eventMakerOnTheFly->SetV2vsPtCutOff(dV2vsPtCutOff);
187 eventMakerOnTheFly->SetV2vsPtMax(dV2vsPtMax);
189 eventMakerOnTheFly->SetSubeventEtaRange(etaMinA,etaMaxA,etaMinB,etaMaxB);
190 eventMakerOnTheFly->SetNTimes(nTimes);
191 if(!uniformAcceptance)
193 eventMakerOnTheFly->SetUniformAcceptance(kFALSE);
194 eventMakerOnTheFly->SetFirstSectorPhiMin(phiMin1);
195 eventMakerOnTheFly->SetFirstSectorPhiMax(phiMax1);
196 eventMakerOnTheFly->SetFirstSectorProbability(p1);
197 eventMakerOnTheFly->SetSecondSectorPhiMin(phiMin2);
198 eventMakerOnTheFly->SetSecondSectorPhiMax(phiMax2);
199 eventMakerOnTheFly->SetSecondSectorProbability(p2);
201 if(!uniformEfficiency)
203 eventMakerOnTheFly->SetUniformEfficiency(kFALSE);
204 eventMakerOnTheFly->SetPtMin(ptMin);
205 eventMakerOnTheFly->SetPtMax(ptMax);
206 eventMakerOnTheFly->SetPtProbability(p);
208 eventMakerOnTheFly->Init();
210 // c) If enabled, access particle weights from external file:
211 TFile *fileWithWeights = NULL;
212 TList *listWithWeights = NULL;
213 if(usePhiWeights||usePtWeights||useEtaWeights)
215 fileWithWeights = TFile::Open("weights.root","READ");
218 listWithWeights = (TList*)fileWithWeights->Get("weights");
222 cout << " WARNING: the file <weights.root> with weights from the previous run was not found."<<endl;
225 } // end of if(usePhiWeights||usePtWeights||useEtaWeights)
227 // d) Configure the flow analysis methods:
228 AliFlowAnalysisWithQCumulants *qc = NULL;
229 AliFlowAnalysisWithCumulants *gfc = NULL;
230 AliFlowAnalysisWithFittingQDistribution *fqd = NULL;
231 AliFlowAnalysisWithLeeYangZeros *lyz1sum = NULL;
232 AliFlowAnalysisWithLeeYangZeros *lyz1prod = NULL;
233 AliFlowAnalysisWithLeeYangZeros *lyz2sum = NULL;
234 AliFlowAnalysisWithLeeYangZeros *lyz2prod = NULL;
235 AliFlowAnalysisWithLYZEventPlane *lyzep = NULL;
236 AliFlowAnalysisWithScalarProduct *sp = NULL;
237 AliFlowAnalysisWithMixedHarmonics *mh = NULL;
238 AliFlowAnalysisWithNestedLoops *nl = NULL;
239 AliFlowAnalysisWithMCEventPlane *mcep = NULL;
240 AliFlowAnalysisWithMultiparticleCorrelations *mpc = NULL;
241 // MCEP = monte carlo event plane
244 //AliFlowAnalysisWithMCEventPlane *mcep = new AliFlowAnalysisWithMCEventPlane();
245 mcep = new AliFlowAnalysisWithMCEventPlane();
246 mcep->SetHarmonic(2); // default is v2
249 // SP = Scalar Product
252 sp = new AliFlowAnalysisWithScalarProduct();
253 if(listWithWeights){sp->SetWeightsList(listWithWeights);}
254 sp->SetUsePhiWeights(usePhiWeights);
256 sp->SetApplyCorrectionForNUA(kFALSE);
262 qc = new AliFlowAnalysisWithQCumulants();
263 if(listWithWeights){qc->SetWeightsList(listWithWeights);}
264 if(usePhiWeights){qc->SetUsePhiWeights(usePhiWeights);}
265 if(usePtWeights){qc->SetUsePtWeights(usePtWeights);}
266 if(useEtaWeights){qc->SetUseEtaWeights(useEtaWeights);}
268 qc->SetCalculateDiffFlow(kTRUE);
269 qc->SetCalculate2DDiffFlow(kFALSE); // vs (pt,eta)
270 qc->SetApplyCorrectionForNUA(kFALSE);
271 qc->SetFillMultipleControlHistograms(kFALSE);
272 qc->SetMultiplicityWeight("combinations"); // default (other supported options are "unit" and "multiplicity")
273 qc->SetCalculateCumulantsVsM(kFALSE);
274 qc->SetCalculateAllCorrelationsVsM(kFALSE); // calculate all correlations in mixed harmonics "vs M"
275 qc->SetnBinsMult(10000);
277 qc->SetMaxMult(10000);
278 qc->SetBookOnlyBasicCCH(kFALSE); // book only basic common control histograms
279 qc->SetCalculateDiffFlowVsEta(kTRUE); // if you set kFALSE only differential flow vs pt is calculated
280 qc->SetCalculateMixedHarmonics(kFALSE); // calculate all multi-partice mixed-harmonics correlators
283 // GFC = Generating Function Cumulants
286 gfc = new AliFlowAnalysisWithCumulants();
287 if(listWithWeights){gfc->SetWeightsList(listWithWeights);}
288 if(usePhiWeights){gfc->SetUsePhiWeights(usePhiWeights);}
289 if(usePtWeights){gfc->SetUsePtWeights(usePtWeights);}
290 if(useEtaWeights){gfc->SetUseEtaWeights(useEtaWeights);}
291 // calculation vs multiplicity:
292 gfc->SetCalculateVsMultiplicity(kFALSE);
293 gfc->SetnBinsMult(10000);
295 gfc->SetMaxMult(10000);
297 // tuning of interpolating parameters:
298 gfc->SetTuneParameters(kFALSE);
299 Double_t r0[10] = {1.8,1.9,2.0,2.1,2.2,2.3,2.4,2.5,2.6,2.7}; // up to 10 values allowed
300 for(Int_t r=0;r<10;r++){gfc->SetTuningR0(r0[r],r);}
303 // FQD = Fitting q-distribution
306 fqd = new AliFlowAnalysisWithFittingQDistribution();
307 if(listWithWeights){fqd->SetWeightsList(listWithWeights);}
308 if(usePhiWeights){fqd->SetUsePhiWeights(usePhiWeights);}
312 // LYZ1 = Lee-Yang Zeroes first run
315 lyz1sum = new AliFlowAnalysisWithLeeYangZeros();
316 lyz1sum->SetFirstRun(kTRUE);
317 lyz1sum->SetUseSum(kTRUE);
319 } // end of if(LYZ1SUM)
322 lyz1prod = new AliFlowAnalysisWithLeeYangZeros();
323 lyz1prod->SetFirstRun(kTRUE);
324 lyz1prod->SetUseSum(kFALSE);
326 } // end of if(LYZ1PROD)
327 // LYZ2 = Lee-Yang Zeroes second run
330 lyz2sum = new AliFlowAnalysisWithLeeYangZeros();
331 // read the input file from the first run
332 TString inputFileNameLYZ2SUM = "outputLYZ1SUManalysis.root" ;
333 TFile* inputFileLYZ2SUM = new TFile(inputFileNameLYZ2SUM.Data(),"READ");
334 if(!inputFileLYZ2SUM || inputFileLYZ2SUM->IsZombie())
336 cerr<<" ERROR: To run LYZ2SUM you need the output file from LYZ1SUM. This file is not there! Please run LYZ1SUM first."<<endl;
340 TList* inputListLYZ2SUM = (TList*)inputFileLYZ2SUM->Get("cobjLYZ1SUM");
341 if(!inputListLYZ2SUM){cout<<"Input list LYZ2SUM is NULL pointer!"<<endl;break;}
344 cout<<"LYZ2SUM input file/list read..."<<endl;
345 lyz2sum->SetFirstRunList(inputListLYZ2SUM);
346 lyz2sum->SetFirstRun(kFALSE);
347 lyz2sum->SetUseSum(kTRUE);
351 } // end of if(LYZ2SUM)
354 lyz2prod = new AliFlowAnalysisWithLeeYangZeros();
355 // read the input file from the first run
356 TString inputFileNameLYZ2PROD = "outputLYZ1PRODanalysis.root" ;
357 TFile* inputFileLYZ2PROD = new TFile(inputFileNameLYZ2PROD.Data(),"READ");
358 if(!inputFileLYZ2PROD || inputFileLYZ2PROD->IsZombie())
360 cerr<<" ERROR: To run LYZ2PROD you need the output file from LYZ1PROD. This file is not there! Please run LYZ1PROD first."<<endl;
364 TList* inputListLYZ2PROD = (TList*)inputFileLYZ2PROD->Get("cobjLYZ1PROD");
365 if(!inputListLYZ2PROD){cout<<"Input list LYZ2PROD is NULL pointer!"<<endl;break;}
368 cout<<"LYZ2PROD input file/list read..."<<endl;
369 lyz2prod->SetFirstRunList(inputListLYZ2PROD);
370 lyz2prod->SetFirstRun(kFALSE);
371 lyz2prod->SetUseSum(kFALSE);
375 } // end of if(LYZ2PROD)
376 // LYZEP = Lee-Yang Zeroes event plane
379 AliFlowLYZEventPlane *ep = new AliFlowLYZEventPlane() ;
380 AliFlowAnalysisWithLYZEventPlane* lyzep = new AliFlowAnalysisWithLYZEventPlane();
381 // read the input file from the second lyz run
382 TString inputFileNameLYZEP = "outputLYZ2SUManalysis.root" ;
383 TFile* inputFileLYZEP = new TFile(inputFileNameLYZEP.Data(),"READ");
384 if(!inputFileLYZEP || inputFileLYZEP->IsZombie()) {
385 cerr << " ERROR: To run LYZEP you need the output file from LYZ2SUM. This file is not there! Please run LYZ2SUM first." << endl ;
389 TList* inputListLYZEP = (TList*)inputFileLYZEP->Get("cobjLYZ2SUM");
390 if (!inputListLYZEP) {cout<<"Input list LYZEP is NULL pointer!"<<endl; break;}
392 cout<<"LYZEP input file/list read..."<<endl;
393 ep ->SetSecondRunList(inputListLYZEP);
394 lyzep->SetSecondRunList(inputListLYZEP);
403 mh = new AliFlowAnalysisWithMixedHarmonics();
404 mh->SetHarmonic(1); // integer n in expression cos[n(2phi1-phi2-phi3)] = v2n*vn^2
405 mh->SetMinMultiplicity(100);
406 mh->SetNoOfMultipicityBins(5);
407 mh->SetMultipicityBinWidth(200);
410 // NL = Nested Loops:
413 nl = new AliFlowAnalysisWithNestedLoops();
416 // MPC = Multi-particle correlations
419 mpc = new AliFlowAnalysisWithMultiparticleCorrelations();
421 //TFile *file = TFile::Open("weights.root","READ");
422 //TH1D *weightsHist = (TH1D*) file->FindObjectAny("Phi weights");
423 //mpc->SetPhiWeightsHist(weightsHist);
424 // Control histograms:
425 mpc->SetFillControlHistograms(kTRUE);
426 mpc->SetFillKinematicsHist(kTRUE);
428 mpc->SetCalculateQvector(kTRUE);
430 mpc->SetCalculateCorrelations(kTRUE);
431 mpc->SetSkipZeroHarmonics(kTRUE);
432 mpc->SetCalculateIsotropic(kTRUE);
434 mpc->SetCalculateStandardCandles(kTRUE);
439 // e) Simple cuts for RPs:
440 AliFlowTrackSimpleCuts *cutsRP = new AliFlowTrackSimpleCuts();
441 cutsRP->SetPtMax(ptMaxRP);
442 cutsRP->SetPtMin(ptMinRP);
443 cutsRP->SetEtaMax(etaMaxRP);
444 cutsRP->SetEtaMin(etaMinRP);
445 cutsRP->SetPhiMax(phiMaxRP*TMath::Pi()/180.);
446 cutsRP->SetPhiMin(phiMinRP*TMath::Pi()/180.);
447 if(bUseChargeRP){cutsRP->SetCharge(chargeRP);}
449 // f) Simple cuts for POIs:
450 AliFlowTrackSimpleCuts *cutsPOI = new AliFlowTrackSimpleCuts();
451 cutsPOI->SetPtMax(ptMaxPOI);
452 cutsPOI->SetPtMin(ptMinPOI);
453 cutsPOI->SetEtaMax(etaMaxPOI);
454 cutsPOI->SetEtaMin(etaMinPOI);
455 cutsPOI->SetPhiMax(phiMaxPOI*TMath::Pi()/180.);
456 cutsPOI->SetPhiMin(phiMinPOI*TMath::Pi()/180.);
457 if(bUseChargePOI){cutsPOI->SetCharge(chargePOI);}
459 // g) Create and analyse events 'on the fly':
460 for(Int_t i=0;i<iNevts;i++)
462 // Creating the event 'on the fly':
463 AliFlowEventSimple *event = eventMakerOnTheFly->CreateEventOnTheFly(cutsRP,cutsPOI);
464 // Passing the created event to flow analysis methods:
465 if(MCEP){mcep->Make(event);}
466 if(QC){qc->Make(event);}
467 if(GFC){gfc->Make(event);}
468 if(FQD){fqd->Make(event);}
469 if(LYZ1SUM){lyz1sum->Make(event);}
470 if(LYZ1PROD){lyz1prod->Make(event);}
471 if(LYZ2SUM){lyz2sum->Make(event);}
472 if(LYZ2PROD){lyz2prod->Make(event);}
473 if(LYZEP){lyzep->Make(event,ep);}
474 if(SP){sp->Make(event);}
475 if(MH){mh->Make(event);}
476 if(NL){nl->Make(event);}
477 if(MPC){mpc->Make(event);}
479 } // end of for(Int_t i=0;i<iNevts;i++)
481 // h) Create the output file and directory structure for the final results of all methods:
482 TString outputFileName = "AnalysisResults.root";
483 TFile *outputFile = new TFile(outputFileName.Data(),"RECREATE");
484 const Int_t nMethods = 13;
485 TString method[nMethods] = {"MCEP","SP","GFC","QC","FQD","LYZ1SUM","LYZ1PROD","LYZ2SUM","LYZ2PROD","LYZEP","MH","NL","MPC"};
486 TDirectoryFile *dirFileFinal[nMethods] = {NULL};
487 TString fileName[nMethods];
488 for(Int_t i=0;i<nMethods;i++)
490 fileName[i]+="output";
491 fileName[i]+=method[i].Data();
492 fileName[i]+="analysis";
493 dirFileFinal[i] = new TDirectoryFile(fileName[i].Data(),fileName[i].Data());
496 // i) Calculate and store the final results of all methods:
497 if(MCEP){mcep->Finish();mcep->WriteHistograms(dirFileFinal[0]);}
498 if(SP){sp->Finish();sp->WriteHistograms(dirFileFinal[1]);}
499 if(GFC){gfc->Finish();gfc->WriteHistograms(dirFileFinal[2]);}
500 if(QC){qc->Finish();qc->WriteHistograms(dirFileFinal[3]);}
501 if(FQD){fqd->Finish();fqd->WriteHistograms(dirFileFinal[4]);}
502 if(LYZ1SUM){lyz1sum->Finish();lyz1sum->WriteHistograms(dirFileFinal[5]);}
503 if(LYZ1PROD){lyz1prod->Finish();lyz1prod->WriteHistograms(dirFileFinal[6]);}
504 if(LYZ2SUM){lyz2sum->Finish();lyz2sum->WriteHistograms(dirFileFinal[7]);}
505 if(LYZ2PROD){lyz2prod->Finish();lyz2prod->WriteHistograms(dirFileFinal[8]);}
506 if(LYZEP){lyzep->Finish();lyzep->WriteHistograms(dirFileFinal[9]);}
507 if(MH){mh->Finish();mh->WriteHistograms(dirFileFinal[10]);}
508 if(NL){nl->Finish();nl->WriteHistograms(dirFileFinal[11]);}
509 if(MPC){mpc->Finish();mpc->WriteHistograms(dirFileFinal[12]);}
516 cout<<" ---- LANDED SUCCESSFULLY ---- "<<endl;
523 } // end of int runFlowAnalysisOnTheFly(Int_t mode=mLocal)
525 void SetupPar(char* pararchivename)
527 //Load par files, create analysis libraries
528 //For testing, if par file already decompressed and modified
529 //classes then do not decompress.
531 TString cdir(Form("%s", gSystem->WorkingDirectory() )) ;
532 TString parpar(Form("%s.par", pararchivename)) ;
533 if ( gSystem->AccessPathName(parpar.Data()) ) {
534 gSystem->ChangeDirectory(gSystem->Getenv("ALICE_ROOT")) ;
535 TString processline(Form(".! make %s", parpar.Data())) ;
536 gROOT->ProcessLine(processline.Data()) ;
537 gSystem->ChangeDirectory(cdir) ;
538 processline = Form(".! mv /tmp/%s .", parpar.Data()) ;
539 gROOT->ProcessLine(processline.Data()) ;
541 if ( gSystem->AccessPathName(pararchivename) ) {
542 TString processline = Form(".! tar xvzf %s",parpar.Data()) ;
543 gROOT->ProcessLine(processline.Data());
546 TString ocwd = gSystem->WorkingDirectory();
547 gSystem->ChangeDirectory(pararchivename);
549 // check for BUILD.sh and execute
550 if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) {
551 printf("*******************************\n");
552 printf("*** Building PAR archive ***\n");
553 cout<<pararchivename<<endl;
554 printf("*******************************\n");
556 if (gSystem->Exec("PROOF-INF/BUILD.sh")) {
557 Error("runProcess","Cannot Build the PAR Archive! - Abort!");
561 // check for SETUP.C and execute
562 if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) {
563 printf("*******************************\n");
564 printf("*** Setup PAR archive ***\n");
565 cout<<pararchivename<<endl;
566 printf("*******************************\n");
567 gROOT->Macro("PROOF-INF/SETUP.C");
570 gSystem->ChangeDirectory(ocwd.Data());
571 printf("Current dir: %s\n", ocwd.Data());
574 void CheckUserSettings()
576 // Check if user settings make sense before taking off.
580 printf("\n WARNING: nEvts <= 0 !!!! Please check your settings before taking off.\n\n");
585 printf("\n WARNING: iMinMult < 0 !!!! Please check your settings before taking off.\n\n");
590 printf("\n WARNING: iMaxMult <= 0 !!!! Please check your settings before taking off.\n\n");
593 if(iMinMult >= iMaxMult)
595 printf("\n WARNING: iMinMult >= iMaxMult !!!! Please check your settings before taking off.\n\n");
600 printf("\n WARNING: dMass < 0 !!!! Please check your settings before taking off.\n\n");
603 if(dTemperature <= 1e-44)
605 printf("\n WARNING: dTemperature <= 0 !!!! Please check your settings before taking off.\n\n");
608 if(TMath::Abs(dV1) > 0.5)
610 printf("\n WARNING: |dV1| > 0.5 !!!! Please check your settings before taking off.\n\n");
613 if(TMath::Abs(dV2) > 0.5)
615 printf("\n WARNING: |dV2| > 0.5 !!!! Please check your settings before taking off.\n\n");
618 if(TMath::Abs(dV3) > 0.5)
620 printf("\n WARNING: |dV3| > 0.5 !!!! Please check your settings before taking off.\n\n");
623 if(TMath::Abs(dV4) > 0.5)
625 printf("\n WARNING: |dV4| > 0.5 !!!! Please check your settings before taking off.\n\n");
628 if(TMath::Abs(dV5) > 0.5)
630 printf("\n WARNING: |dV5| > 0.5 !!!! Please check your settings before taking off.\n\n");
633 if(TMath::Abs(dV6) > 0.5)
635 printf("\n WARNING: |dV6| > 0.5 !!!! Please check your settings before taking off.\n\n");
638 if(LYZ1SUM && LYZ2SUM)
640 cout<<" WARNING: You cannot run LYZ1 and LYZ2 at the same time! LYZ2 needs the output from LYZ1."<<endl;
643 if(LYZ1PROD && LYZ2PROD)
645 cout<<" WARNING: You cannot run LYZ1 and LYZ2 at the same time! LYZ2 needs the output from LYZ1."<<endl;
650 cout<<" WARNING: You cannot run LYZ2 and LYZEP at the same time! LYZEP needs the output from LYZ2."<<endl;
655 cout<<" WARNING: You cannot run LYZ1 and LYZEP at the same time! LYZEP needs the output from LYZ2."<<endl;
659 if(!uniformAcceptance && phiMin1 > phiMax1)
661 cout<<" WARNING: You must have phiMin1 < phiMax1 !!!!"<<endl;
664 if(!uniformAcceptance && !((TMath::Abs(phiMin2) < 1.e-44) && (TMath::Abs(phiMax2) < 1.e-44) && (TMath::Abs(p2) < 1.e-44))
665 && (phiMin2 < phiMax1 || phiMin2 > phiMax2))
667 cout<<" WARNING: You must have phiMin2 > phiMax1 and phiMin2 < phiMax2 !!!!"<<endl;
670 if((phiMin1 < 0 || phiMin1 > 360) || (phiMax1 < 0 || phiMax1 > 360) ||
671 (phiMin2 < 0 || phiMin2 > 360) || (phiMax2 < 0 || phiMax2 > 360) )
673 cout<<" WARNING: You must take azimuthal angles from interval [0,360] !!!!"<<endl;
676 if((p1 < 0 || p1 > 1) || (p2 < 0 || p2 > 1))
678 cout<<" WARNING: you must take p1 and p2 from interval [0,1] !!!!"<<endl;
681 if(bPtDependentV2 && bUniformFluctuationsV2)
683 cout<<" WARNING: Uniform fluctuations not supported for pt denependent v2 !!!!"<<endl;
687 } // end of void CheckUserSettings()
689 void WelcomeMessage()
695 cout<<" ---- ARE YOU READY TO FLY ? ---- "<<endl;
698 gSystem->Sleep(1544);
701 cout<<" ---- BEGIN FLOW ANALYSIS 'ON THE FLY' ---- "<<endl;
705 gSystem->Sleep(1544);
707 } // end of void WelcomeMessage()
709 void LoadLibraries(const anaModes mode) {
711 //--------------------------------------
712 // Load the needed libraries most of them already loaded by aliroot
713 //--------------------------------------
714 //gSystem->Load("libTree");
715 gSystem->Load("libGeom");
716 gSystem->Load("libVMC");
717 gSystem->Load("libXMLIO");
718 gSystem->Load("libPhysics");
720 //----------------------------------------------------------
721 // >>>>>>>>>>> Local mode <<<<<<<<<<<<<<
722 //----------------------------------------------------------
724 //--------------------------------------------------------
725 // If you want to use already compiled libraries
726 // in the aliroot distribution
727 //--------------------------------------------------------
728 gSystem->Load("libSTEERBase");
729 gSystem->Load("libESD");
730 gSystem->Load("libAOD");
731 gSystem->Load("libANALYSIS");
732 gSystem->Load("libANALYSISalice");
733 gSystem->Load("libCORRFW");
734 cerr<<"libCORRFW loaded..."<<endl;
735 gSystem->Load("libPWGflowBase");
736 cerr<<"libPWGflowBase loaded..."<<endl;
737 gSystem->Load("libPWGflowTasks");
738 cerr<<"libPWGflowTasks loaded..."<<endl;
741 else if (mode == mLocalPAR) {
742 //--------------------------------------------------------
743 //If you want to use root and par files from aliroot
744 //--------------------------------------------------------
745 //If you want to use root and par files from aliroot
746 //--------------------------------------------------------
747 SetupPar("STEERBase");
750 SetupPar("ANALYSIS");
751 SetupPar("ANALYSISalice");
754 SetupPar("PWGflowBase");
755 cerr<<"PWGflowBase.par loaded..."<<endl;
756 SetupPar("PWGflowTasks");
757 cerr<<"PWGflowTasks.par loaded..."<<endl;
760 //---------------------------------------------------------
761 // <<<<<<<<<< Source mode >>>>>>>>>>>>
762 //---------------------------------------------------------
763 else if (mode==mLocalSource) {
765 // In root inline compile
768 gROOT->LoadMacro("Base/AliFlowCommonConstants.cxx+");
769 gROOT->LoadMacro("Base/AliFlowLYZConstants.cxx+");
772 gROOT->LoadMacro("Base/AliFlowVector.cxx+");
773 gROOT->LoadMacro("Base/AliFlowTrackSimple.cxx+");
774 gROOT->LoadMacro("Base/AliFlowTrackSimpleCuts.cxx+");
775 gROOT->LoadMacro("Base/AliFlowEventSimple.cxx+");
777 // Output histosgrams
778 gROOT->LoadMacro("Base/AliFlowCommonHist.cxx+");
779 gROOT->LoadMacro("Base/AliFlowCommonHistResults.cxx+");
780 gROOT->LoadMacro("Base/AliFlowLYZHist1.cxx+");
781 gROOT->LoadMacro("Base/AliFlowLYZHist2.cxx+");
783 // Functions needed for various methods
784 gROOT->LoadMacro("Base/AliCumulantsFunctions.cxx+");
785 gROOT->LoadMacro("Base/AliFlowLYZEventPlane.cxx+");
787 // Flow Analysis code for various methods
788 gROOT->LoadMacro("Base/AliFlowAnalysisWithMCEventPlane.cxx+");
789 gROOT->LoadMacro("Base/AliFlowAnalysisWithScalarProduct.cxx+");
790 gROOT->LoadMacro("Base/AliFlowAnalysisWithLYZEventPlane.cxx+");
791 gROOT->LoadMacro("Base/AliFlowAnalysisWithLeeYangZeros.cxx+");
792 gROOT->LoadMacro("Base/AliFlowAnalysisWithCumulants.cxx+");
793 gROOT->LoadMacro("Base/AliFlowAnalysisWithQCumulants.cxx+");
794 gROOT->LoadMacro("Base/AliFlowAnalysisWithFittingQDistribution.cxx+");
795 gROOT->LoadMacro("Base/AliFlowAnalysisWithMixedHarmonics.cxx+");
796 gROOT->LoadMacro("Base/AliFlowAnalysisWithNestedLoops.cxx+");
798 // Class to fill the FlowEvent on the fly (generate Monte Carlo events)
799 gROOT->LoadMacro("Base/AliFlowEventSimpleMakerOnTheFly.cxx+");
801 cout << "finished loading macros!" << endl;