]>
Commit | Line | Data |
---|---|---|
0ab648ea | 1 | void runProtonAnalysis(const char* esdAnalysisType = "Hybrid", |
2 | const char* pidMode = "Bayesian") { | |
da8c4c1c | 3 | //Macro to run the proton analysis tested for local, proof & GRID. |
0ab648ea | 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 | |
6 | // AOD files reside. | |
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 | |
9 | // files. | |
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 | |
15 | // name and . | |
da8c4c1c | 16 | //Analysis mode can be: "MC", "ESD", "AOD" |
17 | //ESD analysis type can be one of the three: "TPC", "Hybrid", "Global" | |
87a55728 | 18 | //PID mode can be one of the four: "Bayesian" (standard Bayesian approach) |
0ab648ea | 19 | // "Ratio" (ratio of measured over expected/theoretical dE/dx a la STAR) |
87a55728 | 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) | |
734d2c12 | 22 | TStopwatch timer; |
23 | timer.Start(); | |
24 | ||
bf80af3b | 25 | runLocal("ESD", |
0ab648ea | 26 | esdAnalysisType, |
27 | pidMode, | |
bf80af3b | 28 | "/home/pchrist/ALICE/Baryons/Analysis/Protons/Local/data"); |
0ab648ea | 29 | //runInteractive("ESD",esdAnalysisType,pidMode,"tag.xml"); |
30 | //runBatch("ESD",esdAnalysisType,pidMode,"wn.xml"); | |
bf80af3b | 31 | /*runProof("ESD",esdAnalysisType,pidMode, |
32 | 500000,0,"/COMMON/COMMON/LHC09a4_run8100X#esdTree");*/ | |
df01f00b | 33 | |
734d2c12 | 34 | timer.Stop(); |
35 | timer.Print(); | |
36 | } | |
37 | ||
38 | //_________________________________________________// | |
da8c4c1c | 39 | void runLocal(const char* mode = "ESD", |
40 | const char* analysisType = 0x0, | |
0ab648ea | 41 | const char* pidMode = 0x0, |
da8c4c1c | 42 | const char* path = "/home/pchrist/ALICE/Alien/Tutorial/November2007/Tags") { |
da8c4c1c | 43 | TString smode = mode; |
44 | TString outputFilename = "Protons."; outputFilename += mode; | |
45 | if(analysisType) { | |
46 | outputFilename += "."; outputFilename += analysisType; | |
47 | } | |
48 | outputFilename += ".root"; | |
49 | ||
734d2c12 | 50 | //____________________________________________________// |
da8c4c1c | 51 | //_____________Setting up the par files_______________// |
734d2c12 | 52 | //____________________________________________________// |
53 | setupPar("STEERBase"); | |
54 | gSystem->Load("libSTEERBase.so"); | |
734d2c12 | 55 | setupPar("ESD"); |
56 | gSystem->Load("libVMC.so"); | |
57 | gSystem->Load("libESD.so"); | |
734d2c12 | 58 | setupPar("AOD"); |
59 | gSystem->Load("libAOD.so"); | |
734d2c12 | 60 | setupPar("ANALYSIS"); |
61 | gSystem->Load("libANALYSIS.so"); | |
e4358d7f | 62 | setupPar("ANALYSISalice"); |
63 | gSystem->Load("libANALYSISalice.so"); | |
0ab648ea | 64 | setupPar("CORRFW"); |
65 | gSystem->Load("libCORRFW.so"); | |
734d2c12 | 66 | setupPar("PWG2spectra"); |
67 | gSystem->Load("libPWG2spectra.so"); | |
da8c4c1c | 68 | //____________________________________________________// |
734d2c12 | 69 | |
70 | //____________________________________________// | |
e4358d7f | 71 | AliTagAnalysis *tagAnalysis = new AliTagAnalysis("ESD"); |
da8c4c1c | 72 | tagAnalysis->ChainLocalTags(path); |
734d2c12 | 73 | |
74 | AliRunTagCuts *runCuts = new AliRunTagCuts(); | |
75 | AliLHCTagCuts *lhcCuts = new AliLHCTagCuts(); | |
76 | AliDetectorTagCuts *detCuts = new AliDetectorTagCuts(); | |
77 | AliEventTagCuts *evCuts = new AliEventTagCuts(); | |
78 | ||
79 | TChain* chain = 0x0; | |
e4358d7f | 80 | chain = tagAnalysis->QueryTags(runCuts,lhcCuts,detCuts,evCuts); |
734d2c12 | 81 | chain->SetBranchStatus("*Calo*",0); |
82 | ||
da8c4c1c | 83 | //____________________________________________// |
0ab648ea | 84 | gROOT->LoadMacro("configProtonAnalysis.C"); |
85 | AliProtonAnalysis *analysis = GetProtonAnalysisObject(mode, | |
86 | analysisType, | |
87 | pidMode); | |
734d2c12 | 88 | //____________________________________________// |
89 | // Make the analysis manager | |
e7df5638 | 90 | AliAnalysisManager *mgr = new AliAnalysisManager("protonAnalysisManager"); |
734d2c12 | 91 | AliVEventHandler* esdH = new AliESDInputHandler; |
92 | mgr->SetInputEventHandler(esdH); | |
6667f3a7 | 93 | if(smode == "MC") { |
94 | AliMCEventHandler *mc = new AliMCEventHandler(); | |
95 | mgr->SetMCtruthEventHandler(mc); | |
96 | } | |
0ab648ea | 97 | |
734d2c12 | 98 | //____________________________________________// |
0ab648ea | 99 | //Create the proton task |
e4358d7f | 100 | AliAnalysisTaskProtons *taskProtons = new AliAnalysisTaskProtons("TaskProtons"); |
0ab648ea | 101 | taskProtons->SetAnalysisObject(analysis); |
e4358d7f | 102 | mgr->AddTask(taskProtons); |
103 | ||
0ab648ea | 104 | // Create containers for input/output |
bf80af3b | 105 | AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer(); |
0ab648ea | 106 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("outputList", |
251e4034 | 107 | TList::Class(), |
0ab648ea | 108 | AliAnalysisManager::kOutputContainer, |
da8c4c1c | 109 | outputFilename.Data()); |
734d2c12 | 110 | |
734d2c12 | 111 | //____________________________________________// |
e4358d7f | 112 | mgr->ConnectInput(taskProtons,0,cinput1); |
113 | mgr->ConnectOutput(taskProtons,0,coutput1); | |
734d2c12 | 114 | if (!mgr->InitAnalysis()) return; |
115 | mgr->PrintStatus(); | |
116 | mgr->StartAnalysis("local",chain); | |
734d2c12 | 117 | } |
118 | ||
119 | //_________________________________________________// | |
da8c4c1c | 120 | void runInteractive(const char* mode = "ESD", |
121 | const char* analysisType = 0x0, | |
0ab648ea | 122 | const char* pidMode = 0x0, |
da8c4c1c | 123 | const char* collectionName = "tag.xml") { |
734d2c12 | 124 | gSystem->Load("libProofPlayer.so"); |
125 | ||
da8c4c1c | 126 | TString smode = mode; |
127 | TString outputFilename = "Protons."; outputFilename += mode; | |
128 | if(analysisType) { | |
129 | outputFilename += "."; outputFilename += analysisType; | |
130 | } | |
131 | outputFilename += ".root"; | |
132 | ||
734d2c12 | 133 | printf("*** Connect to AliEn ***\n"); |
134 | TGrid::Connect("alien://"); | |
135 | ||
136 | //____________________________________________________// | |
da8c4c1c | 137 | //_____________Setting up the par files_______________// |
734d2c12 | 138 | //____________________________________________________// |
139 | setupPar("STEERBase"); | |
140 | gSystem->Load("libSTEERBase.so"); | |
734d2c12 | 141 | setupPar("ESD"); |
142 | gSystem->Load("libVMC.so"); | |
143 | gSystem->Load("libESD.so"); | |
734d2c12 | 144 | setupPar("AOD"); |
145 | gSystem->Load("libAOD.so"); | |
734d2c12 | 146 | setupPar("ANALYSIS"); |
147 | gSystem->Load("libANALYSIS.so"); | |
e4358d7f | 148 | setupPar("ANALYSISalice"); |
149 | gSystem->Load("libANALYSISalice.so"); | |
0ab648ea | 150 | setupPar("CORRFW"); |
151 | gSystem->Load("libCORRFW.so"); | |
734d2c12 | 152 | setupPar("PWG2spectra"); |
153 | gSystem->Load("libPWG2spectra.so"); | |
da8c4c1c | 154 | //____________________________________________________// |
734d2c12 | 155 | |
156 | //____________________________________________// | |
e4358d7f | 157 | AliTagAnalysis *tagAnalysis = new AliTagAnalysis("ESD"); |
734d2c12 | 158 | |
159 | AliRunTagCuts *runCuts = new AliRunTagCuts(); | |
160 | AliLHCTagCuts *lhcCuts = new AliLHCTagCuts(); | |
161 | AliDetectorTagCuts *detCuts = new AliDetectorTagCuts(); | |
162 | AliEventTagCuts *evCuts = new AliEventTagCuts(); | |
163 | ||
164 | //grid tags | |
da8c4c1c | 165 | TAlienCollection* coll = TAlienCollection::Open(collectionName); |
734d2c12 | 166 | TGridResult* TagResult = coll->GetGridResult("",0,0); |
e4358d7f | 167 | tagAnalysis->ChainGridTags(TagResult); |
734d2c12 | 168 | TChain* chain = 0x0; |
e4358d7f | 169 | chain = tagAnalysis->QueryTags(runCuts,lhcCuts,detCuts,evCuts); |
734d2c12 | 170 | chain->SetBranchStatus("*Calo*",0); |
da8c4c1c | 171 | |
172 | //____________________________________________// | |
0ab648ea | 173 | gROOT->LoadMacro("configProtonAnalysis.C"); |
174 | AliProtonAnalysis *analysis = GetProtonAnalysisObject(mode, | |
175 | analysisType, | |
176 | pidMode); | |
734d2c12 | 177 | //____________________________________________// |
178 | // Make the analysis manager | |
e7df5638 | 179 | AliAnalysisManager *mgr = new AliAnalysisManager("protonAnalysisManager"); |
734d2c12 | 180 | AliVEventHandler* esdH = new AliESDInputHandler; |
181 | mgr->SetInputEventHandler(esdH); | |
6667f3a7 | 182 | if(smode == "MC") { |
183 | AliMCEventHandler *mc = new AliMCEventHandler(); | |
184 | mgr->SetMCtruthEventHandler(mc); | |
185 | } | |
186 | ||
734d2c12 | 187 | //____________________________________________// |
0ab648ea | 188 | //Create the proton task |
e4358d7f | 189 | AliAnalysisTaskProtons *taskProtons = new AliAnalysisTaskProtons("TaskProtons"); |
0ab648ea | 190 | taskProtons->SetAnalysisObject(analysis); |
e4358d7f | 191 | mgr->AddTask(taskProtons); |
192 | ||
0ab648ea | 193 | // Create containers for input/output |
bf80af3b | 194 | AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer(); |
0ab648ea | 195 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("outputList", |
251e4034 | 196 | TList::Class(), |
0ab648ea | 197 | AliAnalysisManager::kOutputContainer, |
da8c4c1c | 198 | outputFilename.Data()); |
734d2c12 | 199 | |
200 | //____________________________________________// | |
e4358d7f | 201 | mgr->ConnectInput(taskProtons,0,cinput1); |
202 | mgr->ConnectOutput(taskProtons,0,coutput1); | |
734d2c12 | 203 | if (!mgr->InitAnalysis()) return; |
204 | mgr->PrintStatus(); | |
205 | mgr->StartAnalysis("local",chain); | |
734d2c12 | 206 | } |
207 | ||
208 | //_________________________________________________// | |
da8c4c1c | 209 | void runBatch(const char* mode = "ESD", |
210 | const char* analysisType = 0x0, | |
0ab648ea | 211 | const char* pidMode = 0x0, |
da8c4c1c | 212 | const char *collectionfile = "wn.xml") { |
da8c4c1c | 213 | TString smode = mode; |
214 | TString outputFilename = "Protons."; outputFilename += mode; | |
215 | if(analysisType) { | |
216 | outputFilename += "."; outputFilename += analysisType; | |
217 | } | |
218 | outputFilename += ".root"; | |
219 | ||
734d2c12 | 220 | printf("*** Connect to AliEn ***\n"); |
221 | TGrid::Connect("alien://"); | |
222 | gSystem->Load("libProofPlayer.so"); | |
223 | ||
224 | //____________________________________________________// | |
da8c4c1c | 225 | //_____________Setting up the par files_______________// |
734d2c12 | 226 | //____________________________________________________// |
227 | setupPar("STEERBase"); | |
228 | gSystem->Load("libSTEERBase.so"); | |
734d2c12 | 229 | setupPar("ESD"); |
230 | gSystem->Load("libVMC.so"); | |
231 | gSystem->Load("libESD.so"); | |
734d2c12 | 232 | setupPar("AOD"); |
233 | gSystem->Load("libAOD.so"); | |
734d2c12 | 234 | setupPar("ANALYSIS"); |
235 | gSystem->Load("libANALYSIS.so"); | |
e4358d7f | 236 | setupPar("ANALYSISalice"); |
237 | gSystem->Load("libANALYSISalice.so"); | |
0ab648ea | 238 | setupPar("CORRFW"); |
239 | gSystem->Load("libCORRFW.so"); | |
734d2c12 | 240 | setupPar("PWG2spectra"); |
241 | gSystem->Load("libPWG2spectra.so"); | |
da8c4c1c | 242 | //____________________________________________________// |
734d2c12 | 243 | |
244 | //____________________________________________// | |
245 | //Usage of event tags | |
e4358d7f | 246 | AliTagAnalysis *tagAnalysis = new AliTagAnalysis(); |
734d2c12 | 247 | TChain *chain = 0x0; |
e4358d7f | 248 | chain = tagAnalysis->GetChainFromCollection(collectionfile,"esdTree"); |
734d2c12 | 249 | chain->SetBranchStatus("*Calo*",0); |
250 | ||
da8c4c1c | 251 | //____________________________________________// |
0ab648ea | 252 | gROOT->LoadMacro("configProtonAnalysis.C"); |
253 | AliProtonAnalysis *analysis = GetProtonAnalysisObject(mode, | |
254 | analysisType, | |
255 | pidMode); | |
734d2c12 | 256 | //____________________________________________// |
257 | // Make the analysis manager | |
e7df5638 | 258 | AliAnalysisManager *mgr = new AliAnalysisManager("protonAnalysisManager"); |
734d2c12 | 259 | AliVEventHandler* esdH = new AliESDInputHandler; |
260 | mgr->SetInputEventHandler(esdH); | |
6667f3a7 | 261 | if(smode == "MC") { |
262 | AliMCEventHandler *mc = new AliMCEventHandler(); | |
263 | mgr->SetMCtruthEventHandler(mc); | |
264 | } | |
265 | ||
734d2c12 | 266 | //____________________________________________// |
0ab648ea | 267 | //Create the proton task |
e4358d7f | 268 | AliAnalysisTaskProtons *taskProtons = new AliAnalysisTaskProtons("TaskProtons"); |
0ab648ea | 269 | taskProtons->SetAnalysisObject(analysis); |
e4358d7f | 270 | mgr->AddTask(taskProtons); |
271 | ||
0ab648ea | 272 | // Create containers for input/output |
bf80af3b | 273 | AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer(); |
0ab648ea | 274 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("outputList", |
275 | TList::Class(), | |
276 | AliAnalysisManager::kOutputContainer, | |
da8c4c1c | 277 | outputFilename.Data()); |
734d2c12 | 278 | |
734d2c12 | 279 | //____________________________________________// |
e4358d7f | 280 | mgr->ConnectInput(taskProtons,0,cinput1); |
281 | mgr->ConnectOutput(taskProtons,0,coutput1); | |
734d2c12 | 282 | if (!mgr->InitAnalysis()) return; |
283 | mgr->PrintStatus(); | |
284 | mgr->StartAnalysis("grid",chain); | |
734d2c12 | 285 | } |
286 | ||
287 | //_________________________________________________// | |
da8c4c1c | 288 | void runProof(const char* mode = "ESD", |
0ab648ea | 289 | const char* analysisType = 0x0, |
290 | const char* pidMode = 0x0, | |
f62e9410 | 291 | Int_t stats = 0, Int_t startingPoint = 0, |
0ab648ea | 292 | const char* dataset = 0x0) { |
df01f00b | 293 | TString smode = mode; |
294 | TString outputFilename = "Protons."; outputFilename += mode; | |
da8c4c1c | 295 | if(analysisType) { |
296 | outputFilename += "."; outputFilename += analysisType; | |
297 | } | |
df01f00b | 298 | outputFilename += ".root"; |
299 | ||
f62e9410 | 300 | gEnv->SetValue("XSec.GSI.DelegProxy","2"); |
734d2c12 | 301 | printf("****** Connect to PROOF *******\n"); |
96f84c25 | 302 | TProof::Open("alicecaf.cern.ch"); |
aafecd8b | 303 | gProof->SetParallel(); |
734d2c12 | 304 | |
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"); | |
e4358d7f | 314 | gProof->UploadPackage("ANALYSISalice.par"); |
315 | gProof->EnablePackage("ANALYSISalice"); | |
251e4034 | 316 | gProof->UploadPackage("CORRFW.par"); |
317 | gProof->EnablePackage("CORRFW"); | |
734d2c12 | 318 | gProof->UploadPackage("PWG2spectra.par"); |
319 | gProof->EnablePackage("PWG2spectra"); | |
320 | ||
da8c4c1c | 321 | //____________________________________________// |
0ab648ea | 322 | gROOT->LoadMacro("configProtonAnalysis.C"); |
323 | AliProtonAnalysis *analysis = GetProtonAnalysisObject(mode, | |
324 | analysisType, | |
325 | pidMode); | |
da8c4c1c | 326 | //____________________________________________// |
734d2c12 | 327 | |
e4358d7f | 328 | //____________________________________________// |
734d2c12 | 329 | // Make the analysis manager |
e7df5638 | 330 | AliAnalysisManager *mgr = new AliAnalysisManager("protonAnalysisManager"); |
734d2c12 | 331 | AliVEventHandler* esdH = new AliESDInputHandler; |
df01f00b | 332 | mgr->SetInputEventHandler(esdH); |
333 | if(smode == "MC") { | |
334 | AliMCEventHandler *mc = new AliMCEventHandler(); | |
335 | mgr->SetMCtruthEventHandler(mc); | |
336 | } | |
734d2c12 | 337 | //____________________________________________// |
0ab648ea | 338 | //Create the proton task |
e4358d7f | 339 | AliAnalysisTaskProtons *taskProtons = new AliAnalysisTaskProtons("TaskProtons"); |
0ab648ea | 340 | taskProtons->SetAnalysisObject(analysis); |
e4358d7f | 341 | mgr->AddTask(taskProtons); |
734d2c12 | 342 | |
343 | // Create containers for input/output | |
f62e9410 | 344 | AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer(); |
0ab648ea | 345 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("outputList", |
346 | TList::Class(), | |
251e4034 | 347 | AliAnalysisManager::kOutputContainer, |
0ab648ea | 348 | outputFilename.Data()); |
df01f00b | 349 | |
734d2c12 | 350 | //____________________________________________// |
e4358d7f | 351 | mgr->ConnectInput(taskProtons,0,cinput1); |
352 | mgr->ConnectOutput(taskProtons,0,coutput1); | |
734d2c12 | 353 | if (!mgr->InitAnalysis()) return; |
354 | mgr->PrintStatus(); | |
e4358d7f | 355 | |
356 | if(dataset) | |
f62e9410 | 357 | mgr->StartAnalysis("proof",dataset,stats,startingPoint); |
e4358d7f | 358 | else { |
359 | // You should get this macro and the txt file from: | |
360 | // http://aliceinfo.cern.ch/Offline/Analysis/CAF/ | |
361 | gROOT->LoadMacro("CreateESDChain.C"); | |
362 | TChain* chain = 0x0; | |
363 | chain = CreateESDChain("ESD82XX_30K.txt",stats); | |
364 | chain->SetBranchStatus("*Calo*",0); | |
365 | ||
366 | mgr->StartAnalysis("proof",chain); | |
367 | } | |
734d2c12 | 368 | } |
369 | ||
370 | //_________________________________________________// | |
371 | Int_t setupPar(const char* pararchivename) { | |
372 | /////////////////// | |
373 | // Setup PAR File// | |
374 | /////////////////// | |
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); | |
381 | ||
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"); | |
387 | ||
388 | if (gSystem->Exec("PROOF-INF/BUILD.sh")) { | |
389 | Error("runAnalysis","Cannot Build the PAR Archive! - Abort!"); | |
390 | return -1; | |
391 | } | |
392 | } | |
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"); | |
399 | } | |
400 | ||
401 | gSystem->ChangeDirectory("../"); | |
402 | } | |
403 | return 1; | |
404 | } |