]>
Commit | Line | Data |
---|---|---|
d3b7d108 | 1 | //===================== ANALYSIS TRAIN ========================================= |
2 | // To use: copy this macro to your work directory, modify the global part to match | |
3 | // your needs, then run root. | |
4 | // root[0] .L AnalysisTrain.C | |
5 | // Grid full mode as below (other modes: test, offline, submit, terminate) | |
6 | // root[1] AnalysisTrainNew("grid", "full") | |
7 | // CAF mode (requires root v5-23-02 + aliroot v4-16-Rev08) | |
8 | // root[2] AnalysisTrainNew("proof") | |
9 | // Local mode requires AliESds.root or AliAOD.root in ./data directory | |
10 | // root[3] AnalysisTrainNew("local") | |
11 | // In proof and grid modes, a token is needed and sourcing the produced environment file. | |
12 | // | |
13 | // If 'saveTrain' flag is set, the train will generate a directory name and run | |
14 | // in this directory. A configuration file 'ConfigTrain.C' will be generated. | |
15 | // One can replay at any time the train via: | |
16 | // root[1] AnalysisTrainNew(ana_mode, plugin_mode, "train_default_<date>/ConfigTrain.C") | |
17 | ||
18 | //================== TRAIN NAME ============================================ | |
19 | TString train_name = "FILTERsim"; // local folder name | |
20 | TString train_tag = "_Pb-Pb_"; // Train special tag appended to | |
21 | // visible name. ("data", "sim", "pp", "highmult", ...) | |
22 | // Name in train page (DON'T CHANGE) | |
23 | TString visible_name = Form("FILTER%s$2_$3", train_tag.Data()); //# FIXED # | |
24 | // Add train composition and other comments | |
25 | TString job_comment = "Standard AODs + deltas"; | |
26 | TString job_tag = Form("%s: %s", visible_name.Data(), job_comment.Data()); | |
27 | //============================================================================== | |
28 | ||
29 | // ### Settings that make sense in PROOF only | |
30 | //============================================================================== | |
31 | TString proof_cluster = "alice-caf.cern.ch"; | |
32 | Bool_t useAFPAR = kFALSE; // use AF special par file | |
33 | TString AFversion = "AF-v4-17"; | |
34 | // Change CAF dataset here | |
35 | TString proof_dataset = "/COMMON/COMMON/LHC09a4_run8100X#/esdTree"; | |
36 | TString proof_outdir = ""; | |
37 | ||
38 | // ### Settings that make sense when using the Alien plugin | |
39 | //============================================================================== | |
40 | Int_t runOnData = 0; // Set to 1 if processing real data | |
41 | Int_t iCollision = 1; // 0=pp, 1=Pb-Pb | |
42 | Bool_t usePLUGIN = kTRUE; // do not change | |
43 | Bool_t useProductionMode = kTRUE; // use the plugin in production mode | |
44 | // Usage of par files ONLY in grid mode and ONLY if the code is not available | |
45 | // in the deployed AliRoot versions. Par file search path: local dir, if not there $ALICE_ROOT. | |
46 | // To refresh par files, remove the ones in the workdir, then do "make <target.par>" in | |
47 | // AliRoot. | |
48 | Bool_t usePAR = kFALSE; // use par files for extra libs | |
49 | Bool_t useCPAR = kFALSE; // use par files for common libs | |
50 | TString root_version = "v5-34-02-1"; // *CHANGE ME IF MORE RECENT IN GRID* | |
51 | TString aliroot_version = "v5-04-26-AN"; // *CHANGE ME IF MORE RECENT IN GRID* | |
52 | // Change production base directory here (test mode) | |
53 | TString alien_datadir = "/alice/sim/2011/LHC11f1"; | |
54 | Int_t run_flag = 1100; // year (2011 = 1100) | |
55 | ||
56 | // Work directory in GRID (DON'T CHANGE) | |
57 | TString grid_workdir = "/alice/cern.ch/user/a/alidaq/AOD/AOD$2"; | |
58 | // Data pattern - change as needed for test mode | |
59 | TString data_pattern = "*ESDs.root"; | |
60 | // Set the run range | |
61 | Int_t run_numbers[10] = {130480}; // **********************!!!!!!! | |
62 | //Int_t run_range[2] = {114786, 114949}; // LHC09a7 *CHANGE ME* | |
63 | // AliEn output directory. If blank will become output_<train_name> | |
64 | // Output directory (DON'T CHANGE) | |
65 | TString alien_outdir = "$1/AOD$2"; | |
66 | // Input collection (production mode) | |
67 | TString data_collection = "$1/qa1.xml"; | |
68 | // Output folder to write delta AOD's. Considered if not null. | |
69 | TString outputSingleFolder = ""; | |
70 | //TString outputSingleFolder = "deltas"; | |
71 | // Number of files merged in a chunk | |
72 | Int_t maxMergeFiles = 30; | |
73 | // Number of test files | |
74 | Int_t nTestFiles = 10; | |
75 | // Files that should not be merged | |
76 | TString mergeExclude = "AliAOD.root AliAOD.VertexingHF.root FilterEvents_Trees.root AliAOD.Jets.root AliAOD.Muons.root AliAODGammaConversion.root"; | |
77 | TString mergeDirName = "AOD$2"; | |
78 | // Make replicas on the storages below | |
79 | TString outputStorages = "disk=4"; | |
80 | Int_t outputReplicas = 4; | |
81 | // Number of runs per master job | |
82 | Int_t nRunsPerMaster = 10; | |
83 | // Maximum number of files per job (gives size of AOD) | |
84 | Int_t nFilesPerJob = 10; | |
85 | // Int_t nFilesPerJob = 1; (AOD->delta AOD production case) | |
86 | // ### Settings that make sense only for local analysis | |
87 | //============================================================================== | |
88 | // Change local xml dataset for local interactive analysis | |
89 | TString local_xmldataset = ""; | |
90 | ||
91 | // ### Other flags to steer the analysis | |
92 | //============================================================================== | |
93 | Bool_t doCDBconnect = 1; | |
94 | Bool_t usePhysicsSelection = kTRUE; // use physics selection | |
95 | Bool_t useTender = kFALSE; // use tender wagon | |
96 | Bool_t useCentrality = kTRUE; // centrality delta AOD | |
97 | Bool_t useV0tender = kFALSE; // use V0 correction in tender | |
98 | Bool_t useMergeViaJDL = kTRUE; // merge via JDL | |
99 | Bool_t useFastReadOption = kFALSE; // use xrootd tweaks | |
100 | Bool_t useOverwriteMode = kTRUE; // overwrite existing collections | |
101 | Bool_t useDATE = kFALSE; // use date in train name | |
102 | Bool_t useDBG = kFALSE; // activate debugging | |
103 | Bool_t useMC = kTRUE; // use MC info | |
104 | Bool_t useTAGS = kFALSE; // use ESD tags for selection | |
105 | Bool_t useKFILTER = kTRUE; // use Kinematics filter | |
106 | Bool_t useTR = kFALSE; // use track references | |
107 | Bool_t useCORRFW = kFALSE; // do not change | |
108 | Bool_t useAODTAGS = kFALSE; // use AOD tags | |
109 | Bool_t saveTrain = kTRUE; // save train configuration as: | |
110 | Bool_t saveCanvases = kFALSE; // save canvases created in Terminate | |
111 | Bool_t saveProofToAlien = kFALSE; // save proof outputs in AliEn | |
112 | ||
113 | // ### Analysis modules to be included. Some may not be yet fully implemented. | |
114 | //============================================================================== | |
115 | Int_t iITSImprover = 1; //ITSImprover resolutions | |
116 | Int_t iAODanalysis = 0; // Analysis on input AOD's | |
117 | Int_t iAODhandler = 1; // Analysis produces an AOD or dAOD's | |
118 | Int_t iESDfilter = 1; // ESD to AOD filter (barrel + muon tracks) | |
119 | Int_t iMUONcopyAOD = 0; // Task that copies only muon events in a separate AOD (PWG3) | |
120 | Int_t iJETAN = 0; // Jet analysis (PWG4) | |
121 | Int_t iJETANdelta = 0; // Jet delta AODs | |
122 | Int_t iPWG4partcorr = 0; // Gamma-hadron correlations task (PWG4) | |
123 | Int_t iPWGGAgammaconv = 0; // Gamma conversion analysis (PWG4) | |
124 | Int_t iPWG4omega3pi = 0; // Omega to 3 pi analysis (PWG4) | |
125 | Int_t iPWGHFvertexing =1; // Vertexing HF task (PWG3) | |
126 | Int_t iPWG3hfe = 0; // Electrons analysis (PWG3) | |
127 | Int_t iPWGDQJPSIfilter = 0; // JPSI filtering (PWG3) | |
128 | Int_t iPWGDQJPSI = 0; // JPSI analysis (PWG3) | |
129 | Int_t iPWGHFd2h = 1; // D0->2 hadrons (PWG3) | |
130 | Int_t iPWGMuonTrain = 0; // Muon analysis train | |
131 | Int_t iPWG2femto = 0; // Femtoscopy task (PWG2) | |
132 | Int_t iPWG2spectra = 0; // Spectra tasks (PWG2 | |
133 | Int_t iPWG2protons = 0; // Proton-antiproton analysis | |
134 | Int_t iPWG2checkcascade = 0; // Check cascades task | |
135 | Int_t iPWG2perfcascade = 0; // Check performance cascade | |
136 | Int_t iPWG2checkv0 = 0; // Check V0 task | |
137 | Int_t iPWG2strange = 0; // Strangeness task | |
138 | Int_t iPWG2central = 0; // Anisothropy in central collisions | |
139 | Int_t iPWG2flow = 0; // Flow analysis tasks (PWG2) | |
140 | Int_t iPWG2res = 0; // Resonances task (PWG2) | |
141 | Int_t iPWG2rsneff = 0; // Resonances efficiency | |
142 | Int_t iPWG2kink = 0; // Kink analysis tasks (PWG2) | |
143 | Int_t iPWG2kinkESDMC = 0; // Kink ESD-MC comparison (PWG2) | |
144 | Int_t iPWG2kinkLSKstar = 0; // Kink like-sign K* (PWG2) | |
145 | Int_t iPWG2kinkLSL1520 = 0; // Kink like-sign L1520 (PWG2) | |
146 | Int_t iPWG2kinkLSPhi = 0; // Kink like-sign Phi (PWG2) | |
147 | Int_t iPWG2kinkKstarESD = 0; // Kink Kstar ESD (PWG2) | |
148 | Int_t iPWG2kinkKstarMC = 0; // Kink Kstar MC (PWG2) | |
149 | Int_t iPWG2kinkL1520ESD = 0; // Kink L1520 ESD (PWG2) | |
150 | Int_t iPWG2kinkL1520MC = 0; // Kink L1520 MC (PWG2) | |
151 | Int_t iPWG2kinkPhiESD = 0; // Kink resonances Phi ESD (PWG2) | |
152 | Int_t iPWG2kinkPhiMC = 0; // Kink resonances Phi MC (PWG2) | |
153 | Int_t iPWG2evchar = 0; // Event characteristics (PWG2) | |
154 | Int_t iPWG2unicor = 0; // Unicor analysis (PWG2) | |
155 | Int_t iPWG2forward = 0; // FMD analysis (PWG2) | |
156 | Int_t iPWGLF =0; //PWGLF/SPECTRA/ChargedHadrons/dNdPt/macros | |
157 | Bool_t doPIDResponse = 1; | |
158 | Bool_t doPIDqa = 1; //new | |
159 | ||
160 | // ### Configuration macros used for each module | |
161 | //============================================================================== | |
162 | TString configPWG2femto = "$ALICE_ROOT/PWG2/FEMTOSCOPY/macros/Train/Train3/ConfigFemtoAnalysis.C"; | |
163 | //TString configPWG3d2h = "$ALICE_ROOT/PWGHF/vertexingHF/ConfigVertexingHF_Pb_Cent2080.C"; | |
164 | // TString configPWG3d2h = "$ALICE_ROOT/PWGHF/vertexingHF/ConfigVertexingHF_highmult.C"; | |
165 | // TString configPWG3d2h = "$ALICE_ROOT/PWGHF/vertexingHF/ConfigVertexingHF_ITSUpgrade.C"; | |
166 | TString configPWG3d2h = "$ALICE_ROOT/PWGHF/vertexingHF/ConfigVertexingHF_ITSUpgrade_D0Lc_wPID.C"; | |
167 | // TString configPWG3d2h = "$ALICE_ROOT/PWGHF/vertexingHF/ConfigVertexingHF_Pb_AllCent_NoLS_16var.C"; | |
168 | // Temporaries. | |
169 | TString anaPars = ""; | |
170 | TString anaLibs = ""; | |
171 | // Function signatures | |
172 | class AliAnalysisAlien; | |
173 | ||
174 | //______________________________________________________________________________ | |
175 | void AnalysisTrainNew(const char *analysis_mode="grid", | |
176 | const char *plugin_mode="full", | |
177 | const char *config_file="") | |
178 | { | |
179 | // Main analysis train macro. If a configuration file is provided, all parameters | |
180 | // are taken from there but may be altered by CheckModuleFlags. | |
181 | if (strlen(config_file) && !LoadConfig(config_file)) return; | |
182 | TString smode(analysis_mode); | |
183 | smode.ToUpper(); | |
184 | TString spmode(plugin_mode); | |
185 | spmode.ToLower(); | |
186 | if (spmode == "test") useProductionMode = kFALSE; | |
187 | // Check compatibility of selected modules | |
188 | CheckModuleFlags(smode); | |
189 | if (saveTrain) WriteConfig(); | |
190 | ||
191 | printf("==================================================================\n"); | |
192 | printf("=========== RUNNING ANALYSIS TRAIN %s IN %s MODE ==========\n", train_name.Data(),smode.Data()); | |
193 | printf("==================================================================\n"); | |
194 | printf("= Configuring analysis train for: =\n"); | |
195 | if (iAODanalysis) printf("= AOD analysis =\n"); | |
196 | else printf("= ESD analysis =\n"); | |
197 | if (usePhysicsSelection) printf("= Physics selection =\n"); | |
198 | if (useTender) printf("= TENDER =\n"); | |
199 | if (iESDfilter) printf("= ESD filter =\n"); | |
200 | if (iMUONcopyAOD) printf("= MUON copy AOD =\n"); | |
201 | if (iJETAN) printf("= Jet analysis =\n"); | |
202 | if (iJETANdelta) printf("= Jet delta AODs =\n"); | |
203 | if (iPWG2spectra) { | |
204 | printf("= PWG2 SPECTRA tasks : =\n"); | |
205 | if (iPWG2protons) printf("= PWG2 proton-antiproton =\n"); | |
206 | if (iPWG2checkcascade) printf("= PWG2 check cascades =\n"); | |
207 | if (iPWG2perfcascade) printf("= PWG2 performance cascades =\n"); | |
208 | if (iPWG2checkv0) printf("= PWG2 check V0 =\n"); | |
209 | if (iPWG2strange) printf("= PWG2 strangeness =\n"); | |
210 | if (iPWG2central) printf("= PWG2 central =\n"); | |
211 | } | |
212 | if (iPWG2femto) { | |
213 | printf("= PWG2 femtoscopy =\n"); | |
214 | printf(" +++ configured by: %s\n", configPWG2femto.Data()); | |
215 | } | |
216 | if (iPWG2flow) printf("= PWG2 flow =\n"); | |
217 | if (iPWG2res) printf("= PWG2 resonances =\n"); | |
218 | if (iPWG2rsneff) printf("= PWG2 resonances efficiency =\n"); | |
219 | if (iPWG2kink) { | |
220 | printf("= PWG2 kink analysis tasks: =\n"); | |
221 | if (iPWG2kinkESDMC) printf("= PWG2 ESD-MC kinks =\n"); | |
222 | if (iPWG2kinkLSKstar) printf("= PWG2 kink like-sign analysis K* =\n"); | |
223 | if (iPWG2kinkLSL1520) printf("= PWG2 kink like-sign analysis L1520 =\n"); | |
224 | if (iPWG2kinkLSPhi) printf("= PWG2 kink like-sign analysis Phi =\n"); | |
225 | if (iPWG2kinkKstarESD) printf("= PWG2 kink Kstar ESD analysis =\n"); | |
226 | if (iPWG2kinkKstarMC) printf("= PWG2 kink Kstar MC analysis =\n"); | |
227 | if (iPWG2kinkL1520ESD) printf("= PWG2 kink L1520 ESD analysis =\n"); | |
228 | if (iPWG2kinkL1520MC) printf("= PWG2 kink L1520 MC analysis =\n"); | |
229 | if (iPWG2kinkPhiESD) printf("= PWG2 kink Phi ESD analysis =\n"); | |
230 | if (iPWG2kinkPhiMC) printf("= PWG2 kink Phi MC analysis =\n"); | |
231 | } | |
232 | if (iPWG2evchar) printf("= PWG2 event characteristics =\n"); | |
233 | if (iPWG2unicor) printf("= PWG2 Unicor analysis =\n"); | |
234 | if (iPWG2forward) printf("= PWG2 forward: sharing, density, bkg. correction, dNdEta =\n"); | |
235 | if (iPWGHFvertexing) printf("= PWG3 vertexing =\n"); | |
236 | if (iPWG3hfe) printf("= PWG3 electrons =\n"); | |
237 | if (iPWGDQJPSIfilter) printf("= PWG3 j/psi filter =\n"); | |
238 | if (iPWGDQJPSI) printf("= PWG3 j/psi =\n"); | |
239 | if (iPWGHFd2h) { | |
240 | printf("= PWG3 D0->2 hadrons QA =\n"); | |
241 | } | |
242 | if (iPWGMuonTrain) printf("= PWG3 muon train =\n"); | |
243 | if (iPWG4partcorr) printf("= PWG4 gamma-hadron, pi0 and gamma-jet correlations =\n"); | |
244 | if (iPWGGAgammaconv) printf("= PWG4 gamma conversion =\n"); | |
245 | if (iPWG4omega3pi) printf("= PWG4 omega to 3 pions =\n"); | |
246 | printf("==================================================================\n"); | |
247 | printf(":: use physics selection: %d\n", (UInt_t)usePhysicsSelection); | |
248 | printf(":: use centrality: %d\n", (UInt_t)useCentrality); | |
249 | printf(":: use xrootd tweaks: %d\n", (UInt_t)useFastReadOption); | |
250 | printf(":: use overwrite xml : %d\n", (UInt_t)useOverwriteMode); | |
251 | printf(":: use merge via JDL: %d\n", (UInt_t)useMergeViaJDL); | |
252 | printf(":: use MC truth: %d\n", (UInt_t)useMC); | |
253 | printf(":: use KINE filter: %d\n", (UInt_t)useKFILTER); | |
254 | printf(":: use track references: %d\n", (UInt_t)useTR); | |
255 | printf(":: use tags: %d\n", (UInt_t)useTAGS); | |
256 | printf(":: use AOD tags: %d\n", (UInt_t)useAODTAGS); | |
257 | printf(":: use debugging: %d\n", (UInt_t)useDBG); | |
258 | printf(":: use PAR files: %d\n", (UInt_t)usePAR); | |
259 | printf(":: use AliEn plugin: %d\n", (UInt_t)usePLUGIN); | |
260 | ||
261 | //========================================================================== | |
262 | // Connect to back-end system | |
263 | // if (!Connect(smode)) { | |
264 | // ::Error("AnalysisTrain", "Could not connect to %s back-end", analysis_mode); | |
265 | // return; | |
266 | // } | |
267 | ||
268 | // Load common libraries and set include path | |
269 | if (!LoadCommonLibraries(smode)) { | |
270 | ::Error("AnalysisTrain", "Could not load common libraries"); | |
271 | return; | |
272 | } | |
273 | ||
274 | // Make the analysis manager and connect event handlers | |
275 | AliAnalysisManager *mgr = new AliAnalysisManager("Analysis Train", "Production train"); | |
276 | if (saveProofToAlien) mgr->SetSpecialOutputLocation(proof_outdir); | |
277 | if (!strcmp(plugin_mode, "test")) mgr->SetNSysInfo(100); | |
278 | // Load analysis specific libraries | |
279 | if (!LoadAnalysisLibraries(smode)) { | |
280 | ::Error("AnalysisTrain", "Could not load analysis libraries"); | |
281 | return; | |
282 | } | |
283 | ||
284 | // Create input handler (input container created automatically) | |
285 | if (iAODanalysis) { | |
286 | // AOD input handler | |
287 | AliAODInputHandler *aodH = new AliAODInputHandler(); | |
288 | if (iPWGHFd2h) aodH->AddFriend("AliAOD.VertexingHF.root"); | |
289 | mgr->SetInputEventHandler(aodH); | |
290 | } else { | |
291 | // ESD input handler | |
292 | AliESDInputHandler *esdHandler = new AliESDInputHandler(); | |
293 | if (useTAGS) esdHandler->SetReadTags(); | |
294 | mgr->SetInputEventHandler(esdHandler); | |
295 | } | |
296 | // Monte Carlo handler | |
297 | if (useMC && !iAODanalysis) { | |
298 | AliMCEventHandler* mcHandler = new AliMCEventHandler(); | |
299 | mgr->SetMCtruthEventHandler(mcHandler); | |
300 | mcHandler->SetReadTR(useTR); | |
301 | } | |
302 | // AOD output container, created automatically when setting an AOD handler | |
303 | if (iAODhandler) { | |
304 | // AOD output handler | |
305 | AliAODHandler* aodHandler = new AliAODHandler(); | |
306 | aodHandler->SetOutputFileName("AliAOD.root"); | |
307 | mgr->SetOutputEventHandler(aodHandler); | |
308 | if (iAODanalysis) { | |
309 | aodHandler->SetFillAOD(kFALSE); | |
310 | aodHandler->SetCreateNonStandardAOD(); | |
311 | if (iJETAN) aodHandler->SetOutputFileName("AliAOD.Jets.root"); | |
312 | // if (iPWGHFvertexing) aodHandler->SetOutputFileName("AliAOD.VertexingHF.root"); | |
313 | } | |
314 | } | |
315 | // Debugging if needed | |
316 | if (useDBG) mgr->SetDebugLevel(3); | |
317 | if (saveCanvases) mgr->SetSaveCanvases(kTRUE); | |
318 | ||
319 | //========================================================================== | |
320 | // Create the chain. In this example it is created only from ALIEN files but | |
321 | // can be done to work in batch or grid mode as well. | |
322 | TChain *chain = CreateChain(smode, plugin_mode); | |
323 | ||
324 | //========================================================================== | |
325 | // Load the tasks configuration macros for all wagons. These files are supposed now to be | |
326 | // in the current workdir, but in AliEn they will be in the file catalog, | |
327 | // mapped from AliRoot and pecified in the jdl input list. | |
328 | ||
329 | // For now connection to top input container and common AOD output container | |
330 | // is done in this macro, but in future these containers will be connected | |
331 | // from each task configuration macro. | |
332 | ||
333 | AddAnalysisTasks(); | |
334 | // Run the analysis | |
335 | // | |
336 | if (usePLUGIN) { | |
337 | AliAnalysisGrid *alienHandler = CreateAlienHandler(plugin_mode); | |
338 | AliAnalysisManager::GetAnalysisManager()->SetGridHandler(alienHandler); | |
339 | } | |
340 | ||
341 | if (mgr->InitAnalysis()) { | |
342 | mgr->PrintStatus(); | |
343 | if (saveTrain || strlen(config_file)) gSystem->ChangeDirectory(train_name); | |
344 | StartAnalysis(smode, chain); | |
345 | } | |
346 | } | |
347 | ||
348 | //______________________________________________________________________________ | |
349 | void AddAnalysisTasks(){ | |
350 | // Add all analysis task wagons to the train | |
351 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
352 | ||
353 | // | |
354 | // PIDResponse(JENS) | |
355 | // | |
356 | if (doPIDResponse) { | |
357 | gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C"); | |
358 | AliAnalysisTaskPIDResponse *PIDResponse = AddTaskPIDResponse(); | |
359 | // PIDResponse->SelectCollisionCandidates(AliVEvent::kAny); | |
360 | } | |
361 | // | |
362 | ||
363 | // CDB connection | |
364 | // | |
365 | if (doCDBconnect && !useTender) { | |
366 | gROOT->LoadMacro("$ALICE_ROOT/PWGPP/PilotTrain/AddTaskCDBconnect.C"); | |
367 | AliTaskCDBconnect *taskCDB = AddTaskCDBconnect(); | |
368 | if (!taskCDB) return; | |
369 | AliCDBManager *cdb = AliCDBManager::Instance(); | |
370 | cdb->SetDefaultStorage("raw://"); | |
371 | taskCDB->SetRunNumber(run_numbers[0]); | |
372 | } | |
373 | ||
374 | // | |
375 | // Tender and supplies. Needs to be called for every event. | |
376 | // | |
377 | if (useTender) { | |
378 | gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/TenderSupplies/AddTaskTender.C"); | |
379 | // IF V0 tender needed, put kTRUE below | |
380 | AliAnalysisTaskSE *tender = AddTaskTender(useV0tender); | |
381 | // tender->SetDebugLevel(2); | |
382 | } | |
383 | ||
384 | if (usePhysicsSelection) { | |
385 | // Physics selection task | |
386 | gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C"); | |
387 | mgr->RegisterExtraFile("event_stat.root"); | |
388 | AliPhysicsSelectionTask *physSelTask = AddTaskPhysicsSelection(useMC); | |
389 | mgr->AddStatisticsTask(AliVEvent::kAny); | |
390 | } | |
391 | ||
392 | if (useCentrality) { | |
393 | gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C"); | |
394 | AliCentralitySelectionTask *taskCentrality = AddTaskCentrality(); | |
395 | } | |
396 | ||
397 | // | |
398 | // PIDqa(JENS) | |
399 | // | |
400 | if (doPIDqa) { | |
401 | gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDqa.C"); | |
402 | AliAnalysisTaskPIDqa *PIDQA = AddTaskPIDqa(); | |
403 | PIDQA->SelectCollisionCandidates(AliVEvent::kAny); | |
404 | } | |
405 | ||
406 | //Jacek | |
407 | if (iPWGLF) { | |
408 | gROOT->LoadMacro("$ALICE_ROOT/PWGLF/SPECTRA/ChargedHadrons/dNdPt/macros/AddTask_jacek_dNdPtTrackDumpTaskPbPb_TPCITS.C"); | |
409 | AddTask_jacek_dNdPtTrackDumpTaskPbPb_TPCITS(); | |
410 | } | |
411 | ||
412 | ||
413 | if (iESDfilter && !iAODanalysis) { | |
414 | // ESD filter task configuration. | |
415 | gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskESDFilter.C"); | |
416 | if (iMUONcopyAOD) { | |
417 | printf("Registering delta AOD file\n"); | |
418 | mgr->RegisterExtraFile("AliAOD.Muons.root"); | |
419 | mgr->RegisterExtraFile("AliAOD.Dimuons.root"); | |
420 | // AliAnalysisTaskESDfilter *taskesdfilter = AddTaskESDFilter(useKFILTER, kTRUE, kFALSE, usePhysicsSelection, kFALSE, AliESDpid::kBest_T0); // e | |
421 | // AliAnalysisTaskESDfilter *taskesdfilter = AddTaskESDFilter(useKFILTER, kTRUE, kFALSE, kFALSE /*phis Sel*/,kFALSE,AliESDpid::kTOF_T0,kTRUE); // others | |
422 | AliAnalysisTaskESDfilter *taskesdfilter = AddTaskESDFilter(useKFILTER, kTRUE, kFALSE, kFALSE /*usePhysicsSelection*/,kFALSE,kTRUE,kFALSE,kFALSE,run_flag); // others | |
423 | } else { | |
424 | // AliAnalysisTaskESDfilter *taskesdfilter = AddTaskESDFilter(useKFILTER, kFALSE, kFALSE, usePhysicsSelection, kFALSE, AliESDpid::kBest_T0); // e | |
425 | // AliAnalysisTaskESDfilter *taskesdfilter = AddTaskESDFilter(useKFILTER, kFALSE, kFALSE, kFALSE /*phis Sel*/ ,kFALSE,AliESDpid::kTOF_T0,kTRUE); // others | |
426 | AliAnalysisTaskESDfilter *taskesdfilter = AddTaskESDFilter(useKFILTER, kFALSE, kFALSE, kFALSE /*usePhysicsSelection*/,kFALSE,kTRUE,kFALSE,kFALSE,run_flag); // others | |
427 | } | |
428 | /* | |
429 | Double_t v0Cuts[7]; | |
430 | Double_t cascadeCuts[8]; | |
431 | ||
432 | v0Cuts[0] = 33. ; // max allowed chi2 | |
433 | v0Cuts[1] = 0.1 ; // min allowed impact parameter for the 1st daughter | |
434 | v0Cuts[2] = 0.1 ; // min allowed impact parameter for the 2nd daughter | |
435 | v0Cuts[3] = 1. ; // max allowed DCA between the daughter tracks | |
436 | v0Cuts[4] = .998; // min allowed cosine of V0's pointing angle | |
437 | v0Cuts[5] = 0.9 ; // min radius of the fiducial volume | |
438 | v0Cuts[6] = 100. ; // max radius of the fiducial volume | |
439 | ||
440 | cascadeCuts[0] = 33. ; // max allowed chi2 (same as PDC07) | |
441 | cascadeCuts[1] = 0.05 ; // min allowed V0 impact parameter | |
442 | cascadeCuts[2] = 0.008; // "window" around the Lambda mass | |
443 | cascadeCuts[3] = 0.03 ; // min allowed bachelor's impact parameter | |
444 | cascadeCuts[4] = 0.3 ; // max allowed DCA between the V0 and the bachelor | |
445 | cascadeCuts[5] = 0.999; // min allowed cosine of the cascade pointing angle | |
446 | cascadeCuts[6] = 0.9 ; // min radius of the fiducial volume | |
447 | cascadeCuts[7] = 100. ; // max radius of the fiducial volume | |
448 | ||
449 | taskesdfilter->SetV0Cuts(v0Cuts); | |
450 | taskesdfilter->SetCascadeCuts(cascadeCuts); | |
451 | ||
452 | taskesdfilter->EnableV0CascadeVerticesReco(); | |
453 | taskesdfilter->DisableZDC(); | |
454 | */ | |
455 | } | |
456 | ||
457 | // AOD tags | |
458 | if (useAODTAGS) { | |
459 | AliAnalysisTaskTagCreator* tagTask = new AliAnalysisTaskTagCreator("AOD Tag Creator"); | |
460 | mgr->AddTask(tagTask); | |
461 | AliAnalysisDataContainer *coutTags = mgr->CreateContainer("cTag", TTree::Class(), | |
462 | AliAnalysisManager::kOutputContainer, "AOD.tag.root"); | |
463 | mgr->ConnectInput (tagTask, 0, mgr->GetCommonInputContainer()); | |
464 | mgr->ConnectOutput(tagTask, 1, coutTags); | |
465 | } | |
466 | ||
467 | // ********** PWG2 wagons ****************************************************** | |
468 | AliAnalysisManager::SetCommonFileName("PWG2histograms.root"); | |
469 | ||
470 | // Proton analysis | |
471 | if (iPWG2spectra) { | |
472 | // protons | |
473 | if (iPWG2protons) { | |
474 | gROOT->LoadMacro("$ALICE_ROOT/PWG2/SPECTRA/macros/AddTaskProtons.C"); | |
475 | AliAnalysisTaskProtons *taskprotons = AddTaskProtons(); | |
476 | if (!taskprotons) ::Warning("AnalysisTrainNew", "AliAnalysisTaskProtons cannot run for this train conditions - EXCLUDED"); | |
477 | } | |
478 | // cascades | |
479 | if (iPWG2checkcascade) { | |
480 | gROOT->LoadMacro("$ALICE_ROOT/PWG2/SPECTRA/macros/AddTaskCheckCascade.C"); | |
481 | AliAnalysisTaskCheckCascade *taskcheckcascade = AddTaskCheckCascade(iCollision,runOnData); | |
482 | if (!taskcheckcascade) ::Warning("AnalysisTrainNew", "AliAnalysisTaskCheckCascade cannot run for this train conditions - EXCLUDED"); | |
483 | } | |
484 | // v0's | |
485 | if (iPWG2checkv0) { | |
486 | gROOT->LoadMacro("$ALICE_ROOT/PWG2/SPECTRA/macros/AddTaskCheckV0.C"); | |
487 | AliAnalysisTaskCheckV0 *taskcheckV0 = AddTaskCheckV0(); | |
488 | if (!taskcheckV0) ::Warning("AnalysisTrainNew", "AliAnalysisTaskCheckV0 cannot run for this train conditions - EXCLUDED"); | |
489 | } | |
490 | // strangeness | |
491 | if (iPWG2strange) { | |
492 | gROOT->LoadMacro("$ALICE_ROOT/PWG2/SPECTRA/macros/AddTaskStrange.C"); | |
493 | AliAnalysisTaskStrange *taskstrange = AddTaskStrange(); | |
494 | if (!taskstrange) ::Warning("AnalysisTrainNew", "AliAnalysisTaskStrange cannot run for this train conditions - EXCLUDED"); | |
495 | } | |
496 | // performance cascades | |
497 | if (iPWG2perfcascade) { | |
498 | gROOT->LoadMacro("$ALICE_ROOT/PWG2/SPECTRA/macros/AddTaskCheckPerformanceCascade.C"); | |
499 | AliAnalysisTaskCheckPerformanceCascade *taskperfcascade = AddTaskCheckPerformanceCascade(); | |
500 | if (!taskperfcascade) ::Warning("AnalysisTrainNew", "AliAnalysisTaskCheckPerformanceCascade cannot run for this train conditions - EXCLUDED"); | |
501 | } | |
502 | // central | |
503 | if (iPWG2central) { | |
504 | gROOT->LoadMacro("$ALICE_ROOT/PWG2/SPECTRA/macros/AddTaskCentral.C"); | |
505 | AliAnalysisTaskCentral *taskcentral = AddTaskCentral(); | |
506 | if (!taskcentral) ::Warning("AnalysisTrainNew", "AliAnalysisTaskCentral cannot run for this train conditions - EXCLUDED"); | |
507 | } | |
508 | } | |
509 | ||
510 | // Femtoscopy analysis modules | |
511 | if (iPWG2femto) { | |
512 | gROOT->LoadMacro("$ALICE_ROOT/PWG2/FEMTOSCOPY/macros/AddTaskFemto.C"); | |
513 | AliAnalysisTaskFemto *taskfemto = AddTaskFemto(configPWG2femto); | |
514 | if (!taskfemto) ::Warning("AnalysisTrainNew", "AliAnalysisTaskFemto cannot run for this train conditions - EXCLUDED"); | |
515 | } | |
516 | ||
517 | // Kink analysis | |
518 | if (iPWG2kink) { | |
519 | if (iPWG2kinkESDMC) { | |
520 | gROOT->LoadMacro("$ALICE_ROOT/PWG2/KINK/macros/AddTaskKink.C"); | |
521 | AliAnalysisKinkESDMC *taskkink1 = AddTaskKink(); | |
522 | if (!taskkink1) ::Warning("AnalysisTrainNew", "AliAnalysisKinkESDMC cannot run for this train conditions - EXCLUDED"); | |
523 | } | |
524 | if (iPWG2kinkLSKstar) { | |
525 | gROOT->LoadMacro("$ALICE_ROOT/PWG2/KINK/macros/AddTaskKinkResLikeSignKstar.C"); | |
526 | AliResonanceKinkLikeSign *taskkink2 = AddTaskKinkResLikeSignKstar(); | |
527 | if (!taskkink2) ::Warning("AnalysisTrainNew", "AliResonanceKinkLikeSign cannot run for this train conditions - EXCLUDED"); | |
528 | } | |
529 | if (iPWG2kinkLSL1520) { | |
530 | gROOT->LoadMacro("$ALICE_ROOT/PWG2/KINK/macros/AddTaskKinkResLikeSignL1520.C"); | |
531 | AliResonanceKinkLikeSign *taskkink3 = AddTaskKinkResLikeSignL1520(); | |
532 | if (!taskkink3) ::Warning("AnalysisTrainNew", "AliResonanceKinkLikeSign cannot run for this train conditions - EXCLUDED"); | |
533 | } | |
534 | if (iPWG2kinkLSPhi) { | |
535 | gROOT->LoadMacro("$ALICE_ROOT/PWG2/KINK/macros/AddTaskKinkResLikeSignPhi.C"); | |
536 | AliResonanceKinkLikeSign *taskkink4 = AddTaskKinkResLikeSignPhi(); | |
537 | if (!taskkink4) ::Warning("AnalysisTrainNew", "AliResonanceKinkLikeSign cannot run for this train conditions - EXCLUDED"); | |
538 | } | |
539 | if (iPWG2kinkKstarESD) { | |
540 | gROOT->LoadMacro("$ALICE_ROOT/PWG2/KINK/macros/AddTaskKinkResonanceKstarESD.C"); | |
541 | AliAnalysisTaskKinkResonance *taskkink5 = AddTaskKinkResonanceKstarESD(); | |
542 | if (!taskkink5) ::Warning("AnalysisTrainNew", "AliAnalysisKinkResonanceKstarESD cannot run for this train conditions - EXCLUDED"); | |
543 | } | |
544 | if (iPWG2kinkKstarMC) { | |
545 | gROOT->LoadMacro("$ALICE_ROOT/PWG2/KINK/macros/AddTaskKinkResonanceKstarMC.C"); | |
546 | AliAnalysisTaskKinkResonance *taskkink6 = AddTaskKinkResonanceKstarMC(); | |
547 | if (!taskkink6) ::Warning("AnalysisTrainNew", "AliAnalysisKinkResonanceKstarMC cannot run for this train conditions - EXCLUDED"); | |
548 | } | |
549 | if (iPWG2kinkL1520ESD) { | |
550 | gROOT->LoadMacro("$ALICE_ROOT/PWG2/KINK/macros/AddTaskKinkResonanceL1520ESD.C"); | |
551 | AliAnalysisTaskKinkResonance *taskkink7 = AddTaskKinkResonanceL1520ESD(); | |
552 | if (!taskkink7) ::Warning("AnalysisTrainNew", "AliAnalysisKinkResonanceL1520ESD cannot run for this train conditions - EXCLUDED"); | |
553 | } | |
554 | if (iPWG2kinkL1520MC) { | |
555 | gROOT->LoadMacro("$ALICE_ROOT/PWG2/KINK/macros/AddTaskKinkResonanceL1520MC.C"); | |
556 | AliAnalysisTaskKinkResonance *taskkink8 = AddTaskKinkResonanceL1520MC(); | |
557 | if (!taskkink8) ::Warning("AnalysisTrainNew", "AliAnalysisKinkResonanceL1520MC cannot run for this train conditions - EXCLUDED"); | |
558 | } | |
559 | if (iPWG2kinkPhiESD) { | |
560 | gROOT->LoadMacro("$ALICE_ROOT/PWG2/KINK/macros/AddTaskKinkResonancePhiESD.C"); | |
561 | AliAnalysisTaskKinkResonance *taskkink9 = AddTaskKinkResonancePhiESD(); | |
562 | if (!taskkink9) ::Warning("AnalysisTrainNew", "AliAnalysisKinkResonancePhiESD cannot run for this train conditions - EXCLUDED"); | |
563 | } | |
564 | if (iPWG2kinkPhiMC) { | |
565 | gROOT->LoadMacro("$ALICE_ROOT/PWG2/KINK/macros/AddTaskKinkResonancePhiMC.C"); | |
566 | AliAnalysisTaskKinkResonance *taskkink10 = AddTaskKinkResonancePhiMC(); | |
567 | if (!taskkink10) ::Warning("AnalysisTrainNew", "AliAnalysisKinkResonancePhiMC cannot run for this train conditions - EXCLUDED"); | |
568 | } | |
569 | } | |
570 | ||
571 | // Event characterization | |
572 | if (iPWG2evchar) { | |
573 | gROOT->LoadMacro("$ALICE_ROOT/PWG2/EVCHAR/macros/AddTaskSPDdNdEta.C"); | |
574 | AliAnalysisTaskSPDdNdEta *taskspddndeta = AddTaskSPDdNdEta(); | |
575 | if (!taskspddndeta) ::Warning("AnalysisTrainNew", "AliAnalysisTaskSPDdNdEta cannot run for this train conditions - EXCLUDED"); | |
576 | taskspddndeta->SetReadMC(useMC); | |
577 | } | |
578 | ||
579 | // Unicor | |
580 | if (iPWG2unicor) { | |
581 | gROOT->LoadMacro("$ALICE_ROOT/PWG2/UNICOR/AddTaskUnicor.C"); | |
582 | AliAnalysisTaskUnicor *taskunicor = AddTaskUnicor(); | |
583 | if (!taskunicor) ::Warning("AnalysisTrainNew", "AliAnalysisTaskUnicor cannot run for this train conditions - EXCLUDED"); | |
584 | } | |
585 | ||
586 | // FMD | |
587 | AliAnalysisManager::SetCommonFileName("forward.root"); | |
588 | if (iPWG2forward) { | |
589 | gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis/AddTaskFMD.C"); | |
590 | AliFMDAnalysisTaskSE *taskfmd = AddTaskFMD(); | |
591 | if (!taskfmd) ::Warning("AnalysisTrainNew", "AliFMDAnalysisTaskSE cannot run for this train conditions - EXCLUDED"); | |
592 | } | |
593 | AliAnalysisManager::SetCommonFileName("PWG2histograms.root"); | |
594 | ||
595 | // Flow analysis | |
596 | if (iPWG2flow) { | |
597 | gROOT->LoadMacro("$ALICE_ROOT/PWG2/FLOW/macros/AddTaskFlow.C"); | |
598 | Bool_t SP = kTRUE; | |
599 | Bool_t LYZ1SUM = kTRUE; | |
600 | Bool_t LYZ1PROD = kTRUE; | |
601 | Bool_t LYZ2SUM = kFALSE; | |
602 | Bool_t LYZ2PROD = kFALSE; | |
603 | Bool_t LYZEP = kFALSE; | |
604 | Bool_t GFC = kTRUE; | |
605 | Bool_t QC = kTRUE; | |
606 | Bool_t FQD = kFALSE; | |
607 | Bool_t MCEP = kFALSE; //does not work yet 24/12/08 | |
608 | Bool_t kineFromESD = kTRUE; | |
609 | Bool_t METHODS[] = {SP,LYZ1SUM,LYZ1PROD,LYZ2SUM,LYZ2PROD,LYZEP,GFC,QC,FQD,MCEP}; | |
610 | // Analysis type can be ESD, AOD, MC, ESDMC0, ESDMC1 | |
611 | TString type = "AOD"; | |
612 | if (!iAODanalysis) type = "ESD"; | |
613 | // Boolean to fill/not fill the QA histograms | |
614 | Bool_t QA = kTRUE; | |
615 | // Boolean to use/not use weights for the Q vector | |
616 | Bool_t WEIGHTS[] = {kFALSE,kFALSE,kFALSE}; //Phi, v'(pt), v'(eta) | |
617 | AliAnalysisTaskFlowEvent* taskFE = AddTaskFlow(type,METHODS,QA,WEIGHTS); | |
618 | if (!taskFE) ::Warning("AnalysisTrainNew", "AliAnalysisTaskFlowEvent cannot run for this train conditions - EXCLUDED"); | |
619 | } | |
620 | ||
621 | // PWG2 resonances | |
622 | AliAnalysisManager::SetCommonFileName("resonances.root"); | |
623 | if (iPWG2res) { | |
624 | gROOT->LoadMacro("$ALICE_ROOT/PWG2/RESONANCES/macros/train/AddAnalysisTaskRsnNew.C"); | |
625 | gROOT->LoadMacro("$ALICE_ROOT/PWG2/RESONANCES/macros/train/AddAnalysisTaskRsnEffNew.C"); | |
626 | TString path = gROOT->GetMacroPath(); | |
627 | path += ":$ALICE_ROOT/PWG2/RESONANCES/macros/train"; | |
628 | gROOT->SetMacroPath(path); | |
629 | AddAnalysisTaskRsn(kTRUE); | |
630 | if (iPWG2rsneff) AddAnalysisTaskRsnEff(); | |
631 | } | |
632 | AliAnalysisManager::SetCommonFileName("PWG2histograms.root"); | |
633 | ||
634 | // ********** PWG3 wagons ****************************************************** | |
635 | AliAnalysisManager::SetCommonFileName("PWG3histograms.root"); | |
636 | //its immprove upgrade task | |
637 | if(iITSImprover){ | |
638 | gROOT->LoadMacro("$ALICE_ROOT/PWGHF/vertexingHF/macros/AddTaskImproveITS.C"); | |
639 | // TString taskName="AddTaskImproveITS.C"; //taskName.Prepend(loadMacroPath.Data()); | |
640 | // gROOT->LoadMacro(taskName.Data()); | |
641 | const char *resfileCur="$ALICE_ROOT/PWGHF/vertexingHF/macros/ITSgraphs_Current.root"; | |
642 | const char *resfileUpg="$ALICE_ROOT/PWGHF/vertexingHF/macros/ITSgraphs_NewAll-X0.3-Res4um.root"; | |
643 | AddTaskImproveITS(kTRUE, resfileCur,resfileUpg,1); | |
644 | } | |
645 | ||
646 | // PWG3 vertexing | |
647 | if (iPWGHFvertexing) { | |
648 | gROOT->LoadMacro("$ALICE_ROOT/PWGHF/vertexingHF/macros/AddTaskVertexingHF.C"); | |
649 | if (!iPWGHFd2h) TFile::Cp(gSystem->ExpandPathName(configPWG3d2h.Data()), Form("%s/ConfigVertexingHF.C", train_name.Data())); | |
650 | AliAnalysisTaskSEVertexingHF *taskvertexingHF = AddTaskVertexingHF(); | |
651 | // Now we need to keep in sync with the ESD filter | |
652 | if (!taskvertexingHF) ::Warning("AnalysisTrainNew", "AliAnalysisTaskSEVertexingHF cannot run for this train conditions - EXCLUDED"); | |
653 | else mgr->RegisterExtraFile("AliAOD.VertexingHF.root"); | |
654 | taskvertexingHF->SelectCollisionCandidates(0); | |
655 | } | |
656 | ||
657 | // PWG3 electrons | |
658 | if (iPWG3hfe) { | |
659 | gROOT->LoadMacro("$ALICE_ROOT/PWG3/hfe/AddTaskHFE.C"); | |
660 | AliAnalysisTaskHFE *taskHFE = AddTaskHFE(); | |
661 | if (!taskHFE) ::Warning("AnalysisTrainNew", "AliAnalysisTaskHFE cannot run for this train conditions - EXCLUDED"); | |
662 | } | |
663 | ||
664 | // PWG3 JPSI filtering | |
665 | if (iPWGDQJPSIfilter) { | |
666 | gROOT->LoadMacro("$ALICE_ROOT/PWGDQ/dielectron/macros/AddTaskJPSIFilter.C"); | |
667 | AliAnalysisTaskSE *taskJPSIfilter = AddTaskJPSIFilter(); | |
668 | if (!taskJPSIfilter) ::Warning("AnalysisTrainNew", "AliAnalysisTaskDielectronFilter cannot run for this train conditions - EXCLUDED"); | |
669 | else mgr->RegisterExtraFile("AliAOD.Dielectron.root"); | |
670 | taskJPSIfilter->SelectCollisionCandidates(0); | |
671 | } | |
672 | ||
673 | // PWG3 JPSI | |
674 | if (iPWGDQJPSI) { | |
675 | gROOT->LoadMacro("$ALICE_ROOT/PWGDQ/dielectron/macros/AddTaskJPSI.C"); | |
676 | AliAnalysisTask *taskJPSI = AddTaskJPSI(); | |
677 | if (!taskJPSI) ::Warning("AnalysisTrainNew", "AliAnalysisTaskMultiDielectron cannot run for this train conditions - EXCLUDED"); | |
678 | } | |
679 | ||
680 | // PWG3 D2h | |
681 | if (iPWGHFd2h) { | |
682 | gROOT->LoadMacro("$ALICE_ROOT/PWGHF/vertexingHF/AddD2HTrain.C"); | |
683 | TFile::Cp(gSystem->ExpandPathName(configPWG3d2h.Data()), | |
684 | Form("%s/ConfigVertexingHF.C", train_name.Data())); | |
685 | ||
686 | AddD2HTrain(kFALSE, 1,0,0,0,0,0,0,0,0,0,0); | |
687 | } | |
688 | ||
689 | // PWG3 muon | |
690 | if (iPWGMuonTrain) { | |
691 | gROOT->LoadMacro("$ALICE_ROOT/PWG/muon/AddPWG3MuonTrain.C"); | |
692 | // iESDAnalysis, iAODAnalysis -> flags to select if the train is AOD or ESD based | |
693 | // iMuonDistributions, iSingleMuonANAlysis -> flags to switch on/off analysis wagons | |
694 | Int_t isESDAnalysis = (iAODanalysis)?0:1; | |
695 | Int_t isAODAnalysis = (iAODanalysis)?1:0; | |
696 | Int_t addMuonDistributions = 1; | |
697 | Int_t addSingleMuonAnalysis = 1; | |
698 | Int_t addMuonHFAnalysis = 1; | |
699 | Int_t ntaskmuon = AddPWG3MuonTrain(isESDAnalysis,isAODAnalysis,addMuonDistributions,addSingleMuonAnalysis,addMuonHFAnalysis); | |
700 | printf("Added %d muon tasks\n", ntaskmuon); | |
701 | } | |
702 | ||
703 | // ********** PWG4 wagons ****************************************************** | |
704 | AliAnalysisManager::SetCommonFileName("PWG4histograms.root"); | |
705 | ||
706 | // Jet analysis | |
707 | ||
708 | // Configurations flags, move up? | |
709 | TString kDeltaAODJetName = "AliAOD.Jets.root"; // | |
710 | Bool_t kIsPbPb = true; // can be more intlligent checking the name of the data set | |
711 | TString kDefaultJetBackgroundBranch = ""; | |
712 | TString kJetSubtractBranches = ""; | |
713 | UInt_t kHighPtFilterMask = 768;// from esd filter | |
714 | if(run_flag==1000)kHighPtFilterMask = 272;// from esd filter for 2010 | |
715 | UInt_t iPhysicsSelectionFlag = 0; | |
716 | if (iJETAN) { | |
717 | gROOT->LoadMacro("$ALICE_ROOT/PWGJE/macros/AddTaskJets.C"); | |
718 | if (!iAODanalysis) { | |
719 | // Default jet reconstructor running on ESD's | |
720 | AliAnalysisTaskJets *taskjets = AddTaskJets("AOD","UA1",0.4,kHighPtFilterMask,1.,0); // no background subtraction | |
721 | if(kDeltaAODJetName.Length()>0)taskjets->SetNonStdOutputFile(kDeltaAODJetName.Data()); | |
722 | if (!taskjets) ::Warning("AnalysisTrainNew", "AliAnalysisTaskJets cannot run for this train conditions - EXCLUDED"); | |
723 | if (iJETANdelta) { | |
724 | // AddTaskJetsDelta("AliAOD.Jets.root"); // need to modify this accordingly in the add task jets | |
725 | mgr->RegisterExtraFile(kDeltaAODJetName.Data()); | |
726 | TString cTmp(""); | |
727 | if(kIsPbPb){ | |
728 | // UA1 intrinsic background subtraction | |
729 | taskjets = AddTaskJets("AOD","UA1",0.4,kHighPtFilterMask,1.,2); // background subtraction | |
730 | if(kDeltaAODJetName.Length()>0)taskjets->SetNonStdOutputFile(kDeltaAODJetName.Data()); | |
731 | } | |
732 | ||
733 | // Add the clusters.. | |
734 | gROOT->LoadMacro("$ALICE_ROOT/PWGJE/macros/AddTaskJetCluster.C"); | |
735 | AliAnalysisTaskJetCluster *taskCl = 0; | |
736 | Float_t fCenUp = 0; | |
737 | Float_t fCenLo = 0; | |
738 | Float_t fTrackEtaWindow = 0.9; | |
739 | 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 | |
740 | taskCl->SetBackgroundCalc(kTRUE); | |
741 | taskCl->SetNRandomCones(1); | |
742 | taskCl->SetCentralityCut(fCenLo,fCenUp); | |
743 | taskCl->SetGhostEtamax(fTrackEtaWindow); | |
744 | kDefaultJetBackgroundBranch = Form("%s_%s",AliAODJetEventBackground::StdBranchName(),taskCl->GetJetOutputBranch()); | |
745 | ||
746 | taskCl = AddTaskJetCluster("AOD","",kHighPtFilterMask,iPhysicsSelectionFlag,"ANTIKT",0.4,0,1,kDeltaAODJetName.Data(),0.15); | |
747 | taskCl->SetCentralityCut(fCenLo,fCenUp); | |
748 | if(kIsPbPb)taskCl->SetBackgroundBranch(kDefaultJetBackgroundBranch.Data()); | |
749 | kJetSubtractBranches += Form("%s ",taskCl->GetJetOutputBranch()); | |
750 | ||
751 | taskCl = AddTaskJetCluster("AOD","",kHighPtFilterMask,iPhysicsSelectionFlag,"ANTIKT",0.3,0,1,kDeltaAODJetName.Data(),0.15); | |
752 | taskCl->SetCentralityCut(fCenLo,fCenUp); | |
753 | if(kIsPbPb)taskCl->SetBackgroundBranch(kDefaultJetBackgroundBranch.Data()); | |
754 | kJetSubtractBranches += Form("%s ",taskCl->GetJetOutputBranch()); | |
755 | ||
756 | // DO THE BACKGROUND SUBTRACTION | |
757 | if(kIsPbPb&&kJetSubtractBranches.Length()){ | |
758 | gROOT->LoadMacro("$ALICE_ROOT/PWGJE/macros/AddTaskJetBackgroundSubtract.C"); | |
759 | AliAnalysisTaskJetBackgroundSubtract *taskSubtract = 0; | |
760 | taskSubtract = AddTaskJetBackgroundSubtract(kJetSubtractBranches,1,"B0","B%d"); | |
761 | taskSubtract->SetBackgroundBranch(kDefaultJetBackgroundBranch.Data()); | |
762 | if(kDeltaAODJetName.Length()>0)taskSubtract->SetNonStdOutputFile(kDeltaAODJetName.Data()); | |
763 | } | |
764 | } | |
765 | } else { | |
766 | // AOD-based analysis. Add all reconstructors to write into delta AOD's | |
767 | if (iJETANdelta) { | |
768 | Int_t ntasksjets = AddTaskJetsDelta("AliAOD.Jets.root",0,kFALSE); | |
769 | if (ntasksjets) printf("Added %d jet reconstructors\n", ntasksjets); | |
770 | } | |
771 | } | |
772 | } | |
773 | ||
774 | // PWG4 hadron correlations | |
775 | if (iPWG4partcorr) { | |
776 | Bool_t isSimulation = (runOnData)?kFALSE:kTRUE; | |
777 | gROOT->LoadMacro("$ALICE_ROOT/PWGJE/macros/AddTaskPartCorr.C"); | |
778 | AliAnalysisTaskParticleCorrelation *taskpartcorrPHOS = AddTaskPartCorr("AOD", "PHOS", kFALSE, isSimulation); | |
779 | if (!taskpartcorrPHOS) ::Warning("AnalysisTrainNew", "AliAnalysisTaskParticleCorrelation PHOS cannot run for this train conditions - EXCLUDED"); | |
780 | AliAnalysisTaskParticleCorrelation *taskpartcorrEMCAL = AddTaskPartCorr("AOD", "EMCAL", kFALSE, isSimulation); | |
781 | if (!taskpartcorrEMCAL) ::Warning("AnalysisTrainNew", "AliAnalysisTaskParticleCorrelation EMCAL cannot run for this train conditions - EXCLUDED"); | |
782 | mgr->RegisterExtraFile("deltaAODPartCorr.root"); | |
783 | } | |
784 | ||
785 | // PWG4 omega to 3 pions analysis | |
786 | if (iPWG4omega3pi) { | |
787 | gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskomega3pi.C"); | |
788 | AliAnalysisTaskOmegaPi0PiPi *taskomega3pi = AddTaskomega3pi(); | |
789 | if (!taskomega3pi) ::Warning("AnalysisTrainNew", "AliAnalysisTaskomega3pi cannot run for these train conditions - EXCLUDED"); | |
790 | } | |
791 | if (iPWGGAgammaconv) { | |
792 | gROOT->LoadMacro("$ALICE_ROOT/PWGGA/GammaConv/macros/AddTask_ConversionAODProduction.C"); | |
793 | AliAnalysisTask *taskconv = AddTask_ConversionAODProduction(iCollision); | |
794 | mgr->RegisterExtraFile("AliAODGammaConversion.root"); | |
795 | } | |
796 | } | |
797 | ||
798 | //______________________________________________________________________________ | |
799 | void StartAnalysis(const char *mode, TChain *chain) { | |
800 | // Start analysis. | |
801 | Int_t imode = -1; | |
802 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
803 | if (!strcmp(mode, "LOCAL")) imode = 0; | |
804 | if (!strcmp(mode, "PROOF")) imode = 1; | |
805 | if (!strcmp(mode, "GRID")) imode = 2; | |
806 | switch (imode) { | |
807 | case 0: | |
808 | if (!chain) { | |
809 | ::Error("AnalysisTrainNew.C::StartAnalysis", "Cannot create the chain"); | |
810 | return; | |
811 | } | |
812 | mgr->StartAnalysis(mode, chain); | |
813 | return; | |
814 | case 1: | |
815 | if (!proof_dataset.Length()) { | |
816 | ::Error("AnalysisTrainNew.C::StartAnalysis", "proof_dataset is empty"); | |
817 | return; | |
818 | } | |
819 | mgr->StartAnalysis(mode, proof_dataset, 1000); | |
820 | return; | |
821 | case 2: | |
822 | if (usePLUGIN) { | |
823 | if (!mgr->GetGridHandler()) { | |
824 | ::Error("AnalysisTrainNew.C::StartAnalysis", "Grid plugin not initialized"); | |
825 | return; | |
826 | } | |
827 | mgr->StartAnalysis("grid"); | |
828 | } else { | |
829 | if (!chain) { | |
830 | ::Error("AnalysisTrainNew.C::StartAnalysis", "Cannot create the chain"); | |
831 | return; | |
832 | } | |
833 | mgr->StartAnalysis(mode, chain); | |
834 | } | |
835 | return; | |
836 | } | |
837 | } | |
838 | ||
839 | //______________________________________________________________________________ | |
840 | void CheckModuleFlags(const char *mode) { | |
841 | // Checks selected modules and insure compatibility | |
842 | Int_t imode = -1; | |
843 | if (!strcmp(mode, "LOCAL")) imode = 0; | |
844 | if (!strcmp(mode, "PROOF")) imode = 1; | |
845 | if (!strcmp(mode, "GRID")) imode = 2; | |
846 | if (!iJETAN) iJETANdelta = 0; | |
847 | if (imode==1) { | |
848 | if (!usePAR) { | |
849 | ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PAR files enabled due to PROOF analysis"); | |
850 | usePAR = kTRUE; | |
851 | } | |
852 | } | |
853 | if (imode != 2) { | |
854 | ::Info("AnalysisTrainNew.C::CheckModuleFlags", "AliEn plugin disabled since not in GRID mode"); | |
855 | usePLUGIN = kFALSE; | |
856 | } | |
857 | if (iAODanalysis) { | |
858 | // AOD analysis | |
859 | if (useMC) | |
860 | ::Info("AnalysisTrainNew.C::CheckModuleFlags", "MC usage disabled in analysis on AOD's"); | |
861 | if (useAODTAGS) | |
862 | ::Info("AnalysisTrainNew.C::CheckModuleFlags", "AOD tags usage disabled in analysis on AOD's"); | |
863 | useMC = kFALSE; | |
864 | useTR = kFALSE; | |
865 | useAODTAGS = kFALSE; | |
866 | if (iESDfilter) | |
867 | ::Info("AnalysisTrainNew.C::CheckModuleFlags", "ESD filter disabled in analysis on AOD's"); | |
868 | iESDfilter = 0; | |
869 | if (!iAODhandler) { | |
870 | if (iJETAN) | |
871 | ::Info("AnalysisTrainNew.C::CheckModuleFlags", "JETAN disabled in analysis on AOD's without AOD handler"); | |
872 | iJETAN = 0; | |
873 | iJETANdelta = 0; | |
874 | } | |
875 | // Disable tasks that do not work yet on AOD data | |
876 | if (iPWGGAgammaconv) | |
877 | ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG4gammaconv disabled on AOD's without AOD handler"); | |
878 | iPWGGAgammaconv = 0; | |
879 | if (iPWG2central) | |
880 | ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG2central disabled on AOD's"); | |
881 | iPWG2central = 0; | |
882 | if (iPWG2flow) | |
883 | ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG2flow disabled on AOD's"); | |
884 | iPWG2flow = 0; | |
885 | if (iPWG2femto) | |
886 | ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG2femto disabled on AOD's"); | |
887 | iPWG2femto = 0; | |
888 | if (iPWG2res) | |
889 | ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG2res disabled on AOD's"); | |
890 | iPWG2res = 0; | |
891 | if (iPWG2rsneff) | |
892 | ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG2rsneff disabled on AOD's"); | |
893 | iPWG2rsneff = 0; | |
894 | if (iPWG2kink) | |
895 | ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG2kink disabled in analysis on AOD's"); | |
896 | iPWG2kink = 0; | |
897 | if (iPWG2unicor) | |
898 | ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG2unicor disabled in analysis on AOD's"); | |
899 | iPWG2unicor = 0; | |
900 | if (iPWG2evchar) | |
901 | ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG4evchar disabled on AOD's"); | |
902 | iPWG2evchar = 0; | |
903 | if (iPWG2forward) | |
904 | ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG2forward disabled in analysis on AOD's"); | |
905 | iPWG2forward = 0; | |
906 | if (iPWG3hfe) | |
907 | ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG3hfe disabled on AOD's"); | |
908 | iPWG3hfe = 0; | |
909 | if (iPWG4omega3pi) | |
910 | ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG4omega3pi disabled on AOD's"); | |
911 | iPWG4omega3pi = 0; | |
912 | } else { | |
913 | // ESD analysis | |
914 | if (!useMC) useTR = kFALSE; | |
915 | } | |
916 | if (!useMC) { | |
917 | if (iPWG2perfcascade) | |
918 | ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG2perfcascade disabled without MC info"); | |
919 | iPWG2perfcascade = 0; | |
920 | if (iPWG2central) | |
921 | ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG2central disabled without MC info"); | |
922 | iPWG2central = 0; | |
923 | } | |
924 | if (iJETAN && !iAODanalysis) iESDfilter=1; | |
925 | if (iESDfilter) {iAODhandler=1; useCORRFW = kTRUE;} | |
926 | if (iPWG2spectra || iPWG2flow || iPWGHFvertexing || iPWG3hfe || iPWG2res || iPWG2rsneff) useCORRFW = kTRUE; | |
927 | if (useKFILTER && !useMC) useKFILTER = kFALSE; | |
928 | if (useAODTAGS && !iAODhandler) useAODTAGS = kFALSE; | |
929 | } | |
930 | ||
931 | //______________________________________________________________________________ | |
932 | Bool_t Connect(const char *mode) { | |
933 | // Connect <username> to the back-end system. | |
934 | Int_t imode = -1; | |
935 | if (!strcmp(mode, "LOCAL")) imode = 0; | |
936 | if (!strcmp(mode, "PROOF")) imode = 1; | |
937 | if (!strcmp(mode, "GRID")) imode = 2; | |
938 | TString username = gSystem->Getenv("alien_API_USER"); | |
939 | switch (imode) { | |
940 | case 0: | |
941 | break; | |
942 | case 1: | |
943 | if (!username.Length()) { | |
944 | ::Error(Form("AnalysisTrainNew.C::Connect <%s>", mode), "Make sure you:\n \ | |
945 | 1. Have called: alien-token-init <username>\n \ | |
946 | 2. Have called: >source /tmp/gclient_env_$UID"); | |
947 | return kFALSE; | |
948 | } | |
949 | ::Info("AnalysisTrainNew.C::Connect", "Connecting user <%s> to PROOF cluster <%s>", | |
950 | username.Data(), proof_cluster.Data()); | |
951 | gEnv->SetValue("XSec.GSI.DelegProxy", "2"); | |
952 | // TProof::Open(Form("%s@%s:31093", username.Data(), proof_cluster.Data())); | |
953 | TProof::Open(Form("%s@%s", username.Data(), proof_cluster.Data())); | |
954 | if (!gProof) { | |
955 | if (strcmp(gSystem->Getenv("XrdSecGSISRVNAMES"), "lxfsrd0506.cern.ch")) | |
956 | ::Error(Form("AnalysisTrainNew.C::Connect <%s>", mode), "Environment XrdSecGSISRVNAMES different from lxfsrd0506.cern.ch"); | |
957 | return kFALSE; | |
958 | } | |
959 | TGrid::Connect("alien://"); | |
960 | if (gGrid) { | |
961 | TString homedir = gGrid->GetHomeDirectory(); | |
962 | TString workdir = homedir + train_name; | |
963 | if (!gGrid->Cd(workdir)) { | |
964 | gGrid->Cd(homedir); | |
965 | if (gGrid->Mkdir(workdir)) { | |
966 | gGrid->Cd(train_name); | |
967 | ::Info("AnalysisTrainNew::Connect()", "Directory %s created", gGrid->Pwd()); | |
968 | } | |
969 | } | |
970 | gGrid->Mkdir("proof_output"); | |
971 | gGrid->Cd("proof_output"); | |
972 | proof_outdir = Form("alien://%s", gGrid->Pwd()); | |
973 | } | |
974 | break; | |
975 | case 2: | |
976 | if (usePLUGIN && !gSystem->Getenv("alien_CLOSE_SE")) { | |
977 | ::Error(Form("AnalysisTrainNew.C::Connect <%s>", mode), | |
978 | "When using the AliEn plugin it is preferable to define the \ | |
979 | variable alien_CLOSE_SE in your environment."); | |
980 | return kFALSE; | |
981 | } | |
982 | ::Info("AnalysisTrainNew.C::Connect", "Connecting user <%s> to AliEn ...", | |
983 | username.Data()); | |
984 | TGrid::Connect("alien://"); | |
985 | if (!gGrid || !gGrid->IsConnected()) return kFALSE; | |
986 | break; | |
987 | default: | |
988 | ::Error("AnalysisTrainNew.C::Connect", "Unknown run mode: %s", mode); | |
989 | return kFALSE; | |
990 | } | |
991 | ::Info("AnalysisTrainNew.C::Connect","Connected in %s mode", mode); | |
992 | return kTRUE; | |
993 | } | |
994 | ||
995 | //______________________________________________________________________________ | |
996 | Bool_t LoadCommonLibraries(const char *mode) | |
997 | { | |
998 | // Load common analysis libraries. | |
999 | Int_t imode = -1; | |
1000 | if (!strcmp(mode, "LOCAL")) imode = 0; | |
1001 | if (!strcmp(mode, "PROOF")) imode = 1; | |
1002 | if (!strcmp(mode, "GRID")) imode = 2; | |
1003 | if (!gSystem->Getenv("ALICE_ROOT")) { | |
1004 | ::Error("AnalysisTrainNew.C::LoadCommonLibraries", "Analysis train requires that analysis libraries are compiled with a local AliRoot"); | |
1005 | return kFALSE; | |
1006 | } | |
1007 | Bool_t success = kTRUE; | |
1008 | // ROOT libraries | |
1009 | gSystem->Load("libTree.so"); | |
1010 | gSystem->Load("libGeom.so"); | |
1011 | gSystem->Load("libVMC.so"); | |
1012 | gSystem->Load("libPhysics.so"); | |
1013 | gSystem->Load("libMinuit.so"); | |
1014 | ||
1015 | // Load framework classes. Par option ignored here. | |
1016 | switch (imode) { | |
1017 | case 0: | |
1018 | case 2: | |
1019 | if (useCPAR) { | |
1020 | success &= LoadLibrary("STEERBase", mode, kTRUE); | |
1021 | success &= LoadLibrary("ESD", mode, kTRUE); | |
1022 | success &= LoadLibrary("AOD", mode, kTRUE); | |
1023 | success &= LoadLibrary("ANALYSIS", mode, kTRUE); | |
1024 | success &= LoadLibrary("ANALYSISalice", mode, kTRUE); | |
1025 | if (useCORRFW) success &= LoadLibrary("CORRFW", mode, kTRUE); | |
1026 | } else { | |
1027 | success &= LoadLibrary("libSTEERBase.so", mode); | |
1028 | success &= LoadLibrary("libESD.so", mode); | |
1029 | success &= LoadLibrary("libAOD.so", mode); | |
1030 | success &= LoadLibrary("libANALYSIS.so", mode); | |
1031 | success &= LoadLibrary("libANALYSISalice.so", mode); | |
1032 | if (useCORRFW) success &= LoadLibrary("libCORRFW.so", mode); | |
1033 | gROOT->ProcessLine(".include $ALICE_ROOT/include"); | |
1034 | } | |
1035 | break; | |
1036 | case 1: | |
1037 | Int_t ires = -1; | |
1038 | if (useAFPAR && !gSystem->AccessPathName(AFversion)) ires = gProof->UploadPackage(AFversion); | |
1039 | if (ires < 0) { | |
1040 | success &= LoadLibrary("STEERBase", mode); | |
1041 | success &= LoadLibrary("ESD", mode); | |
1042 | success &= LoadLibrary("AOD", mode); | |
1043 | success &= LoadLibrary("ANALYSIS", mode); | |
1044 | success &= LoadLibrary("ANALYSISalice", mode); | |
1045 | if (useCORRFW) success &= LoadLibrary("CORRFW", mode); | |
1046 | } else { | |
1047 | ires = gProof->EnablePackage(AFversion); | |
1048 | if (ires<0) success = kFALSE; | |
1049 | if (useCORRFW) success &= LoadLibrary("CORRFW", mode); | |
1050 | } | |
1051 | break; | |
1052 | default: | |
1053 | ::Error("AnalysisTrainNew.C::LoadCommonLibraries", "Unknown run mode: %s", mode); | |
1054 | return kFALSE; | |
1055 | } | |
1056 | if (success) { | |
1057 | ::Info("AnalysisTrainNew.C::LoadCommodLibraries", "Load common libraries: SUCCESS"); | |
1058 | ::Info("AnalysisTrainNew.C::LoadCommodLibraries", "Include path for Aclic compilation:\n%s", | |
1059 | gSystem->GetIncludePath()); | |
1060 | } else { | |
1061 | ::Info("AnalysisTrainNew.C::LoadCommodLibraries", "Load common libraries: FAILED"); | |
1062 | } | |
1063 | ||
1064 | return success; | |
1065 | } | |
1066 | ||
1067 | //______________________________________________________________________________ | |
1068 | Bool_t LoadAnalysisLibraries(const char *mode) | |
1069 | { | |
1070 | // Load common analysis libraries. | |
1071 | Bool_t success = kTRUE; | |
1072 | if (useTender || doCDBconnect) { | |
1073 | if (!LoadLibrary("TENDER", mode, kTRUE) || | |
1074 | !LoadLibrary("TENDERSupplies", mode, kTRUE)) return kFALSE; | |
1075 | } | |
1076 | // CDBconnect | |
1077 | if (doCDBconnect && !useTender) { | |
1078 | if (!LoadLibrary("PWGPP", mode, kTRUE)) return kFALSE; | |
1079 | } | |
1080 | ||
1081 | if (iESDfilter || iPWGMuonTrain) { | |
1082 | if (!LoadLibrary("PWGmuon", mode, kTRUE)) return kFALSE; | |
1083 | } | |
1084 | // JETAN | |
1085 | if (iJETAN) { | |
1086 | if (!LoadLibrary("JETAN", mode, kTRUE)) return kFALSE; | |
1087 | } | |
1088 | if (iJETANdelta) { | |
1089 | if (!LoadLibrary("JETAN", mode, kTRUE) || | |
1090 | !LoadLibrary("CGAL", mode, kTRUE) || | |
1091 | !LoadLibrary("fastjet", mode, kTRUE) || | |
1092 | !LoadLibrary("siscone", mode, kTRUE) || | |
1093 | !LoadLibrary("SISConePlugin", mode, kTRUE) || | |
1094 | !LoadLibrary("FASTJETAN", mode, kTRUE)) return kFALSE; | |
1095 | } | |
1096 | // PWG4 particle correlations | |
1097 | if (iPWG4partcorr) { | |
1098 | if (!LoadLibrary("EMCALUtils", mode, kTRUE) || | |
1099 | !LoadLibrary("PHOSUtils", mode, kTRUE) || | |
1100 | !LoadLibrary("PWG4PartCorrBase", mode, kTRUE) || | |
1101 | !LoadLibrary("PWG4PartCorrDep", mode, kTRUE)) return kFALSE; | |
1102 | } | |
1103 | // PWG4 gamma conversion | |
1104 | if (iPWGGAgammaconv) { | |
1105 | if (!LoadLibrary("PWGGAGammaConv", mode, kTRUE)) return kFALSE; | |
1106 | } | |
1107 | // PWG4 omega to 3 pions | |
1108 | if (iPWG4omega3pi) { | |
1109 | if (!LoadLibrary("PWG4omega3pi", mode, kTRUE)) return kFALSE; | |
1110 | } | |
1111 | // PWG2 task protons | |
1112 | if (iPWG2spectra) { | |
1113 | if (!LoadLibrary("PWG2spectra", mode, kTRUE)) return kFALSE; | |
1114 | } | |
1115 | // PWG2 flow | |
1116 | if (iPWG2flow) { | |
1117 | if (!LoadLibrary("PWG2flowCommon", mode, kTRUE) || | |
1118 | !LoadLibrary("PWG2flowTasks", mode, kTRUE)) return kFALSE; | |
1119 | } | |
1120 | // PWG2 resonances | |
1121 | if (iPWG2res || iPWG2rsneff) { | |
1122 | if (!LoadLibrary("PWG2resonances", mode, kTRUE)) return kFALSE; | |
1123 | } | |
1124 | // PWG2 kink | |
1125 | if (iPWG2kink) { | |
1126 | if (!LoadLibrary("PWG2kink", mode, kTRUE)) return kFALSE; | |
1127 | } | |
1128 | // PWG2 unicor | |
1129 | if (iPWG2unicor) { | |
1130 | if (!LoadLibrary("PWG2unicor", mode, kTRUE)) return kFALSE; | |
1131 | } | |
1132 | // PWG2 evchar | |
1133 | if (iPWG2evchar) { | |
1134 | if (!LoadLibrary("PWG2evchar", mode, kTRUE)) return kFALSE; | |
1135 | } | |
1136 | // PWG2 femtoscopy | |
1137 | if (iPWG2femto) { | |
1138 | if (!LoadLibrary("PWG2AOD", mode, kTRUE) || | |
1139 | !LoadLibrary("PWG2femtoscopy", mode, kTRUE) || | |
1140 | !LoadLibrary("PWG2femtoscopyUser", mode, kTRUE)) return kFALSE; | |
1141 | // TFile::Cp(gSystem->ExpandPathName("$(ALICE_ROOT)/PWG2/FEMTOSCOPY/macros/ConfigFemtoAnalysis.C"), Form("%s/ConfigFemtoAnalysis.C", train_name.Data())); | |
1142 | // anaLibs += "ConfigFemtoAnalysis.C "; | |
1143 | } | |
1144 | // PWG2 FORWARD | |
1145 | if (iPWG2forward) { | |
1146 | if (!LoadLibrary("PWG2forward", mode, kTRUE)) return kFALSE; | |
1147 | } | |
1148 | // PWG3 Vertexing HF | |
1149 | if (iPWGHFvertexing || iPWGHFd2h) { | |
1150 | if (!LoadLibrary("PWGflowBase", mode, kTRUE) || | |
1151 | !LoadLibrary("PWGflowTasks", mode, kTRUE) || | |
1152 | !LoadLibrary("PWGHFvertexingHF", mode, kTRUE)) return kFALSE; | |
1153 | } | |
1154 | // PWG3 hfe | |
1155 | if (iPWG3hfe) { | |
1156 | if (!LoadLibrary("PWG3hfe", mode, kTRUE)) return kFALSE; | |
1157 | } | |
1158 | // PWG3 dielectron | |
1159 | if (iPWGDQJPSIfilter || iPWGDQJPSI) { | |
1160 | if (!LoadLibrary("PWGDQdielectron", mode, kTRUE)) return kFALSE; | |
1161 | } | |
1162 | if (iPWGLF) { | |
1163 | if (!LoadLibrary("TENDER", mode, kTRUE) || !LoadLibrary("PWGUDbase", mode, kTRUE) || | |
1164 | !LoadLibrary("TPCcalib", mode, kTRUE) || | |
1165 | !LoadLibrary("PWGPP", mode, kTRUE) || | |
1166 | !LoadLibrary("PWGLFspectra", mode, kTRUE)) return kFALSE; | |
1167 | } | |
1168 | ::Info("AnalysisTrainNew.C::LoadAnalysisLibraries", "Load other libraries: SUCCESS"); | |
1169 | return kTRUE; | |
1170 | } | |
1171 | ||
1172 | //______________________________________________________________________________ | |
1173 | Bool_t LoadLibrary(const char *module, const char *mode, Bool_t rec=kFALSE) | |
1174 | { | |
1175 | // Load a module library in a given mode. Reports success. | |
1176 | Int_t imode = -1; | |
1177 | Int_t result; | |
1178 | TString smodule(module); | |
1179 | if (!strcmp(mode, "LOCAL")) imode = 0; | |
1180 | if (!strcmp(mode, "PROOF")) imode = 1; | |
1181 | if (!strcmp(mode, "GRID")) imode = 2; | |
1182 | TString mod(module); | |
1183 | if (!mod.Length()) { | |
1184 | ::Error("AnalysisTrainNew.C::LoadLibrary", "Empty module name"); | |
1185 | return kFALSE; | |
1186 | } | |
1187 | // If a library is specified, just load it | |
1188 | if (smodule.EndsWith(".so")) { | |
1189 | mod.Remove(mod.Index(".so")); | |
1190 | result = gSystem->Load(mod); | |
1191 | if (result < 0) { | |
1192 | ::Error("AnalysisTrainNew.C::LoadLibrary", "Could not load library %s", module); | |
1193 | return kFALSE; | |
1194 | } | |
1195 | if (rec) anaLibs += Form("%s.so ",mod.Data()); | |
1196 | return kTRUE; | |
1197 | } | |
1198 | // Check if the library is already loaded | |
1199 | if (strlen(gSystem->GetLibraries(Form("%s.so", module), "", kFALSE)) > 0) | |
1200 | return kTRUE; | |
1201 | switch (imode) { | |
1202 | case 0: | |
1203 | case 2: | |
1204 | if (usePAR) { | |
1205 | result = SetupPar(module); | |
1206 | if (rec) anaPars += Form("%s.par ", module); | |
1207 | } else { | |
1208 | result = gSystem->Load(Form("lib%s.so", module)); | |
1209 | if (rec) anaLibs += Form("lib%s.so ", module); | |
1210 | } | |
1211 | break; | |
1212 | case 1: | |
1213 | result = gProof->UploadPackage(module); | |
1214 | if (result<0) { | |
1215 | result = gProof->UploadPackage(gSystem->ExpandPathName(Form("$ALICE_ROOT/%s.par", module))); | |
1216 | if (result<0) { | |
1217 | ::Error("AnalysisTrainNew.C::LoadLibrary", "Could not find module %s.par in current directory nor in $ALICE_ROOT", module); | |
1218 | return kFALSE; | |
1219 | } | |
1220 | } | |
1221 | result = gProof->EnablePackage(module); | |
1222 | break; | |
1223 | default: | |
1224 | return kFALSE; | |
1225 | } | |
1226 | if (result < 0) { | |
1227 | ::Error("AnalysisTrainNew.C::LoadLibrary", "Could not load module %s", module); | |
1228 | return kFALSE; | |
1229 | } | |
1230 | return kTRUE; | |
1231 | } | |
1232 | ||
1233 | ||
1234 | //______________________________________________________________________________ | |
1235 | TChain *CreateChain(const char *mode, const char *plugin_mode) | |
1236 | { | |
1237 | // Create the input chain | |
1238 | Int_t imode = -1; | |
1239 | if (!strcmp(mode, "LOCAL")) imode = 0; | |
1240 | if (!strcmp(mode, "PROOF")) imode = 1; | |
1241 | if (!strcmp(mode, "GRID")) imode = 2; | |
1242 | TChain *chain = NULL; | |
1243 | // Local chain | |
1244 | switch (imode) { | |
1245 | case 0: | |
1246 | if (iAODanalysis) { | |
1247 | if (!local_xmldataset.Length()) { | |
1248 | // Local AOD | |
1249 | chain = new TChain("aodTree"); | |
1250 | if (gSystem->AccessPathName("data/AliAOD.root")) | |
1251 | ::Error("AnalysisTrainNew.C::CreateChain", "File: AliAOD.root not in ./data dir"); | |
1252 | else { | |
1253 | if (!saveTrain) chain->Add("data/AliAOD.root"); | |
1254 | else chain->Add("../data/AliAOD.root"); | |
1255 | } | |
1256 | } else { | |
1257 | // Interactive AOD | |
1258 | chain = CreateChainSingle(local_xmldataset, "aodTree"); | |
1259 | } | |
1260 | } else { | |
1261 | if (!local_xmldataset.Length()) { | |
1262 | // Local ESD | |
1263 | chain = new TChain("esdTree"); | |
1264 | if (gSystem->AccessPathName("data/AliESDs.root")) | |
1265 | ::Error("AnalysisTrainNew.C::CreateChain", "File: AliESDs.root not in ./data dir"); | |
1266 | else { | |
1267 | if (!saveTrain) chain->Add("data/AliESDs.root"); | |
1268 | else chain->Add("../data/AliESDs.root"); | |
1269 | } | |
1270 | } else { | |
1271 | // Interactive ESD | |
1272 | chain = CreateChainSingle(local_xmldataset, "esdTree"); | |
1273 | } | |
1274 | } | |
1275 | break; | |
1276 | case 1: | |
1277 | break; | |
1278 | case 2: | |
1279 | if (usePLUGIN) { | |
1280 | // AliAnalysisGrid *alienHandler = CreateAlienHandler(plugin_mode); | |
1281 | // AliAnalysisManager::GetAnalysisManager()->SetGridHandler(alienHandler); | |
1282 | } else { | |
1283 | TString treeName = "esdTree"; | |
1284 | if (iAODanalysis) treeName = "aodTree"; | |
1285 | chain = CreateChainSingle("wn.xml", treeName); | |
1286 | } | |
1287 | break; | |
1288 | default: | |
1289 | } | |
1290 | if (chain && chain->GetNtrees()) return chain; | |
1291 | return NULL; | |
1292 | } | |
1293 | ||
1294 | //______________________________________________________________________________ | |
1295 | TChain* CreateChainSingle(const char* xmlfile, const char *treeName) | |
1296 | { | |
1297 | printf("*******************************\n"); | |
1298 | printf("*** Getting the ESD Chain ***\n"); | |
1299 | printf("*******************************\n"); | |
1300 | TAlienCollection * myCollection = TAlienCollection::Open(xmlfile); | |
1301 | ||
1302 | if (!myCollection) { | |
1303 | ::Error("AnalysisTrainNew.C::CreateChainSingle", "Cannot create an AliEn collection from %s", xmlfile) ; | |
1304 | return NULL ; | |
1305 | } | |
1306 | ||
1307 | TChain* chain = new TChain(treeName); | |
1308 | myCollection->Reset() ; | |
1309 | while ( myCollection->Next() ) chain->Add(myCollection->GetTURL("")) ; | |
1310 | chain->ls(); | |
1311 | return chain; | |
1312 | } | |
1313 | ||
1314 | //______________________________________________________________________________ | |
1315 | Int_t SetupPar(char* pararchivename) | |
1316 | { | |
1317 | if (!pararchivename || !strlen(pararchivename)) return -1; | |
1318 | char processline[1024]; | |
1319 | if (gSystem->AccessPathName(Form("%s.par", pararchivename))) { | |
1320 | if (!gSystem->AccessPathName(Form("%s/%s.par", gSystem->Getenv("ALICE_ROOT"),pararchivename))) { | |
1321 | ::Info("AnalysisTrainNew.C::SetupPar", "Getting %s.par from $ALICE_ROOT", pararchivename); | |
1322 | TFile::Cp(gSystem->ExpandPathName(Form("$ALICE_ROOT/%s.par", pararchivename)), | |
1323 | Form("%s.par",pararchivename)); | |
1324 | } else { | |
1325 | ::Error("AnalysisTrainNew.C::SetupPar", "Cannot find %s.par", pararchivename); | |
1326 | return -1; | |
1327 | } | |
1328 | } | |
1329 | if (usePLUGIN && saveTrain) gSystem->Exec(Form("ln -s ../%s.par %s",pararchivename, train_name.Data())); | |
1330 | gSystem->Exec(Form("tar xvzf %s.par", pararchivename)); | |
1331 | ||
1332 | TString ocwd = gSystem->WorkingDirectory(); | |
1333 | if (!gSystem->ChangeDirectory(pararchivename)) return -1; | |
1334 | ||
1335 | // check for BUILD.sh and execute | |
1336 | if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) { | |
1337 | printf("*******************************\n"); | |
1338 | printf("*** Building PAR archive ***\n"); | |
1339 | printf("*******************************\n"); | |
1340 | if (gSystem->Exec("PROOF-INF/BUILD.sh")) { | |
1341 | Error("runProcess","Cannot Build the PAR Archive! - Abort!"); | |
1342 | return -1; | |
1343 | } | |
1344 | } | |
1345 | ||
1346 | // check for SETUP.C and execute | |
1347 | if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) { | |
1348 | printf("*******************************\n"); | |
1349 | printf("*** Setup PAR archive ***\n"); | |
1350 | printf("*******************************\n"); | |
1351 | gROOT->Macro("PROOF-INF/SETUP.C"); | |
1352 | } | |
1353 | if (!gSystem->ChangeDirectory(ocwd.Data())) return -1; | |
1354 | return 0; | |
1355 | } | |
1356 | ||
1357 | //______________________________________________________________________________ | |
1358 | AliAnalysisAlien* CreateAlienHandler(const char *plugin_mode) | |
1359 | { | |
1360 | // Check if user has a valid token, otherwise make one. This has limitations. | |
1361 | // One can always follow the standard procedure of calling alien-token-init then | |
1362 | AliAnalysisAlien *plugin = new AliAnalysisAlien(); | |
1363 | // Set the run mode (can be "full", "test", "offline", "submit" or "terminate") | |
1364 | plugin->SetRunMode(plugin_mode); | |
1365 | if (useProductionMode) { | |
1366 | plugin->SetProductionMode(); | |
1367 | plugin->AddDataFile(data_collection); | |
1368 | } | |
1369 | ||
1370 | if (!outputSingleFolder.IsNull()) { | |
1371 | plugin->SetOutputSingleFolder(outputSingleFolder); | |
1372 | plugin->SetOutputToRunNo(); | |
1373 | } | |
1374 | plugin->SetJobTag(job_tag); | |
1375 | plugin->SetNtestFiles(nTestFiles); | |
1376 | plugin->SetCheckCopy(kFALSE); | |
1377 | plugin->SetMergeDirName(mergeDirName); | |
1378 | // Set versions of used packages | |
1379 | plugin->SetAPIVersion("V1.1x"); | |
1380 | plugin->SetROOTVersion(root_version); | |
1381 | plugin->SetAliROOTVersion(aliroot_version); | |
1382 | // Declare input data to be processed. | |
1383 | // Method 1: Create automatically XML collections using alien 'find' command. | |
1384 | // Define production directory LFN | |
1385 | plugin->SetGridDataDir(alien_datadir); | |
1386 | // Set data search pattern | |
1387 | plugin->SetDataPattern(data_pattern); | |
1388 | if (!useProductionMode) { | |
1389 | if (runOnData) { | |
1390 | plugin->SetRunPrefix("000"); | |
1391 | } | |
1392 | // if (!iAODanalysis) plugin->SetRunRange(run_range[0], run_range[1]); | |
1393 | for (Int_t i=0; i<10; i++) { | |
1394 | if (run_numbers[i]==0) break; | |
1395 | plugin->AddRunNumber(run_numbers[i]); | |
1396 | } | |
1397 | } | |
1398 | // Define alien work directory where all files will be copied. Relative to alien $HOME. | |
1399 | plugin->SetGridWorkingDir(grid_workdir); | |
1400 | // Declare alien output directory. Relative to working directory. | |
1401 | if (alien_outdir.IsNull()) alien_outdir = Form("output_%s",train_name.Data()); | |
1402 | plugin->SetGridOutputDir(alien_outdir); | |
1403 | ||
1404 | TString ana_sources = ""; | |
1405 | TString ana_add = ""; | |
1406 | if (usePAR && anaPars.Length()) { | |
1407 | printf("%s\n", anaPars.Data()); | |
1408 | TObjArray *arr; | |
1409 | TObjString *objstr; | |
1410 | arr = anaPars.Tokenize(" "); | |
1411 | TIter next(arr); | |
1412 | while ((objstr=(TObjString*)next())) plugin->EnablePackage(objstr->GetString()); | |
1413 | delete arr; | |
1414 | } | |
1415 | // Add external packages | |
1416 | if (iJETAN || iJETANdelta) { | |
1417 | plugin->AddExternalPackage("boost::v1_43_0"); | |
1418 | plugin->AddExternalPackage("cgal::v3.6"); | |
1419 | plugin->AddExternalPackage("fastjet::v2.4.2"); | |
1420 | } | |
1421 | ||
1422 | // Declare the analysis source files names separated by blancs. To be compiled runtime | |
1423 | // using ACLiC on the worker nodes. | |
1424 | ana_sources = ana_sources.Strip(); | |
1425 | // Declare all libraries (other than the default ones for the framework. These will be | |
1426 | // loaded by the generated analysis macro. Add all extra files (task .cxx/.h) here. | |
1427 | anaLibs = anaLibs.Strip(); | |
1428 | if (ana_sources.Length()) plugin->SetAnalysisSource(ana_sources); | |
1429 | if (anaLibs.Length()) plugin->SetAdditionalLibs(anaLibs); | |
1430 | ||
1431 | // Declare the output file names separated by blancs. | |
1432 | // (can be like: file.root or file.root@ALICE::Niham::File) | |
1433 | plugin->SetDefaultOutputs(); | |
1434 | plugin->SetMergeExcludes(mergeExclude); | |
1435 | plugin->SetMaxMergeFiles(maxMergeFiles); | |
1436 | plugin->SetNrunsPerMaster(nRunsPerMaster); | |
1437 | // Optionally define the files to be archived. | |
1438 | // plugin->SetOutputArchive("log_archive.zip:stdout,stderr@ALICE::NIHAM::File root_archive.zip:AliAOD.root,AOD.tag.root@ALICE::NIHAM::File"); | |
1439 | ||
1440 | ||
1441 | // Put default output files to archive | |
1442 | TString listhists = ""; | |
1443 | TString listaods = ""; | |
1444 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
1445 | TIter next(mgr->GetOutputs()); | |
1446 | AliAnalysisDataContainer *output; | |
1447 | while ((output=(AliAnalysisDataContainer*)next())) { | |
1448 | const char *filename = output->GetFileName(); | |
1449 | if (!(strcmp(filename, "default"))) { | |
1450 | if (!mgr->GetOutputEventHandler()) continue; | |
1451 | filename = mgr->GetOutputEventHandler()->GetOutputFileName(); | |
1452 | if (listaods.Length()) listaods += ","; | |
1453 | listaods += filename; | |
1454 | listaods += ","; | |
1455 | listaods += "pyxsec_hists.root"; | |
1456 | } else { | |
1457 | if (!strcmp(filename, "pyxsec_hists.root")) continue; | |
1458 | if (listhists.Contains(filename)) continue; | |
1459 | if (listhists.Length()) listhists += ","; | |
1460 | listhists += filename; | |
1461 | } | |
1462 | } | |
1463 | if (mgr->GetExtraFiles().Length()) { | |
1464 | if (listaods.Length()) listaods += ","; | |
1465 | listaods += mgr->GetExtraFiles(); | |
1466 | listaods.ReplaceAll(" ", ","); | |
1467 | } | |
1468 | if (listhists.Length()) listhists = Form("hist_archive.zip:%s@%s", listhists.Data(), outputStorages.Data()); | |
1469 | if (listaods.Length()) listaods = Form("aod_archive.zip:%s@%s", listaods.Data(), outputStorages.Data()); | |
1470 | if (!listhists.Length() && !listaods.Length()) { | |
1471 | ::Fatal("AnalysisTrainNew", "No task output !"); | |
1472 | } | |
1473 | TString outputArchive = Form("log_archive.zip:stderr@%s", outputStorages.Data()); | |
1474 | if (listaods.Length()) { | |
1475 | outputArchive += " "; | |
1476 | outputArchive += listaods; | |
1477 | } | |
1478 | if (listhists.Length()) { | |
1479 | outputArchive += " "; | |
1480 | outputArchive += listhists; | |
1481 | } | |
1482 | ||
1483 | // Set friends | |
1484 | // if (iAODanalysis && iPWG3d2h) | |
1485 | // plugin->SetFriendChainName("AliAOD.VertexingHF.root"); | |
1486 | // plugin->SetOutputArchive(outputArchive); | |
1487 | // Optionally set a name for the generated analysis macro (default MyAnalysis.C) | |
1488 | plugin->SetAnalysisMacro(Form("%s.C", train_name.Data())); | |
1489 | // Optionally set a name for the generated validation script | |
1490 | plugin->SetValidationScript("FILTERvalidation.sh"); | |
1491 | // Optionally set maximum number of input files/subjob (default 100, put 0 to ignore) | |
1492 | plugin->SetSplitMaxInputFileNumber(nFilesPerJob); | |
1493 | // Optionally set number of failed jobs that will trigger killing waiting sub-jobs. | |
1494 | // plugin->SetMaxInitFailed(5); | |
1495 | // Optionally modify the number of replicas | |
1496 | plugin->SetNumberOfReplicas(outputReplicas); | |
1497 | // Optionally resubmit threshold. | |
1498 | // plugin->SetMasterResubmitThreshold(90); | |
1499 | // Optionally set time to live (default 30000 sec) | |
1500 | plugin->SetTTL(70000); | |
1501 | // Optionally set input format (default xml-single) | |
1502 | plugin->SetInputFormat("xml-single"); | |
1503 | // Optionally modify the name of the generated JDL (default analysis.jdl) | |
1504 | plugin->SetJDLName(Form("%s.jdl", train_name.Data())); | |
1505 | // Optionally modify the executable name (default analysis.sh) | |
1506 | plugin->SetExecutable(Form("%s.sh", train_name.Data())); | |
1507 | // Optionally modify job price (default 1) | |
1508 | plugin->SetPrice(1); | |
1509 | // Merge via JDL | |
1510 | plugin->SetMergeViaJDL(useMergeViaJDL); | |
1511 | // Use fastread option | |
1512 | plugin->SetFastReadOption(useFastReadOption); | |
1513 | // UseOverwrite mode | |
1514 | plugin->SetOverwriteMode(useOverwriteMode); | |
1515 | plugin->SetExecutableCommand("aliroot -b -q"); | |
1516 | // Optionally modify split mode (default 'se') | |
1517 | plugin->SetSplitMode("se"); | |
1518 | plugin->SetNumberOfReplicas(outputReplicas); | |
1519 | return plugin; | |
1520 | } | |
1521 | ||
1522 | //______________________________________________________________________________ | |
1523 | void WriteConfig() | |
1524 | { | |
1525 | // Write train configuration in a file. The file name has the format: | |
1526 | // train_[trainName]_ddMonthyyyy_time.C | |
1527 | if (useDATE) { | |
1528 | gSystem->Exec("date +%d%b%Y_%Hh%M > date.tmp"); | |
1529 | ifstream fdate("date.tmp"); | |
1530 | if (!fdate.is_open()) { | |
1531 | ::Error("AnalysisTrainNew.C::Export","Could not generate file name"); | |
1532 | return; | |
1533 | } | |
1534 | const char date[64]; | |
1535 | fdate.getline(date,64); | |
1536 | fdate.close(); | |
1537 | gSystem->Exec("rm date.tmp"); | |
1538 | train_name = Form("%s_%s", train_name.Data(), date); | |
1539 | } | |
1540 | TString cdir = gSystem->WorkingDirectory(); | |
1541 | gSystem->MakeDirectory(train_name); | |
1542 | gSystem->ChangeDirectory(train_name); | |
1543 | ofstream out; | |
1544 | out.open(Form("%sConfig.C",train_name.Data()), ios::out); | |
1545 | if (out.bad()) { | |
1546 | ::Error("AnalysisTrainNew.C::Export", "Cannot open ConfigTrain.C for writing"); | |
1547 | return; | |
1548 | } | |
1549 | out << "{" << endl; | |
1550 | out << " train_name = " << "\"" << train_name.Data() << "\";" << endl; | |
1551 | out << " proof_cluster = " << "\"" << proof_cluster.Data() << "\";" << endl; | |
1552 | out << " useAFPAR = " << useAFPAR << ";" << endl; | |
1553 | if (useAFPAR) | |
1554 | out << " AFversion = " << AFversion.Data() << ";" << endl; | |
1555 | out << " proof_dataset = " << "\"" << proof_dataset.Data() << "\";" << endl; | |
1556 | out << " usePLUGIN = " << usePLUGIN << ";" << endl; | |
1557 | out << " usePAR = " << usePAR << ";" << endl; | |
1558 | out << " useCPAR = " << useCPAR << ";" << endl; | |
1559 | out << " root_version = " << "\"" << root_version.Data() << "\";" << endl; | |
1560 | out << " aliroot_version = " << "\"" << aliroot_version.Data() << "\";" << endl; | |
1561 | out << " alien_datadir = " << "\"" << alien_datadir.Data() << "\";" << endl; | |
1562 | if (!alien_outdir.Length()) alien_outdir = Form("output_%s",train_name.Data()); | |
1563 | out << " alien_outdir = " << "\"" << alien_outdir.Data() << "\";" << endl; | |
1564 | out << " maxMergeFiles = " << maxMergeFiles << ";" << endl; | |
1565 | out << " mergeExclude = " << "\"" << mergeExclude.Data() << "\";" << endl; | |
1566 | out << " nRunsPerMaster = " << nRunsPerMaster << ";" << endl; | |
1567 | out << " nFilesPerJob = " << nFilesPerJob << ";" << endl; | |
1568 | // for (Int_t i=0; i<10; i++) { | |
1569 | // if (run_numbers[i]) | |
1570 | // out << " run_numbers[" << i << "] = " << run_numbers[i] << ";" << endl; | |
1571 | // } | |
1572 | // out << " run_range[0] = " << run_range[0] << ";" << endl; | |
1573 | // out << " run_range[1] = " << run_range[1] << ";" << endl; | |
1574 | out << " usePhysicsSelection = " << usePhysicsSelection << ";" << endl; | |
1575 | out << " useTender = " << useTender << ";" << endl; | |
1576 | out << " useMergeViaJDL = " << useMergeViaJDL << ";" << endl; | |
1577 | out << " useOverwriteMode = " << useOverwriteMode << ";" << endl; | |
1578 | out << " useFastReadOption = " << useFastReadOption << ";" << endl; | |
1579 | out << " useDBG = " << useDBG << ";" << endl; | |
1580 | out << " useMC = " << useMC << ";" << endl; | |
1581 | out << " useTAGS = " << useTAGS << ";" << endl; | |
1582 | out << " useKFILTER = " << useKFILTER << ";" << endl; | |
1583 | out << " useTR = " << useTR << ";" << endl; | |
1584 | out << " useCORRFW = " << useCORRFW << ";" << endl; | |
1585 | out << " useAODTAGS = " << useAODTAGS << ";" << endl; | |
1586 | out << " saveTrain = " << "kFALSE;" << endl << endl; | |
1587 | out << " // Analysis modules" << endl; | |
1588 | out << " iAODanalysis = " << iAODanalysis << ";" << endl; | |
1589 | out << " iAODhandler = " << iAODhandler << ";" << endl; | |
1590 | out << " iESDfilter = " << iESDfilter << ";" << endl; | |
1591 | out << " iMUONcopyAOD = " << iMUONcopyAOD << ";" << endl; | |
1592 | out << " iJETAN = " << iJETAN << ";" << endl; | |
1593 | out << " iJETANdelta = " << iJETANdelta << ";" << endl; | |
1594 | out << " iPWG4partcorr = " << iPWG4partcorr << ";" << endl; | |
1595 | out << " iPWGGAgammaconv = " << iPWGGAgammaconv << ";" << endl; | |
1596 | out << " iPWG4omega3pi = " << iPWG4omega3pi << ";" << endl; | |
1597 | out << " iPWGHFvertexing = " << iPWGHFvertexing << ";" << endl; | |
1598 | out << " iPWG3hfe = " << iPWG3hfe << ";" << endl; | |
1599 | out << " iPWGDQJPSIfilter = " << iPWGDQJPSIfilter << ";" << endl; | |
1600 | out << " iPWGDQJPSI = " << iPWGDQJPSI << ";" << endl; | |
1601 | out << " iPWGHFd2h = " << iPWGHFd2h << ";" << endl; | |
1602 | out << " iPWGMuonTrain = " << iPWGMuonTrain << ";" << endl; | |
1603 | out << " iPWG2femto = " << iPWG2femto << ";" << endl; | |
1604 | out << " iPWG2spectra = " << iPWG2spectra << ";" << endl; | |
1605 | out << " iPWG2protons = " << iPWG2protons << ";" << endl; | |
1606 | out << " iPWG2checkcascade = " << iPWG2checkcascade << ";" << endl; | |
1607 | out << " iPWG2perfcascade = " << iPWG2perfcascade << ";" << endl; | |
1608 | out << " iPWG2checkv0 = " << iPWG2checkv0 << ";" << endl; | |
1609 | out << " iPWG2strange = " << iPWG2strange << ";" << endl; | |
1610 | out << " iPWG2central = " << iPWG2central << ";" << endl; | |
1611 | out << " iPWG2flow = " << iPWG2flow << ";" << endl; | |
1612 | out << " iPWG2res = " << iPWG2res << ";" << endl; | |
1613 | out << " iPWG2rsneff = " << iPWG2rsneff << ";" << endl; | |
1614 | out << " iPWG2kink = " << iPWG2kink << ";" << endl; | |
1615 | out << " iPWG2kinkESDMC = " << iPWG2kinkESDMC << ";" << endl; | |
1616 | out << " iPWG2kinkLSKstar = " << iPWG2kinkLSKstar << ";" << endl; | |
1617 | out << " iPWG2kinkLSL1520 = " << iPWG2kinkLSL1520 << ";" << endl; | |
1618 | out << " iPWG2kinkLSPhi = " << iPWG2kinkLSPhi << ";" << endl; | |
1619 | out << " iPWG2kinkKstarESD = " << iPWG2kinkKstarESD << ";" << endl; | |
1620 | out << " iPWG2kinkKstarMC = " << iPWG2kinkKstarMC << ";" << endl; | |
1621 | out << " iPWG2kinkL1520ESD = " << iPWG2kinkL1520ESD << ";" << endl; | |
1622 | out << " iPWG2kinkL1520MC = " << iPWG2kinkL1520MC << ";" << endl; | |
1623 | out << " iPWG2kinkPhiESD = " << iPWG2kinkPhiESD << ";" << endl; | |
1624 | out << " iPWG2kinkPhiMC = " << iPWG2kinkPhiMC << ";" << endl; | |
1625 | out << " iPWG2unicor = " << iPWG2unicor << ";" << endl; | |
1626 | out << " iPWG2evchar = " << iPWG2evchar << ";" << endl; | |
1627 | out << " iPWG2forward = " << iPWG2forward << ";" << endl << endl; | |
1628 | out << "// Configuration fot the wagons" << endl; | |
1629 | out << " configPWG2femto = \"" << configPWG2femto << "\";" << endl; | |
1630 | out << " configPWG3d2h = \"" << configPWG3d2h << "\";" << endl; | |
1631 | out << "}" << endl; | |
1632 | ::Info("AnalysisTrainNew.C::WriteConfig", "Train configuration wrote to file %s", Form("config_%s.C", train_name.Data())); | |
1633 | gSystem->ChangeDirectory(cdir); | |
1634 | } | |
1635 | ||
1636 | //______________________________________________________________________________ | |
1637 | Bool_t LoadConfig(const char *filename) | |
1638 | { | |
1639 | // Read train configuration from file | |
1640 | if (gSystem->AccessPathName(filename)) { | |
1641 | ::Error("AnalysisTrainNew.C::LoadConfig", "Config file name not found"); | |
1642 | return kFALSE; | |
1643 | } | |
1644 | gROOT->ProcessLine(Form(".x %s", filename)); | |
1645 | ::Info("AnalysisTrainNew.C::LoadConfig", "Train configuration loaded from file %s", filename); | |
1646 | return kTRUE; | |
1647 | } |