]>
Commit | Line | Data |
---|---|---|
334e3256 | 1 | #include "TStopwatch.h" |
2 | #include "TObjArray" | |
3 | #include "Riostream.h" | |
26c4cbb9 | 4 | #include "TFile.h" |
334e3256 | 5 | |
03a02aca | 6 | //-------------------------------------------------------------------------------------- |
7 | // RUN SETTINGS | |
334e3256 | 8 | //flow analysis method can be: (set to kTRUE or kFALSE) |
c741f5d0 | 9 | Bool_t SP = kTRUE; |
5b40431d | 10 | Bool_t LYZ1SUM = kTRUE; |
11 | Bool_t LYZ1PROD = kTRUE; | |
c741f5d0 | 12 | Bool_t LYZ2SUM = kFALSE; |
13 | Bool_t LYZ2PROD = kFALSE; | |
5b40431d | 14 | Bool_t LYZEP = kFALSE; |
c741f5d0 | 15 | Bool_t GFC = kTRUE; |
16 | Bool_t QC = kTRUE; | |
b5425e51 | 17 | Bool_t FQD = kTRUE; |
5b40431d | 18 | Bool_t MCEP = kFALSE; //does not work yet 24/12/08 |
03a02aca | 19 | //-------------------------------------------------------------------------------------- |
334e3256 | 20 | |
20e52807 | 21 | // Weights |
22 | // Use weights for Q vector | |
23 | Bool_t usePhiWeights = kFALSE; //Phi (correction for non-uniform azimuthal acceptance) | |
24 | Bool_t usePtWeights = kFALSE; //v'(pt) (differential flow in pt) | |
25 | Bool_t useEtaWeights = kFALSE; //v'(eta) (differential flow in eta) | |
26 | ||
03a02aca | 27 | //-------------------------------------------------------------------------------------- |
28 | // CUT SETTINGS | |
334e3256 | 29 | //integrated selection |
30 | Double_t ptMaxInt = 10.; | |
31 | Double_t ptMinInt = 0.; | |
32 | Double_t etaMaxInt = 1.; | |
33 | Double_t etaMinInt = -1.; | |
34 | Double_t phiMaxInt = 7.5; | |
35 | Double_t phiMinInt = 0.; | |
36 | Int_t PIDInt = 211; | |
37 | ||
38 | //differential selection | |
39 | Double_t ptMaxDiff = 10.; | |
40 | Double_t ptMinDiff = 0.; | |
41 | Double_t etaMaxDiff = 1.; | |
42 | Double_t etaMinDiff = -1.; | |
43 | Double_t phiMaxDiff = 7.5; | |
44 | Double_t phiMinDiff = 0.; | |
45 | Int_t PIDDiff = 211; | |
c741f5d0 | 46 | /* |
03a02aca | 47 | //-------------------------------------------------------------------------------------- |
33314629 | 48 | // FLOW SETTINGS (R.Rietkerk) |
49 | Int_t nLoops=1; // Number of times to use the same particle (nonflow). | |
c741f5d0 | 50 | Double_t xEllipticFlowValue=0.1;// Add Elliptic Flow. Must be in range [0,1]. |
51 | Int_t nMultiplicityOfEvent=500; // Set Average Multiplicity. | |
33314629 | 52 | Double_t xSigmaFlow=0.00; // Add Elliptic Flow. Must be in range [0,1]. |
c741f5d0 | 53 | Int_t nSigmaMult=50; // Set Average Multiplicity. |
33314629 | 54 | //-------------------------------------------------------------------------------------- |
c741f5d0 | 55 | */ |
26c4cbb9 | 56 | |
fdd8c18f | 57 | enum anaModes {mLocal,mLocalSource,mLocalPAR,}; |
58 | //mLocal: Analyze data on your computer using aliroot | |
59 | //mLocalPAR: Analyze data on your computer using root + PAR files | |
60 | //mLocalSource: Analyze data on your computer using root + source files | |
61 | ||
26c4cbb9 | 62 | Int_t offset = 0; |
63 | ||
b5425e51 | 64 | int runFlowAnalysis(Int_t mode=mLocal, Int_t aRuns = 100, const char* |
c741f5d0 | 65 | dir="/data/alice1/kolk/KineOnly3/") |
66 | // dir="/Users/snelling/alice_data/KineOnly3/") | |
33314629 | 67 | // dir="/Users/snelling/alice_data/stoomboot/5b/") |
334e3256 | 68 | { |
69 | TStopwatch timer; | |
70 | timer.Start(); | |
71 | ||
c741f5d0 | 72 | if (LYZ1SUM && LYZ2SUM) {cout<<"WARNING: you cannot run LYZ1 and LYZ2 at the same time! LYZ2 needs the output from LYZ1."<<endl; exit(); } |
73 | if (LYZ1PROD && LYZ2PROD) {cout<<"WARNING: you cannot run LYZ1 and LYZ2 at the same time! LYZ2 needs the output from LYZ1."<<endl; exit(); } | |
74 | if (LYZ2SUM && LYZEP) {cout<<"WARNING: you cannot run LYZ2 and LYZEP at the same time! LYZEP needs the output from LYZ2."<<endl; exit(); } | |
75 | if (LYZ1SUM && LYZEP) {cout<<"WARNING: you cannot run LYZ1 and LYZEP at the same time! LYZEP needs the output from LYZ2."<<endl; exit(); } | |
334e3256 | 76 | |
77 | ||
78 | cout<<endl; | |
79 | cout<<" ---- BEGIN ANALYSIS ---- "<<endl; | |
80 | cout<<endl; | |
81 | ||
fdd8c18f | 82 | LoadLibraries(mode); |
2a413443 | 83 | |
33314629 | 84 | TRandom3 random3Temp; //init for manual settings (R.Rietkerk) |
85 | TTimeStamp dt; | |
86 | Int_t sseed = dt.GetNanoSec()/1000; | |
87 | random3Temp.SetSeed(sseed); | |
88 | ||
fdd8c18f | 89 | if (mode == mLocal || mode == mLocalPAR) { |
90 | // AliFlow event in aliroot or with pars | |
91 | AliFlowEventSimpleMaker* fEventMaker = new AliFlowEventSimpleMaker(); | |
92 | } | |
93 | else if (mode == mLocalSource) { | |
94 | // flow event in source mode | |
95 | FlowEventSimpleMaker* fEventMaker = new FlowEventSimpleMaker(); | |
96 | } | |
97 | else{ | |
98 | cout << "No supported running mode selected!" << endl; | |
99 | break; | |
100 | } | |
2a413443 | 101 | |
2a413443 | 102 | |
334e3256 | 103 | //------------------------------------------------------------------------ |
e085f1a9 | 104 | //cuts: |
334e3256 | 105 | AliFlowTrackSimpleCuts* cutsInt = new AliFlowTrackSimpleCuts(); |
106 | cutsInt->SetPtMax(ptMaxInt); | |
107 | cutsInt->SetPtMin(ptMinInt); | |
108 | cutsInt->SetEtaMax(etaMaxInt); | |
109 | cutsInt->SetEtaMin(etaMinInt); | |
110 | cutsInt->SetPhiMax(phiMaxInt); | |
111 | cutsInt->SetPhiMin(phiMinInt); | |
112 | cutsInt->SetPID(PIDInt); | |
113 | ||
114 | AliFlowTrackSimpleCuts* cutsDiff = new AliFlowTrackSimpleCuts(); | |
115 | cutsDiff->SetPtMax(ptMaxDiff); | |
116 | cutsDiff->SetPtMin(ptMinDiff); | |
117 | cutsDiff->SetEtaMax(etaMaxDiff); | |
118 | cutsDiff->SetEtaMin(etaMinDiff); | |
119 | cutsDiff->SetPhiMax(phiMaxDiff); | |
120 | cutsDiff->SetPhiMin(phiMinDiff); | |
121 | cutsDiff->SetPID(PIDDiff); | |
122 | ||
03a02aca | 123 | //if the weights are used: |
124 | TFile *fileWithWeights = NULL; | |
125 | TList *listWithWeights = NULL; | |
334e3256 | 126 | |
14db9c04 | 127 | if(usePhiWeights||usePtWeights||useEtaWeights) { |
128 | fileWithWeights = TFile::Open("weights.root","READ"); | |
129 | if(fileWithWeights) { | |
130 | listWithWeights = (TList*)fileWithWeights->Get("weights"); | |
131 | } | |
132 | else | |
133 | {cout << " WARNING: the file <weights.root> with weights from the previous run was not found."<<endl; | |
134 | break; | |
135 | } | |
e085f1a9 | 136 | } |
137 | ||
138 | //flow methods: | |
ce4a88f5 | 139 | AliFlowAnalysisWithQCumulants *qc = NULL; |
140 | AliFlowAnalysisWithCumulants *gfc = NULL; | |
141 | AliFlowAnalysisWithFittingQDistribution *fqd = NULL; | |
142 | AliFlowAnalysisWithLeeYangZeros *lyz1sum = NULL; | |
143 | AliFlowAnalysisWithLeeYangZeros *lyz1prod = NULL; | |
144 | AliFlowAnalysisWithLeeYangZeros *lyz2sum = NULL; | |
145 | AliFlowAnalysisWithLeeYangZeros *lyz2prod = NULL; | |
146 | AliFlowAnalysisWithLYZEventPlane *lyzep = NULL; | |
147 | AliFlowAnalysisWithScalarProduct *sp = NULL; | |
148 | AliFlowAnalysisWithMCEventPlane *mcep = NULL; | |
deebd72f | 149 | |
334e3256 | 150 | //MCEP = monte carlo event plane |
deebd72f | 151 | if (MCEP) { |
152 | AliFlowAnalysisWithMCEventPlane *mcep = new AliFlowAnalysisWithMCEventPlane(); | |
153 | mcep->Init(); | |
154 | } | |
334e3256 | 155 | |
156 | //QC = Q-cumulants | |
deebd72f | 157 | if(QC) { |
158 | AliFlowAnalysisWithQCumulants* qc = new AliFlowAnalysisWithQCumulants(); | |
e085f1a9 | 159 | qc->Init(); |
03a02aca | 160 | if(listWithWeights) qc->SetWeightsList(listWithWeights); |
161 | if(usePhiWeights) qc->SetUsePhiWeights(usePhiWeights); | |
162 | if(usePtWeights) qc->SetUsePtWeights(usePtWeights); | |
163 | if(useEtaWeights) qc->SetUseEtaWeights(useEtaWeights); | |
deebd72f | 164 | } |
334e3256 | 165 | |
166 | //GFC = Generating Function Cumulants | |
deebd72f | 167 | if(GFC) { |
168 | AliFlowAnalysisWithCumulants* gfc = new AliFlowAnalysisWithCumulants(); | |
e5e75b58 | 169 | gfc->Init(); |
170 | if(listWithWeights) gfc->SetWeightsList(listWithWeights); | |
171 | if(usePhiWeights) gfc->SetUsePhiWeights(usePhiWeights); | |
172 | if(usePtWeights) gfc->SetUsePtWeights(usePtWeights); | |
173 | if(useEtaWeights) gfc->SetUseEtaWeights(useEtaWeights); | |
deebd72f | 174 | } |
334e3256 | 175 | |
176 | //FQD = Fitting q-distribution | |
deebd72f | 177 | if(FQD) { |
ce4a88f5 | 178 | AliFlowAnalysisWithFittingQDistribution* fqd = new AliFlowAnalysisWithFittingQDistribution(); |
14db9c04 | 179 | fqd->Init(); |
180 | if(listWithWeights) fqd->SetWeightsList(listWithWeights); | |
181 | if(usePhiWeights) fqd->SetUsePhiWeights(usePhiWeights); | |
deebd72f | 182 | } |
60ec66fb | 183 | |
184 | //SP = Scalar Product | |
185 | if(SP) { | |
186 | AliFlowAnalysisWithScalarProduct* sp = new AliFlowAnalysisWithScalarProduct(); | |
187 | sp->Init(); | |
188 | } | |
189 | ||
334e3256 | 190 | //LYZ1 = Lee-Yang Zeroes first run |
c741f5d0 | 191 | if(LYZ1SUM) { |
192 | AliFlowAnalysisWithLeeYangZeros* lyz1sum = new AliFlowAnalysisWithLeeYangZeros(); | |
193 | lyz1sum->SetFirstRun(kTRUE); | |
194 | lyz1sum->SetUseSum(kTRUE); | |
195 | lyz1sum->Init(); | |
196 | } | |
197 | if(LYZ1PROD) { | |
198 | AliFlowAnalysisWithLeeYangZeros* lyz1prod = new AliFlowAnalysisWithLeeYangZeros(); | |
199 | lyz1prod->SetFirstRun(kTRUE); | |
200 | lyz1prod->SetUseSum(kFALSE); | |
201 | lyz1prod->Init(); | |
deebd72f | 202 | } |
334e3256 | 203 | //LYZ2 = Lee-Yang Zeroes second run |
c741f5d0 | 204 | if(LYZ2SUM) { |
205 | AliFlowAnalysisWithLeeYangZeros* lyz2sum = new AliFlowAnalysisWithLeeYangZeros(); | |
deebd72f | 206 | // read the input file from the first run |
c741f5d0 | 207 | TString inputFileNameLYZ2SUM = "outputLYZ1SUManalysis.root" ; |
208 | TFile* inputFileLYZ2SUM = new TFile(inputFileNameLYZ2SUM.Data(),"READ"); | |
209 | if(!inputFileLYZ2SUM || inputFileLYZ2SUM->IsZombie()) { | |
5b40431d | 210 | cerr << " ERROR: To run LYZ2SUM you need the output file from LYZ1SUM. This file is not there! Please run LYZ1SUM first." << endl ; |
ce78b98c | 211 | break; |
deebd72f | 212 | } |
213 | else { | |
c741f5d0 | 214 | TList* inputListLYZ2SUM = (TList*)inputFileLYZ2SUM->Get("cobjLYZ1SUM"); |
215 | if (!inputListLYZ2SUM) {cout<<"SUM Input list is NULL pointer!"<<endl; break;} | |
deebd72f | 216 | else { |
c741f5d0 | 217 | cout<<"LYZ2SUM input file/list read..."<<endl; |
218 | lyz2sum->SetFirstRunList(inputListLYZ2SUM); | |
219 | lyz2sum->SetFirstRun(kFALSE); | |
220 | lyz2sum->SetUseSum(kTRUE); | |
221 | lyz2sum->Init(); | |
222 | } | |
223 | } | |
224 | } | |
225 | if(LYZ2PROD) { | |
226 | AliFlowAnalysisWithLeeYangZeros* lyz2prod = new AliFlowAnalysisWithLeeYangZeros(); | |
227 | // read the input file from the first run | |
228 | TString inputFileNameLYZ2PROD = "outputLYZ1PRODanalysis.root" ; | |
229 | TFile* inputFileLYZ2PROD = new TFile(inputFileNameLYZ2PROD.Data(),"READ"); | |
230 | if(!inputFileLYZ2PROD || inputFileLYZ2PROD->IsZombie()) { | |
5b40431d | 231 | cerr << " ERROR: To run LYZ2PROD you need the output file from LYZ1PROD. This file is not there! Please run LYZ1PROD first." << endl ; |
c741f5d0 | 232 | break; |
233 | } | |
234 | else { | |
235 | TList* inputListLYZ2PROD = (TList*)inputFileLYZ2PROD->Get("cobjLYZ1PROD"); | |
236 | if (!inputListLYZ2PROD) {cout<<"PROD Input list is NULL pointer!"<<endl; break;} | |
237 | else { | |
238 | cout<<"LYZ2PROD input file/list read..."<<endl; | |
239 | lyz2prod->SetFirstRunList(inputListLYZ2PROD); | |
240 | lyz2prod->SetFirstRun(kFALSE); | |
241 | lyz2prod->SetUseSum(kTRUE); | |
242 | lyz2prod->Init(); | |
334e3256 | 243 | } |
244 | } | |
deebd72f | 245 | } |
334e3256 | 246 | //LYZEP = Lee-Yang Zeroes event plane |
deebd72f | 247 | if(LYZEP) { |
248 | AliFlowLYZEventPlane* ep = new AliFlowLYZEventPlane() ; | |
249 | AliFlowAnalysisWithLYZEventPlane* lyzep = new AliFlowAnalysisWithLYZEventPlane(); | |
250 | // read the input file from the second lyz run | |
c741f5d0 | 251 | TString inputFileNameLYZEP = "outputLYZ2SUManalysis.root" ; |
deebd72f | 252 | TFile* inputFileLYZEP = new TFile(inputFileNameLYZEP.Data(),"READ"); |
253 | if(!inputFileLYZEP || inputFileLYZEP->IsZombie()) { | |
5b40431d | 254 | cerr << " ERROR: To run LYZEP you need the output file from LYZ2SUM. This file is not there! Please run LYZ2SUM first." << endl ; |
ce78b98c | 255 | break; |
256 | } | |
deebd72f | 257 | else { |
c741f5d0 | 258 | TList* inputListLYZEP = (TList*)inputFileLYZEP->Get("cobjLYZ2SUM"); |
ace38bad | 259 | if (!inputListLYZEP) {cout<<"Input list is NULL pointer!"<<endl; break;} |
deebd72f | 260 | else { |
261 | cout<<"LYZEP input file/list read..."<<endl; | |
262 | ep ->SetSecondRunList(inputListLYZEP); | |
263 | lyzep->SetSecondRunList(inputListLYZEP); | |
264 | ep ->Init(); | |
265 | lyzep->Init(); | |
334e3256 | 266 | } |
267 | } | |
deebd72f | 268 | } |
334e3256 | 269 | //------------------------------------------------------------------------ |
270 | ||
26c4cbb9 | 271 | |
b25cc698 | 272 | //standard code to read files in directory |
334e3256 | 273 | Int_t fCount = 0; |
274 | TString execDir(gSystem->pwd()); | |
275 | TString targetDir(dir); | |
276 | TSystemDirectory* baseDir = new TSystemDirectory(".", dir); | |
277 | TList* dirList = baseDir->GetListOfFiles(); | |
278 | if (!dirList) { | |
279 | cout << endl << "No input files in: " << targetDir.Data() << endl; | |
280 | break; | |
281 | } | |
282 | Int_t nDirs = dirList->GetEntries(); | |
283 | cout<<endl; | |
284 | cout<<"Int_t nDirs = "<<nDirs<<endl; | |
285 | gSystem->cd(execDir); | |
286 | ||
287 | for(Int_t iDir=0;iDir<nDirs;++iDir) | |
288 | { | |
289 | TSystemFile* presentDir = (TSystemFile*)dirList->At(iDir); | |
290 | if(!presentDir || !presentDir->IsDirectory() || | |
291 | strcmp(presentDir->GetName(), ".") == 0 || | |
292 | strcmp(presentDir->GetName(), "..") == 0) | |
293 | { | |
294 | cout << endl; | |
295 | cout << "Directory (" << iDir << "): " << presentDir->GetName() << | |
296 | " - Skipping ... " << endl; | |
297 | continue ; | |
298 | } | |
299 | ||
300 | if(offset > 0) { --offset ; continue ; } | |
301 | if((aRuns > 0) && (fCount >= aRuns)) { break ; } | |
302 | ||
303 | TString presentDirName(dir); // aDataDir | |
304 | presentDirName += presentDir->GetName(); | |
305 | presentDirName += "/"; | |
306 | //cerr<<" presentDirName = "<<presentDirName<<endl; | |
307 | ||
308 | TString fileName = presentDirName; | |
309 | fileName += "galice.root"; | |
310 | Long_t *id, *size, *flags, *modtime; | |
311 | if(gSystem->GetPathInfo(fileName.Data(),id,size,flags,modtime)) | |
312 | { | |
313 | cout << " File : " << fileName << " does NOT exist ! - Skipping ... " | |
314 | << endl; | |
315 | continue; | |
316 | } | |
deebd72f | 317 | // cout << endl ; cout << "Directory (" << iDir << "): " << presentDirName << " ... " << endl; |
334e3256 | 318 | |
319 | //loop (simulations in the present dir) | |
320 | TSystemDirectory* evtsDir = new TSystemDirectory(".", | |
321 | presentDirName.Data()); | |
322 | TList* fileList = evtsDir->GetListOfFiles(); | |
323 | Int_t nFiles = fileList->GetEntries(); | |
deebd72f | 324 | //cout<<" Int_t nFiles = "<<nFiles<<endl; |
334e3256 | 325 | gSystem->cd(execDir); |
326 | for(Int_t iFiles=0; iFiles<nFiles; ++iFiles) | |
327 | { | |
328 | TSystemFile* presentFile = (TSystemFile*) fileList->At(iFiles); | |
329 | TString presentFileName(presentDirName); | |
330 | presentFileName += presentFile->GetName(); | |
331 | ||
332 | if(!(presentFileName.Contains("Kinematics") && | |
333 | presentFileName.Contains("root"))) { continue ; } | |
334 | ||
deebd72f | 335 | //cout << " found: " << presentFileName.Data() << endl; |
334e3256 | 336 | |
337 | TFile* kineFile = new TFile(presentFileName.Data(), "READ"); | |
338 | // kineFile->ls(); | |
339 | Int_t nEvts = kineFile->GetNkeys() ; | |
deebd72f | 340 | //cout << " . found: " << nEvts << " KineTree(s) in " << presentFileName.Data() << endl; |
334e3256 | 341 | TList* kineEventsList = (TList*)kineFile->GetListOfKeys(); |
342 | TTree* kTree; | |
343 | TIter next(kineEventsList); | |
344 | TKey* key; | |
33314629 | 345 | |
346 | Double_t xRPAngle; | |
334e3256 | 347 | //loop over the events |
348 | while( key=(TKey *)next() ) | |
349 | { | |
350 | TDirectory* tDir = (TDirectory*)key->ReadObj(); | |
351 | if(!tDir) break; | |
352 | ||
353 | TString evtDir(tDir->GetName()); | |
deebd72f | 354 | //cout << " . . found: " << tDir->GetName() << endl; |
334e3256 | 355 | |
356 | kTree = (TTree *)tDir->Get("TreeK"); | |
357 | if(!kTree) break; | |
358 | ||
359 | Int_t nPart = kTree->GetEntries(); | |
deebd72f | 360 | //cout << " . . . kTree " << fCount << " has " << nPart << " particles " << endl; |
334e3256 | 361 | |
362 | //----------------------------------------------------------- | |
26c4cbb9 | 363 | //fill and save the flow event |
33314629 | 364 | |
c741f5d0 | 365 | /* |
33314629 | 366 | Int_t nNewMultOfEvent = random3Temp.Gaus(nMultiplicityOfEvent,nSigmaMult); |
367 | cout << "new multiplicity: " << nNewMultOfEvent << endl; | |
368 | Double_t xNewFlowValue = random3Temp.Gaus(xEllipticFlowValue,xSigmaFlow); | |
4f678629 | 369 | if ( (fCount % 100) == 0) { |
370 | cout << "new multiplicity: " << nNewMultOfEvent << endl; | |
371 | cout << "new flow value: " << xNewFlowValue << endl; | |
372 | } | |
33314629 | 373 | fEventMaker->SetNoOfLoops(nLoops); |
374 | fEventMaker->SetEllipticFlowValue(xNewFlowValue); | |
375 | fEventMaker->SetMultiplicityOfEvent(nNewMultOfEvent); | |
376 | xRPAngle=TMath::TwoPi()*random3Temp.Rndm(); | |
377 | fEventMaker->SetMCReactionPlaneAngle(xRPAngle); | |
c741f5d0 | 378 | */ |
33314629 | 379 | |
26c4cbb9 | 380 | AliFlowEventSimple *fEvent = fEventMaker->FillTracks(kTree, cutsInt, cutsDiff); |
381 | ||
b25cc698 | 382 | // do flow analysis for various methods |
c741f5d0 | 383 | if(MCEP) mcep->Make(fEvent); |
384 | if(QC) qc->Make(fEvent); | |
385 | if(GFC) gfc->Make(fEvent); | |
386 | if(FQD) fqd->Make(fEvent); | |
387 | if(LYZ1SUM) lyz1sum->Make(fEvent); | |
388 | if(LYZ1PROD)lyz1prod->Make(fEvent); | |
389 | if(LYZ2SUM) lyz2sum->Make(fEvent); | |
390 | if(LYZ2PROD)lyz2prod->Make(fEvent); | |
391 | if(LYZEP) lyzep->Make(fEvent,ep); | |
392 | if(SP) sp->Make(fEvent); | |
334e3256 | 393 | //----------------------------------------------------------- |
334e3256 | 394 | fCount++; |
951817d5 | 395 | //cout << "# " << fCount << " events processed" << endl; |
334e3256 | 396 | delete kTree; |
397 | delete fEvent; | |
398 | } | |
399 | delete kineFile ; | |
400 | } | |
401 | delete evtsDir ; | |
402 | } | |
403 | ||
b5425e51 | 404 | //--------------------------------------------------------------------------------------- |
405 | // create a new file which will hold the final results of all methods: | |
406 | TString outputFileName = "AnalysisResults.root"; | |
407 | TFile *outputFile = new TFile(outputFileName.Data(),"RECREATE"); | |
408 | // create a new file for each method wich will hold list with final results: | |
409 | const Int_t nMethods = 10; | |
410 | TString method[nMethods] = {"MCEP","SP","GFC","QC","FQD","LYZ1SUM","LYZ1PROD","LYZ2SUM","LYZ2PROD","LYZEP"}; | |
411 | TDirectoryFile *dirFileFinal[nMethods] = {NULL}; | |
412 | TString fileNameMethod[nMethods]; | |
413 | for(Int_t i=0;i<nMethods;i++) | |
414 | { | |
415 | // form a file name for each method: | |
416 | fileNameMethod[i]+="output"; | |
417 | fileNameMethod[i]+=method[i].Data(); | |
418 | fileNameMethod[i]+="analysis"; | |
419 | dirFileFinal[i] = new TDirectoryFile(fileNameMethod[i].Data(),fileNameMethod[i].Data()); | |
420 | } | |
421 | ||
422 | // calculating and storing the final results of default flow analysis: | |
423 | if(MCEP) {mcep->Finish(); mcep->WriteHistograms(dirFileFinal[0]);} | |
424 | if(SP) {sp->Finish(); sp->WriteHistograms(dirFileFinal[1]);} | |
425 | if(GFC) {gfc->Finish(); gfc->WriteHistograms(dirFileFinal[2]);} | |
426 | if(QC) {qc->Finish(); qc->WriteHistograms(dirFileFinal[3]);} | |
427 | if(FQD) {fqd->Finish(); fqd->WriteHistograms(dirFileFinal[4]);} | |
428 | if(LYZ1SUM) {lyz1sum->Finish(); lyz1sum->WriteHistograms(dirFileFinal[5]);} | |
429 | if(LYZ1PROD){lyz1prod->Finish();lyz1prod->WriteHistograms(dirFileFinal[6]);} | |
430 | if(LYZ2SUM) {lyz2sum->Finish(); lyz2sum->WriteHistograms(dirFileFinal[7]);} | |
431 | if(LYZ2PROD){lyz2prod->Finish();lyz2prod->WriteHistograms(dirFileFinal[8]);} | |
432 | if(LYZEP) {lyzep->Finish(); lyzep->WriteHistograms(dirFileFinal[9]);} | |
433 | //--------------------------------------------------------------------------------------- | |
434 | ||
435 | outputFile->Close(); | |
436 | delete outputFile; | |
334e3256 | 437 | |
438 | cout << endl; | |
ace38bad | 439 | cout << " Fini ... " << endl; |
334e3256 | 440 | cout << endl; |
441 | ||
442 | timer.Stop(); | |
443 | cout << endl; | |
444 | timer.Print(); | |
445 | } | |
21e694dd | 446 | |
447 | void SetupPar(char* pararchivename) | |
448 | { | |
449 | //Load par files, create analysis libraries | |
450 | //For testing, if par file already decompressed and modified | |
451 | //classes then do not decompress. | |
452 | ||
453 | TString cdir(Form("%s", gSystem->WorkingDirectory() )) ; | |
454 | TString parpar(Form("%s.par", pararchivename)) ; | |
455 | if ( gSystem->AccessPathName(parpar.Data()) ) { | |
456 | gSystem->ChangeDirectory(gSystem->Getenv("ALICE_ROOT")) ; | |
457 | TString processline(Form(".! make %s", parpar.Data())) ; | |
458 | gROOT->ProcessLine(processline.Data()) ; | |
459 | gSystem->ChangeDirectory(cdir) ; | |
460 | processline = Form(".! mv /tmp/%s .", parpar.Data()) ; | |
461 | gROOT->ProcessLine(processline.Data()) ; | |
462 | } | |
463 | if ( gSystem->AccessPathName(pararchivename) ) { | |
464 | TString processline = Form(".! tar xvzf %s",parpar.Data()) ; | |
465 | gROOT->ProcessLine(processline.Data()); | |
466 | } | |
467 | ||
468 | TString ocwd = gSystem->WorkingDirectory(); | |
469 | gSystem->ChangeDirectory(pararchivename); | |
470 | ||
471 | // check for BUILD.sh and execute | |
472 | if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) { | |
473 | printf("*******************************\n"); | |
474 | printf("*** Building PAR archive ***\n"); | |
475 | cout<<pararchivename<<endl; | |
476 | printf("*******************************\n"); | |
477 | ||
478 | if (gSystem->Exec("PROOF-INF/BUILD.sh")) { | |
479 | Error("runProcess","Cannot Build the PAR Archive! - Abort!"); | |
480 | return -1; | |
481 | } | |
482 | } | |
483 | // check for SETUP.C and execute | |
484 | if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) { | |
485 | printf("*******************************\n"); | |
486 | printf("*** Setup PAR archive ***\n"); | |
487 | cout<<pararchivename<<endl; | |
488 | printf("*******************************\n"); | |
489 | gROOT->Macro("PROOF-INF/SETUP.C"); | |
490 | } | |
491 | ||
492 | gSystem->ChangeDirectory(ocwd.Data()); | |
493 | printf("Current dir: %s\n", ocwd.Data()); | |
494 | } | |
495 | ||
fdd8c18f | 496 | void LoadLibraries(const anaModes mode) { |
497 | ||
498 | //-------------------------------------- | |
499 | // Load the needed libraries most of them already loaded by aliroot | |
500 | //-------------------------------------- | |
b5425e51 | 501 | //gSystem->Load("libTree"); |
5d040cf3 | 502 | gSystem->Load("libGeom"); |
503 | gSystem->Load("libVMC"); | |
504 | gSystem->Load("libXMLIO"); | |
505 | gSystem->Load("libPhysics"); | |
fdd8c18f | 506 | |
507 | //---------------------------------------------------------- | |
508 | // >>>>>>>>>>> Local mode <<<<<<<<<<<<<< | |
509 | //---------------------------------------------------------- | |
510 | if (mode==mLocal) { | |
511 | //-------------------------------------------------------- | |
512 | // If you want to use already compiled libraries | |
513 | // in the aliroot distribution | |
514 | //-------------------------------------------------------- | |
515 | gSystem->Load("libSTEERBase"); | |
516 | gSystem->Load("libESD"); | |
517 | gSystem->Load("libAOD"); | |
518 | gSystem->Load("libANALYSIS"); | |
519 | gSystem->Load("libANALYSISalice"); | |
5d040cf3 | 520 | gSystem->Load("libCORRFW"); |
521 | cerr<<"libCORRFW loaded..."<<endl; | |
522 | gSystem->Load("libPWG2flowCommon"); | |
523 | cerr<<"libPWG2flowCommon loaded..."<<endl; | |
524 | gSystem->Load("libPWG2flowTasks"); | |
525 | cerr<<"libPWG2flowTasks loaded..."<<endl; | |
fdd8c18f | 526 | } |
527 | ||
528 | else if (mode == mLocalPAR) { | |
529 | //-------------------------------------------------------- | |
530 | //If you want to use root and par files from aliroot | |
531 | //-------------------------------------------------------- | |
532 | //If you want to use root and par files from aliroot | |
533 | //-------------------------------------------------------- | |
534 | SetupPar("STEERBase"); | |
535 | SetupPar("ESD"); | |
536 | SetupPar("AOD"); | |
537 | SetupPar("ANALYSIS"); | |
538 | SetupPar("ANALYSISalice"); | |
539 | SetupPar("PWG2AOD"); | |
540 | SetupPar("CORRFW"); | |
541 | SetupPar("PWG2flowCommon"); | |
542 | cerr<<"PWG2flowCommon.par loaded..."<<endl; | |
543 | SetupPar("PWG2flowTasks"); | |
544 | cerr<<"PWG2flowTasks.par loaded..."<<endl; | |
545 | } | |
546 | ||
547 | //--------------------------------------------------------- | |
548 | // <<<<<<<<<< Source mode >>>>>>>>>>>> | |
549 | //--------------------------------------------------------- | |
550 | else if (mode==mLocalSource) { | |
551 | ||
552 | // In root inline compile | |
553 | ||
554 | ||
555 | // Constants | |
556 | gROOT->LoadMacro("AliFlowCommon/AliFlowCommonConstants.cxx+"); | |
557 | gROOT->LoadMacro("AliFlowCommon/AliFlowLYZConstants.cxx+"); | |
558 | gROOT->LoadMacro("AliFlowCommon/AliFlowCumuConstants.cxx+"); | |
559 | ||
560 | // Flow event | |
561 | gROOT->LoadMacro("AliFlowCommon/AliFlowVector.cxx+"); | |
562 | gROOT->LoadMacro("AliFlowCommon/AliFlowTrackSimple.cxx+"); | |
563 | gROOT->LoadMacro("AliFlowCommon/AliFlowEventSimple.cxx+"); | |
564 | ||
565 | // Cuts | |
566 | gROOT->LoadMacro("AliFlowCommon/AliFlowTrackSimpleCuts.cxx+"); | |
567 | ||
568 | // Output histosgrams | |
569 | gROOT->LoadMacro("AliFlowCommon/AliFlowCommonHist.cxx+"); | |
570 | gROOT->LoadMacro("AliFlowCommon/AliFlowCommonHistResults.cxx+"); | |
571 | gROOT->LoadMacro("AliFlowCommon/AliFlowLYZHist1.cxx+"); | |
572 | gROOT->LoadMacro("AliFlowCommon/AliFlowLYZHist2.cxx+"); | |
573 | ||
574 | // Functions needed for various methods | |
575 | gROOT->LoadMacro("AliFlowCommon/AliCumulantsFunctions.cxx+"); | |
fdd8c18f | 576 | gROOT->LoadMacro("AliFlowCommon/AliFlowLYZEventPlane.cxx+"); |
577 | ||
578 | // Flow Analysis code for various methods | |
579 | gROOT->LoadMacro("AliFlowCommon/AliFlowAnalysisWithMCEventPlane.cxx+"); | |
580 | gROOT->LoadMacro("AliFlowCommon/AliFlowAnalysisWithScalarProduct.cxx+"); | |
581 | gROOT->LoadMacro("AliFlowCommon/AliFlowAnalysisWithLYZEventPlane.cxx+"); | |
582 | gROOT->LoadMacro("AliFlowCommon/AliFlowAnalysisWithLeeYangZeros.cxx+"); | |
583 | gROOT->LoadMacro("AliFlowCommon/AliFlowAnalysisWithCumulants.cxx+"); | |
584 | gROOT->LoadMacro("AliFlowCommon/AliFlowAnalysisWithQCumulants.cxx+"); | |
ce4a88f5 | 585 | gROOT->LoadMacro("AliFlowCommon/AliFlowAnalysisWithFittingQDistribution.cxx+"); |
fdd8c18f | 586 | |
587 | // Class to fill the FlowEvent without aliroot dependence | |
588 | // can be found in the directory FlowEventMakers | |
589 | gROOT->LoadMacro("FlowEventMakers/FlowEventSimpleMaker.cxx+"); | |
590 | ||
591 | cout << "finished loading macros!" << endl; | |
592 | ||
593 | } | |
594 | ||
595 | } | |
596 | ||
597 |