1 void runProtonAnalysis(const char* esdAnalysisType = "Hybrid",
2 const char* pidMode = "Bayesian") {
3 //Macro to run the proton analysis tested for local, proof & GRID.
4 //Local: Takes four arguments, the analysis mode, the type of the ESD
5 // analysis, the PID mode and the path where the tag and ESD or
7 //Interactive: Takes four arguments, the analysis mode, the type of the ESD
8 // analysis, the PID mode and the name of the collection of tag
10 //Batch: Takes four arguments, the analysis mode, the type of the ESD
11 // analysis, the PID mode and the name of the collection file with
12 // the event list for each file.
13 //Proof: Takes five arguments, the analysis level, the analysis mode in
14 // case of ESD, the PID mode, the number of events and the dataset
16 //Analysis mode can be: "MC", "ESD", "AOD"
17 //ESD analysis type can be one of the three: "TPC", "Hybrid", "Global"
18 //PID mode can be one of the four: "Bayesian" (standard Bayesian approach)
19 // "Ratio" (ratio of measured over expected/theoretical dE/dx a la STAR)
20 // "Sigma1" (N-sigma area around the fitted dE/dx vs P band)
21 // "Sigma2" (same as previous but taking into account the No of TPC points)
28 "/home/pchrist/ALICE/Baryons/Analysis/Protons/Local/data");
29 //runInteractive("ESD",esdAnalysisType,pidMode,"tag.xml");
30 //runBatch("ESD",esdAnalysisType,pidMode,"wn.xml");
31 /*runProof("ESD",esdAnalysisType,pidMode,
32 500000,0,"/COMMON/COMMON/LHC09a4_run8100X#esdTree");*/
38 //_________________________________________________//
39 void runLocal(const char* mode = "ESD",
40 const char* analysisType = 0x0,
41 const char* pidMode = 0x0,
42 const char* path = "/home/pchrist/ALICE/Alien/Tutorial/November2007/Tags") {
44 TString outputFilename = "Protons."; outputFilename += mode;
46 outputFilename += "."; outputFilename += analysisType;
48 outputFilename += ".root";
50 //____________________________________________________//
51 //_____________Setting up the par files_______________//
52 //____________________________________________________//
53 setupPar("STEERBase");
54 gSystem->Load("libSTEERBase.so");
56 gSystem->Load("libVMC.so");
57 gSystem->Load("libESD.so");
59 gSystem->Load("libAOD.so");
61 gSystem->Load("libANALYSIS.so");
62 setupPar("ANALYSISalice");
63 gSystem->Load("libANALYSISalice.so");
65 gSystem->Load("libCORRFW.so");
66 setupPar("PWG2spectra");
67 gSystem->Load("libPWG2spectra.so");
68 //____________________________________________________//
70 //____________________________________________//
71 AliTagAnalysis *tagAnalysis = new AliTagAnalysis("ESD");
72 tagAnalysis->ChainLocalTags(path);
74 AliRunTagCuts *runCuts = new AliRunTagCuts();
75 AliLHCTagCuts *lhcCuts = new AliLHCTagCuts();
76 AliDetectorTagCuts *detCuts = new AliDetectorTagCuts();
77 AliEventTagCuts *evCuts = new AliEventTagCuts();
80 chain = tagAnalysis->QueryTags(runCuts,lhcCuts,detCuts,evCuts);
81 chain->SetBranchStatus("*Calo*",0);
83 //____________________________________________//
84 gROOT->LoadMacro("configProtonAnalysis.C");
85 AliProtonAnalysis *analysis = GetProtonAnalysisObject(mode,
88 //____________________________________________//
89 // Make the analysis manager
90 AliAnalysisManager *mgr = new AliAnalysisManager("protonAnalysisManager");
91 AliVEventHandler* esdH = new AliESDInputHandler;
92 mgr->SetInputEventHandler(esdH);
94 AliMCEventHandler *mc = new AliMCEventHandler();
95 mgr->SetMCtruthEventHandler(mc);
98 //____________________________________________//
99 //Create the proton task
100 AliAnalysisTaskProtons *taskProtons = new AliAnalysisTaskProtons("TaskProtons");
101 taskProtons->SetAnalysisObject(analysis);
102 mgr->AddTask(taskProtons);
104 // Create containers for input/output
105 AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
106 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("outputList",
108 AliAnalysisManager::kOutputContainer,
109 outputFilename.Data());
111 //____________________________________________//
112 mgr->ConnectInput(taskProtons,0,cinput1);
113 mgr->ConnectOutput(taskProtons,0,coutput1);
114 if (!mgr->InitAnalysis()) return;
116 mgr->StartAnalysis("local",chain);
119 //_________________________________________________//
120 void runInteractive(const char* mode = "ESD",
121 const char* analysisType = 0x0,
122 const char* pidMode = 0x0,
123 const char* collectionName = "tag.xml") {
124 gSystem->Load("libProofPlayer.so");
126 TString smode = mode;
127 TString outputFilename = "Protons."; outputFilename += mode;
129 outputFilename += "."; outputFilename += analysisType;
131 outputFilename += ".root";
133 printf("*** Connect to AliEn ***\n");
134 TGrid::Connect("alien://");
136 //____________________________________________________//
137 //_____________Setting up the par files_______________//
138 //____________________________________________________//
139 setupPar("STEERBase");
140 gSystem->Load("libSTEERBase.so");
142 gSystem->Load("libVMC.so");
143 gSystem->Load("libESD.so");
145 gSystem->Load("libAOD.so");
146 setupPar("ANALYSIS");
147 gSystem->Load("libANALYSIS.so");
148 setupPar("ANALYSISalice");
149 gSystem->Load("libANALYSISalice.so");
151 gSystem->Load("libCORRFW.so");
152 setupPar("PWG2spectra");
153 gSystem->Load("libPWG2spectra.so");
154 //____________________________________________________//
156 //____________________________________________//
157 AliTagAnalysis *tagAnalysis = new AliTagAnalysis("ESD");
159 AliRunTagCuts *runCuts = new AliRunTagCuts();
160 AliLHCTagCuts *lhcCuts = new AliLHCTagCuts();
161 AliDetectorTagCuts *detCuts = new AliDetectorTagCuts();
162 AliEventTagCuts *evCuts = new AliEventTagCuts();
165 TAlienCollection* coll = TAlienCollection::Open(collectionName);
166 TGridResult* TagResult = coll->GetGridResult("",0,0);
167 tagAnalysis->ChainGridTags(TagResult);
169 chain = tagAnalysis->QueryTags(runCuts,lhcCuts,detCuts,evCuts);
170 chain->SetBranchStatus("*Calo*",0);
172 //____________________________________________//
173 gROOT->LoadMacro("configProtonAnalysis.C");
174 AliProtonAnalysis *analysis = GetProtonAnalysisObject(mode,
177 //____________________________________________//
178 // Make the analysis manager
179 AliAnalysisManager *mgr = new AliAnalysisManager("protonAnalysisManager");
180 AliVEventHandler* esdH = new AliESDInputHandler;
181 mgr->SetInputEventHandler(esdH);
183 AliMCEventHandler *mc = new AliMCEventHandler();
184 mgr->SetMCtruthEventHandler(mc);
187 //____________________________________________//
188 //Create the proton task
189 AliAnalysisTaskProtons *taskProtons = new AliAnalysisTaskProtons("TaskProtons");
190 taskProtons->SetAnalysisObject(analysis);
191 mgr->AddTask(taskProtons);
193 // Create containers for input/output
194 AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
195 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("outputList",
197 AliAnalysisManager::kOutputContainer,
198 outputFilename.Data());
200 //____________________________________________//
201 mgr->ConnectInput(taskProtons,0,cinput1);
202 mgr->ConnectOutput(taskProtons,0,coutput1);
203 if (!mgr->InitAnalysis()) return;
205 mgr->StartAnalysis("local",chain);
208 //_________________________________________________//
209 void runBatch(const char* mode = "ESD",
210 const char* analysisType = 0x0,
211 const char* pidMode = 0x0,
212 const char *collectionfile = "wn.xml") {
213 TString smode = mode;
214 TString outputFilename = "Protons."; outputFilename += mode;
216 outputFilename += "."; outputFilename += analysisType;
218 outputFilename += ".root";
220 printf("*** Connect to AliEn ***\n");
221 TGrid::Connect("alien://");
222 gSystem->Load("libProofPlayer.so");
224 //____________________________________________________//
225 //_____________Setting up the par files_______________//
226 //____________________________________________________//
227 setupPar("STEERBase");
228 gSystem->Load("libSTEERBase.so");
230 gSystem->Load("libVMC.so");
231 gSystem->Load("libESD.so");
233 gSystem->Load("libAOD.so");
234 setupPar("ANALYSIS");
235 gSystem->Load("libANALYSIS.so");
236 setupPar("ANALYSISalice");
237 gSystem->Load("libANALYSISalice.so");
239 gSystem->Load("libCORRFW.so");
240 setupPar("PWG2spectra");
241 gSystem->Load("libPWG2spectra.so");
242 //____________________________________________________//
244 //____________________________________________//
245 //Usage of event tags
246 AliTagAnalysis *tagAnalysis = new AliTagAnalysis();
248 chain = tagAnalysis->GetChainFromCollection(collectionfile,"esdTree");
249 chain->SetBranchStatus("*Calo*",0);
251 //____________________________________________//
252 gROOT->LoadMacro("configProtonAnalysis.C");
253 AliProtonAnalysis *analysis = GetProtonAnalysisObject(mode,
256 //____________________________________________//
257 // Make the analysis manager
258 AliAnalysisManager *mgr = new AliAnalysisManager("protonAnalysisManager");
259 AliVEventHandler* esdH = new AliESDInputHandler;
260 mgr->SetInputEventHandler(esdH);
262 AliMCEventHandler *mc = new AliMCEventHandler();
263 mgr->SetMCtruthEventHandler(mc);
266 //____________________________________________//
267 //Create the proton task
268 AliAnalysisTaskProtons *taskProtons = new AliAnalysisTaskProtons("TaskProtons");
269 taskProtons->SetAnalysisObject(analysis);
270 mgr->AddTask(taskProtons);
272 // Create containers for input/output
273 AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
274 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("outputList",
276 AliAnalysisManager::kOutputContainer,
277 outputFilename.Data());
279 //____________________________________________//
280 mgr->ConnectInput(taskProtons,0,cinput1);
281 mgr->ConnectOutput(taskProtons,0,coutput1);
282 if (!mgr->InitAnalysis()) return;
284 mgr->StartAnalysis("grid",chain);
287 //_________________________________________________//
288 void runProof(const char* mode = "ESD",
289 const char* analysisType = 0x0,
290 const char* pidMode = 0x0,
291 Int_t stats = 0, Int_t startingPoint = 0,
292 const char* dataset = 0x0) {
293 TString smode = mode;
294 TString outputFilename = "Protons."; outputFilename += mode;
296 outputFilename += "."; outputFilename += analysisType;
298 outputFilename += ".root";
300 gEnv->SetValue("XSec.GSI.DelegProxy","2");
301 printf("****** Connect to PROOF *******\n");
302 TProof::Open("alicecaf.cern.ch");
303 gProof->SetParallel();
305 // Enable the Analysis Package
306 gProof->UploadPackage("STEERBase.par");
307 gProof->EnablePackage("STEERBase");
308 gProof->UploadPackage("ESD.par");
309 gProof->EnablePackage("ESD");
310 gProof->UploadPackage("AOD.par");
311 gProof->EnablePackage("AOD");
312 gProof->UploadPackage("ANALYSIS.par");
313 gProof->EnablePackage("ANALYSIS");
314 gProof->UploadPackage("ANALYSISalice.par");
315 gProof->EnablePackage("ANALYSISalice");
316 gProof->UploadPackage("CORRFW.par");
317 gProof->EnablePackage("CORRFW");
318 gProof->UploadPackage("PWG2spectra.par");
319 gProof->EnablePackage("PWG2spectra");
321 //____________________________________________//
322 gROOT->LoadMacro("configProtonAnalysis.C");
323 AliProtonAnalysis *analysis = GetProtonAnalysisObject(mode,
326 //____________________________________________//
328 //____________________________________________//
329 // Make the analysis manager
330 AliAnalysisManager *mgr = new AliAnalysisManager("protonAnalysisManager");
331 AliVEventHandler* esdH = new AliESDInputHandler;
332 mgr->SetInputEventHandler(esdH);
334 AliMCEventHandler *mc = new AliMCEventHandler();
335 mgr->SetMCtruthEventHandler(mc);
337 //____________________________________________//
338 //Create the proton task
339 AliAnalysisTaskProtons *taskProtons = new AliAnalysisTaskProtons("TaskProtons");
340 taskProtons->SetAnalysisObject(analysis);
341 mgr->AddTask(taskProtons);
343 // Create containers for input/output
344 AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer();
345 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("outputList",
347 AliAnalysisManager::kOutputContainer,
348 outputFilename.Data());
350 //____________________________________________//
351 mgr->ConnectInput(taskProtons,0,cinput1);
352 mgr->ConnectOutput(taskProtons,0,coutput1);
353 if (!mgr->InitAnalysis()) return;
357 mgr->StartAnalysis("proof",dataset,stats,startingPoint);
359 // You should get this macro and the txt file from:
360 // http://aliceinfo.cern.ch/Offline/Analysis/CAF/
361 gROOT->LoadMacro("CreateESDChain.C");
363 chain = CreateESDChain("ESD82XX_30K.txt",stats);
364 chain->SetBranchStatus("*Calo*",0);
366 mgr->StartAnalysis("proof",chain);
370 //_________________________________________________//
371 Int_t setupPar(const char* pararchivename) {
375 if (pararchivename) {
376 char processline[1024];
377 sprintf(processline,".! tar xvzf %s.par",pararchivename);
378 gROOT->ProcessLine(processline);
379 const char* ocwd = gSystem->WorkingDirectory();
380 gSystem->ChangeDirectory(pararchivename);
382 // check for BUILD.sh and execute
383 if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) {
384 printf("*******************************\n");
385 printf("*** Building PAR archive ***\n");
386 printf("*******************************\n");
388 if (gSystem->Exec("PROOF-INF/BUILD.sh")) {
389 Error("runAnalysis","Cannot Build the PAR Archive! - Abort!");
393 // check for SETUP.C and execute
394 if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) {
395 printf("*******************************\n");
396 printf("*** Setup PAR archive ***\n");
397 printf("*******************************\n");
398 gROOT->Macro("PROOF-INF/SETUP.C");
401 gSystem->ChangeDirectory("../");