1 void runProtonsFeedDownAnalysis(const char* esdAnalysisType = "Hybrid",
2 const char* pidMode = "Bayesian") {
3 //Macro to run the proton feed-down 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)
25 // runLocal("ESD","TPC","Bayesian","/home/mbroz/FeedDownAnalysis/");
26 //runInteractive("ESD","TPC","Bayesian","pp0901.xml");
27 runBatch("ESD","TPC","Bayesian","wn.xml");
28 // runProof("ESD","TPC","Bayesian",200000,"/COMMON/COMMON/LHC09a4_run8101X");
34 //_________________________________________________//
35 void runLocal(const char* mode = "ESD",
36 const char* analysisType = 0x0,
37 const char* pidMode = 0x0,
38 const char* path = 0x0) {
40 TString outputFilename = "Protons.FeedDown."; outputFilename += mode;
42 outputFilename += "."; outputFilename += analysisType;
44 outputFilename += ".root";
46 //____________________________________________________//
47 //_____________Setting up the par files_______________//
48 //____________________________________________________//
49 setupPar("STEERBase");
50 gSystem->Load("libSTEERBase.so");
52 gSystem->Load("libVMC.so");
53 gSystem->Load("libESD.so");
55 gSystem->Load("libAOD.so");
57 gSystem->Load("libANALYSIS.so");
58 setupPar("ANALYSISalice");
59 gSystem->Load("libANALYSISalice.so");
61 gSystem->Load("libCORRFW.so");
62 setupPar("PWG2spectra");
63 gSystem->Load("libPWG2spectra.so");
64 //____________________________________________________//
66 //____________________________________________//
67 AliTagAnalysis *tagAnalysis = new AliTagAnalysis("ESD");
68 tagAnalysis->ChainLocalTags(path);
70 AliRunTagCuts *runCuts = new AliRunTagCuts();
71 AliLHCTagCuts *lhcCuts = new AliLHCTagCuts();
72 AliDetectorTagCuts *detCuts = new AliDetectorTagCuts();
73 AliEventTagCuts *evCuts = new AliEventTagCuts();
76 chain = tagAnalysis->QueryTags(runCuts,lhcCuts,detCuts,evCuts);
77 //chain->SetBranchStatus("*Calo*",0);
79 //____________________________________________//
80 gROOT->LoadMacro("configProtonFeedDownAnalysis.C");
81 AliProtonFeedDownAnalysis *analysis = GetProtonFeedDownAnalysisObject(mode,
84 //____________________________________________//
85 // Make the analysis manager
86 AliAnalysisManager *mgr = new AliAnalysisManager("protonAnalysisManagerFD");
87 AliVEventHandler* esdH = new AliESDInputHandler;
88 mgr->SetInputEventHandler(esdH);
89 AliMCEventHandler *mc = new AliMCEventHandler();
90 mgr->SetMCtruthEventHandler(mc);
92 //____________________________________________//
93 AliProtonFeedDownAnalysisTask *taskProtons = new AliProtonFeedDownAnalysisTask("TaskProtonsFD");
94 taskProtons->SetAnalysisObject(analysis);
95 mgr->AddTask(taskProtons);
97 // Create containers for input/output
98 AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("dataChain",
100 AliAnalysisManager::kInputContainer);
101 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("outputList",
103 AliAnalysisManager::kOutputContainer,
104 outputFilename.Data());
106 //____________________________________________//
107 mgr->ConnectInput(taskProtons,0,mgr->GetCommonInputContainer());
108 mgr->ConnectOutput(taskProtons,0,coutput1);
109 if (!mgr->InitAnalysis()) return;
111 mgr->StartAnalysis("local",chain);
114 //_________________________________________________//
115 void runInteractive(const char* mode = "ESD",
116 const char* analysisType = 0x0,
117 const char* pidMode = 0x0,
118 const char* collectionName = "tag.xml") {
119 gSystem->Load("libProofPlayer.so");
121 TString smode = mode;
122 TString outputFilename = "Protons.FeedDown."; outputFilename += mode;
124 outputFilename += "."; outputFilename += analysisType;
126 outputFilename += ".root";
128 printf("*** Connect to AliEn ***\n");
129 TGrid::Connect("alien://");
131 //____________________________________________________//
132 //_____________Setting up the par files_______________//
133 //____________________________________________________//
134 setupPar("STEERBase");
135 gSystem->Load("libSTEERBase.so");
137 gSystem->Load("libVMC.so");
138 gSystem->Load("libESD.so");
140 gSystem->Load("libAOD.so");
141 setupPar("ANALYSIS");
142 gSystem->Load("libANALYSIS.so");
143 setupPar("ANALYSISalice");
144 gSystem->Load("libANALYSISalice.so");
146 gSystem->Load("libCORRFW.so");
147 setupPar("PWG2spectra");
148 gSystem->Load("libPWG2spectra.so");
149 //____________________________________________________//
151 //____________________________________________//
152 AliTagAnalysis *tagAnalysis = new AliTagAnalysis("ESD");
154 AliRunTagCuts *runCuts = new AliRunTagCuts();
155 AliLHCTagCuts *lhcCuts = new AliLHCTagCuts();
156 AliDetectorTagCuts *detCuts = new AliDetectorTagCuts();
157 AliEventTagCuts *evCuts = new AliEventTagCuts();
160 TAlienCollection* coll = TAlienCollection::Open(collectionName);
161 TGridResult* TagResult = coll->GetGridResult("",0,0);
162 tagAnalysis->ChainGridTags(TagResult);
164 chain = tagAnalysis->QueryTags(runCuts,lhcCuts,detCuts,evCuts);
165 //chain->SetBranchStatus("*Calo*",0);
167 //____________________________________________//
168 gROOT->LoadMacro("configProtonFeedDownAnalysis.C");
169 AliProtonFeedDownAnalysis *analysis = GetProtonFeedDownAnalysisObject(mode,
172 //____________________________________________//
173 // Make the analysis manager
174 // Make the analysis manager
175 AliAnalysisManager *mgr = new AliAnalysisManager("protonAnalysisManagerFD");
176 AliVEventHandler* esdH = new AliESDInputHandler;
177 mgr->SetInputEventHandler(esdH);
178 AliMCEventHandler *mc = new AliMCEventHandler();
179 mgr->SetMCtruthEventHandler(mc);
181 //____________________________________________//
182 AliProtonFeedDownAnalysisTask *taskProtons = new AliProtonFeedDownAnalysisTask("TaskProtonsFD");
183 taskProtons->SetAnalysisObject(analysis);
184 mgr->AddTask(taskProtons);
186 // Create containers for input/output
187 AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("dataChain",
189 AliAnalysisManager::kInputContainer);
190 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("outputList",
192 AliAnalysisManager::kOutputContainer,
193 outputFilename.Data());
195 //____________________________________________//
196 mgr->ConnectInput(taskProtons,0,mgr->GetCommonInputContainer());
197 mgr->ConnectOutput(taskProtons,0,coutput1);
198 if (!mgr->InitAnalysis()) return;
200 mgr->StartAnalysis("local",chain);
203 //_________________________________________________//
204 void runBatch(const char* mode = "ESD",
205 const char* analysisType = 0x0,
206 const char* pidMode = 0x0,
207 const char *collectionfile = "wn.xml") {
208 TString smode = mode;
209 TString outputFilename = "Protons.FeedDown."; outputFilename += mode;
211 outputFilename += "."; outputFilename += analysisType;
213 outputFilename += ".root";
215 printf("*** Connect to AliEn ***\n");
216 TGrid::Connect("alien://");
217 gSystem->Load("libProofPlayer.so");
219 //____________________________________________________//
220 //_____________Setting up the par files_______________//
221 //____________________________________________________//
222 gSystem->Load("libSTEERBase.so");
223 gSystem->Load("libESD.so");
224 gSystem->Load("libAOD.so");
225 gSystem->Load("libANALYSIS") ;
226 gSystem->Load("libANALYSISalice") ;
227 gSystem->Load("libCORRFW.so") ;
229 setupPar("PWG2spectra");
230 gSystem->Load("libPWG2spectra.so");
231 //____________________________________________________//
233 //____________________________________________//
234 AliTagAnalysis *tagAnalysis = new AliTagAnalysis("ESD");
236 chain = tagAnalysis->GetChainFromCollection(collectionfile,"esdTree");
238 //____________________________________________//
239 gROOT->LoadMacro("configProtonFeedDownAnalysis.C");
240 AliProtonFeedDownAnalysis *analysis = GetProtonFeedDownAnalysisObject(mode,
243 //____________________________________________//
244 // Make the analysis manager
245 AliAnalysisManager *mgr = new AliAnalysisManager("protonAnalysisManagerFD");
246 AliVEventHandler* esdH = new AliESDInputHandler;
247 mgr->SetInputEventHandler(esdH);
248 AliMCEventHandler *mc = new AliMCEventHandler();
249 mgr->SetMCtruthEventHandler(mc);
251 //____________________________________________//
252 AliProtonFeedDownAnalysisTask *taskProtons = new AliProtonFeedDownAnalysisTask("TaskProtonsFD");
253 taskProtons->SetAnalysisObject(analysis);
254 mgr->AddTask(taskProtons);
256 // Create containers for input/output
257 AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("dataChain",
259 AliAnalysisManager::kInputContainer);
260 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("outputList",
262 AliAnalysisManager::kOutputContainer,
263 outputFilename.Data());
265 //____________________________________________//
266 mgr->ConnectInput(taskProtons,0,mgr->GetCommonInputContainer());
267 mgr->ConnectOutput(taskProtons,0,coutput1);
268 if (!mgr->InitAnalysis()) return;
270 mgr->StartAnalysis("local",chain);
273 //_________________________________________________//
274 void runProof(const char* mode = "ESD",
275 const char* analysisType = 0x0,
276 const char* pidMode = 0x0,
278 const char* dataset = 0x0) {
279 TString smode = mode;
280 TString outputFilename = "Protons.FeedDown."; outputFilename += mode;
282 outputFilename += "."; outputFilename += analysisType;
284 outputFilename += ".root";
286 printf("****** Connect to PROOF *******\n");
287 TProof::Open("alicecaf.cern.ch");
288 //gProof->SetParallel();
290 // Enable the Analysis Package
291 gProof->UploadPackage("STEERBase.par");
292 gProof->EnablePackage("STEERBase");
293 gProof->UploadPackage("ESD.par");
294 gProof->EnablePackage("ESD");
295 gProof->UploadPackage("AOD.par");
296 gProof->EnablePackage("AOD");
297 gProof->UploadPackage("ANALYSIS.par");
298 gProof->EnablePackage("ANALYSIS");
299 gProof->UploadPackage("ANALYSISalice.par");
300 gProof->EnablePackage("ANALYSISalice");
301 gProof->UploadPackage("CORRFW.par");
302 gProof->EnablePackage("CORRFW");
303 gProof->UploadPackage("PWG2spectra.par");
304 gProof->EnablePackage("PWG2spectra");
306 //____________________________________________//
307 gROOT->LoadMacro("configProtonFeedDownAnalysis.C");
308 AliProtonFeedDownAnalysis *analysis = GetProtonFeedDownAnalysisObject(mode,
311 //____________________________________________//
313 //____________________________________________//
314 // Make the analysis manager
315 AliAnalysisManager *mgr = new AliAnalysisManager("protonAnalysisManagerFD");
316 AliVEventHandler* esdH = new AliESDInputHandler;
317 mgr->SetInputEventHandler(esdH);
318 AliMCEventHandler *mc = new AliMCEventHandler();
319 mgr->SetMCtruthEventHandler(mc);
320 //____________________________________________//
321 //Create the proton task
322 AliProtonFeedDownAnalysisTask *taskProtons = new AliProtonFeedDownAnalysisTask("TaskProtonsFD");
323 taskProtons->SetAnalysisObject(analysis);
324 mgr->AddTask(taskProtons);
326 // Create containers for input/output
327 AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("dataChain",
329 AliAnalysisManager::kInputContainer);
330 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("outputList",
332 AliAnalysisManager::kOutputContainer,
333 outputFilename.Data());
335 //____________________________________________//
336 mgr->ConnectInput(taskProtons,0,mgr->GetCommonInputContainer());
337 mgr->ConnectOutput(taskProtons,0,coutput1);
338 if (!mgr->InitAnalysis()) return;
342 mgr->StartAnalysis("proof",dataset,stats);
344 // You should get this macro and the txt file from:
345 // http://aliceinfo.cern.ch/Offline/Analysis/CAF/
346 gROOT->LoadMacro("CreateESDChain.C");
348 chain = CreateESDChain("ESD82XX_30K.txt",stats);
349 chain->SetBranchStatus("*Calo*",0);
351 mgr->StartAnalysis("proof",chain);
355 //_________________________________________________//
356 Int_t setupPar(const char* pararchivename) {
360 if (pararchivename) {
361 char processline[1024];
362 sprintf(processline,".! tar xvzf %s.par",pararchivename);
363 gROOT->ProcessLine(processline);
364 const char* ocwd = gSystem->WorkingDirectory();
365 gSystem->ChangeDirectory(pararchivename);
367 // check for BUILD.sh and execute
368 if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) {
369 printf("*******************************\n");
370 printf("*** Building PAR archive ***\n");
371 printf("*******************************\n");
373 if (gSystem->Exec("PROOF-INF/BUILD.sh")) {
374 Error("runAnalysis","Cannot Build the PAR Archive! - Abort!");
378 // check for SETUP.C and execute
379 if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) {
380 printf("*******************************\n");
381 printf("*** Setup PAR archive ***\n");
382 printf("*******************************\n");
383 gROOT->Macro("PROOF-INF/SETUP.C");
386 gSystem->ChangeDirectory("../");