fixing warnings
[u/mrichter/AliRoot.git] / PWG0 / multiplicity / run.C
CommitLineData
745d6088 1void run(Char_t* data, Long64_t nRuns = -1, Long64_t offset = 0, Bool_t aDebug = kFALSE, Int_t aProof = 0, Bool_t mc = kTRUE, const char* option = "")
a9017e49 2{
745d6088 3 // aProof option: 0 no proof
4 // 1 proof with chain
5 // 2 proof with dataset
6
7 if (nRuns < 0)
8 nRuns = 1234567890;
9
a9017e49 10 if (aProof)
11 {
12 TProof::Open("lxb6046");
13
14 // Enable the needed package
745d6088 15 /*gProof->UploadPackage("STEERBase");
a9017e49 16 gProof->EnablePackage("STEERBase");
17 gProof->UploadPackage("ESD");
18 gProof->EnablePackage("ESD");
144ff489 19 gProof->UploadPackage("AOD");
20 gProof->EnablePackage("AOD");
a9017e49 21 gProof->UploadPackage("ANALYSIS");
745d6088 22 gProof->EnablePackage("ANALYSIS");*/
23
24 gProof->UploadPackage("$ALICE_ROOT/AF-v4-12");
25 gProof->EnablePackage("$ALICE_ROOT/AF-v4-12");
26
27 gProof->UploadPackage("$ALICE_ROOT/PWG0base");
28 gProof->EnablePackage("$ALICE_ROOT/PWG0base");
a9017e49 29 }
30 else
31 {
32 gSystem->Load("libVMC");
33 gSystem->Load("libTree");
34 gSystem->Load("libSTEERBase");
35 gSystem->Load("libESD");
a9017e49 36 gSystem->Load("libANALYSIS");
37 gSystem->Load("libPWG0base");
38 }
39
a9017e49 40 // Create the analysis manager
41 mgr = new AliAnalysisManager("testAnalysis");
42
745d6088 43 AliPWG0Helper::AnalysisMode analysisMode = AliPWG0Helper::kSPD;
44
a9017e49 45 // selection of esd tracks
745d6088 46 gROOT->ProcessLine(".L ../CreateStandardCuts.C");
47 AliESDtrackCuts* esdTrackCuts = CreateTrackCuts(analysisMode);
a9017e49 48 if (!esdTrackCuts)
49 {
50 printf("ERROR: esdTrackCuts could not be created\n");
51 return;
52 }
53
54 TString taskName("AliMultiplicityTask.cxx+");
55 if (aDebug)
56 taskName += "+g";
57
58 // Create, add task
745d6088 59 if (aProof > 0) {
a9017e49 60 gProof->Load(taskName);
61 } else
62 gROOT->Macro(taskName);
63
2fa65f52 64 task = new AliMultiplicityTask(option);
a9017e49 65 task->SetTrackCuts(esdTrackCuts);
745d6088 66 task->SetAnalysisMode(analysisMode);
2fa65f52 67
68 if (mc)
69 task->SetReadMC();
70
a9017e49 71 mgr->AddTask(task);
72
2fa65f52 73 if (mc) {
74 // Enable MC event handler
75 AliMCEventHandler* handler = new AliMCEventHandler;
76 handler->SetReadTR(kFALSE);
77 mgr->SetMCtruthEventHandler(handler);
78 }
a9017e49 79
80 // Add ESD handler
81 AliESDInputHandler* esdH = new AliESDInputHandler;
82 mgr->SetInputEventHandler(esdH);
83
84 // Attach input
85 cInput = mgr->CreateContainer("cInput", TChain::Class(), AliAnalysisManager::kInputContainer);
86 mgr->ConnectInput(task, 0, cInput);
87
88 // Attach output
89 cOutput = mgr->CreateContainer("cOutput", TList::Class(), AliAnalysisManager::kOutputContainer);
90 //cOutput->SetDataOwned(kTRUE);
91 mgr->ConnectOutput(task, 0, cOutput);
92
93 // Enable debug printouts
94 if (aDebug)
95 mgr->SetDebugLevel(2);
96
97 // Run analysis
98 mgr->InitAnalysis();
99 mgr->PrintStatus();
745d6088 100
101 if (aProof == 2)
102 {
103 // process dataset
104
105 mgr->StartAnalysis("proof", data, nRuns, offset);
106 }
107 else
108 {
109 // Create chain of input files
110 gROOT->LoadMacro("../CreateESDChain.C");
111 chain = CreateESDChain(data, nRuns, offset);
112
113 mgr->StartAnalysis((aProof > 0) ? "proof" : "local", chain);
114 }
115
a9017e49 116}