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