]>
Commit | Line | Data |
---|---|---|
041e39a0 | 1 | // ### Settings that make sense when using the Alien plugin |
2 | //============================================================================== | |
3 | Int_t runOnData = 1; // Set to 1 if processing real data | |
f9cd4014 | 4 | Int_t iCollision = 0; // 0=pp, 1=Pb-Pb |
041e39a0 | 5 | Int_t run_flag = 1100; // year (2011 = 1100) |
6 | //============================================================================== | |
f9cd4014 | 7 | Bool_t doCDBconnect =1; |
041e39a0 | 8 | Bool_t usePhysicsSelection = kTRUE; // use physics selection |
9 | Bool_t useTender = kFALSE; // use tender wagon | |
c2de0acd | 10 | Bool_t useCentrality = kTRUE; // centrality |
041e39a0 | 11 | Bool_t useV0tender = kFALSE; // use V0 correction in tender |
12 | Bool_t useDBG = kTRUE; // activate debugging | |
13 | Bool_t useMC = kFALSE; // use MC info | |
14 | Bool_t useKFILTER = kFALSE; // use Kinematics filter | |
15 | Bool_t useTR = kFALSE; // use track references | |
16 | Bool_t useCORRFW = kFALSE; // do not change | |
17 | Bool_t useAODTAGS = kFALSE; // use AOD tags | |
18 | Bool_t useSysInfo = kFALSE; // use sys info | |
19 | ||
20 | // ### Analysis modules to be included. Some may not be yet fully implemented. | |
21 | //============================================================================== | |
22 | Int_t iAODhandler = 1; // Analysis produces an AOD or dAOD's | |
23 | Int_t iESDfilter = 1; // ESD to AOD filter (barrel + muon tracks) | |
db47bd9e | 24 | Int_t iESDfilterReVtx = -1; // Request revertexing in ESD filtering |
041e39a0 | 25 | Int_t iMUONcopyAOD = 1; // Task that copies only muon events in a separate AOD (PWG3) |
26 | Int_t iJETAN = 1; // Jet analysis (PWG4) | |
27 | Int_t iJETANdelta = 1; // Jet delta AODs | |
28 | Int_t iPWGHFvertexing = 1; // Vertexing HF task (PWG3) | |
f9cd4014 | 29 | Int_t iPWGDQJPSIfilter = 0; // JPSI filtering (PWG3) |
c1aeea60 | 30 | Int_t iPWGHFd2h = 1; // D0->2 hadrons (PWG3) |
f9cd4014 | 31 | Int_t iPWGPP =1; // high pt filter task |
c2de0acd | 32 | Int_t iPWGLFForward = 1; // Forward mult task (PWGLF) |
f9cd4014 | 33 | Bool_t doPIDResponse = 1; |
34 | Bool_t doPIDqa = 1; //new | |
041e39a0 | 35 | |
36 | // ### Configuration macros used for each module | |
37 | //============================================================================== | |
38 | TString configPWGHFd2h = (iCollision==0)?"$ALICE_ROOT/PWGHF/vertexingHF/ConfigVertexingHF.C" | |
39 | :"$ALICE_ROOT/PWGHF/vertexingHF/ConfigVertexingHF_highmult.C"; | |
40 | ||
41 | // Temporaries. | |
42 | void AODmerge(); | |
43 | void AddAnalysisTasks(); | |
44 | Bool_t LoadCommonLibraries(); | |
45 | Bool_t LoadAnalysisLibraries(); | |
46 | Bool_t LoadLibrary(const char *); | |
47 | TChain *CreateChain(); | |
f37b73fe | 48 | const char *cdbPath = "raw://"; |
49 | Int_t run_number = 0; | |
041e39a0 | 50 | |
51 | //______________________________________________________________________________ | |
52 | void AODtrain(Int_t merge=0) | |
53 | { | |
54 | // Main analysis train macro. | |
55 | ||
f9cd4014 | 56 | if (merge || doCDBconnect) { |
041e39a0 | 57 | TGrid::Connect("alien://"); |
58 | if (!gGrid || !gGrid->IsConnected()) { | |
59 | ::Error("QAtrain", "No grid connection"); | |
60 | return; | |
61 | } | |
62 | } | |
63 | // Set temporary merging directory to current one | |
64 | gSystem->Setenv("TMPDIR", gSystem->pwd()); | |
65 | // Set temporary compilation directory to current one | |
66 | gSystem->SetBuildDir(gSystem->pwd(), kTRUE); | |
67 | printf("==================================================================\n"); | |
68 | printf("=========== RUNNING FILTERING TRAIN ==========\n"); | |
69 | printf("==================================================================\n"); | |
70 | printf("= Configuring analysis train for: =\n"); | |
71 | if (usePhysicsSelection) printf("= Physics selection =\n"); | |
72 | if (useTender) printf("= TENDER =\n"); | |
db47bd9e | 73 | if (iESDfilter) { |
74 | printf("= ESD filter =\n"); | |
75 | if (iESDfilterReVtx>=0) printf("= ESD event revertexed before filterering, algo %2d =\n",iESDfilterReVtx); | |
76 | } | |
041e39a0 | 77 | if (iMUONcopyAOD) printf("= MUON copy AOD =\n"); |
78 | if (iJETAN) printf("= Jet analysis =\n"); | |
79 | if (iJETANdelta) printf("= Jet delta AODs =\n"); | |
80 | if (iPWGHFvertexing) printf("= PWGHF vertexing =\n"); | |
81 | if (iPWGDQJPSIfilter) printf("= PWGDQ j/psi filter =\n"); | |
82 | if (iPWGHFd2h) printf("= PWGHF D0->2 hadrons QA =\n"); | |
83 | ||
84 | // Load common libraries and set include path | |
85 | if (!LoadCommonLibraries()) { | |
86 | ::Error("AnalysisTrain", "Could not load common libraries"); | |
87 | return; | |
88 | } | |
89 | ||
90 | // Make the analysis manager and connect event handlers | |
91 | AliAnalysisManager *mgr = new AliAnalysisManager("Analysis Train", "Production train"); | |
92 | if (useSysInfo) mgr->SetNSysInfo(100); | |
93 | // Load analysis specific libraries | |
94 | if (!LoadAnalysisLibraries()) { | |
95 | ::Error("AnalysisTrain", "Could not load analysis libraries"); | |
96 | return; | |
97 | } | |
98 | ||
99 | // Create input handler (input container created automatically) | |
100 | // ESD input handler | |
101 | AliESDInputHandler *esdHandler = new AliESDInputHandler(); | |
102 | mgr->SetInputEventHandler(esdHandler); | |
103 | // Monte Carlo handler | |
104 | if (useMC) { | |
105 | AliMCEventHandler* mcHandler = new AliMCEventHandler(); | |
106 | mgr->SetMCtruthEventHandler(mcHandler); | |
107 | mcHandler->SetReadTR(useTR); | |
108 | } | |
109 | // AOD output container, created automatically when setting an AOD handler | |
110 | if (iAODhandler) { | |
111 | // AOD output handler | |
112 | AliAODHandler* aodHandler = new AliAODHandler(); | |
113 | aodHandler->SetOutputFileName("AliAOD.root"); | |
114 | mgr->SetOutputEventHandler(aodHandler); | |
115 | } | |
116 | // Debugging if needed | |
117 | if (useDBG) mgr->SetDebugLevel(3); | |
118 | ||
f37b73fe | 119 | AddAnalysisTasks(cdbPath); |
041e39a0 | 120 | if (merge) { |
121 | AODmerge(); | |
122 | mgr->InitAnalysis(); | |
123 | mgr->SetGridHandler(new AliAnalysisAlien); | |
124 | mgr->StartAnalysis("gridterminate",0); | |
125 | return; | |
126 | } | |
127 | // Run the analysis | |
128 | // | |
129 | TChain *chain = CreateChain(); | |
130 | if (!chain) return; | |
131 | ||
132 | TStopwatch timer; | |
133 | timer.Start(); | |
134 | mgr->SetSkipTerminate(kTRUE); | |
135 | if (mgr->InitAnalysis()) { | |
136 | mgr->PrintStatus(); | |
137 | mgr->StartAnalysis("local", chain); | |
138 | } | |
139 | timer.Print(); | |
140 | } | |
141 | ||
142 | //______________________________________________________________________________ | |
f37b73fe | 143 | void AddAnalysisTasks(const char *cdb_location){ |
041e39a0 | 144 | // Add all analysis task wagons to the train |
145 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
146 | ||
147 | // | |
148 | // Tender and supplies. Needs to be called for every event. | |
149 | // | |
150 | AliAnalysisManager::SetCommonFileName("AODQA.root"); | |
151 | if (useTender) { | |
152 | gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/TenderSupplies/AddTaskTender.C"); | |
153 | // IF V0 tender needed, put kTRUE below | |
154 | AliAnalysisTaskSE *tender = AddTaskTender(useV0tender); | |
155 | // tender->SetDebugLevel(2); | |
156 | } | |
f9cd4014 | 157 | // |
158 | // PIDResponse(JENS) | |
159 | // | |
160 | if (doPIDResponse) { | |
161 | gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C"); | |
162 | AliAnalysisTaskPIDResponse *PIDResponse = AddTaskPIDResponse(); | |
163 | // PIDResponse->SelectCollisionCandidates(AliVEvent::kAny); | |
164 | } | |
165 | ||
166 | // | |
167 | // PIDqa(JENS) | |
168 | // | |
169 | if (doPIDqa) { | |
170 | gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDqa.C"); | |
171 | AliAnalysisTaskPIDqa *PIDQA = AddTaskPIDqa(); | |
172 | PIDQA->SelectCollisionCandidates(AliVEvent::kAny); | |
173 | } | |
174 | // CDB connection | |
175 | // | |
176 | if (doCDBconnect && !useTender) { | |
177 | gROOT->LoadMacro("$ALICE_ROOT/PWGPP/PilotTrain/AddTaskCDBconnect.C"); | |
f37b73fe | 178 | AliTaskCDBconnect *taskCDB = AddTaskCDBconnect(cdb_location, run_number); |
f9cd4014 | 179 | if (!taskCDB) return; |
180 | AliCDBManager *cdb = AliCDBManager::Instance(); | |
f37b73fe | 181 | cdb->SetDefaultStorage(cdb_location); |
f9cd4014 | 182 | // taskCDB->SetRunNumber(run_number); |
183 | } | |
184 | ||
041e39a0 | 185 | if (usePhysicsSelection) { |
186 | // Physics selection task | |
187 | gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C"); | |
188 | mgr->RegisterExtraFile("event_stat.root"); | |
189 | AliPhysicsSelectionTask *physSelTask = AddTaskPhysicsSelection(useMC); | |
190 | // AliOADBPhysicsSelection * oadbDefaultPbPb = CreateOADBphysicsSelection(); | |
191 | // physSelTask->GetPhysicsSelection()->SetCustomOADBObjects(oadbDefaultPbPb,0,0); | |
192 | mgr->AddStatisticsTask(AliVEvent::kAny); | |
193 | } | |
f9cd4014 | 194 | |
195 | ||
196 | //Jacek | |
197 | if (iPWGPP) { | |
198 | gROOT->LoadMacro("$ALICE_ROOT/PWGPP/macros/AddTaskFilteredTree.C"); | |
c2de0acd | 199 | AddTaskFilteredTree("FilterEvents_Trees.root"); |
f9cd4014 | 200 | } |
201 | ||
041e39a0 | 202 | // Centrality (only Pb-Pb) |
f9cd4014 | 203 | if (useCentrality) { |
041e39a0 | 204 | gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C"); |
205 | AliCentralitySelectionTask *taskCentrality = AddTaskCentrality(); | |
f9cd4014 | 206 | //taskCentrality->SelectCollisionCandidates(AliVEvent::kAny); |
041e39a0 | 207 | } |
c2de0acd | 208 | |
209 | // --- PWGLF - Forward (cholm@nbi.dk) ----------------------------- | |
210 | if (iPWGLFForward && usePhysicsSelection) { | |
211 | gROOT->LoadMacro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/AddTaskForwardMult.C"); | |
212 | UShort_t pwglfForwardSys = 0; // iCollision+1; // pp:1, PbPb:2, pPb:3 | |
213 | UShort_t pwglfSNN = 0; // GeV, 0==unknown | |
214 | Short_t pwglfField = 0; | |
215 | AddTaskForwardMult(useMC && useTR, // Need track-refs | |
216 | pwglfForwardSys, // Collision system | |
217 | pwglfSNN, | |
218 | pwglfField); | |
219 | gROOT->LoadMacro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/AddTaskCentralMult.C"); | |
220 | AddTaskCentralMult(useMC, pwglfForwardSys, pwglfSNN, pwglfField); | |
221 | } | |
222 | ||
223 | ||
041e39a0 | 224 | |
225 | if (iESDfilter) { | |
226 | // ESD filter task configuration. | |
db47bd9e | 227 | gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/ESDfilter/macros/AddTaskESDFilter.C"); |
228 | AliAnalysisTaskESDfilter *taskesdfilter = 0; | |
041e39a0 | 229 | if (iMUONcopyAOD) { |
230 | printf("Registering delta AOD file\n"); | |
231 | mgr->RegisterExtraFile("AliAOD.Muons.root"); | |
232 | mgr->RegisterExtraFile("AliAOD.Dimuons.root"); | |
db47bd9e | 233 | taskesdfilter = AddTaskESDFilter(useKFILTER, kTRUE, kFALSE, kFALSE /*usePhysicsSelection*/,kFALSE,kTRUE,kFALSE,kFALSE,run_flag); |
041e39a0 | 234 | } else { |
db47bd9e | 235 | taskesdfilter = AddTaskESDFilter(useKFILTER, kFALSE, kFALSE, kFALSE /*usePhysicsSelection*/,kFALSE,kTRUE,kFALSE,kFALSE,run_flag); // others |
041e39a0 | 236 | } |
db47bd9e | 237 | if (iESDfilterReVtx>=0 && taskesdfilter) taskesdfilter->SetRefitVertexTracks(iESDfilterReVtx); |
041e39a0 | 238 | } |
239 | ||
240 | // ********** PWG3 wagons ****************************************************** | |
241 | // PWGHF vertexing | |
242 | if (iPWGHFvertexing) { | |
243 | gROOT->LoadMacro("$ALICE_ROOT/PWGHF/vertexingHF/macros/AddTaskVertexingHF.C"); | |
244 | if (!iPWGHFd2h) TFile::Cp(gSystem->ExpandPathName(configPWGHFd2h.Data()), "file:ConfigVertexingHF.C"); | |
245 | AliAnalysisTaskSEVertexingHF *taskvertexingHF = AddTaskVertexingHF(); | |
246 | if (!taskvertexingHF) ::Warning("AnalysisTrainNew", "AliAnalysisTaskSEVertexingHF cannot run for this train conditions - EXCLUDED"); | |
247 | else mgr->RegisterExtraFile("AliAOD.VertexingHF.root"); | |
248 | taskvertexingHF->SelectCollisionCandidates(0); | |
249 | } | |
250 | ||
251 | // PWGDQ JPSI filtering (only pp) | |
252 | if (iPWGDQJPSIfilter && (iCollision==0)) { | |
253 | gROOT->LoadMacro("$ALICE_ROOT/PWGDQ/dielectron/macros/AddTaskJPSIFilter.C"); | |
254 | AliAnalysisTaskSE *taskJPSIfilter = AddTaskJPSIFilter(); | |
255 | if (!taskJPSIfilter) ::Warning("AnalysisTrainNew", "AliAnalysisTaskDielectronFilter cannot run for this train conditions - EXCLUDED"); | |
256 | else mgr->RegisterExtraFile("AliAOD.Dielectron.root"); | |
257 | taskJPSIfilter->SelectCollisionCandidates(0); | |
258 | } | |
259 | ||
260 | // PWGHF D2h | |
261 | if (iPWGHFd2h) { | |
262 | gROOT->LoadMacro("$ALICE_ROOT/PWGHF/vertexingHF/AddD2HTrain.C"); | |
263 | TFile::Cp(gSystem->ExpandPathName(configPWGHFd2h.Data()), "file:ConfigVertexingHF.C"); | |
264 | AddD2HTrain(kFALSE, 1,0,0,0,0,0,0,0,0,0,0); | |
265 | } | |
266 | ||
267 | // ********** PWG4 wagons ****************************************************** | |
268 | // Jet analysis | |
269 | ||
270 | // Configurations flags, move up? | |
271 | TString kDeltaAODJetName = "AliAOD.Jets.root"; // | |
272 | Bool_t kIsPbPb = (iCollision==0)?false:true; // can be more intlligent checking the name of the data set | |
273 | TString kDefaultJetBackgroundBranch = ""; | |
274 | TString kJetSubtractBranches = ""; | |
f9cd4014 | 275 | UInt_t kHighPtFilterMask = 272;// from esd filter |
276 | UInt_t iPhysicsSelectionFlag = 0; | |
041e39a0 | 277 | if (iJETAN) { |
278 | gROOT->LoadMacro("$ALICE_ROOT/PWGJE/macros/AddTaskJets.C"); | |
279 | // Default jet reconstructor running on ESD's | |
280 | AliAnalysisTaskJets *taskjets = AddTaskJets("AOD","UA1",0.4,kHighPtFilterMask,1.,0); // no background subtraction | |
281 | if (!taskjets) ::Fatal("AnalysisTrainNew", "AliAnalysisTaskJets cannot run for this train conditions - EXCLUDED"); | |
282 | if(kDeltaAODJetName.Length()>0) taskjets->SetNonStdOutputFile(kDeltaAODJetName.Data()); | |
283 | if (iJETANdelta) { | |
284 | // AddTaskJetsDelta("AliAOD.Jets.root"); // need to modify this accordingly in the add task jets | |
285 | mgr->RegisterExtraFile(kDeltaAODJetName.Data()); | |
286 | TString cTmp(""); | |
287 | if(kIsPbPb){ | |
288 | // UA1 intrinsic background subtraction | |
289 | taskjets = AddTaskJets("AOD","UA1",0.4,kHighPtFilterMask,1.,2); // background subtraction | |
290 | if(kDeltaAODJetName.Length()>0)taskjets->SetNonStdOutputFile(kDeltaAODJetName.Data()); | |
291 | } | |
292 | // SICONE | |
293 | taskjets = AddTaskJets("AOD","SISCONE",0.4,kHighPtFilterMask,0.15,0); //no background subtration to be done later.... | |
294 | if(kDeltaAODJetName.Length()>0)taskjets->SetNonStdOutputFile(kDeltaAODJetName.Data()); | |
295 | cTmp = taskjets->GetNonStdBranch(); | |
296 | if(cTmp.Length()>0)kJetSubtractBranches += Form("%s ",cTmp.Data()); | |
297 | ||
298 | // Add the clusters.. | |
299 | gROOT->LoadMacro("$ALICE_ROOT/PWGJE/macros/AddTaskJetCluster.C"); | |
300 | AliAnalysisTaskJetCluster *taskCl = 0; | |
301 | Float_t fCenUp = 0; | |
302 | Float_t fCenLo = 0; | |
303 | Float_t fTrackEtaWindow = 0.9; | |
304 | taskCl = AddTaskJetCluster("AOD","",kHighPtFilterMask,iPhysicsSelectionFlag,"KT",0.4,0,1, kDeltaAODJetName.Data(),0.15,fTrackEtaWindow,0); // this one is for the background and random jets, random cones with no skip | |
305 | taskCl->SetBackgroundCalc(kTRUE); | |
306 | taskCl->SetNRandomCones(10); | |
307 | taskCl->SetCentralityCut(fCenLo,fCenUp); | |
308 | taskCl->SetGhostEtamax(fTrackEtaWindow); | |
309 | kDefaultJetBackgroundBranch = Form("%s_%s",AliAODJetEventBackground::StdBranchName(),taskCl->GetJetOutputBranch()); | |
310 | ||
311 | taskCl = AddTaskJetCluster("AOD","",kHighPtFilterMask,iPhysicsSelectionFlag,"ANTIKT",0.4,2,1,kDeltaAODJetName.Data(),0.15); | |
312 | taskCl->SetCentralityCut(fCenLo,fCenUp); | |
313 | if(kIsPbPb)taskCl->SetBackgroundBranch(kDefaultJetBackgroundBranch.Data()); | |
314 | taskCl->SetNRandomCones(10); | |
315 | kJetSubtractBranches += Form("%s ",taskCl->GetJetOutputBranch()); | |
316 | ||
317 | taskCl = AddTaskJetCluster("AOD","",kHighPtFilterMask,iPhysicsSelectionFlag,"ANTIKT",0.2,0,1,kDeltaAODJetName.Data(),0.15); | |
318 | taskCl->SetCentralityCut(fCenLo,fCenUp); | |
319 | if(kIsPbPb)taskCl->SetBackgroundBranch(kDefaultJetBackgroundBranch.Data()); | |
320 | kJetSubtractBranches += Form("%s ",taskCl->GetJetOutputBranch()); | |
321 | ||
322 | // DO THE BACKGROUND SUBTRACTION | |
323 | if(kIsPbPb&&kJetSubtractBranches.Length()){ | |
324 | gROOT->LoadMacro("$ALICE_ROOT/PWGJE/macros/AddTaskJetBackgroundSubtract.C"); | |
325 | AliAnalysisTaskJetBackgroundSubtract *taskSubtract = 0; | |
326 | taskSubtract = AddTaskJetBackgroundSubtract(kJetSubtractBranches,1,"B0","B%d"); | |
327 | taskSubtract->SetBackgroundBranch(kDefaultJetBackgroundBranch.Data()); | |
328 | if(kDeltaAODJetName.Length()>0)taskSubtract->SetNonStdOutputFile(kDeltaAODJetName.Data()); | |
329 | } | |
330 | } | |
331 | } | |
332 | } | |
041e39a0 | 333 | //______________________________________________________________________________ |
334 | Bool_t LoadCommonLibraries() | |
335 | { | |
336 | // Load common analysis libraries. | |
337 | if (!gSystem->Getenv("ALICE_ROOT")) { | |
338 | ::Error("AnalysisTrainNew.C::LoadCommonLibraries", "Analysis train requires that analysis libraries are compiled with a local AliRoot"); | |
339 | return kFALSE; | |
340 | } | |
341 | Bool_t success = kTRUE; | |
342 | // Load framework classes. Par option ignored here. | |
343 | success &= LoadLibrary("libSTEERBase.so"); | |
344 | success &= LoadLibrary("libESD.so"); | |
345 | success &= LoadLibrary("libAOD.so"); | |
346 | success &= LoadLibrary("libANALYSIS.so"); | |
347 | success &= LoadLibrary("libOADB.so"); | |
348 | success &= LoadLibrary("libANALYSISalice.so"); | |
349 | success &= LoadLibrary("libCORRFW.so"); | |
350 | gROOT->ProcessLine(".include $ALICE_ROOT/include"); | |
351 | if (success) { | |
352 | ::Info("AnalysisTrainNew.C::LoadCommodLibraries", "Load common libraries: SUCCESS"); | |
353 | ::Info("AnalysisTrainNew.C::LoadCommodLibraries", "Include path for Aclic compilation:\n%s", | |
354 | gSystem->GetIncludePath()); | |
355 | } else { | |
356 | ::Info("AnalysisTrainNew.C::LoadCommodLibraries", "Load common libraries: FAILED"); | |
357 | } | |
358 | return success; | |
359 | } | |
360 | ||
361 | //______________________________________________________________________________ | |
362 | Bool_t LoadAnalysisLibraries() | |
363 | { | |
364 | // Load common analysis libraries. | |
f9cd4014 | 365 | if (useTender || doCDBconnect) { |
041e39a0 | 366 | if (!LoadLibrary("TENDER") || |
367 | !LoadLibrary("TENDERSupplies")) return kFALSE; | |
368 | } | |
f9cd4014 | 369 | // CDBconnect |
370 | if (doCDBconnect && !useTender) { | |
371 | if (!LoadLibrary("PWGPP")) return kFALSE; | |
372 | } | |
373 | ||
041e39a0 | 374 | if (iESDfilter || iPWGMuonTrain) { |
375 | if (!LoadLibrary("PWGmuon")) return kFALSE; | |
376 | } | |
377 | // JETAN | |
378 | if (iJETAN) { | |
379 | if (!LoadLibrary("JETAN")) return kFALSE; | |
380 | } | |
381 | if (iJETANdelta) { | |
382 | if (!LoadLibrary("JETAN") || | |
383 | !LoadLibrary("CGAL") || | |
384 | !LoadLibrary("fastjet") || | |
385 | !LoadLibrary("siscone") || | |
386 | !LoadLibrary("SISConePlugin") || | |
387 | !LoadLibrary("FASTJETAN")) return kFALSE; | |
c2de0acd | 388 | } |
389 | // PWG2 FORWARD | |
390 | if (iPWGLFForward) { | |
391 | //if (!LoadLibrary("PWGLFforward", mode, kTRUE)) return kFALSE; | |
392 | if (!LoadLibrary("PWGLFforward2")) return kFALSE; | |
393 | } | |
394 | ||
041e39a0 | 395 | // PWG3 Vertexing HF |
f9cd4014 | 396 | if (iPWGHFvertexing || iPWGHFd2h) { |
397 | if (!LoadLibrary("PWGflowBase") || | |
398 | !LoadLibrary("PWGflowTasks") || | |
041e39a0 | 399 | !LoadLibrary("PWGHFvertexingHF")) return kFALSE; |
f9cd4014 | 400 | } |
401 | // if (iPWGHFvertexing || iPWG3d2h) { | |
402 | // if (!LoadLibrary("PWG3base") || | |
403 | // !LoadLibrary("PWGHFvertexingHF")) return kFALSE; | |
404 | // } | |
041e39a0 | 405 | // PWG3 dielectron |
406 | if (iPWGDQJPSIfilter) { | |
407 | if (!LoadLibrary("PWGDQdielectron")) return kFALSE; | |
408 | } | |
409 | ||
410 | ::Info("AnalysisTrainNew.C::LoadAnalysisLibraries", "Load other libraries: SUCCESS"); | |
411 | return kTRUE; | |
412 | } | |
413 | ||
414 | //______________________________________________________________________________ | |
415 | Bool_t LoadLibrary(const char *module) | |
416 | { | |
417 | // Load a module library in a given mode. Reports success. | |
418 | Int_t result; | |
419 | TString mod(module); | |
420 | if (!mod.Length()) { | |
421 | ::Error("AnalysisTrainNew.C::LoadLibrary", "Empty module name"); | |
422 | return kFALSE; | |
423 | } | |
424 | // If a library is specified, just load it | |
425 | if (mod.EndsWith(".so")) { | |
426 | mod.Remove(mod.Index(".so")); | |
427 | result = gSystem->Load(mod); | |
428 | if (result < 0) { | |
429 | ::Error("AnalysisTrainNew.C::LoadLibrary", "Could not load library %s", module); | |
430 | return kFALSE; | |
431 | } | |
432 | return kTRUE; | |
433 | } | |
434 | // Check if the library is already loaded | |
435 | if (strlen(gSystem->GetLibraries(Form("%s.so", module), "", kFALSE)) > 0) return kTRUE; | |
436 | result = gSystem->Load(Form("lib%s.so", module)); | |
437 | if (result < 0) { | |
438 | ::Error("AnalysisTrainNew.C::LoadLibrary", "Could not load module %s", module); | |
439 | return kFALSE; | |
440 | } | |
441 | return kTRUE; | |
442 | } | |
443 | ||
444 | ||
445 | //______________________________________________________________________________ | |
446 | TChain *CreateChain() | |
447 | { | |
448 | // Create the input chain | |
449 | chain = new TChain("esdTree"); | |
450 | if (gSystem->AccessPathName("AliESDs.root")) | |
451 | ::Error("AnalysisTrainNew.C::CreateChain", "File: AliESDs.root not in ./data dir"); | |
452 | else | |
453 | chain->Add("AliESDs.root"); | |
454 | if (chain->GetNtrees()) return chain; | |
455 | return NULL; | |
456 | } | |
457 | ||
458 | //______________________________________________________________________________ | |
459 | void AODmerge() | |
460 | { | |
461 | // Merging method. No staging and no terminate phase. | |
462 | TStopwatch timer; | |
463 | timer.Start(); | |
464 | TString outputDir = "wn.xml"; | |
f9cd4014 | 465 | TString outputFiles = "EventStat_temp.root,AODQA.root,AliAOD.root,AliAOD.VertexingHF.root,FilterEvents_Trees.root,AliAOD.Muons.root,AliAOD.Jets.root"; |
041e39a0 | 466 | TString mergeExcludes = ""; |
467 | TObjArray *list = outputFiles.Tokenize(","); | |
468 | TIter *iter = new TIter(list); | |
469 | TObjString *str; | |
470 | TString outputFile; | |
471 | Bool_t merged = kTRUE; | |
472 | while((str=(TObjString*)iter->Next())) { | |
473 | outputFile = str->GetString(); | |
474 | // Skip already merged outputs | |
475 | if (!gSystem->AccessPathName(outputFile)) { | |
476 | printf("Output file <%s> found. Not merging again.",outputFile.Data()); | |
477 | continue; | |
478 | } | |
479 | if (mergeExcludes.Contains(outputFile.Data())) continue; | |
480 | merged = AliAnalysisAlien::MergeOutput(outputFile, outputDir, 10, 0); | |
481 | if (!merged) { | |
482 | printf("ERROR: Cannot merge %s\n", outputFile.Data()); | |
f9cd4014 | 483 | continue; |
041e39a0 | 484 | } |
485 | } | |
486 | // all outputs merged, validate | |
487 | ofstream out; | |
488 | out.open("outputs_valid", ios::out); | |
489 | out.close(); | |
490 | timer.Print(); | |
491 | } |