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.
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")
18 //================== TRAIN NAME ============================================
19 TString train_name = "LHC09a4AOD2"; // *CHANGE ME* (no blancs or special characters)
20 TString job_tag = "LHC09a4: standard AODs with MC info, AOD tags and vertexing HF delta AODs with v4-18-07-AN"; // *CHANGE ME*
21 //==============================================================================
23 // ### Settings that make sense in PROOF only
24 //==============================================================================
25 TString proof_cluster = "alicecaf.cern.ch";
26 Bool_t useAFPAR = kFALSE; // use AF special par file
27 TString AFversion = "AF-v4-16";
28 // Change CAF dataset here
29 TString proof_dataset = "/COMMON/COMMON/LHC09a4_run8100X#/esdTree";
30 TString proof_outdir = "";
32 // ### Settings that make sense when using the Alien plugin
33 //==============================================================================
34 Bool_t usePLUGIN = kTRUE; // do not change
35 Bool_t useProductionMode = kTRUE; // use the plugin in production mode
36 // Usage of par files ONLY in grid mode and ONLY if the code is not available
37 // in the deployed AliRoot versions. Par file search path: local dir, if not there $ALICE_ROOT.
38 // To refresh par files, remove the ones in the workdir, then do "make <target.par>" in
40 Bool_t usePAR = kFALSE; // use par files for extra libs
41 Bool_t useCPAR = kFALSE; // use par files for common libs
42 TString root_version = "v5-24-00"; // *CHANGE ME IF MORE RECENT IN GRID*
43 TString aliroot_version = "v4-18-07-AN"; // *CHANGE ME IF MORE RECENT IN GRID*
44 // Change production base directory here
45 TString alien_datadir = "/alice/sim/PDC_09/LHC09a4/";
46 // AliEn output directory. If blank will become output_<train_name>
47 TString alien_outdir = "/alice/sim/PDC_09/LHC09a4/AOD2";
48 // TString alien_outdir = "";
49 // Number of files merged in a chunk
50 Int_t maxMergeFiles = 50;
51 // Files that should not be merged
52 TString mergeExclude = "AliAOD.root AliAOD.VertexingHF.root";
53 // Files that should be archived
54 TString outputArchive = "aod_archive.zip:AliAOD.root,AliAOD.VertexingHF.root,AOD.tag.root,pyxsec_hists.root@ALICE::NIHAM::File,ALICE::CNAF::SE,ALICE::FZK::SE,ALICE::GSI::SE,ALICE::Legnaro::SE";
55 // Number of runs per master job
56 Int_t nRunsPerMaster = 10;
57 // Maximum number of files per job (gives size of AOD)
58 Int_t nFilesPerJob = 200;
60 Int_t run_range[2] = {81000, 81656}; // LHC09a4 *CHANGE ME*
61 //Int_t run_range[2] = {90000, 90040}; // LHC09a5
62 // ### Settings that make sense only for local analysis
63 //==============================================================================
64 // Change local xml dataset for local interactive analysis
65 TString local_xmldataset = "";
67 // ### Other flags to steer the analysis
68 //==============================================================================
69 Bool_t useDATE = kFALSE; // use date in train name
70 Bool_t useDBG = kFALSE; // activate debugging
71 Bool_t useMC = kTRUE; // use MC info
72 Bool_t useTAGS = kFALSE; // use ESD tags for selection
73 Bool_t useKFILTER = kTRUE; // use Kinematics filter
74 Bool_t useTR = kFALSE; // use track references
75 Bool_t useCORRFW = kFALSE; // do not change
76 Bool_t useAODTAGS = kTRUE; // use AOD tags
77 Bool_t saveTrain = kTRUE; // save train configuration as:
78 Bool_t saveProofToAlien = kFALSE; // save proof outputs in AliEn
79 // train_[trainName]_ddMonthyyyy_time.C
80 // ### Analysis modules to be included. Some may not be yet fully implemented.
81 //==============================================================================
82 Int_t iAODanalysis = 0; // Analysis on input AOD's
83 Int_t iAODhandler = 1; // Analysis produces an AOD or dAOD's
84 Int_t iESDfilter = 1; // ESD to AOD filter (barrel + muon tracks)
85 Int_t iMUONcopyAOD = 0; // Task that copies only muon events in a separate AOD (PWG3)
86 Int_t iJETAN = 0; // Jet analysis (PWG4) - needs ESD filter
87 Int_t iPWG4partcorr = 0; // Gamma-hadron correlations task (PWG4)
88 Int_t iPWG4gammaconv = 0; // Gamma conversion analysis (PWG4) # NOT YET WORKING - WAITING FOR FEEDBACK #
89 Int_t iPWG4omega3pi = 0; // Omega to 3 pi analysis (PWG4)
90 Int_t iPWG3vertexing = 1; // Vertexing HF task (PWG2)
91 Int_t iPWG3hfe = 0; // Electrons analysis (PWG3)
92 Int_t iPWG2femto = 0; // Femtoscopy task (PWG2)
93 Int_t iPWG2spectra = 0; // Spectra tasks (PWG2
94 Int_t iPWG2protons = 0; // Proton-antiproton analysis
95 Int_t iPWG2checkcascade = 0; // Check cascades task
96 Int_t iPWG2perfcascade = 0; // Check performance cascade
97 Int_t iPWG2checkv0 = 0; // Check V0 task
98 Int_t iPWG2strange = 0; // Strangeness task
99 Int_t iPWG2flow = 0; // Flow analysis tasks (PWG2) = crashes in AliCFManager
100 Int_t iPWG2res = 0; // Resonances task (PWG2)
101 Int_t iPWG2kink = 0; // Kink analysis tasks (PWG2)
102 Int_t iPWG2kinkESDMC = 0; // Kink ESD-MC comparison (PWG2)
103 Int_t iPWG2kinkres = 0; // Kink resonances (PWG2)
104 Int_t iPWG2kinklikesign = 0; // Kink like-sign (PWG2)
105 Int_t iPWG2evchar = 0; // Event characteristics (PWG2)
106 Int_t iPWG2unicor = 0; // Unicor analysis (PWG2)
109 TString anaPars = "";
110 TString anaLibs = "";
111 // Function signatures
112 class AliAnalysisAlien;
114 //______________________________________________________________________________
115 void AnalysisTrainNew(const char *analysis_mode="grid",
116 const char *plugin_mode="full",
117 const char *config_file="")
119 // Main analysis train macro. If a configuration file is provided, all parameters
120 // are taken from there but may be altered by CheckModuleFlags.
121 if (strlen(config_file) && !LoadConfig(config_file)) return;
122 TString smode(analysis_mode);
124 if (saveTrain) WriteConfig();
125 // Check compatibility of selected modules
126 CheckModuleFlags(smode);
128 printf("==================================================================\n");
129 printf("=========== RUNNING ANALYSIS TRAIN %s IN %s MODE ==========\n", train_name.Data(),smode.Data());
130 printf("==================================================================\n");
131 printf("= Configuring analysis train for: =\n");
132 if (iAODanalysis) printf("= AOD analysis =\n");
133 else printf("= ESD analysis =\n");
134 if (iESDfilter) printf("= ESD filter =\n");
135 if (iMUONcopyAOD) printf("= MUON copy AOD =\n");
136 if (iJETAN) printf("= Jet analysis =\n");
138 printf("= PWG2 SPECTRA tasks : =\n");
139 if (iPWG2protons) printf("= PWG2 proton-antiproton =\n");
140 if (iPWG2checkcascade) printf("= PWG2 check cascades =\n");
141 if (iPWG2perfcascade) printf("= PWG2 performance cascades =\n");
142 if (iPWG2checkv0) printf("= PWG2 check V0 =\n");
143 if (iPWG2strange) printf("= PWG2 strangeness =\n");
145 if (iPWG2femto) printf("= PWG2 femtoscopy =\n");
146 if (iPWG2flow) printf("= PWG2 flow =\n");
147 if (iPWG2res) printf("= PWG2 resonances =\n");
149 printf("= PWG2 kink analysis tasks: =\n");
150 if (iPWG2kinkESDMC) printf("= PWG2 ESD-MC kinks =\n");
151 if (iPWG2kinkres) printf("= PWG2 kink resonances =\n");
152 if (iPWG2kinklikesign) printf("= PWG2 kink like-sign analysis =\n");
154 if (iPWG2evchar) printf("= PWG2 event characteristics =\n");
155 if (iPWG2unicor) printf("= PWG2 Unicor analysis =\n");
156 if (iPWG3vertexing) printf("= PWG3 vertexing =\n");
157 if (iPWG3hfe) printf("= PWG3 electrons =\n");
158 if (iPWG4partcorr) printf("= PWG4 gamma-hadron, pi0 and gamma-jet correlations =\n");
159 if (iPWG4gammaconv) printf("= PWG4 gamma conversion =\n");
160 if (iPWG4omega3pi) printf("= PWG4 omega to 3 pions =\n");
161 printf("==================================================================\n");
162 printf(":: use MC truth %d\n", (UInt_t)useMC);
163 printf(":: use KINE filter %d\n", (UInt_t)useKFILTER);
164 printf(":: use track refs %d\n", (UInt_t)useTR);
165 printf(":: use tags %d\n", (UInt_t)useTAGS);
166 printf(":: use AOD tags %d\n", (UInt_t)useAODTAGS);
167 printf(":: use debugging %d\n", (UInt_t)useDBG);
168 printf(":: use PAR files %d\n", (UInt_t)usePAR);
169 printf(":: use AliEn plugin %d\n", (UInt_t)usePLUGIN);
171 //==========================================================================
172 // Connect to back-end system
173 if (!Connect(smode)) {
174 ::Error("AnalysisTrain", "Could not connect to %s back-end", analysis_mode);
178 // Load common libraries and set include path
179 if (!LoadCommonLibraries(smode)) {
180 ::Error("AnalysisTrain", "Could not load common libraries");
184 // Make the analysis manager and connect event handlers
185 AliAnalysisManager *mgr = new AliAnalysisManager("Analysis Train", "Production train");
186 if (saveProofToAlien) mgr->SetSpecialOutputLocation(proof_outdir);
188 // Load analysis specific libraries
189 if (!LoadAnalysisLibraries(smode)) {
190 ::Error("AnalysisTrain", "Could not load analysis libraries");
194 // Create input handler (input container created automatically)
197 AliAODInputHandler *aodH = new AliAODInputHandler();
198 mgr->SetInputEventHandler(aodH);
201 AliESDInputHandler *esdHandler = new AliESDInputHandler();
202 if (useTAGS) esdHandler->SetReadTags();
203 mgr->SetInputEventHandler(esdHandler);
205 // Monte Carlo handler
206 if (useMC && !iAODanalysis) {
207 AliMCEventHandler* mcHandler = new AliMCEventHandler();
208 mgr->SetMCtruthEventHandler(mcHandler);
209 mcHandler->SetReadTR(useTR);
211 // AOD output container, created automatically when setting an AOD handler
213 // AOD output handler
214 AliAODHandler* aodHandler = new AliAODHandler();
215 aodHandler->SetOutputFileName("AliAOD.root");
216 mgr->SetOutputEventHandler(aodHandler);
218 aodHandler->SetCreateNonStandardAOD();
219 if (iJETAN) aodHandler->SetOutputFileName("AliAOD.Jets.root");
220 if (iPWG3vertexing) aodHandler->SetOutputFileName("AliAOD.VertexingHF.root");
223 // Debugging if needed
224 if (useDBG) mgr->SetDebugLevel(3);
226 //==========================================================================
227 // Create the chain. In this example it is created only from ALIEN files but
228 // can be done to work in batch or grid mode as well.
229 TChain *chain = CreateChain(smode, plugin_mode);
231 //==========================================================================
232 // Load the tasks configuration macros for all wagons. These files are supposed now to be
233 // in the current workdir, but in AliEn they will be in the file catalog,
234 // mapped from AliRoot and pecified in the jdl input list.
236 // For now connection to top input container and common AOD output container
237 // is done in this macro, but in future these containers will be connected
238 // from each task configuration macro.
240 if (iESDfilter && !iAODanalysis) {
241 // ESD filter task configuration.
242 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskESDFilter.C");
243 AliAnalysisTaskESDfilter *taskesdfilter = AddTaskESDFilter(useKFILTER);
248 AliAnalysisTaskTagCreator* tagTask = new AliAnalysisTaskTagCreator("AOD Tag Creator");
249 mgr->AddTask(tagTask);
250 AliAnalysisDataContainer *coutTags = mgr->CreateContainer("cTag", TTree::Class(),
251 AliAnalysisManager::kOutputContainer, "AOD.tag.root");
252 mgr->ConnectInput (tagTask, 0, mgr->GetCommonInputContainer());
253 mgr->ConnectOutput(tagTask, 1, coutTags);
258 gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskJets.C");
259 AliAnalysisTaskJets *taskjets = 0;
260 TString anatype = mgr->GetInputEventHandler()->GetDataType();
261 taskjets = AddTaskJets(anatype, "UA1");
262 taskjets = AddTaskJets(anatype, "Fastjet");
263 if (!taskjets) ::Warning("AnalysisTrainNew", "AliAnalysisTaskJets cannot run for this train conditions - EXCLUDED");
270 gROOT->LoadMacro("$ALICE_ROOT/PWG2/SPECTRA/macros/AddTaskProtons.C");
271 AliAnalysisTaskProtons *taskprotons = AddTaskProtons();
272 if (!taskprotons) ::Warning("AnalysisTrainNew", "AliAnalysisTaskProtons cannot run for this train conditions - EXCLUDED");
275 if (iPWG2checkcascade) {
276 gROOT->LoadMacro("$ALICE_ROOT/PWG2/SPECTRA/macros/AddTaskCheckCascade.C");
277 AliAnalysisTaskCheckCascade *taskcheckcascade = AddTaskCheckCascade();
278 if (!taskcheckcascade) ::Warning("AnalysisTrainNew", "AliAnalysisTaskCheckCascade cannot run for this train conditions - EXCLUDED");
282 gROOT->LoadMacro("$ALICE_ROOT/PWG2/SPECTRA/macros/AddTaskCheckV0.C");
283 AliAnalysisTaskCheckV0 *taskcheckV0 = AddTaskCheckV0();
284 if (!taskcheckV0) ::Warning("AnalysisTrainNew", "AliAnalysisTaskCheckV0 cannot run for this train conditions - EXCLUDED");
288 gROOT->LoadMacro("$ALICE_ROOT/PWG2/SPECTRA/macros/AddTaskStrange.C");
289 AliAnalysisTaskStrange *taskstrange = AddTaskStrange();
290 if (!taskstrange) ::Warning("AnalysisTrainNew", "AliAnalysisTaskStrange cannot run for this train conditions - EXCLUDED");
292 // performance cascades
293 if (iPWG2perfcascade) {
294 gROOT->LoadMacro("$ALICE_ROOT/PWG2/SPECTRA/macros/AddTaskCheckPerformanceCascade.C");
295 AliAnalysisTaskCheckPerformanceCascade *taskperfcascade = AddTaskCheckPerformanceCascade();
296 if (!taskperfcascade) ::Warning("AnalysisTrainNew", "AliAnalysisTaskCheckPerformanceCascade cannot run for this train conditions - EXCLUDED");
300 // Femtoscopy analysis modules
302 gROOT->LoadMacro("$ALICE_ROOT/PWG2/FEMTOSCOPY/macros/AddTaskFemto.C");
303 AliAnalysisTaskFemto *taskfemto = AddTaskFemto();
304 if (!taskfemto) ::Warning("AnalysisTrainNew", "AliAnalysisTaskFemto cannot run for this train conditions - EXCLUDED");
309 if (iPWG2kinkESDMC) {
310 gROOT->LoadMacro("$ALICE_ROOT/PWG2/KINK/macros/AddTaskKink.C");
311 AliAnalysisKinkESDMC *taskkink = AddTaskKink();
312 if (!taskkink) ::Warning("AnalysisTrainNew", "AliAnalysisKinkESDMC cannot run for this train conditions - EXCLUDED");
315 gROOT->LoadMacro("$ALICE_ROOT/PWG2/KINK/macros/AddTaskKinkResonance.C");
316 AliAnalysisTaskKinkResonance *taskkinkres = AddTaskKinkResonance();
317 if (!taskkinkres) ::Warning("AnalysisTrainNew", "AliAnalysisTaskKinkResonance cannot run for this train conditions - EXCLUDED");
319 if (iPWG2kinklikesign) {
320 gROOT->LoadMacro("$ALICE_ROOT/PWG2/KINK/macros/AddTaskKinkResonanceLikeSign.C");
321 AliResonanceKinkLikeSign *taskkinklikesign = AddTaskKinkResonanceLikeSign();
322 if (!taskkinklikesign) ::Warning("AnalysisTrainNew", "AliResonanceKinkLikeSign cannot run for this train conditions - EXCLUDED");
326 // Event characterization
328 gROOT->LoadMacro("$ALICE_ROOT/PWG2/EVCHAR/macros/AddTaskSPDdNdEta.C");
329 AliAnalysisTaskSPDdNdEta *taskspddndeta = AddTaskSPDdNdEta();
330 if (!taskspddndeta) ::Warning("AnalysisTrainNew", "AliAnalysisTaskSPDdNdEta cannot run for this train conditions - EXCLUDED");
331 taskspddndeta->SetReadMC(useMC);
336 gROOT->LoadMacro("$ALICE_ROOT/PWG2/UNICOR/AddTaskUnicor.C");
337 AliAnalysisTaskUnicor *taskunicor = AddTaskUnicor();
338 if (!taskspddndeta) ::Warning("AnalysisTrainNew", "AliAnalysisTaskUnicor cannot run for this train conditions - EXCLUDED");
343 gROOT->LoadMacro("$ALICE_ROOT/PWG2/FLOW/macros/AddTaskFlow.C");
345 Bool_t LYZ1SUM = kTRUE;
346 Bool_t LYZ1PROD = kTRUE;
347 Bool_t LYZ2SUM = kFALSE;
348 Bool_t LYZ2PROD = kFALSE;
349 Bool_t LYZEP = kFALSE;
353 Bool_t MCEP = kFALSE; //does not work yet 24/12/08
354 Bool_t kineFromESD = kTRUE;
355 Bool_t METHODS[] = {SP,LYZ1SUM,LYZ1PROD,LYZ2SUM,LYZ2PROD,LYZEP,GFC,QC,FQD,MCEP};
356 // Analysis type can be ESD, AOD, MC, ESDMC0, ESDMC1
357 TString type = "AOD";
358 if (!iAODanalysis) type = "ESD";
361 if (!kineFromESD) type += "1";
364 // Boolean to fill/not fill the QA histograms
366 // Boolean to use/not use weights for the Q vector
367 Bool_t WEIGHTS[] = {kFALSE,kFALSE,kFALSE}; //Phi, v'(pt), v'(eta)
368 AliAnalysisTaskFlowEvent* taskFE = AddTaskFlow(type,METHODS,QA,WEIGHTS);
369 if (!taskFE) ::Warning("AnalysisTrainNew", "AliAnalysisTaskFlowEvent cannot run for this train conditions - EXCLUDED");
374 gROOT->LoadMacro("$ALICE_ROOT/PWG2/RESONANCES/macros/train/AddAnalysisTaskRsn.C");
375 TString path = gROOT->GetMacroPath();
376 path += ":$ALICE_ROOT/PWG2/RESONANCES/macros/train";
377 gROOT->SetMacroPath(path);
378 AddAnalysisTaskRsn(kTRUE);
382 if (iPWG3vertexing) {
383 gROOT->LoadMacro("$ALICE_ROOT/PWG3/vertexingHF/AddTaskVertexingHF.C");
384 AliAnalysisTaskSEVertexingHF *taskvertexingHF = AddTaskVertexingHF();
385 if (!taskvertexingHF) ::Warning("AnalysisTrainNew", "AliAnalysisTaskSEVertexingHF cannot run for this train conditions - EXCLUDED");
390 gROOT->LoadMacro("$ALICE_ROOT/PWG3/hfe/AddTaskHFE.C");
391 AliAnalysisTaskHFE *taskHFE = AddTaskHFE();
392 if (!taskHFE) ::Warning("AnalysisTrainNew", "AliAnalysisTaskHFE cannot run for this train conditions - EXCLUDED");
395 // PWG4 hadron correlations
397 gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskPartCorr.C");
398 AliAnalysisTaskParticleCorrelation *taskpartcorrPHOS = AddTaskPartCorr("AOD", "PHOS");
399 if (!taskpartcorrPHOS) ::Warning("AnalysisTrainNew", "AliAnalysisTaskParticleCorrelation PHOS cannot run for this train conditions - EXCLUDED");
400 AliAnalysisTaskParticleCorrelation *taskpartcorrEMCAL = AddTaskPartCorr("AOD", "EMCAL");
401 if (!taskpartcorrEMCAL) ::Warning("AnalysisTrainNew", "AliAnalysisTaskParticleCorrelation EMCAL cannot run for this train conditions - EXCLUDED");
404 // PWG4 gamma conversion analysis
405 if (iPWG4gammaconv) {
406 gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskGammaConversion.C");
407 TString cdir = gSystem->WorkingDirectory();
408 gSystem->ChangeDirectory(gSystem->ExpandPathName("$ALICE_ROOT/PWG4/macros/"));
409 TString gcArguments = "-run-on-train -run-jet -run-chic -run-neutralmeson";
410 AliAnalysisTaskGammaConversion * taskGammaConversion = AddTaskGammaConversion(gcArguments,mgr->GetCommonInputContainer());
411 gSystem->ChangeDirectory(cdir);
412 if (!taskGammaConversion) ::Warning("AnalysisTrainNew", "AliAnalysisTaskGammaConversion cannot run for these train conditions - EXCLUDED");
415 // PWG4 omega to 3 pions analysis
417 gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskomega3pi.C");
418 AliAnalysisTaskOmegaPi0PiPi *taskomega3pi = AddTaskomega3pi();
419 if (!taskomega3pi) ::Warning("AnalysisTrainNew", "AliAnalysisTaskomega3pi cannot run for these train conditions - EXCLUDED");
422 //==========================================================================
423 // FOR THE REST OF THE TASKS THE MACRO AddTaskXXX() is not yet implemented/
426 if (mgr->InitAnalysis()) {
428 if (saveTrain || strlen(config_file)) gSystem->ChangeDirectory(train_name);
429 StartAnalysis(smode, chain);
430 if (saveTrain && smode=="GRID") {
431 AliAnalysisAlien *gridhandler = (AliAnalysisAlien*)mgr->GetGridHandler();
432 TString alien_workdir = gGrid->GetHomeDirectory();
433 if (iAODanalysis) alien_workdir += "analysisAOD";
434 else alien_workdir += "analysisESD";
435 alien_outdir = gridhandler->GetGridOutputDir();
436 printf("=== Registering ConfigTrain.C in the work directory <%s> ===\n",
437 alien_workdir.Data());
438 if (AliAnalysisAlien::FileExists(Form("%s/%sConfig.C", alien_workdir.Data(), train_name.Data())))
439 gGrid->Rm(Form("%s/%sConfig.C", alien_workdir.Data(), train_name.Data()));
440 if (strcmp(plugin_mode, "test"))
441 TFile::Cp(Form("file:%sConfig.C",train_name.Data()), Form("alien://%s/%sConfig.C", alien_workdir.Data(), train_name.Data()));
446 //______________________________________________________________________________
447 void StartAnalysis(const char *mode, TChain *chain) {
450 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
451 if (!strcmp(mode, "LOCAL")) imode = 0;
452 if (!strcmp(mode, "PROOF")) imode = 1;
453 if (!strcmp(mode, "GRID")) imode = 2;
457 ::Error("AnalysisTrainNew.C::StartAnalysis", "Cannot create the chain");
460 mgr->StartAnalysis(mode, chain);
463 if (!proof_dataset.Length()) {
464 ::Error("AnalysisTrainNew.C::StartAnalysis", "proof_dataset is empty");
467 mgr->StartAnalysis(mode, proof_dataset, 1000);
471 if (!mgr->GetGridHandler()) {
472 ::Error("AnalysisTrainNew.C::StartAnalysis", "Grid plugin not initialized");
475 mgr->StartAnalysis("grid");
478 ::Error("AnalysisTrainNew.C::StartAnalysis", "Cannot create the chain");
481 mgr->StartAnalysis(mode, chain);
487 //______________________________________________________________________________
488 void CheckModuleFlags(const char *mode) {
489 // Checks selected modules and insure compatibility
491 if (!strcmp(mode, "LOCAL")) imode = 0;
492 if (!strcmp(mode, "PROOF")) imode = 1;
493 if (!strcmp(mode, "GRID")) imode = 2;
496 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PAR files enabled due to PROOF analysis");
501 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "AliEn plugin disabled since not in GRID mode");
507 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "MC usage disabled in analysis on AOD's");
509 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "AOD tags usage disabled in analysis on AOD's");
514 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "ESD filter disabled in analysis on AOD's");
518 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "JETAN disabled in analysis on AOD's without AOD handler");
521 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "iPWG4gammaconv disabled on AOD's without AOD handler");
524 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG4partcorr disabled on AOD's without AOD handler");
527 // Disable tasks that do not work yet on AOD data
529 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG2flow disabled on AOD's");
532 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG2femto disabled on AOD's");
535 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG2res disabled on AOD's");
538 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG2kink disabled in analysis on AOD's");
541 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG2unicor disabled in analysis on AOD's");
544 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG4evchar disabled on AOD's");
547 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG3hfe disabled on AOD's");
550 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG4omega3pi disabled on AOD's");
553 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG4partcorr disabled on AOD's");
558 if (!useMC) useTR = kFALSE;
560 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "iPWG2evchar disabled if not reading track references");
565 if (iPWG2perfcascade)
566 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG2perfcascade disabled without MC info");
567 iPWG2perfcascade = 0;
569 if (iJETAN && !iAODanalysis) iESDfilter=1;
570 if (iESDfilter) {iAODhandler=1; useCORRFW = kTRUE;}
571 if (iPWG2spectra || iPWG2flow || iPWG3vertexing || iPWG3hfe) useCORRFW = kTRUE;
572 if (useKFILTER && !useMC) useKFILTER = kFALSE;
573 if (useAODTAGS && !iAODhandler) useAODTAGS = kFALSE;
576 //______________________________________________________________________________
577 Bool_t Connect(const char *mode) {
578 // Connect <username> to the back-end system.
580 if (!strcmp(mode, "LOCAL")) imode = 0;
581 if (!strcmp(mode, "PROOF")) imode = 1;
582 if (!strcmp(mode, "GRID")) imode = 2;
583 TString username = gSystem->Getenv("alien_API_USER");
588 if (!username.Length()) {
589 ::Error(Form("AnalysisTrainNew.C::Connect <%s>", mode), "Make sure you:\n \
590 1. Have called: alien-token-init <username>\n \
591 2. Have called: >source /tmp/gclient_env_$UID");
594 ::Info("AnalysisTrainNew.C::Connect", "Connecting user <%s> to PROOF cluster <%s>",
595 username.Data(), proof_cluster.Data());
596 gEnv->SetValue("XSec.GSI.DelegProxy", "2");
597 // TProof::Open(Form("%s@%s:31093", username.Data(), proof_cluster.Data()));
598 TProof::Open(Form("%s@%s", username.Data(), proof_cluster.Data()));
600 if (strcmp(gSystem->Getenv("XrdSecGSISRVNAMES"), "lxfsrd0506.cern.ch"))
601 ::Error(Form("AnalysisTrainNew.C::Connect <%s>", mode), "Environment XrdSecGSISRVNAMES different from lxfsrd0506.cern.ch");
604 TGrid::Connect("alien://");
606 TString homedir = gGrid->GetHomeDirectory();
607 TString workdir = homedir + train_name;
608 if (!gGrid->Cd(workdir)) {
610 if (gGrid->Mkdir(workdir)) {
611 gGrid->Cd(train_name);
612 ::Info("AnalysisTrainNew::Connect()", "Directory %s created", gGrid->Pwd());
615 gGrid->Mkdir("proof_output");
616 gGrid->Cd("proof_output");
617 proof_outdir = Form("alien://%s", gGrid->Pwd());
621 if (!username.Length()) {
622 ::Error(Form("AnalysisTrainNew.C::Connect <%s>", mode), "Make sure you:\n \
623 1. Have called: alien-token-init <username>\n \
624 2. Have called: >source /tmp/gclient_env_$UID");
627 if (usePLUGIN && !gSystem->Getenv("alien_CLOSE_SE")) {
628 ::Error(Form("AnalysisTrainNew.C::Connect <%s>", mode),
629 "When using the AliEn plugin it is preferable to define the \
630 variable alien_CLOSE_SE in your environment.");
633 ::Info("AnalysisTrainNew.C::Connect", "Connecting user <%s> to AliEn ...",
635 TGrid::Connect("alien://");
636 if (!gGrid || !gGrid->IsConnected()) return kFALSE;
639 ::Error("AnalysisTrainNew.C::Connect", "Unknown run mode: %s", mode);
642 ::Info("AnalysisTrainNew.C::Connect","Connected in %s mode", mode);
646 //______________________________________________________________________________
647 Bool_t LoadCommonLibraries(const char *mode)
649 // Load common analysis libraries.
651 if (!strcmp(mode, "LOCAL")) imode = 0;
652 if (!strcmp(mode, "PROOF")) imode = 1;
653 if (!strcmp(mode, "GRID")) imode = 2;
654 if (!gSystem->Getenv("ALICE_ROOT")) {
655 ::Error("AnalysisTrainNew.C::LoadCommonLibraries", "Analysis train requires that analysis libraries are compiled with a local AliRoot");
658 Bool_t success = kTRUE;
660 gSystem->Load("libTree.so");
661 gSystem->Load("libGeom.so");
662 gSystem->Load("libVMC.so");
663 gSystem->Load("libPhysics.so");
665 // Load framework classes. Par option ignored here.
670 success &= LoadLibrary("STEERBase", mode, kTRUE);
671 success &= LoadLibrary("ESD", mode, kTRUE);
672 success &= LoadLibrary("AOD", mode, kTRUE);
673 success &= LoadLibrary("ANALYSIS", mode, kTRUE);
674 success &= LoadLibrary("ANALYSISalice", mode, kTRUE);
675 if (useCORRFW) success &= LoadLibrary("CORRFW", mode, kTRUE);
677 success &= LoadLibrary("libSTEERBase.so", mode);
678 success &= LoadLibrary("libESD.so", mode);
679 success &= LoadLibrary("libAOD.so", mode);
680 success &= LoadLibrary("libANALYSIS.so", mode);
681 success &= LoadLibrary("libANALYSISalice.so", mode);
682 if (useCORRFW) success &= LoadLibrary("libCORRFW.so", mode);
683 gROOT->ProcessLine(".include $ALICE_ROOT/include");
688 if (useAFPAR && !gSystem->AccessPathName(AFversion)) ires = gProof->UploadPackage(AFversion);
690 success &= LoadLibrary("STEERBase", mode);
691 success &= LoadLibrary("ESD", mode);
692 success &= LoadLibrary("AOD", mode);
693 success &= LoadLibrary("ANALYSIS", mode);
694 success &= LoadLibrary("ANALYSISalice", mode);
695 if (useCORRFW) success &= LoadLibrary("CORRFW", mode);
697 ires = gProof->EnablePackage(AFversion);
698 if (ires<0) success = kFALSE;
699 if (useCORRFW) success &= LoadLibrary("CORRFW", mode);
703 ::Error("AnalysisTrainNew.C::LoadCommonLibraries", "Unknown run mode: %s", mode);
707 ::Info("AnalysisTrainNew.C::LoadCommodLibraries", "Load common libraries: SUCCESS");
708 ::Info("AnalysisTrainNew.C::LoadCommodLibraries", "Include path for Aclic compilation:\n%s",
709 gSystem->GetIncludePath());
711 ::Info("AnalysisTrainNew.C::LoadCommodLibraries", "Load common libraries: FAILED");
717 //______________________________________________________________________________
718 Bool_t LoadAnalysisLibraries(const char *mode)
720 // Load common analysis libraries.
721 Bool_t success = kTRUE;
723 if (!LoadLibrary("PWG3base", mode, kTRUE) ||
724 !LoadLibrary("PWG3muon", mode, kTRUE)) return kFALSE;
728 if (!LoadLibrary("JETAN", mode, kTRUE)) return kFALSE;
730 // PWG4 particle correlations
732 if (!LoadLibrary("PWG4PartCorrBase", mode, kTRUE) ||
733 !LoadLibrary("PWG4PartCorrDep", mode, kTRUE)) return kFALSE;
735 // PWG4 gamma conversion
736 if (iPWG4gammaconv) {
737 if (!LoadLibrary("PWG4GammaConv", mode, kTRUE)) return kFALSE;
739 // PWG4 omega to 3 pions
741 if (!LoadLibrary("PWG4omega3pi", mode, kTRUE)) return kFALSE;
745 if (!LoadLibrary("PWG2spectra", mode, kTRUE)) return kFALSE;
749 if (!LoadLibrary("PWG2flowCommon", mode, kTRUE) ||
750 !LoadLibrary("PWG2flowTasks", mode, kTRUE)) return kFALSE;
754 if (!LoadLibrary("PWG2resonances", mode, kTRUE)) return kFALSE;
758 if (!LoadLibrary("PWG2kink", mode, kTRUE)) return kFALSE;
762 if (!LoadLibrary("PWG2unicor", mode, kTRUE)) return kFALSE;
766 if (!LoadLibrary("PWG2evchar", mode, kTRUE)) return kFALSE;
770 if (!LoadLibrary("PWG2AOD", mode, kTRUE) ||
771 !LoadLibrary("PWG2femtoscopy", mode, kTRUE) ||
772 !LoadLibrary("PWG2femtoscopyUser", mode, kTRUE)) return kFALSE;
773 TFile::Cp(gSystem->ExpandPathName("$(ALICE_ROOT)/PWG2/FEMTOSCOPY/macros/ConfigFemtoAnalysis.C"), Form("%s/ConfigFemtoAnalysis.C", train_name.Data()));
774 anaLibs += "ConfigFemtoAnalysis.C ";
777 if (iPWG3vertexing) {
778 if (!LoadLibrary("PWG3base", mode, kTRUE) ||
779 !LoadLibrary("PWG3vertexingHF", mode, kTRUE)) return kFALSE;
783 if (!LoadLibrary("PWG3hfe", mode, kTRUE)) return kFALSE;
786 ::Info("AnalysisTrainNew.C::LoadAnalysisLibraries", "Load other libraries: SUCCESS");
790 //______________________________________________________________________________
791 Bool_t LoadLibrary(const char *module, const char *mode, Bool_t rec=kFALSE)
793 // Load a module library in a given mode. Reports success.
796 TString smodule(module);
797 if (!strcmp(mode, "LOCAL")) imode = 0;
798 if (!strcmp(mode, "PROOF")) imode = 1;
799 if (!strcmp(mode, "GRID")) imode = 2;
802 ::Error("AnalysisTrainNew.C::LoadLibrary", "Empty module name");
805 // If a library is specified, just load it
806 if (smodule.EndsWith(".so")) {
807 mod.Remove(mod.Index(".so"));
808 result = gSystem->Load(mod);
810 ::Error("AnalysisTrainNew.C::LoadLibrary", "Could not load library %s", module);
813 if (rec) anaLibs += Form("%s.so ",mod.Data());
816 // Check if the library is already loaded
817 if (strlen(gSystem->GetLibraries(Form("%s.so", module), "", kFALSE)) > 0)
823 result = SetupPar(module);
824 if (rec) anaPars += Form("%s.par ", module);
826 result = gSystem->Load(Form("lib%s.so", module));
827 if (rec) anaLibs += Form("lib%s.so ", module);
831 result = gProof->UploadPackage(module);
833 result = gProof->UploadPackage(gSystem->ExpandPathName(Form("$ALICE_ROOT/%s.par", module)));
835 ::Error("AnalysisTrainNew.C::LoadLibrary", "Could not find module %s.par in current directory nor in $ALICE_ROOT", module);
839 result = gProof->EnablePackage(module);
845 ::Error("AnalysisTrainNew.C::LoadLibrary", "Could not load module %s", module);
852 //______________________________________________________________________________
853 TChain *CreateChain(const char *mode, const char *plugin_mode)
855 // Create the input chain
857 if (!strcmp(mode, "LOCAL")) imode = 0;
858 if (!strcmp(mode, "PROOF")) imode = 1;
859 if (!strcmp(mode, "GRID")) imode = 2;
860 TChain *chain = NULL;
865 if (!local_xmldataset.Length()) {
867 chain = new TChain("aodTree");
868 if (gSystem->AccessPathName("data/AliAOD.root"))
869 ::Error("AnalysisTrainNew.C::CreateChain", "File: AliAOD.root not in ./data dir");
871 if (!saveTrain) chain->Add("data/AliAOD.root");
872 else chain->Add("../data/AliAOD.root");
876 chain = CreateChainSingle(local_xmldataset, "aodTree");
879 if (!local_xmldataset.Length()) {
881 chain = new TChain("esdTree");
882 if (gSystem->AccessPathName("data/AliESDs.root"))
883 ::Error("AnalysisTrainNew.C::CreateChain", "File: AliESDs.root not in ./data dir");
885 if (!saveTrain) chain->Add("data/AliESDs.root");
886 else chain->Add("../data/AliESDs.root");
890 chain = CreateChainSingle(local_xmldataset, "esdTree");
898 AliAnalysisGrid *alienHandler = CreateAlienHandler(plugin_mode);
899 AliAnalysisManager::GetAnalysisManager()->SetGridHandler(alienHandler);
901 TString treeName = "esdTree";
902 if (iAODanalysis) treeName = "aodTree";
903 chain = CreateChainSingle("wn.xml", treeName);
908 if (chain && chain->GetNtrees()) return chain;
912 //______________________________________________________________________________
913 TChain* CreateChainSingle(const char* xmlfile, const char *treeName)
915 printf("*******************************\n");
916 printf("*** Getting the ESD Chain ***\n");
917 printf("*******************************\n");
918 TAlienCollection * myCollection = TAlienCollection::Open(xmlfile);
921 ::Error("AnalysisTrainNew.C::CreateChainSingle", "Cannot create an AliEn collection from %s", xmlfile) ;
925 TChain* chain = new TChain(treeName);
926 myCollection->Reset() ;
927 while ( myCollection->Next() ) chain->Add(myCollection->GetTURL("")) ;
932 //______________________________________________________________________________
933 Int_t SetupPar(char* pararchivename)
935 if (!pararchivename || !strlen(pararchivename)) return -1;
936 char processline[1024];
937 if (gSystem->AccessPathName(Form("%s.par", pararchivename))) {
938 if (!gSystem->AccessPathName(Form("%s/%s.par", gSystem->Getenv("ALICE_ROOT"),pararchivename))) {
939 ::Info("AnalysisTrainNew.C::SetupPar", "Getting %s.par from $ALICE_ROOT", pararchivename);
940 TFile::Cp(gSystem->ExpandPathName(Form("$ALICE_ROOT/%s.par", pararchivename)),
941 Form("%s.par",pararchivename));
943 ::Error("AnalysisTrainNew.C::SetupPar", "Cannot find %s.par", pararchivename);
947 if (usePLUGIN && saveTrain) gSystem->Exec(Form("ln -s ../%s.par %s",pararchivename, train_name.Data()));
948 gSystem->Exec(Form("tar xvzf %s.par", pararchivename));
950 TString ocwd = gSystem->WorkingDirectory();
951 if (!gSystem->ChangeDirectory(pararchivename)) return -1;
953 // check for BUILD.sh and execute
954 if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) {
955 printf("*******************************\n");
956 printf("*** Building PAR archive ***\n");
957 printf("*******************************\n");
958 if (gSystem->Exec("PROOF-INF/BUILD.sh")) {
959 Error("runProcess","Cannot Build the PAR Archive! - Abort!");
964 // check for SETUP.C and execute
965 if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) {
966 printf("*******************************\n");
967 printf("*** Setup PAR archive ***\n");
968 printf("*******************************\n");
969 gROOT->Macro("PROOF-INF/SETUP.C");
971 if (!gSystem->ChangeDirectory(ocwd.Data())) return -1;
975 //______________________________________________________________________________
976 AliAnalysisAlien* CreateAlienHandler(const char *plugin_mode)
978 // Check if user has a valid token, otherwise make one. This has limitations.
979 // One can always follow the standard procedure of calling alien-token-init then
980 // source /tmp/gclient_env_$UID in the current shell.
981 if (!AliAnalysisGrid::CreateToken()) return NULL;
982 AliAnalysisAlien *plugin = new AliAnalysisAlien();
983 // Set the run mode (can be "full", "test", "offline", "submit" or "terminate")
984 plugin->SetRunMode(plugin_mode);
985 if (useProductionMode) plugin->SetProductionMode();
986 plugin->SetJobTag(job_tag);
987 plugin->SetNtestFiles(1);
988 // plugin->SetPreferedSE("ALICE::Legnaro::SE");
989 // Set versions of used packages
990 plugin->SetAPIVersion("V2.4");
991 plugin->SetROOTVersion(root_version);
992 plugin->SetAliROOTVersion(aliroot_version);
993 // Declare input data to be processed.
994 // Method 1: Create automatically XML collections using alien 'find' command.
995 // Define production directory LFN
996 plugin->SetGridDataDir(alien_datadir);
997 // Set data search pattern
998 if (iAODanalysis) plugin->SetDataPattern("*AliAOD.root");
999 else plugin->SetDataPattern("*ESD.tag.root");
1000 // ...then add run numbers to be considered
1001 plugin->SetRunRange(run_range[0], run_range[1]);
1002 // for (Int_t i=0; i<10; i++) {
1003 // if (run_numbers[i]==0) break;
1004 // plugin->AddRunNumber(run_numbers[i]);
1006 // Method 2: Declare existing data files (raw collections, xml collections, root file)
1007 // If no path mentioned data is supposed to be in the work directory (see SetGridWorkingDir())
1008 // XML collections added via this method can be combined with the first method if
1009 // the content is compatible (using or not tags)
1010 // plugin->AddDataFile("tag.xml");
1011 // plugin->AddDataFile("/alice/data/2008/LHC08c/000057657/raw/Run57657.Merged.RAW.tag.root");
1012 // Define alien work directory where all files will be copied. Relative to alien $HOME.
1013 if (iAODanalysis) plugin->SetGridWorkingDir("analysisAOD");
1014 else plugin->SetGridWorkingDir("analysisESD");
1015 // Declare alien output directory. Relative to working directory.
1016 if (!alien_outdir.Length()) alien_outdir = Form("output_%s",train_name.Data());
1017 plugin->SetGridOutputDir(alien_outdir);
1019 TString ana_sources = "";
1020 TString ana_add = "";
1021 if (usePAR && anaPars.Length()) {
1022 printf("%s\n", anaPars.Data());
1025 arr = anaPars.Tokenize(" ");
1027 while ((objstr=(TObjString*)next())) plugin->EnablePackage(objstr->GetString());
1031 // Declare the analysis source files names separated by blancs. To be compiled runtime
1032 // using ACLiC on the worker nodes.
1033 ana_sources = ana_sources.Strip();
1034 // Declare all libraries (other than the default ones for the framework. These will be
1035 // loaded by the generated analysis macro. Add all extra files (task .cxx/.h) here.
1036 anaLibs = anaLibs.Strip();
1037 if (ana_sources.Length()) plugin->SetAnalysisSource(ana_sources);
1038 if (anaLibs.Length()) plugin->SetAdditionalLibs(anaLibs);
1040 // Declare the output file names separated by blancs.
1041 // (can be like: file.root or file.root@ALICE::Niham::File)
1042 plugin->SetDefaultOutputs();
1043 plugin->SetMergeExcludes(mergeExclude);
1044 plugin->SetMaxMergeFiles(maxMergeFiles);
1045 plugin->SetNrunsPerMaster(nRunsPerMaster);
1046 // Optionally define the files to be archived.
1047 // plugin->SetOutputArchive("log_archive.zip:stdout,stderr@ALICE::NIHAM::File root_archive.zip:AliAOD.root,AOD.tag.root@ALICE::NIHAM::File");
1048 plugin->SetOutputArchive(Form("log_archive.zip:stdout,stderr@ALICE::CERN::SE %s",outputArchive.Data()));
1049 // Optionally set a name for the generated analysis macro (default MyAnalysis.C)
1050 plugin->SetAnalysisMacro(Form("%s.C", train_name.Data()));
1051 // Optionally set maximum number of input files/subjob (default 100, put 0 to ignore)
1052 plugin->SetSplitMaxInputFileNumber(nFilesPerJob);
1053 // Optionally set number of failed jobs that will trigger killing waiting sub-jobs.
1054 // plugin->SetMaxInitFailed(5);
1055 // Optionally resubmit threshold.
1056 // plugin->SetMasterResubmitThreshold(90);
1057 // Optionally set time to live (default 30000 sec)
1058 plugin->SetTTL(30000);
1059 // Optionally set input format (default xml-single)
1060 plugin->SetInputFormat("xml-single");
1061 // Optionally modify the name of the generated JDL (default analysis.jdl)
1062 plugin->SetJDLName(Form("%s.jdl", train_name.Data()));
1063 // Optionally modify the executable name (default analysis.sh)
1064 plugin->SetExecutable(Form("%s.sh", train_name.Data()));
1065 // Optionally modify job price (default 1)
1066 plugin->SetPrice(1);
1067 // Optionally modify split mode (default 'se')
1068 plugin->SetSplitMode("se");
1072 //______________________________________________________________________________
1075 // Write train configuration in a file. The file name has the format:
1076 // train_[trainName]_ddMonthyyyy_time.C
1078 gSystem->Exec("date +%d%b%Y_%Hh%M > date.tmp");
1079 ifstream fdate("date.tmp");
1080 if (!fdate.is_open()) {
1081 ::Error("AnalysisTrainNew.C::Export","Could not generate file name");
1084 const char date[64];
1085 fdate.getline(date,64);
1087 gSystem->Exec("rm date.tmp");
1088 train_name = Form("train_%s_%s", train_name.Data(), date);
1090 train_name = Form("train_%s", train_name.Data());
1092 TString cdir = gSystem->WorkingDirectory();
1093 gSystem->MakeDirectory(train_name);
1094 gSystem->ChangeDirectory(train_name);
1096 out.open(Form("%sConfig.C",train_name.Data()), ios::out);
1098 ::Error("AnalysisTrainNew.C::Export", "Cannot open ConfigTrain.C for writing");
1102 out << " train_name = " << "\"" << train_name.Data() << "\";" << endl;
1103 out << " proof_cluster = " << "\"" << proof_cluster.Data() << "\";" << endl;
1104 out << " useAFPAR = " << useAFPAR << ";" << endl;
1106 out << " AFversion = " << AFversion.Data() << ";" << endl;
1107 out << " proof_dataset = " << "\"" << proof_dataset.Data() << "\";" << endl;
1108 out << " usePLUGIN = " << usePLUGIN << ";" << endl;
1109 out << " usePAR = " << usePAR << ";" << endl;
1110 out << " useCPAR = " << useCPAR << ";" << endl;
1111 out << " root_version = " << "\"" << root_version.Data() << "\";" << endl;
1112 out << " aliroot_version = " << "\"" << aliroot_version.Data() << "\";" << endl;
1113 out << " alien_datadir = " << "\"" << alien_datadir.Data() << "\";" << endl;
1114 if (!alien_outdir.Length()) alien_outdir = Form("output_%s",train_name.Data());
1115 out << " alien_outdir = " << "\"" << alien_outdir.Data() << "\";" << endl;
1116 out << " maxMergeFiles = " << maxMergeFiles << ";" << endl;
1117 out << " mergeExclude = " << "\"" << mergeExclude.Data() << "\";" << endl;
1118 out << " nRunsPerMaster = " << nRunsPerMaster << ";" << endl;
1119 out << " nFilesPerJob = " << nFilesPerJob << ";" << endl;
1120 // for (Int_t i=0; i<10; i++) {
1121 // if (run_numbers[i])
1122 // out << " run_numbers[" << i << "] = " << run_numbers[i] << ";" << endl;
1124 out << " run_range[0] = " << run_range[0] << ";" << endl;
1125 out << " run_range[1] = " << run_range[1] << ";" << endl;
1126 out << " useDBG = " << useDBG << ";" << endl;
1127 out << " useMC = " << useMC << ";" << endl;
1128 out << " useTAGS = " << useTAGS << ";" << endl;
1129 out << " useKFILTER = " << useKFILTER << ";" << endl;
1130 out << " useTR = " << useTR << ";" << endl;
1131 out << " useCORRFW = " << useCORRFW << ";" << endl;
1132 out << " useAODTAGS = " << useAODTAGS << ";" << endl;
1133 out << " saveTrain = " << "kFALSE;" << endl << endl;
1134 out << " // Analysis modules" << endl;
1135 out << " iAODanalysis = " << iAODanalysis << ";" << endl;
1136 out << " iAODhandler = " << iAODhandler << ";" << endl;
1137 out << " iESDfilter = " << iESDfilter << ";" << endl;
1138 out << " iMUONcopyAOD = " << iMUONcopyAOD << ";" << endl;
1139 out << " iJETAN = " << iJETAN << ";" << endl;
1140 out << " iPWG4partcorr = " << iPWG4partcorr << ";" << endl;
1141 out << " iPWG4gammaconv = " << iPWG4gammaconv << ";" << endl;
1142 out << " iPWG4omega3pi = " << iPWG4omega3pi << ";" << endl;
1143 out << " iPWG3vertexing = " << iPWG3vertexing << ";" << endl;
1144 out << " iPWG3hfe = " << iPWG3hfe << ";" << endl;
1145 out << " iPWG2femto = " << iPWG2femto << ";" << endl;
1146 out << " iPWG2spectra = " << iPWG2spectra << ";" << endl;
1147 out << " iPWG2protons = " << iPWG2protons << ";" << endl;
1148 out << " iPWG2checkcascade = " << iPWG2checkcascade << ";" << endl;
1149 out << " iPWG2perfcascade = " << iPWG2perfcascade << ";" << endl;
1150 out << " iPWG2checkv0 = " << iPWG2checkv0 << ";" << endl;
1151 out << " iPWG2strange = " << iPWG2strange << ";" << endl;
1152 out << " iPWG2flow = " << iPWG2flow << ";" << endl;
1153 out << " iPWG2res = " << iPWG2res << ";" << endl;
1154 out << " iPWG2kink = " << iPWG2kink << ";" << endl;
1155 out << " iPWG2kinkESDMC = " << iPWG2kinkESDMC << ";" << endl;
1156 out << " iPWG2kinkres = " << iPWG2kinkres << ";" << endl;
1157 out << " iPWG2kinklikesign = " << iPWG2kinklikesign << ";" << endl;
1158 out << " iPWG2unicor = " << iPWG2unicor << ";" << endl;
1159 out << " iPWG2evchar = " << iPWG2evchar << ";" << endl;
1161 ::Info("AnalysisTrainNew.C::WriteConfig", "Train configuration wrote to file %s", Form("config_%s.C", train_name.Data()));
1162 gSystem->ChangeDirectory(cdir);
1165 //______________________________________________________________________________
1166 Bool_t LoadConfig(const char *filename)
1168 // Read train configuration from file
1169 if (gSystem->AccessPathName(filename)) {
1170 ::Error("AnalysisTrainNew.C::LoadConfig", "Config file name not found");
1173 gROOT->ProcessLine(Form(".x %s", filename));
1174 ::Info("AnalysisTrainNew.C::LoadConfig", "Train configuration loaded from file %s", filename);