]>
Commit | Line | Data |
---|---|---|
790140ac | 1 | void runProtonAnalysis(Bool_t kAnalyzeMC = kTRUE, |
2 | const char* esdAnalysisType = "Hybrid", | |
c6909683 | 3 | const char* pidMode = "Ratio", |
1fd2c71b | 4 | Bool_t kUseOnlineTrigger = kTRUE, |
2f6dae44 | 5 | Bool_t kUseOfflineTrigger = kTRUE, |
6 | Bool_t kRunQA = kFALSE) { | |
da8c4c1c | 7 | //Macro to run the proton analysis tested for local, proof & GRID. |
f203beb9 | 8 | //Local: Takes six arguments, the analysis mode, a boolean to define the ESD |
9 | // analysis of MC data, the type of the ESD analysis, the PID mode, | |
10 | // the run number for the offline trigger in case of real data | |
11 | // analysis and the path where the tag and ESD or AOD files reside. | |
12 | //Interactive: Takes six arguments, the analysis mode, a boolean to define | |
13 | // the ESD analysis of MC data, the type of the ESD analysis, | |
14 | // the PID mode, the run number for the offline trigger in case | |
15 | // of real data analysis and the name of the collection of tag | |
0ab648ea | 16 | // files. |
f203beb9 | 17 | //Batch: Takes six arguments, the analysis mode, a boolean to define |
18 | // the ESD analysis of MC data, the type of the ESD analysis, | |
19 | // the PID mode, the run number for the offline trigger in case | |
20 | // of real data analysis and the name of the collection file with | |
0ab648ea | 21 | // the event list for each file. |
f203beb9 | 22 | //Proof: Takes eight arguments, the analysis mode, a boolean to define |
23 | // the ESD analysis of MC data, the type of the ESD analysis, | |
24 | // the PID mode, the run number for the offline trigger in case | |
25 | // of real data analysis, the number of events to be analyzed, | |
26 | // the event number from where we start the analysis and the dataset | |
27 | //======================================================================== | |
da8c4c1c | 28 | //Analysis mode can be: "MC", "ESD", "AOD" |
29 | //ESD analysis type can be one of the three: "TPC", "Hybrid", "Global" | |
87a55728 | 30 | //PID mode can be one of the four: "Bayesian" (standard Bayesian approach) |
0ab648ea | 31 | // "Ratio" (ratio of measured over expected/theoretical dE/dx a la STAR) |
c6909683 | 32 | // "Sigma" (N-sigma area around the fitted dE/dx vs P band) |
734d2c12 | 33 | TStopwatch timer; |
34 | timer.Start(); | |
35 | ||
e56f08ed | 36 | /*runLocal("ESD", |
790140ac | 37 | kAnalyzeMC, |
0ab648ea | 38 | esdAnalysisType, |
1fd2c71b | 39 | pidMode, kUseOnlineTrigger,kUseOfflineTrigger, |
e56f08ed | 40 | "/home/pchrist/ALICE/Baryons/Data/104070");*/ |
1fd2c71b | 41 | //runInteractive("ESD", kAnalyzeMC, esdAnalysisType, pidMode, kUseOnlineTrigger, kUseOfflineTrigger, "tag.xml"); |
42 | //runBatch("ESD", kAnalyzeMC, esdAnalysisType, pidMode, kUseOnlineTrigger, kUseOfflineTrigger, "wn.xml"); | |
43 | runProof("ESD", kAnalyzeMC, esdAnalysisType, pidMode, kUseOnlineTrigger, | |
44 | kUseOfflineTrigger, | |
71a67ee1 | 45 | 500000,0,"/COMMON/COMMON/LHC10a8_run104867_8#esdTree"); |
47e7cd57 | 46 | |
734d2c12 | 47 | timer.Stop(); |
48 | timer.Print(); | |
49 | } | |
50 | ||
51 | //_________________________________________________// | |
da8c4c1c | 52 | void runLocal(const char* mode = "ESD", |
790140ac | 53 | Bool_t kAnalyzeMC = kTRUE, |
da8c4c1c | 54 | const char* analysisType = 0x0, |
0ab648ea | 55 | const char* pidMode = 0x0, |
4de4661f | 56 | Bool_t kUseOnlineTrigger = kTRUE, |
1fd2c71b | 57 | Bool_t kUseOfflineTrigger = kTRUE, |
da8c4c1c | 58 | const char* path = "/home/pchrist/ALICE/Alien/Tutorial/November2007/Tags") { |
da8c4c1c | 59 | TString smode = mode; |
c6909683 | 60 | TString cutFilename = "ListOfCuts."; cutFilename += mode; |
da8c4c1c | 61 | TString outputFilename = "Protons."; outputFilename += mode; |
62 | if(analysisType) { | |
c6909683 | 63 | cutFilename += "."; cutFilename += analysisType; |
da8c4c1c | 64 | outputFilename += "."; outputFilename += analysisType; |
65 | } | |
c6909683 | 66 | if(pidMode) { |
67 | cutFilename += "."; cutFilename += pidMode; | |
68 | outputFilename += "."; outputFilename += pidMode; | |
69 | } | |
70 | cutFilename += ".root"; | |
71 | outputFilename += ".root"; | |
da8c4c1c | 72 | |
734d2c12 | 73 | //____________________________________________________// |
da8c4c1c | 74 | //_____________Setting up the par files_______________// |
734d2c12 | 75 | //____________________________________________________// |
76 | setupPar("STEERBase"); | |
77 | gSystem->Load("libSTEERBase.so"); | |
734d2c12 | 78 | setupPar("ESD"); |
79 | gSystem->Load("libVMC.so"); | |
80 | gSystem->Load("libESD.so"); | |
734d2c12 | 81 | setupPar("AOD"); |
82 | gSystem->Load("libAOD.so"); | |
734d2c12 | 83 | setupPar("ANALYSIS"); |
84 | gSystem->Load("libANALYSIS.so"); | |
e4358d7f | 85 | setupPar("ANALYSISalice"); |
86 | gSystem->Load("libANALYSISalice.so"); | |
0ab648ea | 87 | setupPar("CORRFW"); |
88 | gSystem->Load("libCORRFW.so"); | |
734d2c12 | 89 | setupPar("PWG2spectra"); |
90 | gSystem->Load("libPWG2spectra.so"); | |
da8c4c1c | 91 | //____________________________________________________// |
734d2c12 | 92 | |
93 | //____________________________________________// | |
e4358d7f | 94 | AliTagAnalysis *tagAnalysis = new AliTagAnalysis("ESD"); |
da8c4c1c | 95 | tagAnalysis->ChainLocalTags(path); |
734d2c12 | 96 | |
97 | AliRunTagCuts *runCuts = new AliRunTagCuts(); | |
98 | AliLHCTagCuts *lhcCuts = new AliLHCTagCuts(); | |
99 | AliDetectorTagCuts *detCuts = new AliDetectorTagCuts(); | |
100 | AliEventTagCuts *evCuts = new AliEventTagCuts(); | |
101 | ||
102 | TChain* chain = 0x0; | |
e4358d7f | 103 | chain = tagAnalysis->QueryTags(runCuts,lhcCuts,detCuts,evCuts); |
734d2c12 | 104 | chain->SetBranchStatus("*Calo*",0); |
105 | ||
da8c4c1c | 106 | //____________________________________________// |
0ab648ea | 107 | gROOT->LoadMacro("configProtonAnalysis.C"); |
790140ac | 108 | AliProtonAnalysis *analysis = GetProtonAnalysisObject(mode,kAnalyzeMC, |
0ab648ea | 109 | analysisType, |
4de4661f | 110 | pidMode, |
1fd2c71b | 111 | kUseOnlineTrigger, |
2f6dae44 | 112 | kUseOfflineTrigger, |
113 | kRunQA); | |
734d2c12 | 114 | //____________________________________________// |
115 | // Make the analysis manager | |
e7df5638 | 116 | AliAnalysisManager *mgr = new AliAnalysisManager("protonAnalysisManager"); |
734d2c12 | 117 | AliVEventHandler* esdH = new AliESDInputHandler; |
118 | mgr->SetInputEventHandler(esdH); | |
6667f3a7 | 119 | if(smode == "MC") { |
120 | AliMCEventHandler *mc = new AliMCEventHandler(); | |
121 | mgr->SetMCtruthEventHandler(mc); | |
122 | } | |
0ab648ea | 123 | |
734d2c12 | 124 | //____________________________________________// |
0ab648ea | 125 | //Create the proton task |
e4358d7f | 126 | AliAnalysisTaskProtons *taskProtons = new AliAnalysisTaskProtons("TaskProtons"); |
0ab648ea | 127 | taskProtons->SetAnalysisObject(analysis); |
e4358d7f | 128 | mgr->AddTask(taskProtons); |
129 | ||
0ab648ea | 130 | // Create containers for input/output |
bf80af3b | 131 | AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer(); |
0ab648ea | 132 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("outputList", |
251e4034 | 133 | TList::Class(), |
0ab648ea | 134 | AliAnalysisManager::kOutputContainer, |
da8c4c1c | 135 | outputFilename.Data()); |
735cc63d | 136 | AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("outputQAList", |
137 | TList::Class(), | |
138 | AliAnalysisManager::kOutputContainer, | |
139 | outputFilename.Data()); | |
0894be86 | 140 | /*AliAnalysisDataContainer *coutput3 = mgr->CreateContainer("cutCanvas", |
c6909683 | 141 | TCanvas::Class(), |
142 | AliAnalysisManager::kOutputContainer, | |
0894be86 | 143 | outputFilename.Data());*/ |
734d2c12 | 144 | |
734d2c12 | 145 | //____________________________________________// |
e4358d7f | 146 | mgr->ConnectInput(taskProtons,0,cinput1); |
147 | mgr->ConnectOutput(taskProtons,0,coutput1); | |
735cc63d | 148 | mgr->ConnectOutput(taskProtons,1,coutput2); |
0894be86 | 149 | //mgr->ConnectOutput(taskProtons,2,coutput3); |
734d2c12 | 150 | if (!mgr->InitAnalysis()) return; |
151 | mgr->PrintStatus(); | |
152 | mgr->StartAnalysis("local",chain); | |
734d2c12 | 153 | } |
154 | ||
155 | //_________________________________________________// | |
da8c4c1c | 156 | void runInteractive(const char* mode = "ESD", |
790140ac | 157 | Bool_t kAnalyzeMC = kTRUE, |
da8c4c1c | 158 | const char* analysisType = 0x0, |
0ab648ea | 159 | const char* pidMode = 0x0, |
4de4661f | 160 | Bool_t kUseOnlineTrigger = kTRUE, |
1fd2c71b | 161 | Bool_t kUseOfflineTrigger = kTRUE, |
da8c4c1c | 162 | const char* collectionName = "tag.xml") { |
734d2c12 | 163 | gSystem->Load("libProofPlayer.so"); |
c6909683 | 164 | |
da8c4c1c | 165 | TString smode = mode; |
c6909683 | 166 | TString cutFilename = "ListOfCuts."; cutFilename += mode; |
da8c4c1c | 167 | TString outputFilename = "Protons."; outputFilename += mode; |
168 | if(analysisType) { | |
c6909683 | 169 | cutFilename += "."; cutFilename += analysisType; |
da8c4c1c | 170 | outputFilename += "."; outputFilename += analysisType; |
171 | } | |
c6909683 | 172 | if(pidMode) { |
173 | cutFilename += "."; cutFilename += pidMode; | |
174 | outputFilename += "."; outputFilename += pidMode; | |
175 | } | |
176 | cutFilename += ".root"; | |
da8c4c1c | 177 | outputFilename += ".root"; |
178 | ||
734d2c12 | 179 | printf("*** Connect to AliEn ***\n"); |
180 | TGrid::Connect("alien://"); | |
181 | ||
182 | //____________________________________________________// | |
da8c4c1c | 183 | //_____________Setting up the par files_______________// |
734d2c12 | 184 | //____________________________________________________// |
185 | setupPar("STEERBase"); | |
186 | gSystem->Load("libSTEERBase.so"); | |
734d2c12 | 187 | setupPar("ESD"); |
188 | gSystem->Load("libVMC.so"); | |
189 | gSystem->Load("libESD.so"); | |
734d2c12 | 190 | setupPar("AOD"); |
191 | gSystem->Load("libAOD.so"); | |
734d2c12 | 192 | setupPar("ANALYSIS"); |
193 | gSystem->Load("libANALYSIS.so"); | |
e4358d7f | 194 | setupPar("ANALYSISalice"); |
195 | gSystem->Load("libANALYSISalice.so"); | |
0ab648ea | 196 | setupPar("CORRFW"); |
197 | gSystem->Load("libCORRFW.so"); | |
734d2c12 | 198 | setupPar("PWG2spectra"); |
199 | gSystem->Load("libPWG2spectra.so"); | |
da8c4c1c | 200 | //____________________________________________________// |
734d2c12 | 201 | |
202 | //____________________________________________// | |
e4358d7f | 203 | AliTagAnalysis *tagAnalysis = new AliTagAnalysis("ESD"); |
734d2c12 | 204 | |
205 | AliRunTagCuts *runCuts = new AliRunTagCuts(); | |
206 | AliLHCTagCuts *lhcCuts = new AliLHCTagCuts(); | |
207 | AliDetectorTagCuts *detCuts = new AliDetectorTagCuts(); | |
208 | AliEventTagCuts *evCuts = new AliEventTagCuts(); | |
209 | ||
210 | //grid tags | |
da8c4c1c | 211 | TAlienCollection* coll = TAlienCollection::Open(collectionName); |
734d2c12 | 212 | TGridResult* TagResult = coll->GetGridResult("",0,0); |
e4358d7f | 213 | tagAnalysis->ChainGridTags(TagResult); |
734d2c12 | 214 | TChain* chain = 0x0; |
e4358d7f | 215 | chain = tagAnalysis->QueryTags(runCuts,lhcCuts,detCuts,evCuts); |
734d2c12 | 216 | chain->SetBranchStatus("*Calo*",0); |
da8c4c1c | 217 | |
218 | //____________________________________________// | |
0ab648ea | 219 | gROOT->LoadMacro("configProtonAnalysis.C"); |
790140ac | 220 | AliProtonAnalysis *analysis = GetProtonAnalysisObject(mode,kAnalyzeMC, |
0ab648ea | 221 | analysisType, |
4de4661f | 222 | pidMode, |
1fd2c71b | 223 | kUseOnlineTrigger, |
2f6dae44 | 224 | kUseOfflineTrigger, |
225 | kRunQA); | |
df201289 | 226 | //runNumberForOfflineTtrigger); |
734d2c12 | 227 | //____________________________________________// |
228 | // Make the analysis manager | |
e7df5638 | 229 | AliAnalysisManager *mgr = new AliAnalysisManager("protonAnalysisManager"); |
734d2c12 | 230 | AliVEventHandler* esdH = new AliESDInputHandler; |
231 | mgr->SetInputEventHandler(esdH); | |
6667f3a7 | 232 | if(smode == "MC") { |
233 | AliMCEventHandler *mc = new AliMCEventHandler(); | |
234 | mgr->SetMCtruthEventHandler(mc); | |
235 | } | |
236 | ||
734d2c12 | 237 | //____________________________________________// |
0ab648ea | 238 | //Create the proton task |
e4358d7f | 239 | AliAnalysisTaskProtons *taskProtons = new AliAnalysisTaskProtons("TaskProtons"); |
0ab648ea | 240 | taskProtons->SetAnalysisObject(analysis); |
e4358d7f | 241 | mgr->AddTask(taskProtons); |
242 | ||
0ab648ea | 243 | // Create containers for input/output |
bf80af3b | 244 | AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer(); |
0ab648ea | 245 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("outputList", |
251e4034 | 246 | TList::Class(), |
0ab648ea | 247 | AliAnalysisManager::kOutputContainer, |
da8c4c1c | 248 | outputFilename.Data()); |
735cc63d | 249 | AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("outputQAList", |
250 | TList::Class(), | |
251 | AliAnalysisManager::kOutputContainer, | |
252 | outputFilename.Data()); | |
0894be86 | 253 | /*AliAnalysisDataContainer *coutput3 = mgr->CreateContainer("cutCanvas", |
c6909683 | 254 | TCanvas::Class(), |
255 | AliAnalysisManager::kOutputContainer, | |
0894be86 | 256 | outputFilename.Data());*/ |
735cc63d | 257 | |
734d2c12 | 258 | //____________________________________________// |
e4358d7f | 259 | mgr->ConnectInput(taskProtons,0,cinput1); |
260 | mgr->ConnectOutput(taskProtons,0,coutput1); | |
735cc63d | 261 | mgr->ConnectOutput(taskProtons,1,coutput2); |
0894be86 | 262 | //mgr->ConnectOutput(taskProtons,2,coutput3); |
734d2c12 | 263 | if (!mgr->InitAnalysis()) return; |
264 | mgr->PrintStatus(); | |
265 | mgr->StartAnalysis("local",chain); | |
734d2c12 | 266 | } |
267 | ||
268 | //_________________________________________________// | |
da8c4c1c | 269 | void runBatch(const char* mode = "ESD", |
790140ac | 270 | Bool_t kAnalyzeMC = kTRUE, |
da8c4c1c | 271 | const char* analysisType = 0x0, |
0ab648ea | 272 | const char* pidMode = 0x0, |
4de4661f | 273 | Bool_t kUseOnlineTrigger = kTRUE, |
1fd2c71b | 274 | Bool_t kUseOfflineTrigger = kTRUE, |
da8c4c1c | 275 | const char *collectionfile = "wn.xml") { |
da8c4c1c | 276 | TString smode = mode; |
c6909683 | 277 | TString cutFilename = "ListOfCuts."; cutFilename += mode; |
da8c4c1c | 278 | TString outputFilename = "Protons."; outputFilename += mode; |
279 | if(analysisType) { | |
c6909683 | 280 | cutFilename += "."; cutFilename += analysisType; |
da8c4c1c | 281 | outputFilename += "."; outputFilename += analysisType; |
282 | } | |
c6909683 | 283 | if(pidMode) { |
284 | cutFilename += "."; cutFilename += pidMode; | |
285 | outputFilename += "."; outputFilename += pidMode; | |
286 | } | |
287 | cutFilename += ".root"; | |
da8c4c1c | 288 | outputFilename += ".root"; |
289 | ||
734d2c12 | 290 | printf("*** Connect to AliEn ***\n"); |
291 | TGrid::Connect("alien://"); | |
292 | gSystem->Load("libProofPlayer.so"); | |
293 | ||
294 | //____________________________________________________// | |
da8c4c1c | 295 | //_____________Setting up the par files_______________// |
734d2c12 | 296 | //____________________________________________________// |
297 | setupPar("STEERBase"); | |
298 | gSystem->Load("libSTEERBase.so"); | |
734d2c12 | 299 | setupPar("ESD"); |
300 | gSystem->Load("libVMC.so"); | |
301 | gSystem->Load("libESD.so"); | |
734d2c12 | 302 | setupPar("AOD"); |
303 | gSystem->Load("libAOD.so"); | |
734d2c12 | 304 | setupPar("ANALYSIS"); |
305 | gSystem->Load("libANALYSIS.so"); | |
e4358d7f | 306 | setupPar("ANALYSISalice"); |
307 | gSystem->Load("libANALYSISalice.so"); | |
0ab648ea | 308 | setupPar("CORRFW"); |
309 | gSystem->Load("libCORRFW.so"); | |
734d2c12 | 310 | setupPar("PWG2spectra"); |
311 | gSystem->Load("libPWG2spectra.so"); | |
da8c4c1c | 312 | //____________________________________________________// |
734d2c12 | 313 | |
314 | //____________________________________________// | |
315 | //Usage of event tags | |
e4358d7f | 316 | AliTagAnalysis *tagAnalysis = new AliTagAnalysis(); |
734d2c12 | 317 | TChain *chain = 0x0; |
e4358d7f | 318 | chain = tagAnalysis->GetChainFromCollection(collectionfile,"esdTree"); |
734d2c12 | 319 | chain->SetBranchStatus("*Calo*",0); |
320 | ||
da8c4c1c | 321 | //____________________________________________// |
0ab648ea | 322 | gROOT->LoadMacro("configProtonAnalysis.C"); |
790140ac | 323 | AliProtonAnalysis *analysis = GetProtonAnalysisObject(mode,kAnalyzeMC, |
0ab648ea | 324 | analysisType, |
4de4661f | 325 | pidMode, |
1fd2c71b | 326 | kUseOnlineTrigger, |
2f6dae44 | 327 | kUseOfflineTrigger, |
328 | kRunQA); | |
df201289 | 329 | //runNumberForOfflineTtrigger); |
734d2c12 | 330 | //____________________________________________// |
331 | // Make the analysis manager | |
e7df5638 | 332 | AliAnalysisManager *mgr = new AliAnalysisManager("protonAnalysisManager"); |
734d2c12 | 333 | AliVEventHandler* esdH = new AliESDInputHandler; |
334 | mgr->SetInputEventHandler(esdH); | |
6667f3a7 | 335 | if(smode == "MC") { |
336 | AliMCEventHandler *mc = new AliMCEventHandler(); | |
337 | mgr->SetMCtruthEventHandler(mc); | |
338 | } | |
339 | ||
734d2c12 | 340 | //____________________________________________// |
0ab648ea | 341 | //Create the proton task |
e4358d7f | 342 | AliAnalysisTaskProtons *taskProtons = new AliAnalysisTaskProtons("TaskProtons"); |
0ab648ea | 343 | taskProtons->SetAnalysisObject(analysis); |
e4358d7f | 344 | mgr->AddTask(taskProtons); |
345 | ||
0ab648ea | 346 | // Create containers for input/output |
bf80af3b | 347 | AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer(); |
0ab648ea | 348 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("outputList", |
349 | TList::Class(), | |
350 | AliAnalysisManager::kOutputContainer, | |
da8c4c1c | 351 | outputFilename.Data()); |
735cc63d | 352 | AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("outputQAList", |
353 | TList::Class(), | |
354 | AliAnalysisManager::kOutputContainer, | |
355 | outputFilename.Data()); | |
0894be86 | 356 | /*AliAnalysisDataContainer *coutput3 = mgr->CreateContainer("cutCanvas", |
c6909683 | 357 | TCanvas::Class(), |
358 | AliAnalysisManager::kOutputContainer, | |
0894be86 | 359 | outputFilename.Data());*/ |
735cc63d | 360 | |
734d2c12 | 361 | //____________________________________________// |
e4358d7f | 362 | mgr->ConnectInput(taskProtons,0,cinput1); |
363 | mgr->ConnectOutput(taskProtons,0,coutput1); | |
735cc63d | 364 | mgr->ConnectOutput(taskProtons,1,coutput2); |
0894be86 | 365 | //mgr->ConnectOutput(taskProtons,2,coutput3); |
734d2c12 | 366 | if (!mgr->InitAnalysis()) return; |
367 | mgr->PrintStatus(); | |
368 | mgr->StartAnalysis("grid",chain); | |
734d2c12 | 369 | } |
370 | ||
371 | //_________________________________________________// | |
da8c4c1c | 372 | void runProof(const char* mode = "ESD", |
790140ac | 373 | Bool_t kAnalyzeMC = kTRUE, |
0ab648ea | 374 | const char* analysisType = 0x0, |
375 | const char* pidMode = 0x0, | |
4de4661f | 376 | Bool_t kUseOnlineTrigger = kTRUE, |
1fd2c71b | 377 | Bool_t kUseOfflineTrigger = kTRUE, |
f62e9410 | 378 | Int_t stats = 0, Int_t startingPoint = 0, |
0ab648ea | 379 | const char* dataset = 0x0) { |
df01f00b | 380 | TString smode = mode; |
c6909683 | 381 | TString cutFilename = "ListOfCuts."; cutFilename += mode; |
df01f00b | 382 | TString outputFilename = "Protons."; outputFilename += mode; |
da8c4c1c | 383 | if(analysisType) { |
c6909683 | 384 | cutFilename += "."; cutFilename += analysisType; |
da8c4c1c | 385 | outputFilename += "."; outputFilename += analysisType; |
386 | } | |
c6909683 | 387 | if(pidMode) { |
388 | cutFilename += "."; cutFilename += pidMode; | |
389 | outputFilename += "."; outputFilename += pidMode; | |
390 | } | |
391 | cutFilename += ".root"; | |
df01f00b | 392 | outputFilename += ".root"; |
393 | ||
f62e9410 | 394 | gEnv->SetValue("XSec.GSI.DelegProxy","2"); |
734d2c12 | 395 | printf("****** Connect to PROOF *******\n"); |
96f84c25 | 396 | TProof::Open("alicecaf.cern.ch"); |
aafecd8b | 397 | gProof->SetParallel(); |
734d2c12 | 398 | |
399 | // Enable the Analysis Package | |
400 | gProof->UploadPackage("STEERBase.par"); | |
401 | gProof->EnablePackage("STEERBase"); | |
402 | gProof->UploadPackage("ESD.par"); | |
403 | gProof->EnablePackage("ESD"); | |
404 | gProof->UploadPackage("AOD.par"); | |
405 | gProof->EnablePackage("AOD"); | |
406 | gProof->UploadPackage("ANALYSIS.par"); | |
407 | gProof->EnablePackage("ANALYSIS"); | |
e4358d7f | 408 | gProof->UploadPackage("ANALYSISalice.par"); |
409 | gProof->EnablePackage("ANALYSISalice"); | |
251e4034 | 410 | gProof->UploadPackage("CORRFW.par"); |
411 | gProof->EnablePackage("CORRFW"); | |
734d2c12 | 412 | gProof->UploadPackage("PWG2spectra.par"); |
413 | gProof->EnablePackage("PWG2spectra"); | |
414 | ||
da8c4c1c | 415 | //____________________________________________// |
0ab648ea | 416 | gROOT->LoadMacro("configProtonAnalysis.C"); |
790140ac | 417 | AliProtonAnalysis *analysis = GetProtonAnalysisObject(mode,kAnalyzeMC, |
0ab648ea | 418 | analysisType, |
4de4661f | 419 | pidMode, |
1fd2c71b | 420 | kUseOnlineTrigger, |
2f6dae44 | 421 | kUseOfflineTrigger, |
422 | kRunQA); | |
da8c4c1c | 423 | //____________________________________________// |
734d2c12 | 424 | |
e4358d7f | 425 | //____________________________________________// |
734d2c12 | 426 | // Make the analysis manager |
e7df5638 | 427 | AliAnalysisManager *mgr = new AliAnalysisManager("protonAnalysisManager"); |
734d2c12 | 428 | AliVEventHandler* esdH = new AliESDInputHandler; |
df01f00b | 429 | mgr->SetInputEventHandler(esdH); |
430 | if(smode == "MC") { | |
431 | AliMCEventHandler *mc = new AliMCEventHandler(); | |
432 | mgr->SetMCtruthEventHandler(mc); | |
433 | } | |
734d2c12 | 434 | //____________________________________________// |
0ab648ea | 435 | //Create the proton task |
e4358d7f | 436 | AliAnalysisTaskProtons *taskProtons = new AliAnalysisTaskProtons("TaskProtons"); |
0ab648ea | 437 | taskProtons->SetAnalysisObject(analysis); |
e4358d7f | 438 | mgr->AddTask(taskProtons); |
734d2c12 | 439 | |
440 | // Create containers for input/output | |
f62e9410 | 441 | AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer(); |
0ab648ea | 442 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("outputList", |
443 | TList::Class(), | |
251e4034 | 444 | AliAnalysisManager::kOutputContainer, |
0ab648ea | 445 | outputFilename.Data()); |
735cc63d | 446 | AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("outputQAList", |
447 | TList::Class(), | |
448 | AliAnalysisManager::kOutputContainer, | |
449 | outputFilename.Data()); | |
0894be86 | 450 | /*AliAnalysisDataContainer *coutput3 = mgr->CreateContainer("cutCanvas", |
c6909683 | 451 | TCanvas::Class(), |
452 | AliAnalysisManager::kOutputContainer, | |
0894be86 | 453 | outputFilename.Data());*/ |
df01f00b | 454 | |
734d2c12 | 455 | //____________________________________________// |
e4358d7f | 456 | mgr->ConnectInput(taskProtons,0,cinput1); |
457 | mgr->ConnectOutput(taskProtons,0,coutput1); | |
735cc63d | 458 | mgr->ConnectOutput(taskProtons,1,coutput2); |
0894be86 | 459 | //mgr->ConnectOutput(taskProtons,3,coutput3); |
734d2c12 | 460 | if (!mgr->InitAnalysis()) return; |
461 | mgr->PrintStatus(); | |
e4358d7f | 462 | |
463 | if(dataset) | |
f62e9410 | 464 | mgr->StartAnalysis("proof",dataset,stats,startingPoint); |
e4358d7f | 465 | else { |
466 | // You should get this macro and the txt file from: | |
467 | // http://aliceinfo.cern.ch/Offline/Analysis/CAF/ | |
468 | gROOT->LoadMacro("CreateESDChain.C"); | |
469 | TChain* chain = 0x0; | |
470 | chain = CreateESDChain("ESD82XX_30K.txt",stats); | |
471 | chain->SetBranchStatus("*Calo*",0); | |
472 | ||
473 | mgr->StartAnalysis("proof",chain); | |
474 | } | |
734d2c12 | 475 | } |
476 | ||
477 | //_________________________________________________// | |
478 | Int_t setupPar(const char* pararchivename) { | |
479 | /////////////////// | |
480 | // Setup PAR File// | |
481 | /////////////////// | |
482 | if (pararchivename) { | |
483 | char processline[1024]; | |
484 | sprintf(processline,".! tar xvzf %s.par",pararchivename); | |
485 | gROOT->ProcessLine(processline); | |
486 | const char* ocwd = gSystem->WorkingDirectory(); | |
487 | gSystem->ChangeDirectory(pararchivename); | |
488 | ||
489 | // check for BUILD.sh and execute | |
490 | if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) { | |
491 | printf("*******************************\n"); | |
492 | printf("*** Building PAR archive ***\n"); | |
493 | printf("*******************************\n"); | |
494 | ||
495 | if (gSystem->Exec("PROOF-INF/BUILD.sh")) { | |
496 | Error("runAnalysis","Cannot Build the PAR Archive! - Abort!"); | |
497 | return -1; | |
498 | } | |
499 | } | |
500 | // check for SETUP.C and execute | |
501 | if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) { | |
502 | printf("*******************************\n"); | |
503 | printf("*** Setup PAR archive ***\n"); | |
504 | printf("*******************************\n"); | |
505 | gROOT->Macro("PROOF-INF/SETUP.C"); | |
506 | } | |
507 | ||
508 | gSystem->ChangeDirectory("../"); | |
509 | } | |
510 | return 1; | |
511 | } |