1 #include "TStopwatch.h"
6 //flow analysis method can be: (set to kTRUE or kFALSE)
10 Bool_t LYZEP = kFALSE;
14 Bool_t MCEP = kFALSE; //does not work yet 24/12/08
19 //integrated selection
20 Double_t ptMaxInt = 10.;
21 Double_t ptMinInt = 0.;
22 Double_t etaMaxInt = 1.;
23 Double_t etaMinInt = -1.;
24 Double_t phiMaxInt = 7.5;
25 Double_t phiMinInt = 0.;
28 //differential selection
29 Double_t ptMaxDiff = 10.;
30 Double_t ptMinDiff = 0.;
31 Double_t etaMaxDiff = 1.;
32 Double_t etaMinDiff = -1.;
33 Double_t phiMaxDiff = 7.5;
34 Double_t phiMinDiff = 0.;
37 int runFlowAnalysis(Int_t aRuns = 100, const char*
38 // dir="/data/alice1/kolk/KineOnly3/")
39 dir="/Users/snelling/alice_data/KineOnly3/")
44 if (LYZ1 && LYZ2) {cout<<"WARNING: you cannot run LYZ1 and LYZ2 at the same time! LYZ2 needs the output from LYZ1."<<endl; exit(); }
46 if (LYZ2 && LYZEP) {cout<<"WARNING: you cannot run LYZ2 and LYZEP at the same time! LYZEP needs the output from LYZ2."<<endl; exit(); }
48 if (LYZ1 && LYZEP) {cout<<"WARNING: you cannot run LYZ1 and LYZEP at the same time! LYZEP needs the output from LYZ2."<<endl; exit(); }
52 cout<<" ---- BEGIN ANALYSIS ---- "<<endl;
55 // gSystem->AddIncludePath("-I$ALICE_ROOT/include");
56 gSystem->AddIncludePath("-I$ROOTSYS/include");
59 gROOT->LoadMacro("code/AliFlowCommonConstants.cxx+");
60 gROOT->LoadMacro("code/AliFlowLYZConstants.cxx+");
61 gROOT->LoadMacro("code/AliFlowCumuConstants.cxx+");
64 gROOT->LoadMacro("code/AliFlowVector.cxx+");
65 gROOT->LoadMacro("code/AliFlowTrackSimple.cxx+");
66 gROOT->LoadMacro("code/AliFlowEventSimple.cxx+");
69 gROOT->LoadMacro("code/AliFlowTrackSimpleCuts.cxx+");
72 gROOT->LoadMacro("code/AliFlowCommonHist.cxx+");
73 gROOT->LoadMacro("code/AliFlowCommonHistResults.cxx+");
74 gROOT->LoadMacro("code/AliFlowLYZHist1.cxx+");
75 gROOT->LoadMacro("code/AliFlowLYZHist2.cxx+");
77 // functions needed for various methods
78 gROOT->LoadMacro("code/AliCumulantsFunctions.cxx+");
79 gROOT->LoadMacro("code/AliQCumulantsFunctions.cxx+");
80 gROOT->LoadMacro("code/AliFittingFunctionsForQDistribution.cxx+");
81 gROOT->LoadMacro("code/AliFlowLYZEventPlane.cxx+");
83 // Flow Analysis code for various methods
84 gROOT->LoadMacro("code/AliFlowAnalysisWithMCEventPlane.cxx+");
85 gROOT->LoadMacro("code/AliFlowAnalysisWithScalarProduct.cxx+");
86 gROOT->LoadMacro("code/AliFlowAnalysisWithLYZEventPlane.cxx+");
87 gROOT->LoadMacro("code/AliFlowAnalysisWithLeeYangZeros.cxx+");
88 gROOT->LoadMacro("code/AliFlowAnalysisWithCumulants.cxx+");
89 gROOT->LoadMacro("code/AliFlowAnalysisWithQCumulants.cxx+");
90 gROOT->LoadMacro("code/AliFittingQDistribution.cxx+");
92 // Method to fill the FlowEvent
93 gROOT->LoadMacro("code/FlowEventSimpleMaker.cxx+");
95 //load needed libraries
96 gSystem->Load("libTree.so");
98 cout << "finished loading macros!" << endl;
99 // gSystem->Load("libANALYSIS.so");
100 // gSystem->Load("libPWG2flow.so");
102 //------------------------------------------------------------------------
104 AliFlowTrackSimpleCuts* cutsInt = new AliFlowTrackSimpleCuts();
105 cutsInt->SetPtMax(ptMaxInt);
106 cutsInt->SetPtMin(ptMinInt);
107 cutsInt->SetEtaMax(etaMaxInt);
108 cutsInt->SetEtaMin(etaMinInt);
109 cutsInt->SetPhiMax(phiMaxInt);
110 cutsInt->SetPhiMin(phiMinInt);
111 cutsInt->SetPID(PIDInt);
113 AliFlowTrackSimpleCuts* cutsDiff = new AliFlowTrackSimpleCuts();
114 cutsDiff->SetPtMax(ptMaxDiff);
115 cutsDiff->SetPtMin(ptMinDiff);
116 cutsDiff->SetEtaMax(etaMaxDiff);
117 cutsDiff->SetEtaMin(etaMinDiff);
118 cutsDiff->SetPhiMax(phiMaxDiff);
119 cutsDiff->SetPhiMin(phiMinDiff);
120 cutsDiff->SetPID(PIDDiff);
122 //------------------------------------------------------------------------
124 FlowEventSimpleMaker* fEventMaker = new FlowEventSimpleMaker();
126 AliFlowAnalysisWithQCumulants *qc = NULL;
127 AliFlowAnalysisWithCumulants *gfc = NULL;
128 AliFittingQDistribution *fqd = NULL;
129 AliFlowAnalysisWithLeeYangZeros *lyz1 = NULL;
130 AliFlowAnalysisWithLeeYangZeros *lyz2 = NULL;
131 AliFlowAnalysisWithLYZEventPlane *lyzep = NULL;
132 AliFlowAnalysisWithScalarProduct *sp = NULL;
133 AliFlowAnalysisWithMCEventPlane *mcep = NULL;
136 //MCEP = monte carlo event plane
137 AliFlowAnalysisWithMCEventPlane *mcep = new AliFlowAnalysisWithMCEventPlane();
146 AliFlowAnalysisWithQCumulants* qc = new AliFlowAnalysisWithQCumulants();
147 qc->CreateOutputObjects();
150 //GFC = Generating Function Cumulants
153 AliFlowAnalysisWithCumulants* gfc = new AliFlowAnalysisWithCumulants();
154 gfc->CreateOutputObjects();
157 //FQD = Fitting q-distribution
158 AliFittingQDistribution* fqd = new AliFittingQDistribution();
161 fqd->CreateOutputObjects();
164 //LYZ1 = Lee-Yang Zeroes first run
165 AliFlowAnalysisWithLeeYangZeros* lyz1 = new AliFlowAnalysisWithLeeYangZeros();
168 lyz1->SetFirstRun(kTRUE);
169 lyz1->SetUseSum(kTRUE);
173 //LYZ2 = Lee-Yang Zeroes second run
174 AliFlowAnalysisWithLeeYangZeros* lyz2 = new AliFlowAnalysisWithLeeYangZeros();
177 // read the input file from the first run
178 TString inputFileNameLYZ2 = "outputLYZ1analysis.root" ;
179 TFile* inputFileLYZ2 = new TFile(inputFileNameLYZ2.Data(),"READ");
180 if(!inputFileLYZ2 || inputFileLYZ2->IsZombie()) {
181 cerr << " ERROR: NO First Run file... " << endl ; }
183 TList* inputListLYZ2 = (TList*)inputFileLYZ2->Get("cobjLYZ1");
184 if (!inputListLYZ2) {cout<<"list is NULL pointer!"<<endl;
187 cout<<"LYZ2 input file/list read..."<<endl;
188 lyz2->SetFirstRunList(inputListLYZ2);
189 lyz2->SetFirstRun(kFALSE);
190 lyz2->SetUseSum(kTRUE);
196 //LYZEP = Lee-Yang Zeroes event plane
197 AliFlowLYZEventPlane* ep = new AliFlowLYZEventPlane() ;
198 AliFlowAnalysisWithLYZEventPlane* lyzep = new AliFlowAnalysisWithLYZEventPlane();
201 // read the input file from the second lyz run
202 TString inputFileNameLYZEP = "outputLYZ2analysis.root" ;
203 TFile* inputFileLYZEP = new TFile(inputFileNameLYZEP.Data(),"READ");
204 if(!inputFileLYZEP || inputFileLYZEP->IsZombie()) {
205 cerr << " ERROR: NO Second Run file... " << endl ; }
207 TList* inputListLYZEP = (TList*)inputFileLYZEP->Get("cobjLYZ2");
208 if (!inputListLYZEP) {cout<<"list is NULL pointer!"<<endl;
211 cout<<"LYZEP input file/list read..."<<endl;
212 ep ->SetSecondRunList(inputListLYZEP);
213 lyzep->SetSecondRunList(inputListLYZEP);
220 //SP = Scalar Product
221 AliFlowAnalysisWithScalarProduct* sp = new AliFlowAnalysisWithScalarProduct();
229 //------------------------------------------------------------------------
233 TString execDir(gSystem->pwd());
234 TString targetDir(dir);
235 TSystemDirectory* baseDir = new TSystemDirectory(".", dir);
236 TList* dirList = baseDir->GetListOfFiles();
238 cout << endl << "No input files in: " << targetDir.Data() << endl;
241 Int_t nDirs = dirList->GetEntries();
243 cout<<"Int_t nDirs = "<<nDirs<<endl;
244 gSystem->cd(execDir);
246 for(Int_t iDir=0;iDir<nDirs;++iDir)
248 TSystemFile* presentDir = (TSystemFile*)dirList->At(iDir);
249 if(!presentDir || !presentDir->IsDirectory() ||
250 strcmp(presentDir->GetName(), ".") == 0 ||
251 strcmp(presentDir->GetName(), "..") == 0)
254 cout << "Directory (" << iDir << "): " << presentDir->GetName() <<
255 " - Skipping ... " << endl;
259 if(offset > 0) { --offset ; continue ; }
260 if((aRuns > 0) && (fCount >= aRuns)) { break ; }
262 TString presentDirName(dir); // aDataDir
263 presentDirName += presentDir->GetName();
264 presentDirName += "/";
265 //cerr<<" presentDirName = "<<presentDirName<<endl;
267 TString fileName = presentDirName;
268 fileName += "galice.root";
269 Long_t *id, *size, *flags, *modtime;
270 if(gSystem->GetPathInfo(fileName.Data(),id,size,flags,modtime))
272 cout << " File : " << fileName << " does NOT exist ! - Skipping ... "
276 cout << endl ; cout << "Directory (" << iDir << "): " << presentDirName
279 //loop (simulations in the present dir)
280 TSystemDirectory* evtsDir = new TSystemDirectory(".",
281 presentDirName.Data());
282 TList* fileList = evtsDir->GetListOfFiles();
283 Int_t nFiles = fileList->GetEntries();
284 cout<<" Int_t nFiles = "<<nFiles<<endl;
285 gSystem->cd(execDir);
286 for(Int_t iFiles=0; iFiles<nFiles; ++iFiles)
288 TSystemFile* presentFile = (TSystemFile*) fileList->At(iFiles);
289 TString presentFileName(presentDirName);
290 presentFileName += presentFile->GetName();
292 if(!(presentFileName.Contains("Kinematics") &&
293 presentFileName.Contains("root"))) { continue ; }
295 cout << " found: " << presentFileName.Data() << endl;
297 TFile* kineFile = new TFile(presentFileName.Data(), "READ");
299 Int_t nEvts = kineFile->GetNkeys() ;
300 cout << " . found: " << nEvts << " KineTree(s) in " <<
301 presentFileName.Data() << endl;
302 TList* kineEventsList = (TList*)kineFile->GetListOfKeys();
304 TIter next(kineEventsList);
307 //loop over the events
308 while( key=(TKey *)next() )
310 TDirectory* tDir = (TDirectory*)key->ReadObj();
313 TString evtDir(tDir->GetName());
314 cout << " . . found: " << tDir->GetName() << endl;
316 kTree = (TTree *)tDir->Get("TreeK");
319 Int_t nPart = kTree->GetEntries();
320 cout << " . . . kTree " << fCount << " has " << nPart <<
321 " particles " << endl;
325 //-----------------------------------------------------------
326 //fill and save the flow event
328 AliFlowEventSimple* fEvent = fEventMaker->FillTracks(kTree, cutsInt, cutsDiff);
330 //pass the flow event to flow methods for analysis
334 //mcep->Make(fEvent,fEP); //fix fEP
335 cout<<" --> MCEP analysis..."<<endl;
341 cout<<" --> QC analysis..."<<endl;
347 cout<<" --> GFC analysis..."<<endl;
353 cout<<" --> FQD analysis..."<<endl;
359 cout<<" --> LYZ1 analysis..."<<endl;
365 cout<<" --> LYZ2 analysis..."<<endl;
370 lyzep->Make(fEvent,ep);
371 cout<<" --> LYZEP analysis..."<<endl;
377 cout<<" --> SP analysis..."<<endl;
382 //-----------------------------------------------------------
393 //--------------------------------------------------------------
394 //calculating and storing the final results of flow analysis
399 TString *outputFileNameMCEP = new TString("outputMCEPanalysis.root");
400 //mcep->WriteHistograms(outputFileNameMCEP); //add this method to MCEP classes
401 delete outputFileNameMCEP;
407 TString *outputFileNameQC = new TString("outputQCanalysis.root");
408 qc->WriteHistograms(outputFileNameQC);
409 delete outputFileNameQC;
415 TString *outputFileNameGFC = new TString("outputGFCanalysis.root");
416 gfc->WriteHistograms(outputFileNameGFC);
417 delete outputFileNameGFC;
423 TString *outputFileNameFQD = new TString("outputFQDanalysis.root");
424 fqd->WriteHistograms(outputFileNameFQD);
425 delete outputFileNameFQD;
431 TString *outputFileNameLYZ1 = new TString("outputLYZ1analysis.root");
432 lyz1->WriteHistograms(outputFileNameLYZ1);
433 delete outputFileNameLYZ1;
439 TString *outputFileNameLYZ2 = new TString("outputLYZ2analysis.root");
440 lyz2->WriteHistograms(outputFileNameLYZ2);
441 delete outputFileNameLYZ2;
447 TString *outputFileNameLYZEP = new TString("outputLYZEPanalysis.root");
448 lyzep->WriteHistograms(outputFileNameLYZEP);
449 delete outputFileNameLYZEP;
455 TString *outputFileNameSP = new TString("outputSPanalysis.root");
456 sp->WriteHistograms(outputFileNameSP);
457 delete outputFileNameSP;
462 //--------------------------------------------------------------
465 cout << " Finished ... " << endl;