1 enum anaModes {mLocal,mLocalPAR,mPROOF,mGrid,mGridPAR};
2 //mLocal: Analyze locally files in your computer using aliroot
3 //mLocalPAR: Analyze locally files in your computer using root + PAR files
4 //mPROOF: Analyze CAF files with PROOF
5 //mGrid: Analyze files on Grid via AliEn plug-in and using precompiled FLOW libraries
6 // (Remark: When using this mode set also Bool_t bUseParFiles = kFALSE; in CreateAlienHandler.C)
7 //mGridPAR: Analyze files on Grid via AliEn plug-in and using par files for FLOW package
8 // (Remark: when using this mode set also Bool_t bUseParFiles = kTRUE; in CreateAlienHandler.C)
10 // CENTRALITY DEFINITION
11 //Int_t binfirst = 4; //where do we start numbering bins
12 //Int_t binlast = 6; //where do we stop numbering bins
13 //const Int_t numberOfCentralityBins = 9;
14 //Int_t centralityArray[numberOfCentralityBins+1] = {41,80,146,245,384,576,835,1203,1471,10000}; // in terms of reference multiplicity
15 Int_t binfirst = 0; //where do we start numbering bins
16 Int_t binlast = 0; //where do we stop numbering bins
17 const Int_t numberOfCentralityBins = 1;
18 Int_t centralityArray[numberOfCentralityBins+1] = {41,10000}; // in terms of reference multiplicity
19 TString commonOutputFileName = "outputCentrality"; // e.g.: result for centrality bin 0 will be in the file "outputCentrality0.root", etc
21 //void runFlowTaskCentralityTrain(Int_t mode=mLocal, Int_t nRuns = 10,
22 //Bool_t DATA = kFALSE, const Char_t* dataDir="/Users/snelling/alice_data/Therminator_midcentral", Int_t offset = 0)
24 void runFlowTaskCentralityTrain(Int_t mode = mPROOF, Int_t nRuns = 50000000,
25 Bool_t DATA = kTRUE, const Char_t* dataDir="/alice/data/LHC10h_000137161_p1_plusplusplus", Int_t offset=0)
26 //void runFlowTaskCentralityTrain(Int_t mode = mLocal, Int_t nRuns = 50000000,
27 // Bool_t DATA = kTRUE, const Char_t* dataDir="./data/", Int_t offset=0)
28 //void runFlowTaskCentralityTrain(Int_t mode = mGridPAR, Bool_t DATA = kTRUE)
33 // Cross-check user settings before starting:
34 // CrossCheckUserSettings(DATA);
35 // Load needed libraries:
37 // Create and configure the AliEn plug-in:
38 if(mode == mGrid || mode == mGridPAR)
40 gROOT->LoadMacro("CreateAlienHandler.C");
41 AliAnalysisGrid *alienHandler = CreateAlienHandler();
42 if(!alienHandler) return;
45 if(mode == mLocal || mode == mLocalPAR) {
46 TChain* chain = CreateESDChain(dataDir, nRuns, offset);
47 //TChain* chain = CreateAODChain(dataDir, nRuns, offset);
50 // Create analysis manager:
51 AliAnalysisManager *mgr = new AliAnalysisManager("FlowAnalysisManager");
52 // Connect plug-in to the analysis manager:
53 if(mode == mGrid || mode == mGridPAR)
55 mgr->SetGridHandler(alienHandler);
59 AliVEventHandler* esdH = new AliESDInputHandler;
60 mgr->SetInputEventHandler(esdH);
62 AliMCEventHandler *mc = new AliMCEventHandler();
63 mgr->SetMCtruthEventHandler(mc);
66 // Task to check the offline trigger:
67 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
68 AliPhysicsSelectionTask* physicsSelTask = AddTaskPhysicsSelection(!DATA,0);
70 // Setup analysis per centrality bin:
71 gROOT->LoadMacro("AddTaskFlowCentrality.C");
72 for (Int_t i=binfirst; i<binlast+1; i++)
74 Int_t lowCentralityBinEdge = centralityArray[i];
75 Int_t highCentralityBinEdge = centralityArray[i+1];
76 Printf("\nWagon for centrality bin %i:",i);
77 AddTaskFlowCentrality( lowCentralityBinEdge,
78 highCentralityBinEdge,
81 } // end of for (Int_t i=0; i<numberOfCentralityBins; i++)
83 // Enable debug printouts:
84 mgr->SetDebugLevel(2);
86 if(!mgr->InitAnalysis()) return;
88 if(mode == mLocal || mode == mLocalPAR) {
89 mgr->StartAnalysis("local",chain);
90 } else if(mode == mPROOF) {
91 mgr->StartAnalysis("proof",dataDir,nRuns,offset);
92 } else if(mode == mGrid || mode == mGridPAR) {
93 mgr->StartAnalysis("grid");
96 // Print real and CPU time used for analysis:
100 } // end of void runFlowTaskCentralityTrain(...)
102 //===============================================================================================
104 void CrossCheckUserSettings(Bool_t bData)
106 // Check in this method if the user settings make sense.
107 if(LYZ1SUM && LYZ2SUM) {cout<<" WARNING: You cannot run LYZ1 and LYZ2 at the same time! LYZ2 needs the output from LYZ1 !!!!"<<endl; exit(0); }
108 if(LYZ1PROD && LYZ2PROD) {cout<<" WARNING: You cannot run LYZ1 and LYZ2 at the same time! LYZ2 needs the output from LYZ1 !!!!"<<endl; exit(0); }
109 if(LYZ2SUM && LYZEP) {cout<<" WARNING: You cannot run LYZ2 and LYZEP at the same time! LYZEP needs the output from LYZ2 !!!!"<<endl; exit(0); }
110 if(LYZ1SUM && LYZEP) {cout<<" WARNING: You cannot run LYZ1 and LYZEP at the same time! LYZEP needs the output from LYZ2 !!!!"<<endl; exit(0); }
111 } // end of void CrossCheckUserSettings()
113 //===============================================================================================
115 void LoadLibraries(const anaModes mode)
117 //--------------------------------------
118 // Load the needed libraries most of them already loaded by aliroot
119 //--------------------------------------
121 gSystem->Load("libCore");
122 gSystem->Load("libTree");
123 gSystem->Load("libGeom");
124 gSystem->Load("libVMC");
125 gSystem->Load("libXMLIO");
126 gSystem->Load("libPhysics");
127 gSystem->Load("libXMLParser");
128 gSystem->Load("libProof");
130 if (mode==mLocal || mode==mGrid || mode == mGridPAR || mode == mLocalPAR )
132 gSystem->Load("libSTEERBase");
133 gSystem->Load("libCDB");
134 gSystem->Load("libRAWDatabase");
135 gSystem->Load("libRAWDatarec");
136 gSystem->Load("libESD");
137 gSystem->Load("libAOD");
138 gSystem->Load("libSTEER");
139 gSystem->Load("libANALYSIS");
140 gSystem->Load("libANALYSISalice");
141 gSystem->Load("libTOFbase");
142 gSystem->Load("libTOFrec");
144 if (mode == mLocal || mode == mGrid)
146 gSystem->Load("libPWG2flowCommon");
147 gSystem->Load("libPWG2flowTasks");
149 if (mode == mLocalPAR || mode == mGridPAR )
151 AliAnalysisAlien::SetupPar("PWG2flowCommon");
152 AliAnalysisAlien::SetupPar("PWG2flowTasks");
156 //---------------------------------------------------------
157 // <<<<<<<<<< PROOF mode >>>>>>>>>>>>
158 //---------------------------------------------------------
159 else if (mode==mPROOF) {
160 // set to debug root versus if needed
161 //TProof::Mgr("alicecaf")->SetROOTVersion("v5-24-00a_dbg");
162 //TProof::Mgr("alicecaf")->SetROOTVersion("v5-24-00a");
163 //TProof::Reset("proof://snelling@alicecaf.cern.ch");
165 printf("*** Connect to PROOF ***\n");
166 gEnv->SetValue("XSec.GSI.DelegProxy","2");
167 TProof::Open("mkrzewic@alice-caf.cern.ch");
168 //TProof::Open("mkrzewic@skaf.saske.sk");
169 // list the data available
170 //gProof->ShowDataSets("/*/*");
171 //gProof->ShowDataSets("/alice/sim/"); //for MC Data
172 //gProof->ShowDataSets("/alice/data/"); //for REAL Data
174 // Clear the Packages
176 gProof->ClearPackage("STEERBase.par");
177 gProof->ClearPackage("ESD.par");
178 gProof->ClearPackage("AOD.par");
180 //gProof->ClearPackage("ANALYSIS.par");
181 //gProof->ClearPackage("ANALYSISalice.par");
182 //gProof->ClearPackage("CORRFW.par");
184 gProof->ClearPackage("PWG2flowCommon");
185 gProof->ClearPackage("PWG2flowTasks");
187 // Upload the Packages
188 //gProof->UploadPackage("STEERBase.par");
189 //gProof->UploadPackage("ESD.par");
190 //gProof->UploadPackage("AOD.par");
192 //gProof->UploadPackage("ANALYSIS.par");
193 //gProof->UploadPackage("ANALYSISalice.par");
194 gProof->UploadPackage("CORRFW.par");
195 gProof->UploadPackage("PWG2flowCommon.par");
196 gProof->UploadPackage("PWG2flowTasks.par");
197 gProof->UploadPackage("ALIRECO.par");
199 // Enable the Packages
200 // The global package
201 TList* list = new TList();
202 list->Add(new TNamed("ALIROOT_EXTRA_INCLUDES","RAW:OCDB:STEER:TOF"));
203 gProof->EnablePackage("VO_ALICE@AliRoot::v4-21-07-AN",list);
204 gProof->EnablePackage("ALIRECO");
205 //gProof->EnablePackage("ANALYSIS");
206 //gProof->EnablePackage("ANALYSISalice");
207 //gProof->EnablePackage("CORRFW");
208 gProof->EnablePackage("PWG2flowCommon");
209 gProof->EnablePackage("PWG2flowTasks");
211 // Show enables Packages
212 gProof->ShowEnabledPackages();
215 } // end of void LoadLibraries(const anaModes mode)
217 // Helper macros for creating chains
218 // from: CreateESDChain.C,v 1.10 jgrosseo Exp
220 TChain* CreateESDChain(const char* aDataDir, Int_t aRuns, Int_t offset)
222 // creates chain of files in a given directory or file containing a list.
223 // In case of directory the structure is expected as:
224 // <aDataDir>/<dir0>/AliESDs.root
225 // <aDataDir>/<dir1>/AliESDs.root
231 Long_t id, size, flags, modtime;
232 if (gSystem->GetPathInfo(aDataDir, &id, &size, &flags, &modtime))
234 printf("%s not found.\n", aDataDir);
238 TChain* chain = new TChain("esdTree");
239 TChain* chaingAlice = 0;
243 TString execDir(gSystem->pwd());
244 TSystemDirectory* baseDir = new TSystemDirectory(".", aDataDir);
245 TList* dirList = baseDir->GetListOfFiles();
246 Int_t nDirs = dirList->GetEntries();
247 gSystem->cd(execDir);
251 for (Int_t iDir=0; iDir<nDirs; ++iDir)
253 TSystemFile* presentDir = (TSystemFile*) dirList->At(iDir);
254 if (!presentDir || !presentDir->IsDirectory() || strcmp(presentDir->GetName(), ".") == 0 || strcmp(presentDir->GetName(), "..") == 0)
263 if (count++ == aRuns)
266 TString presentDirName(aDataDir);
267 presentDirName += "/";
268 presentDirName += presentDir->GetName();
269 chain->Add(presentDirName + "/AliESDs.root/esdTree");
270 // cerr<<presentDirName<<endl;
276 // Open the input stream
282 // Read the input list of files and add them to the chain
286 if (!esdfile.Contains("root")) continue; // protection
294 if (count++ == aRuns)
306 } // end of TChain* CreateESDChain(const char* aDataDir, Int_t aRuns, Int_t offset)
308 //===============================================================================================
310 TChain* CreateAODChain(const char* aDataDir, Int_t aRuns, Int_t offset)
312 // creates chain of files in a given directory or file containing a list.
313 // In case of directory the structure is expected as:
314 // <aDataDir>/<dir0>/AliAOD.root
315 // <aDataDir>/<dir1>/AliAOD.root
321 Long_t id, size, flags, modtime;
322 if (gSystem->GetPathInfo(aDataDir, &id, &size, &flags, &modtime))
324 printf("%s not found.\n", aDataDir);
328 TChain* chain = new TChain("aodTree");
329 TChain* chaingAlice = 0;
333 TString execDir(gSystem->pwd());
334 TSystemDirectory* baseDir = new TSystemDirectory(".", aDataDir);
335 TList* dirList = baseDir->GetListOfFiles();
336 Int_t nDirs = dirList->GetEntries();
337 gSystem->cd(execDir);
341 for (Int_t iDir=0; iDir<nDirs; ++iDir)
343 TSystemFile* presentDir = (TSystemFile*) dirList->At(iDir);
344 if (!presentDir || !presentDir->IsDirectory() || strcmp(presentDir->GetName(), ".") == 0 || strcmp(presentDir->GetName(), "..") == 0)
353 if (count++ == aRuns)
356 TString presentDirName(aDataDir);
357 presentDirName += "/";
358 presentDirName += presentDir->GetName();
359 chain->Add(presentDirName + "/AliAOD.root/aodTree");
360 // cerr<<presentDirName<<endl;
366 // Open the input stream
372 // Read the input list of files and add them to the chain
376 if (!aodfile.Contains("root")) continue; // protection
384 if (count++ == aRuns)
396 } // end of TChain* CreateAODChain(const char* aDataDir, Int_t aRuns, Int_t offset)