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 = "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 //==============================================================================
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 = "";
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
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)
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";
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 = "";
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
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
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";
169 TString anaPars = "";
170 TString anaLibs = "";
171 // Function signatures
172 class AliAnalysisAlien;
174 //______________________________________________________________________________
175 void AnalysisTrainNew(const char *analysis_mode="grid",
176 const char *plugin_mode="full",
177 const char *config_file="")
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);
184 TString spmode(plugin_mode);
186 if (spmode == "test") useProductionMode = kFALSE;
187 // Check compatibility of selected modules
188 CheckModuleFlags(smode);
189 if (saveTrain) WriteConfig();
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");
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");
213 printf("= PWG2 femtoscopy =\n");
214 printf(" +++ configured by: %s\n", configPWG2femto.Data());
216 if (iPWG2flow) printf("= PWG2 flow =\n");
217 if (iPWG2res) printf("= PWG2 resonances =\n");
218 if (iPWG2rsneff) printf("= PWG2 resonances efficiency =\n");
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");
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");
240 printf("= PWG3 D0->2 hadrons QA =\n");
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);
261 //==========================================================================
262 // Connect to back-end system
263 // if (!Connect(smode)) {
264 // ::Error("AnalysisTrain", "Could not connect to %s back-end", analysis_mode);
268 // Load common libraries and set include path
269 if (!LoadCommonLibraries(smode)) {
270 ::Error("AnalysisTrain", "Could not load common libraries");
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");
284 // Create input handler (input container created automatically)
287 AliAODInputHandler *aodH = new AliAODInputHandler();
288 if (iPWGHFd2h) aodH->AddFriend("AliAOD.VertexingHF.root");
289 mgr->SetInputEventHandler(aodH);
292 AliESDInputHandler *esdHandler = new AliESDInputHandler();
293 if (useTAGS) esdHandler->SetReadTags();
294 mgr->SetInputEventHandler(esdHandler);
296 // Monte Carlo handler
297 if (useMC && !iAODanalysis) {
298 AliMCEventHandler* mcHandler = new AliMCEventHandler();
299 mgr->SetMCtruthEventHandler(mcHandler);
300 mcHandler->SetReadTR(useTR);
302 // AOD output container, created automatically when setting an AOD handler
304 // AOD output handler
305 AliAODHandler* aodHandler = new AliAODHandler();
306 aodHandler->SetOutputFileName("AliAOD.root");
307 mgr->SetOutputEventHandler(aodHandler);
309 aodHandler->SetFillAOD(kFALSE);
310 aodHandler->SetCreateNonStandardAOD();
311 if (iJETAN) aodHandler->SetOutputFileName("AliAOD.Jets.root");
312 // if (iPWGHFvertexing) aodHandler->SetOutputFileName("AliAOD.VertexingHF.root");
315 // Debugging if needed
316 if (useDBG) mgr->SetDebugLevel(3);
317 if (saveCanvases) mgr->SetSaveCanvases(kTRUE);
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);
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.
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.
337 AliAnalysisGrid *alienHandler = CreateAlienHandler(plugin_mode);
338 AliAnalysisManager::GetAnalysisManager()->SetGridHandler(alienHandler);
341 if (mgr->InitAnalysis()) {
343 if (saveTrain || strlen(config_file)) gSystem->ChangeDirectory(train_name);
344 StartAnalysis(smode, chain);
348 //______________________________________________________________________________
349 void AddAnalysisTasks(){
350 // Add all analysis task wagons to the train
351 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
357 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
358 AliAnalysisTaskPIDResponse *PIDResponse = AddTaskPIDResponse();
359 // PIDResponse->SelectCollisionCandidates(AliVEvent::kAny);
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]);
375 // Tender and supplies. Needs to be called for every event.
378 gROOT->LoadMacro("$ALICE_ROOT/TENDER/TenderSupplies/AddTaskTender.C");
379 // IF V0 tender needed, put kTRUE below
380 AliAnalysisTaskSE *tender = AddTaskTender(useV0tender);
381 // tender->SetDebugLevel(2);
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);
393 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C");
394 AliCentralitySelectionTask *taskCentrality = AddTaskCentrality();
401 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDqa.C");
402 AliAnalysisTaskPIDqa *PIDQA = AddTaskPIDqa();
403 PIDQA->SelectCollisionCandidates(AliVEvent::kAny);
408 gROOT->LoadMacro("$ALICE_ROOT/PWGLF/SPECTRA/ChargedHadrons/dNdPt/macros/AddTask_jacek_dNdPtTrackDumpTaskPbPb_TPCITS.C");
409 AddTask_jacek_dNdPtTrackDumpTaskPbPb_TPCITS();
413 if (iESDfilter && !iAODanalysis) {
414 // ESD filter task configuration.
415 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskESDFilter.C");
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
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
430 Double_t cascadeCuts[8];
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
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
449 taskesdfilter->SetV0Cuts(v0Cuts);
450 taskesdfilter->SetCascadeCuts(cascadeCuts);
452 taskesdfilter->EnableV0CascadeVerticesReco();
453 taskesdfilter->DisableZDC();
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);
467 // ********** PWG2 wagons ******************************************************
468 AliAnalysisManager::SetCommonFileName("PWG2histograms.root");
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");
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");
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");
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");
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");
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");
510 // Femtoscopy analysis modules
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");
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");
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");
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");
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");
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");
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");
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");
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");
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");
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");
571 // Event characterization
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);
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");
587 AliAnalysisManager::SetCommonFileName("forward.root");
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");
593 AliAnalysisManager::SetCommonFileName("PWG2histograms.root");
597 gROOT->LoadMacro("$ALICE_ROOT/PWG2/FLOW/macros/AddTaskFlow.C");
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;
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
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");
622 AliAnalysisManager::SetCommonFileName("resonances.root");
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();
632 AliAnalysisManager::SetCommonFileName("PWG2histograms.root");
634 // ********** PWG3 wagons ******************************************************
635 AliAnalysisManager::SetCommonFileName("PWG3histograms.root");
636 //its immprove upgrade task
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);
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);
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");
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);
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");
682 gROOT->LoadMacro("$ALICE_ROOT/PWGHF/vertexingHF/AddD2HTrain.C");
683 TFile::Cp(gSystem->ExpandPathName(configPWG3d2h.Data()),
684 Form("%s/ConfigVertexingHF.C", train_name.Data()));
686 AddD2HTrain(kFALSE, 1,0,0,0,0,0,0,0,0,0,0);
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);
703 // ********** PWG4 wagons ******************************************************
704 AliAnalysisManager::SetCommonFileName("PWG4histograms.root");
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;
717 gROOT->LoadMacro("$ALICE_ROOT/PWGJE/macros/AddTaskJets.C");
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");
724 // AddTaskJetsDelta("AliAOD.Jets.root"); // need to modify this accordingly in the add task jets
725 mgr->RegisterExtraFile(kDeltaAODJetName.Data());
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());
733 // Add the clusters..
734 gROOT->LoadMacro("$ALICE_ROOT/PWGJE/macros/AddTaskJetCluster.C");
735 AliAnalysisTaskJetCluster *taskCl = 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());
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());
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());
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());
766 // AOD-based analysis. Add all reconstructors to write into delta AOD's
768 Int_t ntasksjets = AddTaskJetsDelta("AliAOD.Jets.root",0,kFALSE);
769 if (ntasksjets) printf("Added %d jet reconstructors\n", ntasksjets);
774 // PWG4 hadron correlations
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");
785 // PWG4 omega to 3 pions analysis
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");
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");
798 //______________________________________________________________________________
799 void StartAnalysis(const char *mode, TChain *chain) {
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;
809 ::Error("AnalysisTrainNew.C::StartAnalysis", "Cannot create the chain");
812 mgr->StartAnalysis(mode, chain);
815 if (!proof_dataset.Length()) {
816 ::Error("AnalysisTrainNew.C::StartAnalysis", "proof_dataset is empty");
819 mgr->StartAnalysis(mode, proof_dataset, 1000);
823 if (!mgr->GetGridHandler()) {
824 ::Error("AnalysisTrainNew.C::StartAnalysis", "Grid plugin not initialized");
827 mgr->StartAnalysis("grid");
830 ::Error("AnalysisTrainNew.C::StartAnalysis", "Cannot create the chain");
833 mgr->StartAnalysis(mode, chain);
839 //______________________________________________________________________________
840 void CheckModuleFlags(const char *mode) {
841 // Checks selected modules and insure compatibility
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;
849 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PAR files enabled due to PROOF analysis");
854 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "AliEn plugin disabled since not in GRID mode");
860 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "MC usage disabled in analysis on AOD's");
862 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "AOD tags usage disabled in analysis on AOD's");
867 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "ESD filter disabled in analysis on AOD's");
871 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "JETAN disabled in analysis on AOD's without AOD handler");
875 // Disable tasks that do not work yet on AOD data
877 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG4gammaconv disabled on AOD's without AOD handler");
880 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG2central disabled on AOD's");
883 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG2flow disabled on AOD's");
886 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG2femto disabled on AOD's");
889 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG2res disabled on AOD's");
892 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG2rsneff disabled on AOD's");
895 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG2kink disabled in analysis on AOD's");
898 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG2unicor disabled in analysis on AOD's");
901 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG4evchar disabled on AOD's");
904 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG2forward disabled in analysis on AOD's");
907 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG3hfe disabled on AOD's");
910 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG4omega3pi disabled on AOD's");
914 if (!useMC) useTR = kFALSE;
917 if (iPWG2perfcascade)
918 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG2perfcascade disabled without MC info");
919 iPWG2perfcascade = 0;
921 ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG2central disabled without MC info");
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;
931 //______________________________________________________________________________
932 Bool_t Connect(const char *mode) {
933 // Connect <username> to the back-end system.
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");
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");
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()));
955 if (strcmp(gSystem->Getenv("XrdSecGSISRVNAMES"), "lxfsrd0506.cern.ch"))
956 ::Error(Form("AnalysisTrainNew.C::Connect <%s>", mode), "Environment XrdSecGSISRVNAMES different from lxfsrd0506.cern.ch");
959 TGrid::Connect("alien://");
961 TString homedir = gGrid->GetHomeDirectory();
962 TString workdir = homedir + train_name;
963 if (!gGrid->Cd(workdir)) {
965 if (gGrid->Mkdir(workdir)) {
966 gGrid->Cd(train_name);
967 ::Info("AnalysisTrainNew::Connect()", "Directory %s created", gGrid->Pwd());
970 gGrid->Mkdir("proof_output");
971 gGrid->Cd("proof_output");
972 proof_outdir = Form("alien://%s", gGrid->Pwd());
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.");
982 ::Info("AnalysisTrainNew.C::Connect", "Connecting user <%s> to AliEn ...",
984 TGrid::Connect("alien://");
985 if (!gGrid || !gGrid->IsConnected()) return kFALSE;
988 ::Error("AnalysisTrainNew.C::Connect", "Unknown run mode: %s", mode);
991 ::Info("AnalysisTrainNew.C::Connect","Connected in %s mode", mode);
995 //______________________________________________________________________________
996 Bool_t LoadCommonLibraries(const char *mode)
998 // Load common analysis libraries.
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");
1007 Bool_t success = kTRUE;
1009 gSystem->Load("libTree");
1010 gSystem->Load("libGeom");
1011 gSystem->Load("libVMC");
1012 gSystem->Load("libPhysics");
1013 gSystem->Load("libMinuit");
1015 // Load framework classes. Par option ignored here.
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);
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");
1038 if (useAFPAR && !gSystem->AccessPathName(AFversion)) ires = gProof->UploadPackage(AFversion);
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);
1047 ires = gProof->EnablePackage(AFversion);
1048 if (ires<0) success = kFALSE;
1049 if (useCORRFW) success &= LoadLibrary("CORRFW", mode);
1053 ::Error("AnalysisTrainNew.C::LoadCommonLibraries", "Unknown run mode: %s", mode);
1057 ::Info("AnalysisTrainNew.C::LoadCommodLibraries", "Load common libraries: SUCCESS");
1058 ::Info("AnalysisTrainNew.C::LoadCommodLibraries", "Include path for Aclic compilation:\n%s",
1059 gSystem->GetIncludePath());
1061 ::Info("AnalysisTrainNew.C::LoadCommodLibraries", "Load common libraries: FAILED");
1067 //______________________________________________________________________________
1068 Bool_t LoadAnalysisLibraries(const char *mode)
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;
1077 if (doCDBconnect && !useTender) {
1078 if (!LoadLibrary("PWGPP", mode, kTRUE)) return kFALSE;
1081 if (iESDfilter || iPWGMuonTrain) {
1082 if (!LoadLibrary("PWGmuon", mode, kTRUE)) return kFALSE;
1086 if (!LoadLibrary("JETAN", mode, kTRUE)) return kFALSE;
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;
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;
1103 // PWG4 gamma conversion
1104 if (iPWGGAgammaconv) {
1105 if (!LoadLibrary("PWGGAGammaConv", mode, kTRUE)) return kFALSE;
1107 // PWG4 omega to 3 pions
1108 if (iPWG4omega3pi) {
1109 if (!LoadLibrary("PWG4omega3pi", mode, kTRUE)) return kFALSE;
1111 // PWG2 task protons
1113 if (!LoadLibrary("PWG2spectra", mode, kTRUE)) return kFALSE;
1117 if (!LoadLibrary("PWG2flowCommon", mode, kTRUE) ||
1118 !LoadLibrary("PWG2flowTasks", mode, kTRUE)) return kFALSE;
1121 if (iPWG2res || iPWG2rsneff) {
1122 if (!LoadLibrary("PWG2resonances", mode, kTRUE)) return kFALSE;
1126 if (!LoadLibrary("PWG2kink", mode, kTRUE)) return kFALSE;
1130 if (!LoadLibrary("PWG2unicor", mode, kTRUE)) return kFALSE;
1134 if (!LoadLibrary("PWG2evchar", mode, kTRUE)) return kFALSE;
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 ";
1146 if (!LoadLibrary("PWG2forward", mode, kTRUE)) return kFALSE;
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;
1156 if (!LoadLibrary("PWG3hfe", mode, kTRUE)) return kFALSE;
1159 if (iPWGDQJPSIfilter || iPWGDQJPSI) {
1160 if (!LoadLibrary("PWGDQdielectron", mode, kTRUE)) return kFALSE;
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;
1168 ::Info("AnalysisTrainNew.C::LoadAnalysisLibraries", "Load other libraries: SUCCESS");
1172 //______________________________________________________________________________
1173 Bool_t LoadLibrary(const char *module, const char *mode, Bool_t rec=kFALSE)
1175 // Load a module library in a given mode. Reports success.
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");
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);
1192 ::Error("AnalysisTrainNew.C::LoadLibrary", "Could not load library %s", module);
1195 if (rec) anaLibs += Form("%s.so ",mod.Data());
1198 // Check if the library is already loaded
1199 if (strlen(gSystem->GetLibraries(module, "", kFALSE)) > 0)
1205 result = SetupPar(module);
1206 if (rec) anaPars += Form("%s.par ", module);
1208 result = gSystem->Load(Form("lib%s", module));
1209 if (rec) anaLibs += Form("lib%s.so ", module);
1213 result = gProof->UploadPackage(module);
1215 result = gProof->UploadPackage(gSystem->ExpandPathName(Form("$ALICE_ROOT/%s.par", module)));
1217 ::Error("AnalysisTrainNew.C::LoadLibrary", "Could not find module %s.par in current directory nor in $ALICE_ROOT", module);
1221 result = gProof->EnablePackage(module);
1227 ::Error("AnalysisTrainNew.C::LoadLibrary", "Could not load module %s", module);
1234 //______________________________________________________________________________
1235 TChain *CreateChain(const char *mode, const char *plugin_mode)
1237 // Create the input chain
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;
1247 if (!local_xmldataset.Length()) {
1249 chain = new TChain("aodTree");
1250 if (gSystem->AccessPathName("data/AliAOD.root"))
1251 ::Error("AnalysisTrainNew.C::CreateChain", "File: AliAOD.root not in ./data dir");
1253 if (!saveTrain) chain->Add("data/AliAOD.root");
1254 else chain->Add("../data/AliAOD.root");
1258 chain = CreateChainSingle(local_xmldataset, "aodTree");
1261 if (!local_xmldataset.Length()) {
1263 chain = new TChain("esdTree");
1264 if (gSystem->AccessPathName("data/AliESDs.root"))
1265 ::Error("AnalysisTrainNew.C::CreateChain", "File: AliESDs.root not in ./data dir");
1267 if (!saveTrain) chain->Add("data/AliESDs.root");
1268 else chain->Add("../data/AliESDs.root");
1272 chain = CreateChainSingle(local_xmldataset, "esdTree");
1280 // AliAnalysisGrid *alienHandler = CreateAlienHandler(plugin_mode);
1281 // AliAnalysisManager::GetAnalysisManager()->SetGridHandler(alienHandler);
1283 TString treeName = "esdTree";
1284 if (iAODanalysis) treeName = "aodTree";
1285 chain = CreateChainSingle("wn.xml", treeName);
1290 if (chain && chain->GetNtrees()) return chain;
1294 //______________________________________________________________________________
1295 TChain* CreateChainSingle(const char* xmlfile, const char *treeName)
1297 printf("*******************************\n");
1298 printf("*** Getting the ESD Chain ***\n");
1299 printf("*******************************\n");
1300 TAlienCollection * myCollection = TAlienCollection::Open(xmlfile);
1302 if (!myCollection) {
1303 ::Error("AnalysisTrainNew.C::CreateChainSingle", "Cannot create an AliEn collection from %s", xmlfile) ;
1307 TChain* chain = new TChain(treeName);
1308 myCollection->Reset() ;
1309 while ( myCollection->Next() ) chain->Add(myCollection->GetTURL("")) ;
1314 //______________________________________________________________________________
1315 Int_t SetupPar(char* pararchivename)
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));
1325 ::Error("AnalysisTrainNew.C::SetupPar", "Cannot find %s.par", pararchivename);
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));
1332 TString ocwd = gSystem->WorkingDirectory();
1333 if (!gSystem->ChangeDirectory(pararchivename)) return -1;
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!");
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");
1353 if (!gSystem->ChangeDirectory(ocwd.Data())) return -1;
1357 //______________________________________________________________________________
1358 AliAnalysisAlien* CreateAlienHandler(const char *plugin_mode)
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);
1370 if (!outputSingleFolder.IsNull()) {
1371 plugin->SetOutputSingleFolder(outputSingleFolder);
1372 plugin->SetOutputToRunNo();
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) {
1390 plugin->SetRunPrefix("000");
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]);
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);
1404 TString ana_sources = "";
1405 TString ana_add = "";
1406 if (usePAR && anaPars.Length()) {
1407 printf("%s\n", anaPars.Data());
1410 arr = anaPars.Tokenize(" ");
1412 while ((objstr=(TObjString*)next())) plugin->EnablePackage(objstr->GetString());
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");
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);
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");
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;
1455 listaods += "pyxsec_hists.root";
1457 if (!strcmp(filename, "pyxsec_hists.root")) continue;
1458 if (listhists.Contains(filename)) continue;
1459 if (listhists.Length()) listhists += ",";
1460 listhists += filename;
1463 if (mgr->GetExtraFiles().Length()) {
1464 if (listaods.Length()) listaods += ",";
1465 listaods += mgr->GetExtraFiles();
1466 listaods.ReplaceAll(" ", ",");
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 !");
1473 TString outputArchive = Form("log_archive.zip:stderr@%s", outputStorages.Data());
1474 if (listaods.Length()) {
1475 outputArchive += " ";
1476 outputArchive += listaods;
1478 if (listhists.Length()) {
1479 outputArchive += " ";
1480 outputArchive += listhists;
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);
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);
1522 //______________________________________________________________________________
1525 // Write train configuration in a file. The file name has the format:
1526 // train_[trainName]_ddMonthyyyy_time.C
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");
1534 const char date[64];
1535 fdate.getline(date,64);
1537 gSystem->Exec("rm date.tmp");
1538 train_name = Form("%s_%s", train_name.Data(), date);
1540 TString cdir = gSystem->WorkingDirectory();
1541 gSystem->MakeDirectory(train_name);
1542 gSystem->ChangeDirectory(train_name);
1544 out.open(Form("%sConfig.C",train_name.Data()), ios::out);
1546 ::Error("AnalysisTrainNew.C::Export", "Cannot open ConfigTrain.C for writing");
1550 out << " train_name = " << "\"" << train_name.Data() << "\";" << endl;
1551 out << " proof_cluster = " << "\"" << proof_cluster.Data() << "\";" << endl;
1552 out << " useAFPAR = " << useAFPAR << ";" << endl;
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;
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;
1632 ::Info("AnalysisTrainNew.C::WriteConfig", "Train configuration wrote to file %s", Form("config_%s.C", train_name.Data()));
1633 gSystem->ChangeDirectory(cdir);
1636 //______________________________________________________________________________
1637 Bool_t LoadConfig(const char *filename)
1639 // Read train configuration from file
1640 if (gSystem->AccessPathName(filename)) {
1641 ::Error("AnalysisTrainNew.C::LoadConfig", "Config file name not found");
1644 gROOT->ProcessLine(Form(".x %s", filename));
1645 ::Info("AnalysisTrainNew.C::LoadConfig", "Train configuration loaded from file %s", filename);