]>
Commit | Line | Data |
---|---|---|
7a1ac44b | 1 | void Load(const char* taskName, Bool_t debug) |
2 | { | |
3 | TString compileTaskName; | |
51f6de65 | 4 | compileTaskName.Form("%s.cxx++", taskName); |
7a1ac44b | 5 | if (debug) |
51f6de65 | 6 | compileTaskName += "g"; |
7a1ac44b | 7 | |
8 | if (gProof) { | |
9 | gProof->Load(compileTaskName); | |
10 | } else | |
11 | gROOT->Macro(compileTaskName); | |
12 | ||
13 | // Enable debug printouts | |
14 | if (debug) | |
15 | { | |
16 | AliLog::SetClassDebugLevel(taskName, AliLog::kDebug+2); | |
17 | } | |
18 | else | |
19 | AliLog::SetClassDebugLevel(taskName, AliLog::kWarning); | |
20 | } | |
21 | ||
12bb57f1 | 22 | void run(Int_t runWhat, const Char_t* data, Int_t nRuns=20, Int_t offset=0, Bool_t aDebug = kFALSE, Int_t aProof = kFALSE, Int_t requiredData = 1, const char* option = "", const char* requireClass = "", const char* rejectClass = "") |
0f67a57c | 23 | { |
0fc41645 | 24 | // runWhat options: 0 = AlidNdEtaTask |
25 | // 1 = AlidNdEtaCorrectionTask | |
7a1ac44b | 26 | // 2 = both |
0fc41645 | 27 | // |
28 | // aProof option: 0 no proof | |
29 | // 1 proof with chain | |
30 | // 2 proof with dataset | |
a7f69e56 | 31 | // |
12bb57f1 | 32 | // requiredData option: 0 = only ESD |
33 | // 1 = ESD+MC | |
34 | // 2 = RAW (ESD+check on event type) | |
35 | // | |
a7f69e56 | 36 | // option is passed to the task(s) |
37 | // option SAVE is removed and results in moving the output files to maps/<ds name>/<trigger>/<det> | |
38 | // | |
69b09e3b | 39 | |
0fc41645 | 40 | TString taskName; |
7a1ac44b | 41 | if (runWhat == 0 || runWhat == 2) |
0fc41645 | 42 | { |
7a1ac44b | 43 | Printf("Running AlidNdEtaTask"); |
0fc41645 | 44 | } |
7a1ac44b | 45 | if (runWhat == 1 || runWhat == 2) |
0fc41645 | 46 | { |
7a1ac44b | 47 | Printf("Running AlidNdEtaCorrectionTask"); |
12bb57f1 | 48 | if (requiredData != 1) |
0fc41645 | 49 | { |
7a1ac44b | 50 | Printf("AlidNdEtaCorrectionTask needs MC. Exiting..."); |
0fc41645 | 51 | return; |
52 | } | |
53 | } | |
0fc41645 | 54 | |
55 | if (nRuns < 0) | |
56 | nRuns = 1234567890; | |
57 | ||
0f67a57c | 58 | if (aProof) |
59 | { | |
12bb57f1 | 60 | TProof::Mgr("alicecaf")->SetROOTVersion("v5-24-00a"); |
a7f69e56 | 61 | TProof::Open("alicecaf"); |
12bb57f1 | 62 | //gProof->SetParallel(2); |
63 | //gProof->SetParameter("PROOF_Packetizer", "TPacketizer"); | |
0f67a57c | 64 | |
12bb57f1 | 65 | Bool_t fullAliroot = kFALSE; |
0f67a57c | 66 | // Enable the needed package |
567160d6 | 67 | if (1) |
68 | { | |
69 | gProof->UploadPackage("$ALICE_ROOT/STEERBase"); | |
70 | gProof->EnablePackage("$ALICE_ROOT/STEERBase"); | |
71 | gProof->UploadPackage("$ALICE_ROOT/ESD"); | |
72 | gProof->EnablePackage("$ALICE_ROOT/ESD"); | |
73 | gProof->UploadPackage("$ALICE_ROOT/AOD"); | |
74 | gProof->EnablePackage("$ALICE_ROOT/AOD"); | |
75 | gProof->UploadPackage("$ALICE_ROOT/ANALYSIS"); | |
76 | gProof->EnablePackage("$ALICE_ROOT/ANALYSIS"); | |
77 | gProof->UploadPackage("$ALICE_ROOT/ANALYSISalice"); | |
78 | gProof->EnablePackage("$ALICE_ROOT/ANALYSISalice"); | |
79 | } | |
12bb57f1 | 80 | else if (!fullAliroot) |
81 | { | |
82 | gProof->UploadPackage("$ALICE_ROOT/AF-v4-18-12-AN.par"); | |
83 | gProof->EnablePackage("AF-v4-18-12-AN"); | |
84 | } | |
567160d6 | 85 | else |
86 | { | |
12bb57f1 | 87 | // needed if ITS recpoints are accessed, see AlidNdEtaTask, FULLALIROOT define statement |
88 | gProof->UploadPackage("$ALICE_ROOT/v4-18-12-AN-all.par"); | |
89 | gProof->EnablePackage("v4-18-12-AN-all"); | |
90 | ||
91 | gProof->Exec("TGrid::Connect(\"alien://\")", kTRUE); | |
92 | ||
93 | // TODO add this to loadlibs.C | |
94 | gProof->Exec("gSystem->Load(\"libXMLParser\")", kTRUE); | |
567160d6 | 95 | } |
0fc41645 | 96 | |
97 | gProof->UploadPackage("$ALICE_ROOT/PWG0base"); | |
98 | gProof->EnablePackage("$ALICE_ROOT/PWG0base"); | |
0f67a57c | 99 | } |
100 | else | |
101 | { | |
69b09e3b | 102 | gSystem->AddIncludePath("-I${ALICE_ROOT}/include/ -I${ALICE_ROOT}/PWG0/ -I${ALICE_ROOT}/PWG0/dNdEta/"); |
0f67a57c | 103 | gSystem->Load("libVMC"); |
104 | gSystem->Load("libTree"); | |
69b09e3b | 105 | gSystem->Load("libProof"); |
0f67a57c | 106 | gSystem->Load("libSTEERBase"); |
107 | gSystem->Load("libESD"); | |
1c15d51a | 108 | gSystem->Load("libAOD"); |
0f67a57c | 109 | gSystem->Load("libANALYSIS"); |
745d6088 | 110 | gSystem->Load("libANALYSISalice"); |
0f67a57c | 111 | gSystem->Load("libPWG0base"); |
112 | } | |
113 | ||
0f67a57c | 114 | // Create the analysis manager |
115 | mgr = new AliAnalysisManager; | |
116 | ||
861795a8 | 117 | // Add ESD handler |
1d107532 | 118 | |
12bb57f1 | 119 | if (fullAliroot) |
120 | AliESDInputHandler* esdH = new AliESDInputHandlerRP; // for RecPoints | |
121 | else | |
122 | AliESDInputHandler* esdH = new AliESDInputHandlerRP; | |
123 | ||
124 | esdH->SetInactiveBranches("AliESDACORDE FMD AliRawDataErrorLogs CaloClusters Cascades EMCALCells EMCALTrigger ESDfriend Kinks Kinks Cascades ALIESDACORDE MuonTracks TrdTracks CaloClusters"); | |
861795a8 | 125 | mgr->SetInputEventHandler(esdH); |
126 | ||
70fdd197 | 127 | AliPWG0Helper::AnalysisMode analysisMode = AliPWG0Helper::kSPD | AliPWG0Helper::kFieldOn; |
1d107532 | 128 | AliTriggerAnalysis::Trigger trigger = AliTriggerAnalysis::kSPDGFOBits | AliTriggerAnalysis::kOfflineFlag; // AcceptAll; |
0fc41645 | 129 | |
130 | AliPWG0Helper::PrintConf(analysisMode, trigger); | |
770a1f1d | 131 | |
0fc41645 | 132 | AliESDtrackCuts* esdTrackCuts = 0; |
a7f69e56 | 133 | if (!(analysisMode & AliPWG0Helper::kSPD)) |
770a1f1d | 134 | { |
135 | // selection of esd tracks | |
136 | gROOT->ProcessLine(".L ../CreateStandardCuts.C"); | |
0fc41645 | 137 | esdTrackCuts = CreateTrackCuts(analysisMode); |
770a1f1d | 138 | if (!esdTrackCuts) |
139 | { | |
140 | printf("ERROR: esdTrackCuts could not be created\n"); | |
141 | return; | |
142 | } | |
1c15d51a | 143 | esdTrackCuts->SetHistogramsOn(kTRUE); |
0fc41645 | 144 | } |
145 | ||
a7f69e56 | 146 | cInput = mgr->GetCommonInputContainer(); |
147 | ||
148 | // remove SAVE option if set | |
149 | Bool_t save = kFALSE; | |
150 | TString optStr(option); | |
151 | if (optStr.Contains("SAVE")) | |
152 | { | |
153 | optStr = optStr(0,optStr.Index("SAVE")) + optStr(optStr.Index("SAVE")+4, optStr.Length()); | |
154 | save = kTRUE; | |
155 | } | |
156 | ||
7a1ac44b | 157 | // Create, add task |
158 | if (runWhat == 0 || runWhat == 2) | |
0fc41645 | 159 | { |
7a1ac44b | 160 | Load("AlidNdEtaTask", aDebug); |
a7f69e56 | 161 | task = new AlidNdEtaTask(optStr); |
770a1f1d | 162 | |
12bb57f1 | 163 | if (requiredData == 1) |
0fc41645 | 164 | task->SetReadMC(); |
165 | ||
51f6de65 | 166 | // syst. error flags |
0fc41645 | 167 | //task->SetUseMCVertex(); |
168 | //task->SetUseMCKine(); | |
7a1ac44b | 169 | //task->SetOnlyPrimaries(); |
69b09e3b | 170 | //task->SetFillPhi(); |
1d107532 | 171 | //task->SetSymmetrize(); |
69b09e3b | 172 | |
7a1ac44b | 173 | task->SetTrigger(trigger); |
174 | task->SetAnalysisMode(analysisMode); | |
175 | task->SetTrackCuts(esdTrackCuts); | |
a7f69e56 | 176 | //task->SetDeltaPhiCut(0.05); |
1d107532 | 177 | |
12bb57f1 | 178 | if (requiredData == 2) |
179 | task->SetCheckEventType(); | |
180 | task->SetTriggerClasses(requireClass, rejectClass); | |
7a1ac44b | 181 | |
182 | mgr->AddTask(task); | |
51f6de65 | 183 | |
7a1ac44b | 184 | // Attach input |
185 | mgr->ConnectInput(task, 0, cInput); | |
186 | ||
187 | // Attach output | |
188 | cOutput = mgr->CreateContainer("cOutput", TList::Class(), AliAnalysisManager::kOutputContainer); | |
189 | mgr->ConnectOutput(task, 0, cOutput); | |
770a1f1d | 190 | } |
7a1ac44b | 191 | if (runWhat == 1 || runWhat == 2) |
0fc41645 | 192 | { |
7a1ac44b | 193 | Load("AlidNdEtaCorrectionTask", aDebug); |
a7f69e56 | 194 | task2 = new AlidNdEtaCorrectionTask(optStr); |
51f6de65 | 195 | |
196 | // syst. error flags | |
69b09e3b | 197 | //task2->SetFillPhi(); |
7a1ac44b | 198 | //task2->SetOnlyPrimaries(); |
1d107532 | 199 | //task2->SetSymmetrize(); |
7a1ac44b | 200 | |
201 | task2->SetTrigger(trigger); | |
202 | task2->SetAnalysisMode(analysisMode); | |
203 | task2->SetTrackCuts(esdTrackCuts); | |
69b09e3b | 204 | //task2->SetDeltaPhiCut(0.05); |
7a1ac44b | 205 | |
206 | mgr->AddTask(task2); | |
51f6de65 | 207 | |
7a1ac44b | 208 | // Attach input |
209 | mgr->ConnectInput(task2, 0, cInput); | |
51f6de65 | 210 | |
7a1ac44b | 211 | // Attach output |
212 | cOutput = mgr->CreateContainer("cOutput2", TList::Class(), AliAnalysisManager::kOutputContainer); | |
213 | mgr->ConnectOutput(task2, 0, cOutput); | |
0fc41645 | 214 | } |
0f67a57c | 215 | |
12bb57f1 | 216 | if (requiredData == 1) { |
0f67a57c | 217 | // Enable MC event handler |
218 | AliMCEventHandler* handler = new AliMCEventHandler; | |
219 | handler->SetReadTR(kFALSE); | |
220 | mgr->SetMCtruthEventHandler(handler); | |
221 | } | |
222 | ||
0f67a57c | 223 | // Enable debug printouts |
224 | if (aDebug) | |
225 | mgr->SetDebugLevel(2); | |
226 | ||
227 | // Run analysis | |
228 | mgr->InitAnalysis(); | |
229 | mgr->PrintStatus(); | |
230 | ||
0fc41645 | 231 | if (aProof == 2) |
232 | { | |
233 | // process dataset | |
234 | ||
235 | mgr->StartAnalysis("proof", data, nRuns, offset); | |
a7f69e56 | 236 | |
237 | if (save) | |
238 | { | |
239 | TString path("maps/"); | |
240 | path += TString(data).Tokenize("/")->Last()->GetName(); | |
241 | ||
1d107532 | 242 | UInt_t triggerNoFlags = (UInt_t) trigger % (UInt_t) AliTriggerAnalysis::kStartOfFlags; |
243 | switch (triggerNoFlags) | |
a7f69e56 | 244 | { |
1d107532 | 245 | case AliTriggerAnalysis::kMB1: path += "/mb1"; break; |
246 | case AliTriggerAnalysis::kMB2: path += "/mb2"; break; | |
247 | case AliTriggerAnalysis::kMB3: path += "/mb3"; break; | |
248 | case AliTriggerAnalysis::kSPDGFO: path += "/spdgfo"; break; | |
249 | case AliTriggerAnalysis::kSPDGFOBits: path += "/spdgfobits"; break; | |
a7f69e56 | 250 | default: Printf("ERROR: Trigger undefined for path to files"); return; |
251 | } | |
252 | ||
12bb57f1 | 253 | if (strlen(requireClass) > 0 && strlen(rejectClass) == 0) |
254 | { | |
255 | path += Form("/%s", requireClass); | |
256 | } | |
257 | else if (strlen(rejectClass) > 0) | |
258 | path += Form("/%s--%s", requireClass, rejectClass); | |
259 | ||
a7f69e56 | 260 | if (analysisMode & AliPWG0Helper::kSPD) |
261 | path += "/spd"; | |
262 | ||
263 | if (analysisMode & AliPWG0Helper::kTPC) | |
264 | path += "/tpc"; | |
265 | ||
266 | gSystem->mkdir(path, kTRUE); | |
267 | if (runWhat == 0 || runWhat == 2) | |
1d107532 | 268 | { |
a7f69e56 | 269 | gSystem->Rename("analysis_esd_raw.root", path + "/analysis_esd_raw.root"); |
12bb57f1 | 270 | if (requiredData == 1) |
1d107532 | 271 | gSystem->Rename("analysis_mc.root", path + "/analysis_mc.root"); |
272 | } | |
a7f69e56 | 273 | if (runWhat == 1 || runWhat == 2) |
274 | { | |
a7f69e56 | 275 | gSystem->Rename("correction_map.root", path + "/correction_map.root"); |
276 | } | |
277 | ||
278 | Printf(">>>>> Moved files to %s", path.Data()); | |
279 | } | |
0fc41645 | 280 | } |
51f6de65 | 281 | else if (aProof == 3) |
282 | { | |
69b09e3b | 283 | gROOT->ProcessLine(".L CreateChainFromDataSet.C"); |
284 | ds = gProof->GetDataSet(data)->GetStagedSubset(); | |
51f6de65 | 285 | chain = CreateChainFromDataSet(ds); |
286 | mgr->StartAnalysis("local", chain, nRuns, offset); | |
287 | } | |
0fc41645 | 288 | else |
289 | { | |
290 | // Create chain of input files | |
291 | gROOT->LoadMacro("../CreateESDChain.C"); | |
51f6de65 | 292 | |
0fc41645 | 293 | chain = CreateESDChain(data, nRuns, offset); |
1c15d51a | 294 | //chain = CreateChain("TE", data, nRuns, offset); |
0fc41645 | 295 | |
296 | mgr->StartAnalysis((aProof > 0) ? "proof" : "local", chain); | |
297 | } | |
0f67a57c | 298 | } |
dd367a14 | 299 |