]>
Commit | Line | Data |
---|---|---|
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] AnalysisTrainPWG-244Jets("grid", "full") | |
7 | // CAF mode (requires root v5-23-02 + aliroot v4-16-Rev08) | |
8 | // root[2] AnalysisTrainPWG4Jets("proof") | |
9 | // Local mode requires AliESds.root or AliAOD.root in ./data directory | |
10 | // root[3] AnalysisTrainPWG4Jets("local") | |
11 | // In proof and grid modes, a token is needed and sourcing the produced environment file. | |
12 | // | |
13 | // If 'saveTrain' flag is set, the train will generate a directory name and run | |
14 | // in this directory. A configuration file 'ConfigTrain.C' will be generated. | |
15 | // One can replay at any time the train via: | |
16 | // root[1] AnalysisTrainPWG4Jets(ana_mode, plugin_mode, "train_default_<date>/ConfigTrain.C") | |
17 | ||
18 | // For Usage with fastjet run in "offline" first and then "submit" | |
19 | // jdl and analysismacro are automatically patched after "offline" mode | |
20 | ||
21 | // ============================================================================= | |
22 | // ### General Steering variables | |
23 | // ============================================================================= | |
24 | //== general setup variables | |
25 | TString kTrainName = "testAnalysis"; // *CHANGE ME* (no blancs or special characters) | |
26 | TString kJobTag = "PWG4 Jet Tasks analysis train configured"; // *CHANGE ME* | |
27 | ||
28 | // Usage of par files ONLY in grid mode and ONLY if the code is not available | |
29 | // in the deployed AliRoot versions. Par file search path: local dir, if not there $ALICE_ROOT. | |
30 | // To refresh par files, remove the ones in the workdir, then do "make <target.par>" in | |
31 | // AliRoot. | |
32 | Bool_t kUsePAR = kFALSE; // use par files for extra libs | |
33 | Bool_t kUseCPAR = kFALSE; // use par files for common libs | |
34 | Bool_t kFillAOD = kTRUE; // switch of AOD filling for on the fly analysis | |
35 | Bool_t kFilterAOD = kTRUE; | |
36 | Int_t kSaveAOD = 8; // Bit switch 1 = Full AOD 2 = Jet AOD , 4 = PartCorr, 8 = JCORRAN | |
37 | //== general input and output variables | |
38 | ||
39 | Int_t iAODanalysis = 1; // Analysis on input AOD's | |
40 | Int_t iAODhandler = 1; // Analysis produces an AOD or dAOD's | |
41 | Int_t iCentralitySelection = 0; // Use the centrality | |
42 | Int_t iESDfilter = 0; // ESD to AOD filter (barrel + muon tracks) | |
43 | Int_t iPhysicsSelection = 1; // ESD to AOD filter (barrel + muon tracks) | |
44 | UInt_t iPhysicsSelectionFlag = 1; // set by pyshics selection and passed to the task, kMB, kUserDefined etc | |
45 | Bool_t useTender = kFALSE; // use tender wagon | |
46 | Bool_t kUseKinefilter = kFALSE; // use Kinematics filter | |
47 | Bool_t kUseMuonfilter = kFALSE; // use Kinematics filter | |
48 | TString kCommonOutputFileName = "PWG4_JetTasksOutput.root"; | |
49 | TString kCaloQAOutputFileName = "PWG4_CaloQAOutput.root"; | |
50 | ||
51 | ||
52 | //== general process variables | |
53 | ||
54 | // ### Other flags to steer the analysis | |
55 | //============================================================================== | |
56 | Bool_t kSkipTerminate = kTRUE; // Do not call Teminate | |
57 | Bool_t kUseDate = kFALSE; // use date in train name | |
58 | Bool_t kUseDebug = kTRUE; // activate debugging | |
59 | Int_t kErrorIgnoreLevel = -1; // takes the errror print level from .rootrc | |
60 | // From TError.h: | |
61 | // const Int_t kUnset = -1; | |
62 | // const Int_t kPrint = 0; | |
63 | // const Int_t kInfo = 1000; | |
64 | // const Int_t kWarning = 2000; | |
65 | // const Int_t kError = 3000; | |
66 | // const Int_t kBreak = 4000; | |
67 | // const Int_t kSysError = 5000; | |
68 | // const Int_t kFatal = 6000; | |
69 | Int_t kUseSysInfo = 0; // activate debugging | |
70 | Long64_t kNumberOfEvents = 1234567890; // number of events to process from the chain | |
71 | Bool_t kUseMC = kTRUE; // use MC info | |
72 | Bool_t kIsMC = kTRUE; // is MC info, if false it overwrites Use(AOD)MC | |
73 | Bool_t kUseAODMC = kTRUE; // use MC infA | |
74 | Bool_t kUseESDTags = kFALSE; // use ESD tags for selection | |
75 | Bool_t kUseTR = kFALSE; // use track references | |
76 | Bool_t kUseAODTags = kFALSE; // use AOD tags | |
77 | Bool_t kSaveTrain = kFALSE; // save train configuration as: | |
78 | Bool_t kIsPbPb = kFALSE; // Pb+Pb | |
79 | ||
80 | ||
81 | // ### Analysis modules to be included. Some may not be yet fully implemented. | |
82 | //============================================================================== | |
83 | Int_t iJETAN = 1; // Jet analysis (PWG4) // 1 write standard 2 write non-standard jets, 3 wrtie both | |
84 | Int_t iJETSUBTRACT = 1; // Jet background subtration | |
85 | TString kDefaultJetBranch = ""; // is currently set when filled (iJETAN or clusters) or from config macro | |
86 | TString kDefaultJetBackgroundBranch = ""; // is currently set when filled (jet clsuters | |
87 | TString kDefaultJetBackgroundBranch_extra = ""; // is currently set when filled (jet clsuters) | |
88 | TString kJetSubtractBranches = ""; // is currently set when filled (jet clsuters | |
89 | TString kJetSubtractBranches_extra = ""; // is currently set when filled (jet clsuters | |
90 | ||
91 | TString kDefaultJetBranchMC = ""; // is currently set when filled (iJETAN or clusters) or from config macro | |
92 | TString kDefaultJetBackgroundBranchMC = ""; // is currently set when filled (jet clsuters | |
93 | TString kDefaultJetBranchMC2 = ""; // is currently set when filled (iJETAN or clusters) or from config macro | |
94 | TString kDefaultJetBackgroundBranchMC2 = ""; // is currently set when filled (jet clsuters | |
95 | TString kJetSubtractMask1 = "B0"; | |
96 | TString kJetSubtractMask2 = "B%d"; | |
97 | Int_t iDIJETAN = 1; | |
98 | Int_t iJETANLib = 1; | |
99 | Int_t iPWG1QASym = 0; // Eva's QA task compiled on the fly... | |
100 | Int_t iPWG4FastEmbedding = 0; // Generate non-standard AOD for embedding | |
101 | Int_t iPWG4JetTasks = 0; // all jet tasks flag for lib laoding | |
102 | Int_t iPWG4JetServices = 0; // jet spectrum analysis | |
103 | Int_t iPWG4JetSpectrum = 0; // jet spectrum analysis | |
104 | Int_t iPWG4JetResponse = 0; // jet response matrix | |
105 | Int_t iPWG4JCORRAN = 0; // JCORRAN module | |
106 | Int_t iPWG4UE = 0; // Underlying Event analysis | |
107 | Int_t iPWG4LeadingUE = 0; // Underlying Event analysis | |
108 | Int_t iPWG4CorrectionsUE = 0; // Underlying Event analysis | |
109 | Int_t iPWG4TmpSourceSara = 0; // Underlying Event analysis not in svn | |
110 | Int_t iPWG4Fragmentation = 0; // Official Fragmentation | |
111 | Int_t iPWG4JetChem = 0; // Jet chemistry | |
112 | Int_t iPWG4PtQAMC = 0; // Marta's QA tasks | |
113 | Int_t iPWG4PtTrackQA = 0; // Marta's QA tasks | |
114 | Int_t iPWG4PtSpectra = 0; // Marta's QA tasks | |
115 | Int_t iPWG4PtQATPC = 0; // Marta's QA tasks | |
116 | Int_t iPWG4Cosmics = 0; // Marta's Cosmics Taks | |
117 | Int_t iPWG4ThreeJets = 0; // Sona's thrust task | |
118 | Int_t iPWG4QGSep = 0; // Sona's QG Separation task | |
119 | Int_t iPWG4Minijet = 0; // Eva's Mini Jet Task cluster task | |
120 | Int_t iPWG4KMeans = 0; // Andreas' KMeans task | |
121 | Int_t iPWG4Cluster = 0; // CKB cluster task | |
122 | Int_t iEMCUtilLibs = 0; // Flag to satisfy dependence on EMC utils | |
123 | Int_t iPWG4PartCorrLibs = 0; // Gustavo's part corr analysis | |
124 | Int_t iPWG4PartCorr = 0; // Gustavo's part corr analysis | |
125 | Int_t iPWG4CaloQA = 0; // Gustavo's part corr analysis | |
126 | Int_t iPWG4JetCorr = 0; // Paul's jet corr analysis | |
127 | Int_t iPWG4Tagged = 0; // Gustavo's part corr analysis | |
128 | Int_t iPWG4omega3pi = 0; // Omega to 3 pi analysis (PWG4) | |
129 | Int_t iPWG4GammaConvLib = 0; // Gamma Conversio | |
130 | Int_t iPWG4GammaConv = 0; // Gamma Conversio | |
131 | Int_t iPWG4CaloConv = 0; // Gamma Conversio | |
132 | Int_t kHighPtFilterMask = 32; // change depending on the used AOD Filter | |
133 | TString kDeltaAODJetName = "AliAOD.Jets.root"; | |
134 | TString kDeltaAODJCORRANName = "AliAOD.JCORRAN.root"; | |
135 | TString kDeltaAODPartCorrName = "AliAOD.PartCorr.root"; | |
136 | TString kFastEmbeddingAOD = "emb/AliAOD.root"; | |
137 | TString kFastEmbAODList = ""; | |
138 | ||
139 | //============================================================================== | |
140 | // ### PROOF Steering varibales | |
141 | //============================================================================== | |
142 | //== proof setup variables | |
143 | TString kProofCluster = "alicecaf.cern.ch"; | |
144 | Bool_t kProofUseAFPAR = kFALSE; // use AF special par file | |
145 | TString kProofAFversion = "AF-v4-17"; | |
146 | //== proof input and output variables | |
147 | TString kProofDataSet = "/COMMON/COMMON/LHC09a4_run8100X#/esdTree"; | |
148 | Bool_t kProofSaveToAlien = kFALSE; // save proof outputs in AliEn train_[trainName]_ddMonthyyyy_time.C | |
149 | TString kProofOutdir = ""; | |
150 | Bool_t kProofClearPackages = kFALSE; | |
151 | Int_t kProofEvents = 10000; | |
152 | Int_t kProofOffset = 0; | |
153 | //== proof process variables | |
154 | ||
155 | ||
156 | //============================================================================== | |
157 | // ### Grid plugin Steering varibiables | |
158 | //============================================================================== | |
159 | //== grid plugin setup variables | |
160 | Bool_t kPluginUse = kTRUE; // do not change | |
161 | Bool_t kPluginUseProductionMode = kFALSE; // use the plugin in production mode | |
162 | TString kPluginRootVersion = "v5-27-06b"; // *CHANGE ME IF MORE RECENT IN GRID* | |
163 | TString kPluginAliRootVersion = "v4-19-15-AN"; // *CHANGE ME IF MORE RECENT IN GRID* | |
164 | Bool_t kPluginMergeViaJDL = kTRUE; // merge via JDL | |
165 | Bool_t kPluginFastReadOption = kFALSE; // use xrootd tweaks | |
166 | Bool_t kPluginOverwriteMode = kTRUE; // overwrite existing collections | |
167 | Int_t kPluginOutputToRunNumber = 1; // write the output to subdirs named after run number | |
168 | // TString kPluginExecutableCommand = "root -b -q"; | |
169 | TString kPluginExecutableCommand = "source /Users/kleinb/setup_32bit_aliroot_trunk_clean_root_trunk.sh; alienroot -b -q "; | |
170 | ||
171 | // == grid plugin input and output variables | |
172 | TString kGridDatadir = "/alice/sim/PDC_08b/LHC09a1/AOD/"; | |
173 | Int_t kGridMaxRunsFromList = 999999999; | |
174 | Int_t kGridOffsetRunFromList = 0; // skip the first n runs from the list | |
175 | TString kGridLocalRunList = ""; | |
176 | TString kGridOutdir = ""; // AliEn output directory. If blank will become output_<kTrainName> | |
177 | TString kGridDataSet = ""; // sub working directory not to confuse different run xmls | |
178 | Int_t kGridRunRange[2] = {0, -1}; // Set the run range | |
179 | TString kGridRunPattern = "%03d"; // important for leading zeroes!! | |
180 | TString kGridPassPattern = ""; | |
181 | TString kGridExtraFiles = ""; // files that will be added to the input list in the JDL... | |
182 | Int_t kGridMaxMergeFiles = 25; // Number of files merged in a chunk grid run range | |
183 | TString kGridMergeExclude = "AliAOD.root"; // Files that should not be merged | |
184 | TString kGridOutputStorages = "disk=2"; // Make replicas on the storages | |
185 | // == grid process variables | |
186 | Int_t kGridRunsPerMaster = 100; // Number of runs per master job | |
187 | Int_t kGridFilesPerJob = 100; // Maximum number of files per job (gives size of AOD) | |
188 | ||
189 | //============================================================================== | |
190 | // ### Local Steering variables | |
191 | //============================================================================== | |
192 | //== local setup variables | |
193 | //== local input and output variables | |
194 | TString kLocalXMLDataset = ""; // Change local xml dataset for local interactive analysis | |
195 | TString kLocalDataList = "local_deltaaod.txt"; // Change local xml dataset for local interactive analysis | |
196 | // == local process variables | |
197 | ||
198 | TString kPluginMode = ""; | |
199 | TString kAnalysisMode = ""; | |
200 | ||
201 | ||
202 | // Temporaries. | |
203 | TString anaPars = ""; | |
204 | TString anaLibs = ""; | |
205 | TString anaLibsExtra = ""; | |
206 | TString anaSources = ""; | |
207 | // Function signatures | |
208 | class AliAnalysisAlien; | |
209 | ||
210 | //______________________________________________________________________________ | |
211 | void AnalysisTrainPWG4Jets(const char *analysis_mode="local", | |
212 | const char *plugin_mode="", | |
213 | const char *config_file="",Int_t iOffset = 0,Int_t iTotal = 0) | |
214 | { | |
215 | // Main analysis train macro. If a configuration file is provided, all parameters | |
216 | // are taken from there but may be altered by CheckModuleFlags. | |
217 | ||
218 | // these flag may be needed by the config file | |
219 | kPluginMode = plugin_mode; | |
220 | kAnalysisMode = analysis_mode; | |
221 | ||
222 | if (strlen(config_file) && !LoadConfig(config_file)) return; | |
223 | if(iTotal>0)kGridMaxRunsFromList = iTotal; // overwrites the settings from config file | |
224 | if(iOffset)kGridOffsetRunFromList = iOffset; | |
225 | if(iOffset)kProofOffset = iOffset; | |
226 | ||
227 | ||
228 | TString smode(analysis_mode); | |
229 | smode.ToUpper(); | |
230 | if (kSaveTrain)WriteConfig(); | |
231 | // Check compatibility of selected modules | |
232 | CheckModuleFlags(smode); | |
233 | // gROOT->ProcessLine(".trace"); | |
234 | ||
235 | printf("==================================================================\n"); | |
236 | printf("=========== RUNNING ANALYSIS TRAIN %s IN %s MODE ==========\n", kTrainName.Data(),smode.Data()); | |
237 | printf("==================================================================\n"); | |
238 | printf("= Configuring analysis train for: =\n"); | |
239 | if (iAODanalysis) printf("= AOD analysis =\n"); | |
240 | else printf("= ESD analysis =\n"); | |
241 | if (iPhysicsSelection) printf("= Physics selection =\n"); | |
242 | if(iCentralitySelection)printf("= Centrality selection =\n"); | |
243 | if (useTender) printf("= Using tender =\n"); | |
244 | if (iESDfilter) printf("= ESD filter =\n"); | |
245 | if (iJETAN) printf("= Jet analysis =\n"); | |
246 | printf("==================================================================\n"); | |
247 | ||
248 | char *printMask = ":: %20s %10d\n"; | |
249 | printf(printMask,"Fill AOD",(UInt_t)kFillAOD); | |
250 | printf(printMask,"Save AOD", (UInt_t)kSaveAOD); | |
251 | printf(printMask,"MC truth", (UInt_t)kUseMC); | |
252 | printf(printMask,"KINE filter", (UInt_t)kUseKinefilter); | |
253 | printf(printMask,"track refs", (UInt_t)kUseTR); | |
254 | printf(printMask,"tags", (UInt_t)kUseESDTags); | |
255 | printf(printMask,"AOD tags", (UInt_t)kUseAODTags); | |
256 | printf(printMask,"debugging", (UInt_t)kUseDebug); | |
257 | printf(printMask,"PAR files", (UInt_t)kUsePAR); | |
258 | printf(printMask,"AliEn plugin", (UInt_t)kPluginUse); | |
259 | printf(printMask,"JETAN subtract", (UInt_t)iJETSUBTRACT); | |
260 | printf(printMask,"PWG1 QA sym", iPWG1QASym); | |
261 | printf(printMask,"PWG4 Source Sara",iPWG4TmpSourceSara); | |
262 | printf(printMask,"PWG4 Fragmentation",iPWG4Fragmentation); | |
263 | printf(printMask,"PWG4 Jet Chem",iPWG4JetChem); | |
264 | printf(printMask,"PWG4 Jet tasks",iPWG4JetTasks); | |
265 | printf(printMask,"PWG4 Jet Services",iPWG4JetServices); | |
266 | printf(printMask,"PWG4 Jet Spectrum",iPWG4JetSpectrum); | |
267 | printf(printMask,"PWG4 JCORRAN",iPWG4JCORRAN); | |
268 | printf(printMask,"PWG4 UE",iPWG4UE); | |
269 | printf(printMask,"PWG4 Leading UE",iPWG4LeadingUE); | |
270 | printf(printMask,"PWG4 Corrections UE",iPWG4CorrectionsUE); | |
271 | printf(printMask,"PWG4 Pt QA MC",iPWG4PtQAMC); | |
272 | printf(printMask,"PWG4 Pt QA track",iPWG4PtTrackQA); | |
273 | printf(printMask,"PWG4 Pt Spectra",iPWG4PtSpectra); | |
274 | printf(printMask,"PWG4 Pt QA TPC",iPWG4PtQATPC); | |
275 | printf(printMask,"PWG4 Cosmics",iPWG4Cosmics); | |
276 | printf(printMask,"PWG4 Three Jets",iPWG4ThreeJets); | |
277 | printf(printMask,"PWG4 QGSep",iPWG4QGSep); | |
278 | printf(printMask,"PWG4 Minijet",iPWG4Minijet); | |
279 | printf(printMask,"PWG4 KMeans",iPWG4KMeans); | |
280 | printf(printMask,"PWG4 Cluster",iPWG4Cluster); | |
281 | printf(printMask,"PWG4 Part Corr",iPWG4PartCorr); | |
282 | printf(printMask,"PWG4 Calo QA",iPWG4CaloQA); | |
283 | printf(printMask,"PWG4 Jet Corr",iPWG4JetCorr); | |
284 | printf(printMask,"PWG4 JCORRAN",iPWG4JCORRAN); | |
285 | printf(printMask,"PWG4 Tagged",iPWG4Tagged); | |
286 | printf(printMask,"PWG4 omega to 3 pi ",iPWG4omega3pi); | |
287 | printf(printMask,"PWG4 Gamma Conv",iPWG4GammaConv); | |
288 | printf(printMask,"PWG4 Calo Conv",iPWG4CaloConv); | |
289 | printf(printMask,"HighPt FilterMask",kHighPtFilterMask); | |
290 | ||
291 | //========================================================================== | |
292 | // Connect to back-end system | |
293 | if (!Connect(smode)) { | |
294 | ::Error("AnalysisTrain", "Could not connect to %s back-end", analysis_mode); | |
295 | return; | |
296 | } | |
297 | ||
298 | // Load common libraries and set include path | |
299 | if (!LoadCommonLibraries(smode)) { | |
300 | ::Error("AnalysisTrain", "Could not load common libraries"); | |
301 | return; | |
302 | } | |
303 | ||
304 | ||
305 | ||
306 | // Make the analysis manager and connect event handlers | |
307 | AliAnalysisManager *mgr = new AliAnalysisManager("PWG4Train", "pwg4 mini train"); | |
308 | if (kCommonOutputFileName.Length()>0)mgr->SetCommonFileName(kCommonOutputFileName.Data()); | |
309 | if (kProofSaveToAlien) mgr->SetSpecialOutputLocation(kProofOutdir); | |
310 | mgr->SetNSysInfo(0); | |
311 | if (!strcmp(plugin_mode, "test")) mgr->SetNSysInfo(1); | |
312 | if (kUseSysInfo)mgr->SetNSysInfo(kUseSysInfo); | |
313 | mgr->SetSkipTerminate(kSkipTerminate); | |
314 | ||
315 | // Load analysis specific libraries | |
316 | if (!LoadAnalysisLibraries(smode)) { | |
317 | ::Error("AnalysisTrain", "Could not load analysis libraries"); | |
318 | return; | |
319 | } | |
320 | ||
321 | // Create input handler (input container created automatically) | |
322 | if (iAODanalysis) { | |
323 | // AOD input handler | |
324 | AliAODInputHandler *aodH = new AliAODInputHandler(); | |
325 | mgr->SetInputEventHandler(aodH); | |
326 | // if (iPWG4JetTasks) aodH->AddFriend(Form("deltas/%s",kDeltaAODJetName.Data())); | |
327 | // if (iPWG4PartCorr) aodH->AddFriend(Form("deltas/%s"kDeltaAODJetName.Data())); | |
328 | } else { | |
329 | // ESD input handler | |
330 | AliESDInputHandler *esdHandler = new AliESDInputHandler(); | |
331 | if (kUseESDTags) esdHandler->SetReadTags(); | |
332 | esdHandler->SetReadFriends(kFALSE); | |
333 | mgr->SetInputEventHandler(esdHandler); | |
334 | // if(iPWG4PtQATPC&& !kTrainName.Contains("pass5"))esdHandler->SetActiveBranches("ESDfriend"); | |
335 | ||
336 | } | |
337 | ||
338 | // Monte Carlo handler | |
339 | if (kUseMC && !iAODanalysis) { | |
340 | AliMCEventHandler* mcHandler = new AliMCEventHandler(); | |
341 | mgr->SetMCtruthEventHandler(mcHandler); | |
342 | mcHandler->SetReadTR(kUseTR); | |
343 | } | |
344 | // AOD output container, created automatically when setting an AOD handler | |
345 | if (iAODhandler) { | |
346 | // AOD output handler | |
347 | AliAODHandler* aodHandler = new AliAODHandler(); | |
348 | aodHandler->SetOutputFileName("AliAOD.root"); | |
349 | aodHandler->SetFillAODforRun(kFillAOD); | |
350 | // | |
351 | mgr->SetOutputEventHandler(aodHandler); | |
352 | AliAnalysisDataContainer * cout_aod = mgr->GetCommonOutputContainer(); | |
353 | cout_aod->SetSpecialOutput(); | |
354 | } | |
355 | // Debugging if needed | |
356 | ||
357 | if (kUseDebug){ | |
358 | mgr->SetDebugLevel(3); | |
359 | } | |
360 | if(kUseSysInfo>0){ | |
361 | mgr->RegisterExtraFile("syswatch.root"); | |
362 | if(kGridMergeExclude.Length())kGridMergeExclude += " "; | |
363 | kGridMergeExclude += "syswatch.root"; | |
364 | } | |
365 | else{ | |
366 | AliLog::SetGlobalLogLevel(AliLog::kError); | |
367 | } | |
368 | ||
369 | ||
370 | //========================================================================== | |
371 | // Create the chain. In this example it is created only from ALIEN files but | |
372 | // can be done to work in batch or grid mode as well. | |
373 | TChain *chain = CreateChain(smode, plugin_mode); | |
374 | ||
375 | //========================================================================== | |
376 | // Load the tasks configuration macros for all wagons. These files are supposed now to be | |
377 | // in the current workdir, but in AliEn they will be in the file catalog, | |
378 | // mapped from AliRoot and pecified in the jdl input list. | |
379 | ||
380 | // For now connection to top input container and common AOD output container | |
381 | // is done in this macro, but in future these containers will be connected | |
382 | // from each task configuration macro. | |
383 | ||
384 | // | |
385 | // Tender and supplies. Needs to be called for every event. | |
386 | // | |
387 | ||
388 | if (useTender) { | |
389 | gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/TenderSupplies/AddTaskTender.C"); | |
390 | AliAnalysisTaskSE *tender = AddTaskTender(kTRUE); | |
391 | // tender->SelectCollisionCandidates(); | |
392 | tender->SetDebugLevel(2); | |
393 | } | |
394 | ||
395 | ||
396 | Float_t fTrackEtaWindow = 0.9; | |
397 | Float_t fJetEtaWindow = 0.5; | |
398 | ||
399 | /* | |
400 | if(kIsPbPb){// for pass1 | |
401 | Float_t fTrackEtaWindow = 0.8; | |
402 | Float_t fJetEtaWindow = 0.4; | |
403 | } | |
404 | */ | |
405 | ||
406 | if(iPhysicsSelection && !iAODanalysis){ | |
407 | gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C"); | |
408 | Int_t iTriggerHIC = 0; | |
409 | Bool_t rejectBkg = true; | |
410 | if(kIsPbPb){ | |
411 | iTriggerHIC = 2; | |
412 | rejectBkg = false; // for the moment... | |
413 | } | |
414 | AliPhysicsSelectionTask* physSelTask = AddTaskPhysicsSelection(kIsMC,rejectBkg); | |
415 | iPhysicsSelectionFlag = AliVEvent::kMB; | |
416 | mgr->RegisterExtraFile("EventStat_temp.root"); | |
417 | mgr->AddStatisticsTask(); | |
418 | } | |
419 | ||
420 | if(iCentralitySelection){ | |
421 | ||
422 | // has to run before AOD filter | |
423 | gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskCentrality.C"); | |
424 | // const char* file1="$ALICE_ROOT/ANALYSIS/macros/AliCentralityBy1D_137161.root"; | |
425 | // const char* file2="$ALICE_ROOT/ANALYSIS/macros/AliCentralityByFunction_137161.root"; | |
426 | AliCentralitySelectionTask *taskC = AddTaskCentrality(); | |
427 | if (!taskC) ::Warning("AnalysisTrainPWG4Jets", "AliCentralitySelectionTask cannot run for this train conditions - EXCLUDED"); | |
428 | } | |
429 | ||
430 | if (iESDfilter && !iAODanalysis) { | |
431 | // ESD filter task configuration. | |
432 | gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskESDFilterPWG4Train.C"); | |
433 | AliAnalysisTaskESDfilter *taskesdfilter = AddTaskESDFilter(kUseKinefilter,kUseMuonfilter); | |
434 | taskesdfilter->SetEnableFillAOD(!kFilterAOD); | |
435 | ||
436 | if(kIsMC){ | |
437 | mgr->RegisterExtraFile("pyxsec_hists.root"); | |
438 | if(kGridMergeExclude.Length())kGridMergeExclude += " "; | |
439 | kGridMergeExclude += "pyxsec_hists.root"; | |
440 | ||
441 | } | |
442 | } | |
443 | ||
444 | // AOD tags | |
445 | if (kUseAODTags) { | |
446 | AliAnalysisTaskTagCreator* tagTask = new AliAnalysisTaskTagCreator("AOD Tag Creator"); | |
447 | mgr->AddTask(tagTask); | |
448 | AliAnalysisDataContainer *coutTags = mgr->CreateContainer("cTag", TTree::Class(), | |
449 | AliAnalysisManager::kOutputContainer, "AOD.tag.root"); | |
450 | mgr->ConnectInput (tagTask, 0, mgr->GetCommonInputContainer()); | |
451 | mgr->ConnectOutput(tagTask, 1, coutTags); | |
452 | } | |
453 | ||
454 | if (iPWG4FastEmbedding) { | |
455 | gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskFastEmbedding.C"); | |
456 | AliAnalysisTaskFastEmbedding *taskEmbedding = 0; | |
457 | if(kFastEmbAODList.Length()) taskEmbedding = AddTaskFastEmbedding(kFastEmbAODList, 1); | |
458 | else taskEmbedding = AddTaskFastEmbedding(kFastEmbeddingAOD, 0); | |
459 | taskEmbedding->SetJetBranch("jetsAOD_UA104_B0_Filter00256_Cut01000"); | |
460 | // taskEmbedding->SetEvtSelecMode(AliAnalysisTaskFastEmbedding::kEventsAll); | |
461 | // taskEmbedding->SetDebugLevel(10); | |
462 | } | |
463 | ||
464 | // Jet analysis | |
465 | if (iJETAN) { | |
466 | gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskJets.C"); | |
467 | AliAnalysisTaskJets *taskjets = 0; | |
468 | if(iJETAN&1){ | |
469 | /* | |
470 | taskjets = AddTaskJets(kHighPtFilterMask); | |
471 | taskjets->SetName("StandardJets"); | |
472 | taskjets->SetNonStdBranch(""); | |
473 | */ | |
474 | } | |
475 | if(iJETAN&2){ | |
476 | // Set only few jet finders backgroudn subtraction w an wo | |
477 | ||
478 | taskjets = AddTaskJets("AOD","UA1",0.4,kHighPtFilterMask,1.,0); // no background subtraction | |
479 | if(kDeltaAODJetName.Length()>0)taskjets->SetNonStdOutputFile(kDeltaAODJetName.Data()); | |
480 | ||
481 | // STANDARD UA jet finders pT cut 1 GeV background mode 2 R = 0.4 | |
482 | if(kIsPbPb){ | |
483 | taskjets = AddTaskJets("AOD","UA1",0.4,kHighPtFilterMask,1.,2); // background subtraction | |
484 | if(kDeltaAODJetName.Length()>0)taskjets->SetNonStdOutputFile(kDeltaAODJetName.Data()); | |
485 | } | |
486 | ||
487 | TString cTmp(""); | |
488 | ||
489 | // SICONE | |
490 | taskjets = AddTaskJets("AOD","SISCONE",0.4,kHighPtFilterMask,0.15,0); //no background subtraction to be done later.... | |
491 | if(kDeltaAODJetName.Length()>0)taskjets->SetNonStdOutputFile(kDeltaAODJetName.Data()); | |
492 | cTmp = taskjets->GetNonStdBranch(); | |
493 | if(cTmp.Length()>0)kJetSubtractBranches += Form("%s ",cTmp.Data()); | |
494 | ||
495 | if(kUseAODMC){ | |
496 | // STANDARD UA jet finders pT cut 1 GeV background mode 2 R = 0.4 | |
497 | if(kIsPbPb){ | |
498 | taskjets = AddTaskJets("AODMC","UA1",0.4,kHighPtFilterMask,1.,2); // background subtraction | |
499 | taskjets = AddTaskJets("AODMC2","UA1",0.4,kHighPtFilterMask,1.,2); // background subtraction | |
500 | } | |
501 | else{ | |
502 | taskjets = AddTaskJets("AODMC","UA1",0.4,kHighPtFilterMask,1.,0); // no background subtraction | |
503 | taskjets = AddTaskJets("AODMC2","UA1",0.4,kHighPtFilterMask,1.,0); // no background subtraction | |
504 | } | |
505 | } | |
506 | if(kDeltaAODJetName.Length()>0)mgr->RegisterExtraFile(kDeltaAODJetName.Data()); | |
507 | } | |
508 | if (!taskjets) ::Warning("AnalysisTrainPWG4Jets", "AliAnalysisTaskJets cannot run for this train conditions - EXCLUDED"); | |
509 | } | |
510 | ||
511 | ||
512 | if (iPWG4FastEmbedding && iJETAN) { | |
513 | AliAnalysisTaskJets *taskEmbJets = AddTaskJets("AODextra", "FASTJET", 0.4, kHighPtFilterMask); | |
514 | taskEmbJets->ReadAODFromOutput(); | |
515 | kJetSubtractBranches_extra += Form("%s ", taskEmbJets->GetNonStdBranch()); | |
516 | ||
517 | taskEmbJets = AddTaskJets("AODextraonly", "FASTJET", 0.4, kHighPtFilterMask); | |
518 | taskEmbJets->ReadAODFromOutput(); | |
519 | ||
520 | taskEmbJets = AddTaskJets("AODextra", "UA1", 0.4, kHighPtFilterMask,1.,0); | |
521 | taskEmbJets->ReadAODFromOutput(); | |
522 | taskEmbJets = AddTaskJets("AODextraonly", "UA1", 0.4, kHighPtFilterMask,1.,0); | |
523 | taskEmbJets->ReadAODFromOutput(); | |
524 | taskEmbJets = AddTaskJets("AODextra", "UA1", 0.4, kHighPtFilterMask,1.,2); | |
525 | taskEmbJets->ReadAODFromOutput(); | |
526 | } | |
527 | ||
528 | if(iPWG4Cluster){ | |
529 | gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskJetCluster.C"); | |
530 | AliAnalysisTaskJetCluster *taskCl = 0; | |
531 | Float_t fCenUp = 0; | |
532 | Float_t fCenLo = 0; | |
533 | if(kIsPbPb&&!kIsMC){ | |
534 | fCenLo = 0; | |
535 | fCenUp = 80; | |
536 | } | |
537 | if(iPWG4Cluster&1){ | |
538 | ||
539 | if(kIsPbPb){ | |
540 | 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 | |
541 | taskCl->SetBackgroundCalc(kTRUE); | |
542 | taskCl->SetNRandomCones(10); | |
543 | taskCl->SetCentralityCut(fCenLo,fCenUp); | |
544 | taskCl->SetGhostEtamax(fTrackEtaWindow); | |
545 | kDefaultJetBackgroundBranch = Form("%s_%s",AliAODJetEventBackground::StdBranchName(),taskCl->GetJetOutputBranch()); | |
546 | ||
547 | if (iPWG4FastEmbedding) { | |
548 | AliAnalysisTaskJetCluster *taskClEmb = 0; | |
549 | taskClEmb = AddTaskJetCluster("AODextra","",kHighPtFilterMask,iPhysicsSelectionFlag,"KT",0.4,0,1, kDeltaAODJetName.Data(),0.15,fTrackEtaWindow); // this one is for the background and random jets | |
550 | taskClEmb->SetBackgroundCalc(kTRUE); | |
551 | taskClEmb->SetCentralityCut(fCenLo,fCenUp); | |
552 | taskClEmb->SetGhostEtamax(fTrackEtaWindow); | |
553 | kDefaultJetBackgroundBranch_extra = Form("%s_%s",AliAODJetEventBackground::StdBranchName(),taskClEmb->GetJetOutputBranch()); | |
554 | ||
555 | taskClEmb = AddTaskJetCluster("AODextraonly","",kHighPtFilterMask,iPhysicsSelectionFlag,"KT",0.4,0,1, kDeltaAODJetName.Data(),0.15,fTrackEtaWindow); // this one is for the background and random jets | |
556 | taskClEmb->SetBackgroundCalc(kFALSE); | |
557 | taskClEmb->SetCentralityCut(fCenLo,fCenUp); | |
558 | taskClEmb->SetGhostEtamax(fTrackEtaWindow); | |
559 | ||
560 | taskClEmb = AddTaskJetCluster("AODextra","",kHighPtFilterMask,iPhysicsSelectionFlag,"ANTIKT",0.4,0,1,kDeltaAODJetName.Data(),0.15,fTrackEtaWindow); | |
561 | taskClEmb->SetCentralityCut(fCenLo,fCenUp); | |
562 | taskClEmb->SetBackgroundBranch(kDefaultJetBackgroundBranch_extra.Data()); | |
563 | kJetSubtractBranches_extra += Form("%s ",taskClEmb->GetJetOutputBranch()); | |
564 | ||
565 | taskClEmb = AddTaskJetCluster("AODextraonly","",kHighPtFilterMask,iPhysicsSelectionFlag,"ANTIKT",0.4,0,1,kDeltaAODJetName.Data(),0.15,fTrackEtaWindow); | |
566 | taskClEmb->SetCentralityCut(fCenLo,fCenUp); | |
567 | } | |
568 | ||
569 | taskCl = AddTaskJetCluster("AOD","",kHighPtFilterMask,iPhysicsSelectionFlag,"KT",0.2,0,1, kDeltaAODJetName.Data(),0.15); // this one is for the background and random jets | |
570 | taskCl->SetBackgroundCalc(kTRUE); | |
571 | taskCl->SetCentralityCut(fCenLo,fCenUp); | |
572 | taskCl->SetGhostEtamax(fTrackEtaWindow); | |
573 | } | |
574 | else{ | |
575 | taskCl = AddTaskJetCluster("AOD","",kHighPtFilterMask,iPhysicsSelectionFlag,"KT",0.6,0,1,kDeltaAODJetName.Data(),0.15); // this one is for the background jets | |
576 | taskCl->SetBackgroundCalc(kTRUE); | |
577 | kDefaultJetBackgroundBranch = Form("%s_%s",AliAODJetEventBackground::StdBranchName(),taskCl->GetJetOutputBranch()); | |
578 | taskCl->SetGhostEtamax(fTrackEtaWindow); | |
579 | ||
580 | taskCl = AddTaskJetCluster("AOD","",kHighPtFilterMask,iPhysicsSelectionFlag,"KT",0.4,0,1,kDeltaAODJetName.Data(),0.15); | |
581 | taskCl->SetBackgroundCalc(kTRUE); | |
582 | taskCl->SetGhostEtamax(fTrackEtaWindow); | |
583 | } | |
584 | ||
585 | taskCl = AddTaskJetCluster("AOD","",kHighPtFilterMask,iPhysicsSelectionFlag,"ANTIKT",0.4,2,1,kDeltaAODJetName.Data(),0.15); | |
586 | taskCl->SetCentralityCut(fCenLo,fCenUp); | |
587 | if(kIsPbPb)taskCl->SetBackgroundBranch(kDefaultJetBackgroundBranch.Data()); | |
588 | taskCl->SetNRandomCones(10); | |
589 | kDefaultJetBranch = taskCl->GetJetOutputBranch(); | |
590 | kJetSubtractBranches += Form("%s ",taskCl->GetJetOutputBranch()); | |
591 | ||
592 | ||
593 | taskCl = AddTaskJetCluster("AOD","",kHighPtFilterMask,iPhysicsSelectionFlag,"ANTIKT",0.2,0,1,kDeltaAODJetName.Data(),0.15); | |
594 | taskCl->SetCentralityCut(fCenLo,fCenUp); | |
595 | if(kIsPbPb)taskCl->SetBackgroundBranch(kDefaultJetBackgroundBranch.Data()); | |
596 | kJetSubtractBranches += Form("%s ",taskCl->GetJetOutputBranch()); | |
597 | ||
598 | ||
599 | ||
600 | if(kDeltaAODJetName.Length()==0&&kFilterAOD){ | |
601 | if(kIsPbPb)taskCl->SetJetTriggerPtCut(0.0001); | |
602 | else taskCl->SetJetTriggerPtCut(20.); | |
603 | } | |
604 | ||
605 | if(kUseAODMC){ | |
606 | if(kIsPbPb){ | |
607 | taskCl = AddTaskJetCluster("AODMC","",kHighPtFilterMask,iPhysicsSelectionFlag,"KT",0.4,0,1, kDeltaAODJetName.Data(),0.15,fTrackEtaWindow); // this one is for the background and random jets | |
608 | taskCl->SetBackgroundCalc(kTRUE); | |
609 | taskCl->SetGhostEtamax(0.9); | |
610 | kDefaultJetBackgroundBranchMC = Form("%s_%s",AliAODJetEventBackground::StdBranchName(),taskCl->GetJetOutputBranch()); | |
611 | ||
612 | taskCl = AddTaskJetCluster("AODMC2","",kHighPtFilterMask,iPhysicsSelectionFlag,"KT",0.4,0,1, kDeltaAODJetName.Data(),0.15); // this one is for the background and random jets | |
613 | taskCl->SetBackgroundCalc(kTRUE); | |
614 | taskCl->SetGhostEtamax(fTrackEtaWindow); | |
615 | kDefaultJetBackgroundBranchMC2 = Form("%s_%s",AliAODJetEventBackground::StdBranchName(),taskCl->GetJetOutputBranch(),fTrackEtaWindow); | |
616 | } | |
617 | else{ | |
618 | taskCl = AddTaskJetCluster("AODMC","",kHighPtFilterMask,iPhysicsSelectionFlag,"KT",0.6,0,1, kDeltaAODJetName.Data(),0.15,fTrackEtaWindow); // this one is for the background and random jets | |
619 | taskCl->SetBackgroundCalc(kTRUE); | |
620 | taskCl->SetGhostEtamax(fTrackEtaWindow); | |
621 | kDefaultJetBackgroundBranchMC = Form("%s_%s",AliAODJetEventBackground::StdBranchName(),taskCl->GetJetOutputBranch()); | |
622 | ||
623 | taskCl = AddTaskJetCluster("AODMC2","",kHighPtFilterMask,iPhysicsSelectionFlag,"KT",0.6,0,1, kDeltaAODJetName.Data(),0.15,fTrackEtaWindow); // this one is for the background and random jets | |
624 | taskCl->SetBackgroundCalc(kTRUE); | |
625 | taskCl->SetGhostEtamax(fTrackEtaWindow); | |
626 | kDefaultJetBackgroundBranchMC2 = Form("%s_%s",AliAODJetEventBackground::StdBranchName(),taskCl->GetJetOutputBranch()); | |
627 | // pp background calcs... | |
628 | } | |
629 | ||
630 | taskCl = AddTaskJetCluster("AODMC","",kHighPtFilterMask,iPhysicsSelectionFlag,"ANTIKT",0.4,0,1, kDeltaAODJetName.Data(),0.15,fTrackEtaWindow); | |
631 | taskCl->SetGhostEtamax(fTrackEtaWindow); | |
632 | if(kIsPbPb)taskCl->SetBackgroundBranch(kDefaultJetBackgroundBranchMC.Data()); | |
633 | kDefaultJetBranchMC = taskCl->GetJetOutputBranch(); | |
634 | ||
635 | taskCl = AddTaskJetCluster("AODMC2","",kHighPtFilterMask,iPhysicsSelectionFlag,"ANTIKT",0.4,0,1, kDeltaAODJetName.Data(),0.15,fTrackEtaWindow); | |
636 | if(kIsPbPb)taskCl->SetBackgroundBranch(kDefaultJetBackgroundBranchMC2.Data()); | |
637 | kDefaultJetBranchMC2 = taskCl->GetJetOutputBranch(); | |
638 | ||
639 | } | |
640 | ||
641 | ||
642 | if (!taskCl) ::Warning("AnalysisTrainPWG4Jets", "AliAnalysisTaskCluster cannot run for this train conditions - EXCLUDED"); | |
643 | } | |
644 | } | |
645 | ||
646 | ||
647 | if(iJETSUBTRACT&&kJetSubtractBranches.Length()){ | |
648 | gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskJetBackgroundSubtract.C"); | |
649 | AliAnalysisTaskJetBackgroundSubtract *taskSubtract = 0; | |
650 | if(kJetSubtractBranches.Length()){ | |
651 | ||
652 | taskSubtract = AddTaskJetBackgroundSubtract(kJetSubtractBranches,3,kJetSubtractMask1.Data(),kJetSubtractMask2.Data()); | |
653 | taskSubtract->SetBackgroundBranch(kDefaultJetBackgroundBranch.Data()); | |
654 | if(kDeltaAODJetName.Length()>0)taskSubtract->SetNonStdOutputFile(kDeltaAODJetName.Data()); | |
655 | ||
656 | taskSubtract = AddTaskJetBackgroundSubtract(kJetSubtractBranches,2,kJetSubtractMask1.Data(),kJetSubtractMask2.Data()); | |
657 | taskSubtract->SetBackgroundBranch(kDefaultJetBackgroundBranch.Data()); taskSubtract->SelectCollisionCandidates(iPhysicsSelectionFlag); | |
658 | if(kDeltaAODJetName.Length()>0)taskSubtract->SetNonStdOutputFile(kDeltaAODJetName.Data()); | |
659 | ||
660 | // taskSubtract->SetDebugLevel(3); | |
661 | ||
662 | taskSubtract = AddTaskJetBackgroundSubtract(kJetSubtractBranches,1,kJetSubtractMask1.Data(),kJetSubtractMask2.Data()); | |
663 | taskSubtract->SetBackgroundBranch(kDefaultJetBackgroundBranch.Data()); taskSubtract->SelectCollisionCandidates(iPhysicsSelectionFlag); | |
664 | if(kDeltaAODJetName.Length()>0)taskSubtract->SetNonStdOutputFile(kDeltaAODJetName.Data()); | |
665 | ||
666 | if(kJetSubtractBranches.Contains(kDefaultJetBranch.Data())&&kIsPbPb){ | |
667 | kDefaultJetBranch.ReplaceAll(taskSubtract->GetToReplace(),Form(taskSubtract->GetReplacementMask(),taskSubtract->GetSubtractionMethod())); | |
668 | } | |
669 | } | |
670 | if(kJetSubtractBranches_extra.Length()){ | |
671 | taskSubtract = AddTaskJetBackgroundSubtract(kJetSubtractBranches_extra,1,kJetSubtractMask1.Data(),kJetSubtractMask2.Data(),"extra"); | |
672 | taskSubtract->SetBackgroundBranch(kDefaultJetBackgroundBranch_extra.Data()); | |
673 | taskSubtract->SelectCollisionCandidates(iPhysicsSelectionFlag); | |
674 | //taskSubtract->SetDebugLevel(3); | |
675 | if(kDeltaAODJetName.Length()>0)taskSubtract->SetNonStdOutputFile(kDeltaAODJetName.Data()); | |
676 | if(kJetSubtractBranches_extra.Contains(kDefaultJetBranch.Data())){ | |
677 | kDefaultJetBranch.ReplaceAll(taskSubtract->GetToReplace(),Form(taskSubtract->GetReplacementMask(),taskSubtract->GetSubtractionMethod())); | |
678 | } | |
679 | } | |
680 | if (!taskSubtract) ::Warning("AnalysisTrainPWG4Jets", "AliAnalysisTaskJetBackgroundSubtrac cannot run for this train conditions - EXCLUDED"); | |
681 | } | |
682 | ||
683 | if (iDIJETAN) { | |
684 | gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskDiJets.C"); | |
685 | AliAnalysisTaskDiJets *taskdijets = 0; | |
686 | if(iDIJETAN&1)taskdijets = AddTaskDiJets(); | |
687 | if (!taskdijets) ::Warning("AnalysisTrainPWG4Jets", "AliAnalysisTaskJets cannot run for this train conditions - EXCLUDED"); | |
688 | if(iDIJETAN&2){ | |
689 | taskdijets = AddTaskDiJets("jetsAOD_CDF07"); | |
690 | taskdijets = AddTaskDiJets("jetsAOD_DA07"); | |
691 | taskdijets = AddTaskDiJets("jetsAOD_FASTJET07"); | |
692 | taskdijets = AddTaskDiJets("jetsAOD_FASTKT07"); | |
693 | taskdijets = AddTaskDiJets("jetsAOD_SISCONE07"); | |
694 | taskdijets = AddTaskDiJets("jetsAOD_UA107"); | |
695 | } | |
696 | } | |
697 | ||
698 | if(iPWG1QASym){ | |
699 | gROOT->LoadMacro("$ALICE_ROOT/PWG1/PilotTrain/AddTaskQAsym.C"); | |
700 | AliAnalysisTaskQASym *taskQASym = AddTaskQAsym(-1); | |
701 | if (!taskQASym) ::Warning("AnalysisTrainPWG4Jets", "AliAnalysisTaskQASym cannot run for this train conditions - EXCLUDED"); | |
702 | } | |
703 | ||
704 | ||
705 | ||
706 | if(iPWG4TmpSourceSara){ | |
707 | gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskEta.C"); | |
708 | AliAnalysisTaskEta *taskEta = AddTaskEta(); | |
709 | if (!taskEta) ::Warning("AnalysisTrainPWG4Jets", "AliAnalysisTaskEta cannot run for this train conditions - EXCLUDED"); | |
710 | } | |
711 | ||
712 | ||
713 | if(iPWG4JetServices){ | |
714 | gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskJetServices.C"); | |
715 | AliAnalysisTaskJetServices *taskjetServ = 0; | |
716 | taskjetServ = AddTaskJetServices(); | |
717 | if (!taskjetServ) ::Warning("AnalysisTrainPWG4Jets", "AliAnalysisTaskJetServices cannot run for this train conditions - EXCLUDED"); | |
718 | if(kGridRunRange[0]>0)taskjetServ->SetRunRange(kGridRunRange[0],kGridRunRange[1]); | |
719 | else taskjetServ->SetRunRange(110000,160000); | |
720 | taskjetServ->SetMCData(kIsMC); | |
721 | taskjetServ->SetUsePhysicsSelection((Bool_t)iPhysicsSelection); | |
722 | taskjetServ->SetPhysicsSelectionFlag(iPhysicsSelectionFlag); // | |
723 | taskjetServ->SetNonStdFile(kDeltaAODJetName.Data()); | |
724 | if(kIsPbPb){ | |
725 | if(kDeltaAODJetName.Length()>0&&kFilterAOD)taskjetServ->SetFilterAODCollisions(kTRUE); | |
726 | // else if(iAODanalysis)taskjetServ->SetFilterAODCollisions(kTRUE); | |
727 | taskjetServ->SetDebugLevel(3); | |
728 | taskjetServ->SetZVertexCut(8.); | |
729 | } | |
730 | if(iAODanalysis){ | |
731 | // | |
732 | taskjetServ->SetAODInput(kTRUE); | |
733 | } | |
734 | } | |
735 | ||
736 | if(iPWG4JetSpectrum){ | |
737 | gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskJetSpectrum2.C"); | |
738 | AliAnalysisTaskJetSpectrum2 *taskjetSpectrum = 0; | |
739 | TString bkgClusters = kDefaultJetBackgroundBranch.Data(); | |
740 | bkgClusters.ReplaceAll(Form("%s_",AliAODJetEventBackground::StdBranchName()),""); | |
741 | ||
742 | if(iPWG4JetSpectrum&1){ | |
743 | if(kIsPbPb){ | |
744 | for(int i = 0;i<5;i++){ | |
745 | TString tmp(kDefaultJetBranch.Data()); | |
746 | // tmp.ReplaceAll(Form(kJetSubtractMask2.Data(),1),kJetSubtractMask1.Data()); | |
747 | // tmp.ReplaceAll(Form(kJetSubtractMask2.Data(),1),kJetSubtractMask1.Data()); | |
748 | tmp.ReplaceAll(Form(kJetSubtractMask2.Data(),1),Form(kJetSubtractMask1.Data(),0)); | |
749 | ||
750 | taskjetSpectrum = AddTaskJetSpectrum2(kDefaultJetBranch.Data(),tmp.Data(),kDeltaAODJetName.Data(),kHighPtFilterMask,AliVEvent::kMB,0,i); | |
751 | taskjetSpectrum->SetBranchBkgRec(bkgClusters.Data()); | |
752 | taskjetSpectrum->SetBranchBkgGen(bkgClusters.Data()); | |
753 | ||
754 | // taskjetSpectrum->SetDebugLevel(3); | |
755 | // taskjetSpectrum->SetMinJetPt(10); | |
756 | taskjetSpectrum->SetTrackEtaWindow(fTrackEtaWindow); | |
757 | taskjetSpectrum->SetJetEtaWindow(fJetEtaWindow); | |
758 | if(iAODanalysis)SetAODInput(taskjetSpectrum); | |
759 | ||
760 | ||
761 | // check the old subtracted vs. the new subtracted | |
762 | TString tmp2(kDefaultJetBranch.Data()); | |
763 | tmp2.ReplaceAll(Form(kJetSubtractMask2.Data(),1),Form(kJetSubtractMask2.Data(),2)); | |
764 | taskjetSpectrum = AddTaskJetSpectrum2(tmp2.Data(),kDefaultJetBranch.Data(),kDeltaAODJetName.Data(),kHighPtFilterMask,AliVEvent::kMB,0,i); | |
765 | taskjetSpectrum->SetBranchBkgRec(bkgClusters.Data()); | |
766 | taskjetSpectrum->SetBranchBkgGen(bkgClusters.Data()); | |
767 | // taskjetSpectrum->SetDebugLevel(3); | |
768 | // taskjetSpectrum->SetMinJetPt(10); | |
769 | taskjetSpectrum->SetTrackEtaWindow(fTrackEtaWindow); | |
770 | taskjetSpectrum->SetJetEtaWindow(fJetEtaWindow); | |
771 | if(iAODanalysis)SetAODInput(taskjetSpectrum); | |
772 | ||
773 | // check the old subtracted vs. the new subtracted | |
774 | TString tmp3(kDefaultJetBranch.Data()); | |
775 | tmp3.ReplaceAll(Form(kJetSubtractMask2.Data(),1),Form(kJetSubtractMask2.Data(),3)); | |
776 | ||
777 | taskjetSpectrum = AddTaskJetSpectrum2(tmp3.Data(),kDefaultJetBranch.Data(),kDeltaAODJetName.Data(),kHighPtFilterMask,AliVEvent::kMB,0,i); | |
778 | // taskjetSpectrum->SetDebugLevel(3); | |
779 | // taskjetSpectrum->SetMinJetPt(10); | |
780 | taskjetSpectrum->SetBranchBkgRec(bkgClusters.Data()); | |
781 | taskjetSpectrum->SetBranchBkgGen(bkgClusters.Data()); | |
782 | taskjetSpectrum->SetTrackEtaWindow(0.8); | |
783 | taskjetSpectrum->SetJetEtaWindow(0.4); | |
784 | if(iAODanalysis)SetAODInput(taskjetSpectrum); | |
785 | ||
786 | ||
787 | taskjetSpectrum = AddTaskJetSpectrum2(Form("jetsAOD_UA104_B2_Filter%05d_Cut01000",kHighPtFilterMask),kDefaultJetBranch.Data(),kDeltaAODJetName.Data(),kHighPtFilterMask,AliVEvent::kMB,0,i); | |
788 | // taskjetSpectrum->SetDebugLevel(3); | |
789 | // taskjetSpectrum->SetMinJetPt(10); | |
790 | taskjetSpectrum->SetTrackEtaWindow(fTrackEtaWindow); | |
791 | taskjetSpectrum->SetJetEtaWindow(fJetEtaWindow); | |
792 | taskjetSpectrum->SetBranchBkgRec(bkgClusters.Data()); | |
793 | taskjetSpectrum->SetBranchBkgGen(bkgClusters.Data()); | |
794 | if(iAODanalysis)SetAODInput(taskjetSpectrum); | |
795 | ||
796 | } | |
797 | } | |
798 | else{ // ! PbPb | |
799 | Int_t i = 0; | |
800 | ||
801 | taskjetSpectrum = AddTaskJetSpectrum2(kDefaultJetBranch.Data(), | |
802 | "",kDeltaAODJetName.Data(),kHighPtFilterMask,AliVEvent::kMB,0,i); | |
803 | ||
804 | ||
805 | ||
806 | if(kDefaultJetBranchMC.Length()){ | |
807 | taskjetSpectrum = AddTaskJetSpectrum2(kDefaultJetBranch.Data(), | |
808 | kDefaultJetBranchMC.Data(),kDeltaAODJetName.Data(),kHighPtFilterMask,AliVEvent::kMB,0,i); | |
809 | // taskjetSpectrum->SetMinJetPt(10); | |
810 | taskjetSpectrum->SetTrackEtaWindow(fTrackEtaWindow); | |
811 | taskjetSpectrum->SetJetEtaWindow(fJetEtaWindow); | |
812 | taskjetSpectrum->SetBranchBkgRec(bkgClusters.Data()); | |
813 | taskjetSpectrum->SetBranchBkgGen(bkgClusters.Data()); | |
814 | if(iAODanalysis)SetAODInput(taskjetSpectrum); | |
815 | } | |
816 | if(kDefaultJetBranchMC2.Length()){ | |
817 | taskjetSpectrum = AddTaskJetSpectrum2(kDefaultJetBranch.Data(), | |
818 | kDefaultJetBranchMC2.Data(),kDeltaAODJetName.Data(),kHighPtFilterMask,AliVEvent::kMB,0,i); | |
819 | // taskjetSpectrum->SetMinJetPt(10); | |
820 | taskjetSpectrum->SetTrackEtaWindow(fTrackEtaWindow); | |
821 | taskjetSpectrum->SetJetEtaWindow(fJetEtaWindow); | |
822 | taskjetSpectrum->SetBranchBkgRec(bkgClusters.Data()); | |
823 | taskjetSpectrum->SetBranchBkgGen(bkgClusters.Data()); | |
824 | if(iAODanalysis)SetAODInput(taskjetSpectrum); | |
825 | } | |
826 | ||
827 | /* | |
828 | TString tmp2(kDefaultJetBranch.Data()); | |
829 | tmp2.ReplaceAll(Form(kJetSubtractMask2.Data(),0),Form(kJetSubtractMask2.Data(),2)); | |
830 | taskjetSpectrum = AddTaskJetSpectrum2(tmp2.Data(),kDefaultJetBranch.Data(),kDeltaAODJetName.Data(),kHighPtFilterMask,AliVEvent::kMB,0,i); | |
831 | // taskjetSpectrum->SetDebugLevel(3); | |
832 | // taskjetSpectrum->SetMinJetPt(10); | |
833 | taskjetSpectrum->SetBranchBkgRec(bkgClusters.Data()); | |
834 | taskjetSpectrum->SetBranchBkgGen(bkgClusters.Data()); | |
835 | taskjetSpectrum->SetTrackEtaWindow(0.8); | |
836 | taskjetSpectrum->SetJetEtaWindow(0.4); | |
837 | ||
838 | // check the old subtracted vs. the new subtracted | |
839 | TString tmp3(kDefaultJetBranch.Data()); | |
840 | tmp3.ReplaceAll(Form(kJetSubtractMask2.Data(),0),Form(kJetSubtractMask2.Data(),3)); | |
841 | taskjetSpectrum = AddTaskJetSpectrum2(tmp3.Data(),kDefaultJetBranch.Data(),kDeltaAODJetName.Data(),kHighPtFilterMask,AliVEvent::kMB,0,i); | |
842 | // taskjetSpectrum->SetDebugLevel(3); | |
843 | // taskjetSpectrum->SetMinJetPt(10); | |
844 | taskjetSpectrum->SetBranchBkgRec(bkgClusters.Data()); | |
845 | taskjetSpectrum->SetBranchBkgGen(bkgClusters.Data()); | |
846 | taskjetSpectrum->SetTrackEtaWindow(0.8); | |
847 | taskjetSpectrum->SetJetEtaWindow(0.4); | |
848 | if(iAODanalysis)SetAODInput(taskjetSpectrum); | |
849 | */ | |
850 | } | |
851 | if (!taskjetSpectrum) ::Warning("AnalysisTrainPWG4Jets", "AliAnalysisTaskJetSpectrum2 cannot run for this train conditions - EXCLUDED"); | |
852 | } | |
853 | } | |
854 | ||
855 | if(iPWG4Fragmentation){ | |
856 | gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskFragmentationFunction.C"); | |
857 | AliAnalysisTaskFragmentationFunction *taskFrag = 0; | |
858 | if(kUseAODMC){ | |
859 | ||
860 | } | |
861 | else{ | |
862 | taskFrag = AddTaskFragmentationFunction(kDefaultJetBranch.Data(),"","","",kHighPtFilterMask); | |
863 | traskFrag->SetIJMode(0); | |
864 | } | |
865 | if (!taskFrag) ::Warning("AnalysisTrainPWG4Jets", "AliAnalysisTaskFragmentationFunction cannot run for this train conditions - EXCLUDED"); | |
866 | } | |
867 | ||
868 | if(iPWG4JetChem){ | |
869 | gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskJetChem.C"); | |
870 | AliAnalysisTask *taskChem = AddTaskJetChem(kHighPtFilterMask); | |
871 | if (!taskChem) ::Warning("AnalysisTrainPWG4Jets", "AliAnalysisTaskJetChem cannot run for this train conditions - EXCLUDED"); | |
872 | } | |
873 | ||
874 | if (iPWG4JetResponse) { | |
875 | gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskJetResponse.C"); | |
876 | AliAnalysisTask *taskJetResponse = 0; | |
877 | ||
878 | if(iJETAN){ | |
879 | taskJetResponse = AddTaskJetResponse("jets", "FASTJET", 0.4, kHighPtFilterMask, 0.15, 0); | |
880 | taskJetResponse = AddTaskJetResponse("jets", "FASTJET", 0.4, kHighPtFilterMask, 0.15, 1); | |
881 | ||
882 | taskJetResponse = AddTaskJetResponse("jets", "UA1", 0.4, kHighPtFilterMask, 1., 0); | |
883 | taskJetResponse = AddTaskJetResponse("jets", "UA1", 0.4, kHighPtFilterMask, 1., 2); | |
884 | } | |
885 | if(iPWG4Cluster){ | |
886 | taskJetResponse = AddTaskJetResponse("clusters", "ANTIKT", 0.4, kHighPtFilterMask, 0.15, 0); | |
887 | taskJetResponse = AddTaskJetResponse("clusters", "ANTIKT", 0.4, kHighPtFilterMask, 0.15, 1); | |
888 | } | |
889 | if (!taskJetResponse) ::Warning("AnalysisTrainPWG4Jets", "AliAnalysisTaskJetResponse cannot run for this train conditions - EXCLUDED"); | |
890 | ||
891 | } | |
892 | ||
893 | if(iPWG4JCORRAN){ | |
894 | gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskJCORRANTask.C"); | |
895 | AliJCORRANTask* corran = AddTaskJCORRAN(kDeltaAODJCORRANName.Data(),0); | |
896 | if(!corran)::Warning("AnalysisTrainPWG4Jets", "AliJCORRANTask cannot run for this train conditions - EXCLUDED"); | |
897 | else{ | |
898 | if(kDeltaAODJCORRANName.Length()>0)mgr->RegisterExtraFile(kDeltaAODJCORRANName.Data()); | |
899 | } | |
900 | } | |
901 | ||
902 | if(iPWG4UE){ | |
903 | gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskUE.C"); | |
904 | AliAnalysisTaskUE *taskUE = 0; | |
905 | if(iPWG4UE&1)taskUE = AddTaskUE(); | |
906 | if(iPWG4UE&2){ | |
907 | taskUE =AddTaskUE("jetsAOD_CDF04","CDF", "LJ", "TRANSV","MSP"); //finder not yet in train | |
908 | // taskUE =AddTaskUE("jetsAOD_CDF07","CDF", "LJ", "TRANSV","MSP"); | |
909 | taskUE =AddTaskUE("jetsAOD_SISCONE04","CDF", "LJ", "TRANSV","MSP"); | |
910 | // taskUE =AddTaskUE("jetsAOD_SISCONE07","CDF", "LJ", "TRANSV","MSP"); //finder not yet in train | |
911 | taskUE =AddTaskUE("jetsAOD_ICDF","CDF","LJ","TRANSV","MSP"); | |
912 | taskUE =AddTaskUE("jetsAOD_FASTKT04","CDF", "LJ", "TRANSV","MSP"); | |
913 | // taskUE =AddTaskUE("jetsAOD_FASTKT07","CDF", "LJ", "TRANSV","MSP"); //finder not yet in train | |
914 | taskUE =AddTaskUE("jetsAOD_NONE","CDF", "MP_eta05", "TRANSV","MSP"); | |
915 | taskUE =AddTaskUE("jetsAOD_NONE","CDF", "MP_eta09", "TRANSV","MSP"); | |
916 | } | |
917 | ||
918 | if (!taskUE) ::Warning("AnalysisTrainPWG4Jets", "AliAnalysisTaskUE cannot run for this train conditions - EXCLUDED"); | |
919 | } | |
920 | ||
921 | if(iPWG4LeadingUE){ | |
922 | gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskLeadingTrackUE.C"); | |
923 | AliAnalysisTaskLeadingTrackUE *taskLeadingUE = AddTaskLeadingTrackUE(kUseMC); | |
924 | if (!taskLeadingUE) ::Warning("AnalysisTrainPWG4Jets", "AliAnalysisTasLeadingTrackkUE cannot run for this train conditions - EXCLUDED"); | |
925 | // taskLeadingUE->SetFilterBit(64); | |
926 | } | |
927 | ||
928 | ||
929 | if(iPWG4CorrectionsUE){ | |
930 | gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskCorrectionsUE.C"); | |
931 | AliAnalysisTaskCorrectionsUE *taskCorrectionsUE = 0; | |
932 | if(iPWG4CorrectionsUE&1)taskCorrectionsUE = AddTaskCorrectionsUE("jetsAOD_NONE","CDF","MP_eta05","TRANSV","MSP",kFALSE); | |
933 | if (!taskCorrectionsUE) ::Warning("AnalysisTrainPWG4Jets", "AliAnalysisTaskCorrectionsUE cannot run for this train conditions - EXCLUDED"); | |
934 | } | |
935 | ||
936 | if(iPWG4ThreeJets){ | |
937 | gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskThreeJets.C"); | |
938 | AliAnalysisTaskThreeJets *taskThree = AddTaskThreeJets(); | |
939 | if(!taskThree)::Warning("AnalysisTrainPWG4Jets", "AliAnalysisTaskThreets cannot run for this train conditions - EXCLUDED"); | |
940 | } | |
941 | if(iPWG4QGSep){ | |
942 | gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskQGSep.C"); | |
943 | AliAnalysisTaskQGSep *taskQGSep = AddTaskQGSep(kUseMC,iAODanalysis); | |
944 | if(!taskQGSep)::Warning("AnalysisTrainPWG4Jets", "AliAnalysisTaskQGSep cannot run for this train conditions - EXCLUDED"); | |
945 | } | |
946 | ||
947 | ||
948 | if(iPWG4Minijet){ | |
949 | gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskMinijet.C"); | |
950 | AliAnalysisTaskMinijet *taskMini = AddTaskMinijet(-1,"esd",kUseMC,kGridDataSet); | |
951 | // if we ha highmult trigger add another task | |
952 | if(!taskMini)::Warning("AnalysisTrainPWG4Jets", "AliAnalysisTaskMinjet cannot run for this train conditions - EXCLUDED"); | |
953 | } | |
954 | ||
955 | ||
956 | if(iPWG4PtQAMC){ | |
957 | gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskPWG4HighPtQAMC.C"); | |
958 | AliPWG4HighPtQAMC *taskQAMC = 0; | |
959 | if(kUseMC){ | |
960 | if(iPWG4PtQAMC&1){ | |
961 | taskQAMC = AddTaskPWG4HighPtQAMC(kGridDataSet.Data(),0); | |
962 | taskQAMC = AddTaskPWG4HighPtQAMC(kGridDataSet.Data(),1); | |
963 | taskQAMC = AddTaskPWG4HighPtQAMC(kGridDataSet.Data(),2); | |
964 | taskQAMC = AddTaskPWG4HighPtQAMC(kGridDataSet.Data(),3); | |
965 | } | |
966 | } | |
967 | if (!taskQAMC) ::Warning("AnalysisTrainPWG4Jets", "AliAnalysisTaskQAMC cannot run for this train conditions - EXCLUDED"); | |
968 | } | |
969 | ||
970 | if(iPWG4PtTrackQA){ | |
971 | gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskPWG4HighPtTrackQA.C"); | |
972 | ||
973 | AddTaskPWG4HighPtTrackQAAll(kGridDataSet.Data(),kIsPbPb,iAODanalysis); | |
974 | ||
975 | } | |
976 | ||
977 | if(iPWG4PtQATPC){ | |
978 | gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskPWG4HighPtQATPConly.C"); | |
979 | AliPWG4HighPtQATPConly *taskQATPC = 0; | |
980 | if(iPWG4PtQATPC&1)taskQATPC = AddTaskPWG4HighPtQATPConly(kGridDataSet.Data(),1); | |
981 | if(iPWG4PtQATPC&2)taskQATPC = AddTaskPWG4HighPtQATPConly(kGridDataSet.Data(),2); | |
982 | ||
983 | if (!taskQATPC) ::Warning("AnalysisTrainPWG4Jets", "AliAnalysisTaskQATPC cannot run for this train conditions - EXCLUDED"); | |
984 | } | |
985 | ||
986 | if(iPWG4Cosmics){ | |
987 | gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskPWG4CosmicCandidates.C"); | |
988 | ||
989 | AliPWG4CosmicCandidates *taskPWG4CosmicCandidates = AddTaskPWG4CosmicCandidates(0); | |
990 | taskPWG4CosmicCandidates = AddTaskPWG4CosmicCandidates(1); | |
991 | ||
992 | if (!taskPWG4CosmicCandidates) ::Warning("AnalysisTrainPWG4Jets", "AddTaskPWG4CosmicCandidates cannot run for this train conditions - EXCLUDED"); | |
993 | } | |
994 | ||
995 | ||
996 | if(iPWG4PtSpectra){ | |
997 | gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskPWG4HighPtSpectra.C"); | |
998 | AddTaskPWG4HighPtSpectraAll(kGridDataSet.Data(),kIsPbPb); | |
999 | } | |
1000 | ||
1001 | if(iPWG4KMeans){ | |
1002 | gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskKMeans.C"); | |
1003 | AliAnalysisTaskKMeans *taskKMeans = AddTaskKMeans(); | |
1004 | if (!taskKMeans) ::Warning("AnalysisTrainPWG4Jets", "AliAnalysisTaskKMenans cannot run for this train conditions - EXCLUDED"); | |
1005 | } | |
1006 | ||
1007 | if(iPWG4PartCorr){ | |
1008 | gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskPartCorr.C"); | |
1009 | AliAnalysisTaskParticleCorrelation *taskpartcorrPHOS = AddTaskPartCorr("AOD", "PHOS",kFALSE,kIsMC); | |
1010 | if (!taskpartcorrPHOS) ::Warning("AnalysisTrainNew", "AliAnalysisTaskParticleCorrelation PHOS cannot run for this train conditions - EXCLUDED"); | |
1011 | AliAnalysisTaskParticleCorrelation *taskpartcorrEMCAL = AddTaskPartCorr("AOD", "EMCAL",kFALSE,kIsMC); | |
1012 | if (!taskpartcorrEMCAL) ::Warning("AnalysisTrainNew", "AliAnalysisTaskParticleCorrelation EMCAL cannot run for this train conditions - EXCLUDED"); | |
1013 | if(kDeltaAODPartCorrName.Length()>0)mgr->RegisterExtraFile(kDeltaAODPartCorrName.Data()); | |
1014 | } | |
1015 | ||
1016 | if(iPWG4CaloQA){ | |
1017 | gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/QA/AddTaskCalorimeterQA.C"); | |
1018 | AliAnalysisTaskParticleCorrelation *taskcaloQA = AddTaskCalorimeterQA("ESD",kFALSE,kIsMC,kCaloQAOutputFileName.Data()); | |
1019 | if(!taskcaloQA)::Warning("AnalysisTrainNew", "AliAnalysisTaskParticleCorrelation QA cannot run - EXCLUDED"); | |
1020 | // if(kCaloQAOutputFileName.Length()>0)mgr->RegisterExtraFile(kCaloQAOutputFileName.Data()); | |
1021 | } | |
1022 | ||
1023 | if(iPWG4JetCorr){ | |
1024 | // using namespace JetCorrelHD; | |
1025 | TString cdir = gSystem->WorkingDirectory(); | |
1026 | gSystem->ChangeDirectory(gSystem->ExpandPathName("$ALICE_ROOT/PWG4/macros/")); | |
1027 | gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskJetCorrel.C"); | |
1028 | AliAnalysisTaskJetCorrel *taskjetcorr = AddTaskJetCorrel(); | |
1029 | gSystem->ChangeDirectory(cdir); | |
1030 | if (!taskjetcorr) ::Warning("AnalysisTrainNew", "AliAnalysisTaskJetCorrel cannot run for this train conditions - EXCLUDED"); | |
1031 | } | |
1032 | ||
1033 | if(iPWG4Tagged){ | |
1034 | gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskTaggedPhotons.C"); | |
1035 | AliAnalysisTaskTaggedPhotons * taskTagged = AddTaskTaggedPhotons(kFALSE); // EMCAL | |
1036 | taskTagged = AddTaskTaggedPhotons(kTRUE); // PHOS | |
1037 | if (!taskTagged) ::Warning("AnalysisTrainNew", "AliAnalysisTaskTaggedPhotons cannot run for this train conditions - EXCLUDED"); | |
1038 | } | |
1039 | if (iPWG4omega3pi) { | |
1040 | gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskomega3pi.C"); | |
1041 | AliAnalysisTaskOmegaPi0PiPi *taskomega3pi = AddTaskomega3pi(); | |
1042 | if (!taskomega3pi) ::Warning("AnalysisTrainNew", "AliAnalysisTaskomega3pi cannot run\ | |
1043 | for these train conditions - EXCLUDED"); | |
1044 | } | |
1045 | ||
1046 | // PWG4 gamma conversion analysis | |
1047 | if (iPWG4GammaConv) { | |
1048 | gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskGammaConversion.C"); | |
1049 | TString cdir = gSystem->WorkingDirectory(); | |
1050 | gSystem->ChangeDirectory(gSystem->ExpandPathName("$ALICE_ROOT/PWG4/macros/")); | |
1051 | // TString gcArguments = "-run-on-train -run-jet -run-chic -run-neutralmeson -run-cf"; | |
1052 | // TString gcArguments = "-run-on-train -run-jet -run-neutralmeson -run-cf -use-own-xyz"; | |
1053 | // TString gcArguments = "-run-on-train -run-jet -run-neutralmeson -run-cf -use-own-xyz"; | |
1054 | TString gcArguments = "-run-on-train -run-jet -run-omega-meson -use-own-xyz -run-neutralmeson -no-aod"; | |
1055 | // TString kGCAnalysisCutSelectionId="9003562000100310"; | |
1056 | // TString kGCAnalysisCutSelectionId="9003562000100312"; | |
1057 | // gcArguments.Append(Form(" -set-cut-selection %s ",kGCAnalysisCutSelectionId.Data())); | |
1058 | if(!kIsMC)gcArguments += " -mc-off"; | |
1059 | AliAnalysisTaskGammaConversion * taskGammaConversion = AddTaskGammaConversion(gcArguments,mgr->GetCommonInputContainer()); | |
1060 | gSystem->ChangeDirectory(cdir); | |
1061 | taskGammaConversion->SelectCollisionCandidates(); | |
1062 | if (!taskGammaConversion) ::Warning("AnalysisTrainNew", "AliAnalysisTaskGammaConversion cannot run for these train conditions - EXCLUDED"); | |
1063 | } | |
1064 | ||
1065 | if (iPWG4CaloConv) { | |
1066 | gROOT->LoadMacro("$ALICE_ROOT/PWG4/macros/AddTaskCaloConv.C"); | |
1067 | AliAnalysisTaskCaloConv * taskCaloConv = AddTaskCaloConv(); | |
1068 | if (!taskCaloConv) ::Warning("AnalysisTrainNew", "AliAnalysisTaskCaloConv cannot run for these train conditions - EXCLUDED"); | |
1069 | } | |
1070 | ||
1071 | ||
1072 | ||
1073 | //========================================================================== | |
1074 | // FOR THE REST OF THE TASKS THE MACRO AddTaskXXX() is not yet implemented/ | |
1075 | // Run the analysis | |
1076 | // | |
1077 | if (kPluginUse) { | |
1078 | AliAnalysisGrid *alienHandler = CreateAlienHandler(plugin_mode); | |
1079 | AliAnalysisManager::GetAnalysisManager()->SetGridHandler(alienHandler); | |
1080 | } | |
1081 | ||
1082 | if (mgr->InitAnalysis()) { | |
1083 | mgr->PrintStatus(); | |
1084 | // if (kSaveTrain || strlen(config_file)) gSystem->ChangeDirectory(kTrainName); | |
1085 | if (!strcmp(plugin_mode,"submit")&&smode=="GRID"){ | |
1086 | TString alien_workdir = gGrid->GetHomeDirectory(); | |
1087 | if (iAODanalysis) alien_workdir += "analysisAOD"; | |
1088 | else alien_workdir += "analysisESD"; | |
1089 | if(kGridDataSet.Length()>0)alien_workdir += Form("/%s",kGridDataSet.Data()); | |
1090 | AliAnalysisAlien *gridhandler = (AliAnalysisAlien*)mgr->GetGridHandler(); | |
1091 | printf("=== AnalysisTrainPWG4Jets:: Registering jdl in the work directory alien://%s/%s, should be done by the manager! ===\n", | |
1092 | alien_workdir.Data(),gridhandler->GetGridOutputDir()); | |
1093 | ||
1094 | TString dest; | |
1095 | dest = Form("%s/%s/%s.jdl",alien_workdir.Data(),gridhandler->GetGridOutputDir(),kTrainName.Data()); | |
1096 | if(AliAnalysisAlien::FileExists(dest.Data())){ | |
1097 | Printf("%s exist on grid removing...",dest.Data()); | |
1098 | gGrid->Rm(dest.Data()); | |
1099 | } | |
1100 | Printf("%s copy ...",dest.Data()); | |
1101 | TFile::Cp(Form("file:%s.jdl",kTrainName.Data()),Form("alien://%s",dest.Data())); | |
1102 | ||
1103 | ||
1104 | TString dest; | |
1105 | dest = Form("%s/%s/%s_merge.jdl",alien_workdir.Data(),gridhandler->GetGridOutputDir(),kTrainName.Data()); | |
1106 | if(AliAnalysisAlien::FileExists(dest.Data())){ | |
1107 | Printf("%s exist on grid removing...",dest.Data()); | |
1108 | gGrid->Rm(dest.Data()); | |
1109 | } | |
1110 | Printf("%s copy ...",dest.Data()); | |
1111 | TFile::Cp(Form("file:%s_merge.jdl",kTrainName.Data()),Form("alien://%s",dest.Data())); | |
1112 | ||
1113 | dest = Form("%s/%s/%s_merge_final.jdl",alien_workdir.Data(),gridhandler->GetGridOutputDir(),kTrainName.Data()); | |
1114 | if(AliAnalysisAlien::FileExists(dest.Data())){ | |
1115 | Printf("%s exist on grid removing...",dest.Data()); | |
1116 | gGrid->Rm(dest.Data()); | |
1117 | } | |
1118 | Printf("%s copy ...",dest.Data()); | |
1119 | TFile::Cp(Form("file:%s_merge.jdl",kTrainName.Data()),Form("alien://%s",dest.Data())); | |
1120 | ||
1121 | ||
1122 | /* | |
1123 | dest = Form("%s/rootfiles/STEER/LQ1dRef_v1.root",gGrid->GetHomeDirectory()); | |
1124 | if(AliAnalysisAlien::FileExists(dest.Data())){ | |
1125 | Printf("%s exist on grid removing...",dest.Data()); | |
1126 | gGrid->Rm(dest.Data()); | |
1127 | } | |
1128 | TFile::Cp(Form("file:%s/STEER/LQ1dRef_v1.root", | |
1129 | gSystem->ExpandPathName("$ALICE_ROOT")),Form("alien://%s",dest.Data())); | |
1130 | */ | |
1131 | } | |
1132 | AliLog::SetGlobalLogLevel(AliLog::kError); | |
1133 | if((kUseSysInfo>0&&smode=="LOCAL")||!strcmp(plugin_mode, "test")){ | |
1134 | TFile * fM = TFile::Open("manager_local.root","RECREATE"); | |
1135 | mgr->Write(); | |
1136 | fM->Close(); | |
1137 | } | |
1138 | ||
1139 | // grmpf, aliroot error handler overwrites root | |
1140 | gErrorIgnoreLevel = kErrorIgnoreLevel; | |
1141 | if(gErrorIgnoreLevel>3000) AliLog::SetGlobalLogLevel(AliLog::kFatal); | |
1142 | StartAnalysis(smode, chain); | |
1143 | if((kUseSysInfo>0&&smode=="LOCAL")||!strcmp(plugin_mode, "test")){ | |
1144 | for(int i = 0;i < mgr->GetTopTasks()->GetEntries();i++){ | |
1145 | mgr->ProfileTask(i); | |
1146 | } | |
1147 | } | |
1148 | if (!strcmp(plugin_mode, "offline")&&smode=="GRID"){ | |
1149 | // Offline mode path files | |
1150 | // PatchJDL(); | |
1151 | // PatchAnalysisMacro(); | |
1152 | } | |
1153 | ||
1154 | if (kSaveTrain && smode=="GRID") { | |
1155 | AliAnalysisAlien *gridhandler = (AliAnalysisAlien*)mgr->GetGridHandler(); | |
1156 | TString alien_workdir = gGrid->GetHomeDirectory(); | |
1157 | if (iAODanalysis) alien_workdir += "analysisAOD"; | |
1158 | else alien_workdir += "analysisESD"; | |
1159 | if(kGridDataSet.Length()>0)alien_workdir += Form("/%s",kGridDataSet.Data()); | |
1160 | // kGridOutdir = gridhandler->GetGridOutputDir(); | |
1161 | printf("=== Registering ConfigTrain.C in the work directory <%s> ===\n", | |
1162 | alien_workdir.Data()); | |
1163 | if (AliAnalysisAlien::FileExists(Form("%s/%sConfig.C", alien_workdir.Data(), kTrainName.Data()))) | |
1164 | gGrid->Rm(Form("%s/%sConfig.C", alien_workdir.Data(), kTrainName.Data())); | |
1165 | if (strcmp(plugin_mode, "test")) | |
1166 | TFile::Cp(Form("file:%sConfig.C",kTrainName.Data()), Form("alien://%s/%sConfig.C", alien_workdir.Data(), kTrainName.Data())); | |
1167 | } | |
1168 | } | |
1169 | } | |
1170 | ||
1171 | //______________________________________________________________________________ | |
1172 | void StartAnalysis(const char *mode, TChain *chain) { | |
1173 | // Start analysis. | |
1174 | Int_t imode = -1; | |
1175 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
1176 | if (!strcmp(mode, "LOCAL")) imode = 0; | |
1177 | if (!strcmp(mode, "PROOF")) imode = 1; | |
1178 | if (!strcmp(mode, "GRID")) imode = 2; | |
1179 | switch (imode) { | |
1180 | case 0: | |
1181 | if (!chain) { | |
1182 | ::Error("AnalysisTrainPWG4Jets.C::StartAnalysis", "Cannot create the chain"); | |
1183 | return; | |
1184 | } | |
1185 | mgr->StartAnalysis(mode, chain,kNumberOfEvents); | |
1186 | return; | |
1187 | case 1: | |
1188 | if (!kProofDataSet.Length()) { | |
1189 | ::Error("AnalysisTrainPWG4Jets.C::StartAnalysis", "kProofDataSet is empty"); | |
1190 | return; | |
1191 | } | |
1192 | mgr->StartAnalysis(mode, kProofDataSet, kProofEvents,kProofOffset); | |
1193 | return; | |
1194 | case 2: | |
1195 | if (kPluginUse) { | |
1196 | if (!mgr->GetGridHandler()) { | |
1197 | ::Error("AnalysisTrainPWG4Jets.C::StartAnalysis", "Grid plugin not initialized"); | |
1198 | return; | |
1199 | } | |
1200 | mgr->StartAnalysis("grid",chain,kNumberOfEvents); | |
1201 | } else { | |
1202 | if (!chain) { | |
1203 | ::Error("AnalysisTrainPWG4Jets.C::StartAnalysis", "Cannot create the chain"); | |
1204 | return; | |
1205 | } | |
1206 | mgr->StartAnalysis(mode, chain); | |
1207 | mgr->StartAnalysis(mode, chain,kNumberOfEvents); | |
1208 | } | |
1209 | return; | |
1210 | } | |
1211 | } | |
1212 | ||
1213 | //______________________________________________________________________________ | |
1214 | void CheckModuleFlags(const char *mode) { | |
1215 | // Checks selected modules and insure compatibility | |
1216 | Int_t imode = -1; | |
1217 | if (!strcmp(mode, "LOCAL")) imode = 0; | |
1218 | if (!strcmp(mode, "PROOF")) imode = 1; | |
1219 | if (!strcmp(mode, "GRID")) imode = 2; | |
1220 | ||
1221 | ||
1222 | if (kUseCPAR) { | |
1223 | kPluginAliRootVersion = ""; // NO aliroot if we use CPAR | |
1224 | } | |
1225 | ||
1226 | if (imode==1) { | |
1227 | if (!kUsePAR) { | |
1228 | ::Info("AnalysisTrainPWG4Jets.C::CheckModuleFlags", "PAR files enabled due to PROOF analysis"); | |
1229 | kUsePAR = kTRUE; | |
1230 | } | |
1231 | } | |
1232 | if (imode != 2) { | |
1233 | ::Info("AnalysisTrainPWG4Jets.C::CheckModuleFlags", "AliEn plugin disabled since not in GRID mode"); | |
1234 | kPluginUse = kFALSE; | |
1235 | } | |
1236 | ||
1237 | ||
1238 | if(!kIsMC){ | |
1239 | // switch off anthin related to MC | |
1240 | kUseMC = 0; | |
1241 | kUseAODMC = 0; | |
1242 | kUseTR = kFALSE; | |
1243 | } | |
1244 | ||
1245 | // Decide if we have PbPb | |
1246 | if(kGridDataSet.CompareTo("LHC10h")==0||kGridDataSet.Contains("LHC10h")) { | |
1247 | Printf("Using settings for Pb+Pb"); | |
1248 | kIsPbPb = true; | |
1249 | } | |
1250 | ||
1251 | ||
1252 | ||
1253 | if (iAODanalysis) { | |
1254 | // AOD analysis | |
1255 | if (kUseMC) | |
1256 | ::Info("AnalysisTrainPWG4Jets.C::CheckModuleFlags", "MC usage disabled in analysis on AOD's"); | |
1257 | if (kUseAODTags) | |
1258 | ::Info("AnalysisTrainPWG4Jets.C::CheckModuleFlags", "AOD tags usage disabled in analysis on AOD's"); | |
1259 | kUseMC = kFALSE; | |
1260 | kUseTR = kFALSE; | |
1261 | kUseAODTags = kFALSE; | |
1262 | if (iESDfilter) | |
1263 | ::Info("AnalysisTrainPWG4Jets.C::CheckModuleFlags", "ESD filter disabled in analysis on AOD's"); | |
1264 | iESDfilter = 0; | |
1265 | if (iPhysicsSelection) | |
1266 | ::Info("AnalysisTrainPWG4Jets.C::CheckModuleFlags", "Physics Selection disabled in analysis on AOD's"); | |
1267 | iPhysicsSelection = 0; | |
1268 | if (!iAODhandler) { | |
1269 | if (iJETAN) | |
1270 | ::Info("AnalysisTrainPWG4Jets.C::CheckModuleFlags", "JETAN disabled in analysis on AOD's without AOD handler"); | |
1271 | iJETAN = 0; | |
1272 | iDIJETAN = 0; | |
1273 | } | |
1274 | // Disable tasks that do not work yet on AOD data | |
1275 | if(iPWG4JCORRAN)::Info("AnalysisTrainPWG4Jets.C::CheckModuleFlags", "PWG4 JCORRAN disabled in analysis on AOD's"); | |
1276 | iPWG4JCORRAN = 0; | |
1277 | if( iPWG4PtQAMC)::Info("AnalysisTrainPWG4Jets.C::CheckModuleFlags", "PWG4 PtQAMC disabled in analysis on AOD's"); | |
1278 | iPWG4PtQAMC = 0; | |
1279 | if( iPWG4PtQATPC)::Info("AnalysisTrainPWG4Jets.C::CheckModuleFlags", "PWG4 PtTPC disabled in analysis on AOD's"); | |
1280 | iPWG4PtQATPC = 0; | |
1281 | if( iPWG4Cosmics)::Info("AnalysisTrainPWG4Jets.C::CheckModuleFlags", "PWG4 Comics disabled in analysis on AOD's"); | |
1282 | iPWG4Cosmics = 0; | |
1283 | ||
1284 | if( iPWG4PtSpectra)::Info("AnalysisTrainPWG4Jets.C::CheckModuleFlags", "PWG4 PtQAMC disabled in analysis on AOD's"); | |
1285 | iPWG4PtSpectra = 0; | |
1286 | if(iPWG4KMeans)::Info("AnalysisTrainPWG4Jets.C::CheckModuleFlags", "PWG4KMeans disabled on AOD's"); | |
1287 | iPWG4KMeans = 0; | |
1288 | if (iPWG4JetCorr)::Info("AnalysisTrainPWG4Jets.C::CheckModuleFlags", "PWG4Jetcorr disabled on AOD's"); | |
1289 | iPWG4JetCorr = 0; | |
1290 | if (iPWG4PartCorr)::Info("AnalysisTrainPWG4Jets.C::CheckModuleFlags", "PWG4partcorr disabled on AOD's"); | |
1291 | iPWG4PartCorr = 0; | |
1292 | if (iPWG4CaloQA)::Info("AnalysisTrainPWG4Jets.C::CheckModuleFlags", "PWG4CaloQA disabled on AOD's"); | |
1293 | iPWG4CaloQA = 0; | |
1294 | if (iPWG4Tagged)::Info("AnalysisTrainPWG4Jets.C::CheckModuleFlags", "PWG4tagged disabled on AOD's"); | |
1295 | iPWG4Tagged = 0; | |
1296 | if (iPWG4omega3pi) | |
1297 | ::Info("AnalysisTrainNew.C::CheckModuleFlags", "PWG4omega3pi disabled on AOD's"); | |
1298 | iPWG4omega3pi = 0; | |
1299 | if(iPWG1QASym)::Info("AnalysisTrainPWG4Jets.C::CheckModuleFlags", "PWG1 QA Sym disabled in analysis on AOD's"); | |
1300 | if (iPWG4GammaConv)::Info("AnalysisPWG4Jets.C::CheckModuleFlags", "PWG4gammaconv disabled on AOD's"); | |
1301 | iPWG4GammaConv = 0; | |
1302 | iPWG1QASym = 0; | |
1303 | iCentralitySelection = 0; | |
1304 | } else { | |
1305 | // ESD analysis | |
1306 | ||
1307 | if(kIsPbPb){ | |
1308 | iCentralitySelection = 1; | |
1309 | } | |
1310 | ||
1311 | if (!kUseMC){ | |
1312 | kUseTR = kFALSE; | |
1313 | ||
1314 | if(kUseKinefilter)::Info("AnalysisTrainPWG4Jets.C::CheckModuleFlags", "PWG4 Kine Filter disabled in analysis without MC"); | |
1315 | kUseKinefilter = kFALSE; | |
1316 | if( iPWG4PtQAMC)::Info("AnalysisTrainPWG4Jets.C::CheckModuleFlags", "PWG4 PtQAMC disabled in analysis without MC"); | |
1317 | iPWG4PtQAMC = 0; | |
1318 | if( iPWG4CorrectionsUE)::Info("AnalysisTrainPWG4Jets.C::CheckModuleFlags", "PWG4 CorrectionsUE disabled in analysis without MC"); | |
1319 | iPWG4CorrectionsUE = 0; | |
1320 | } | |
1321 | if (iJETAN){ | |
1322 | iESDfilter=1; | |
1323 | } | |
1324 | if (!iESDfilter){ | |
1325 | kUseKinefilter = kFALSE; | |
1326 | kUseMuonfilter = kFALSE; | |
1327 | } | |
1328 | if(!iJETAN){ | |
1329 | iPWG4JetSpectrum = iPWG4UE = iPWG4CorrectionsUE = iPWG4ThreeJets = iPWG4QGSep = iDIJETAN = 0; | |
1330 | } | |
1331 | } | |
1332 | iPWG4JetTasks = iPWG4JetServices||iPWG4JetSpectrum||iPWG4UE||iPWG4LeadingUE||iPWG4PtQAMC||iPWG4PtTrackQA||iPWG4PtSpectra||iPWG4PtQATPC||iPWG4Cosmics||iPWG4ThreeJets||iPWG4QGSep||iPWG4JetChem||iPWG4Minijet||iPWG4Fragmentation; | |
1333 | iPWG4PartCorrLibs = iPWG4PartCorr||iPWG4Tagged||iPWG4CaloQA; | |
1334 | iPWG4GammaConvLib = iPWG4GammaConv||iPWG4CaloConv; | |
1335 | ||
1336 | ||
1337 | iEMCUtilLibs = iPWG4PartCorrLibs||iPWG4JCORRAN||iPWG4GammaConvLib||iJETAN; | |
1338 | iJETANLib = iPWG4JetTasks||iJETAN||iDIJETAN; | |
1339 | ||
1340 | if (iESDfilter) {iAODhandler=1;} | |
1341 | if (kUseKinefilter && !kUseMC) kUseKinefilter = kFALSE; | |
1342 | if (kUseAODTags && !iAODhandler) kUseAODTags = kFALSE; | |
1343 | ||
1344 | ||
1345 | ||
1346 | } | |
1347 | ||
1348 | //______________________________________________________________________________ | |
1349 | Bool_t Connect(const char *mode) { | |
1350 | // Connect <username> to the back-end system. | |
1351 | Int_t imode = -1; | |
1352 | if (!strcmp(mode, "LOCAL")) imode = 0; | |
1353 | if (!strcmp(mode, "PROOF")) imode = 1; | |
1354 | if (!strcmp(mode, "GRID")) imode = 2; | |
1355 | TString username = gSystem->Getenv("alien_API_USER"); | |
1356 | switch (imode) { | |
1357 | case 0: | |
1358 | break; | |
1359 | case 1: | |
1360 | if (!username.Length()) { | |
1361 | ::Error(Form("AnalysisTrainPWG4Jets.C::Connect <%s>", mode), "Make sure you:\n \ | |
1362 | 1. Have called: alien-token-init <username>\n \ | |
1363 | 2. Have called: >source /tmp/gclient_env_$UID"); | |
1364 | return kFALSE; | |
1365 | } | |
1366 | ::Info("AnalysisTrainPWG4Jets.C::Connect", "Connecting user <%s> to PROOF cluster <%s>", | |
1367 | username.Data(), kProofCluster.Data()); | |
1368 | gEnv->SetValue("XSec.GSI.DelegProxy", "2"); | |
1369 | // TProof::Open(Form("%s@%s:31093", username.Data(), kProofCluster.Data())); | |
1370 | TProof::Open(Form("%s@%s", username.Data(), kProofCluster.Data())); | |
1371 | if (!gProof) { | |
1372 | if (strcmp(gSystem->Getenv("XrdSecGSISRVNAMES"), "lxfsrd0506.cern.ch")) | |
1373 | ::Error(Form("AnalysisTrainPWG4Jets.C::Connect <%s>", mode), "Environment XrdSecGSISRVNAMES different from lxfsrd0506.cern.ch"); | |
1374 | return kFALSE; | |
1375 | } | |
1376 | if(kProofClearPackages)gProof->ClearPackages(); | |
1377 | ||
1378 | if(kProofSaveToAlien){ | |
1379 | TGrid::Connect("alien://"); | |
1380 | if (gGrid) { | |
1381 | TString homedir = gGrid->GetHomeDirectory(); | |
1382 | TString workdir = homedir + kTrainName; | |
1383 | if (!gGrid->Cd(workdir)) { | |
1384 | gGrid->Cd(homedir); | |
1385 | if (gGrid->Mkdir(workdir)) { | |
1386 | gGrid->Cd(kTrainName); | |
1387 | ::Info("AnalysisTrainPWG4Jets::Connect()", "Directory %s created", gGrid->Pwd()); | |
1388 | } | |
1389 | } | |
1390 | gGrid->Mkdir("proof_output"); | |
1391 | gGrid->Cd("proof_output"); | |
1392 | kProofOutdir = Form("alien://%s", gGrid->Pwd()); | |
1393 | } | |
1394 | } | |
1395 | break; | |
1396 | case 2: | |
1397 | if (!username.Length()) { | |
1398 | ::Error(Form("AnalysisTrainPWG4Jets.C::Connect <%s>", mode), "Make sure you:\n \ | |
1399 | 1. Have called: alien-token-init <username>\n \ | |
1400 | 2. Have called: >source /tmp/gclient_env_$UID"); | |
1401 | return kFALSE; | |
1402 | } | |
1403 | if (kPluginUse && !gSystem->Getenv("alien_CLOSE_SE")) { | |
1404 | ::Error(Form("AnalysisTrainPWG4Jets.C::Connect <%s>", mode), | |
1405 | "When using the AliEn plugin it is preferable to define the \ | |
1406 | variable alien_CLOSE_SE in your environment."); | |
1407 | return kFALSE; | |
1408 | } | |
1409 | ::Info("AnalysisTrainPWG4Jets.C::Connect", "Connecting user <%s> to AliEn ...", | |
1410 | username.Data()); | |
1411 | TGrid::Connect("alien://"); | |
1412 | if (!gGrid || !gGrid->IsConnected()) return kFALSE; | |
1413 | break; | |
1414 | default: | |
1415 | ::Error("AnalysisTrainPWG4Jets.C::Connect", "Unknown run mode: %s", mode); | |
1416 | return kFALSE; | |
1417 | } | |
1418 | ::Info("AnalysisTrainPWG4Jets.C::Connect","Connected in %s mode", mode); | |
1419 | return kTRUE; | |
1420 | } | |
1421 | ||
1422 | //______________________________________________________________________________ | |
1423 | Bool_t LoadCommonLibraries(const char *mode) | |
1424 | { | |
1425 | if (!gSystem->Getenv("ALICE_ROOT")) { | |
1426 | ::Error("AnalysisTrainPWG4Jets.C", "Analysis train requires that ALICE_ROOT is set to pick up Configurations"); | |
1427 | return kFALSE; | |
1428 | } | |
1429 | ||
1430 | // Load common analysis libraries. | |
1431 | Int_t imode = -1; | |
1432 | if (!strcmp(mode, "LOCAL")) imode = 0; | |
1433 | if (!strcmp(mode, "PROOF")) imode = 1; | |
1434 | if (!strcmp(mode, "GRID")) imode = 2; | |
1435 | Bool_t success = kTRUE; | |
1436 | // ROOT libraries | |
1437 | gSystem->Load("libTree.so"); | |
1438 | gSystem->Load("libGeom.so"); | |
1439 | gSystem->Load("libVMC.so"); | |
1440 | gSystem->Load("libPhysics.so"); | |
1441 | ||
1442 | // Load framework classes. Par option ignored here. | |
1443 | switch (imode) { | |
1444 | case 0: | |
1445 | case 2: | |
1446 | if (kUseCPAR) { | |
1447 | success &= LoadLibrary("STEERBase", mode, kTRUE); | |
1448 | success &= LoadLibrary("ESD", mode, kTRUE); | |
1449 | success &= LoadLibrary("AOD", mode, kTRUE); | |
1450 | success &= LoadLibrary("ANALYSIS", mode, kTRUE); | |
1451 | success &= LoadLibrary("ANALYSISalice", mode, kTRUE); | |
1452 | success &= LoadLibrary("OADB", mode, kTRUE); | |
1453 | success &= LoadLibrary("ROOTFILES", mode, kTRUE); | |
1454 | // success &= LoadLibrary("EventMixing", mode,kTRUE); | |
1455 | success &= LoadLibrary("CORRFW", mode, kTRUE); | |
1456 | } else { | |
1457 | success &= LoadLibrary("libSTEERBase.so", mode); | |
1458 | success &= LoadLibrary("libESD.so", mode); | |
1459 | success &= LoadLibrary("libAOD.so", mode); | |
1460 | success &= LoadLibrary("libANALYSIS.so", mode); | |
1461 | success &= LoadLibrary("libANALYSISalice.so", mode); | |
1462 | success &= LoadLibrary("libOADB.so", mode, kTRUE); | |
1463 | // success &= LoadLibrary("libEventMixing.so", mode); | |
1464 | success &= LoadLibrary("libCORRFW.so", mode); | |
1465 | gROOT->ProcessLine(".include $ALICE_ROOT/include"); | |
1466 | } | |
1467 | break; | |
1468 | case 1: | |
1469 | Int_t ires = -1; | |
1470 | if (kProofUseAFPAR && !gSystem->AccessPathName(kProofAFversion)) ires = gProof->UploadPackage(kProofAFversion); | |
1471 | if (ires < 0) { | |
1472 | success &= LoadLibrary("STEERBase", mode); | |
1473 | success &= LoadLibrary("ESD", mode); | |
1474 | success &= LoadLibrary("AOD", mode); | |
1475 | success &= LoadLibrary("ANALYSIS", mode); | |
1476 | success &= LoadLibrary("ANALYSISalice", mode); | |
1477 | success &= LoadLibrary("EventMixing", mode); | |
1478 | success &= LoadLibrary("CORRFW", mode); | |
1479 | } else { | |
1480 | ires = gProof->EnablePackage(kProofAFversion); | |
1481 | if (ires<0) success = kFALSE; | |
1482 | success &= LoadLibrary("CORRFW", mode); | |
1483 | } | |
1484 | break; | |
1485 | default: | |
1486 | ::Error("AnalysisTrainPWG4Jets.C::LoadCommonLibraries", "Unknown run mode: %s", mode); | |
1487 | return kFALSE; | |
1488 | } | |
1489 | if (success) { | |
1490 | ::Info("AnalysisTrainPWG4Jets.C::LoadCommodLibraries", "Load common libraries: SUCCESS"); | |
1491 | ::Info("AnalysisTrainPWG4Jets.C::LoadCommodLibraries", "Include path for Aclic compilation:\n%s", | |
1492 | gSystem->GetIncludePath()); | |
1493 | } else { | |
1494 | ::Info("AnalysisTrainPWG4Jets.C::LoadCommodLibraries", "Load common libraries: FAILED"); | |
1495 | } | |
1496 | ||
1497 | return success; | |
1498 | } | |
1499 | ||
1500 | //______________________________________________________________________________ | |
1501 | Bool_t LoadAnalysisLibraries(const char *mode) | |
1502 | { | |
1503 | // Load common analysis libraries. | |
1504 | Bool_t success = kTRUE; | |
1505 | if (useTender) { | |
1506 | if (!LoadLibrary("TENDER", mode, kTRUE) || | |
1507 | !LoadLibrary("TENDERSupplies", mode, kTRUE)) return kFALSE; | |
1508 | } | |
1509 | if (iESDfilter) { | |
1510 | /* | |
1511 | if (!LoadLibrary("PWG3base", mode, kTRUE) || | |
1512 | !LoadLibrary("PWG3muon", mode, kTRUE)) return kFALSE; | |
1513 | */ | |
1514 | } | |
1515 | // JETAN | |
1516 | if (iJETANLib) { | |
1517 | // this part needs some rework in case we do not need the fastjed finders for processing | |
1518 | if(iEMCUtilLibs){ | |
1519 | if (!LoadLibrary("EMCALUtils", mode, kTRUE) || | |
1520 | !LoadLibrary("PHOSUtils", mode, kTRUE)) return kFALSE; | |
1521 | } | |
1522 | if (!LoadLibrary("JETAN", mode, kTRUE)) return kFALSE; | |
1523 | if (!strcmp(mode, "PROOF")){ | |
1524 | gProof->Exec("gSystem->Load\(\"/afs/cern.ch/user/d/dperrino/public/libCGAL.so\"\)", kTRUE); | |
1525 | gProof->Exec("gSystem->Load\(\"/afs/cern.ch/user/d/dperrino/public/libfastjet.so\"\)", kTRUE); | |
1526 | // problem when loading siscone copiled with different gcc version?? | |
1527 | // gProof->Exec("gSystem->Load\(\"/afs/cern.ch/user/d/dperrino/public/libsiscone.so\"\)", kTRUE); | |
1528 | gProof->Exec("gSystem->Load\(\"/afs/cern.ch/user/d/dperrino/public/libSISConePlugin.so\"\)", kTRUE); | |
1529 | } | |
1530 | if(!kUsePAR){ | |
1531 | if (!LoadLibrary("CGAL", mode, kTRUE)) return kFALSE; | |
1532 | if (!LoadLibrary("fastjet", mode, kTRUE)) return kFALSE; | |
1533 | if (!LoadLibrary("siscone", mode, kTRUE)) return kFALSE; | |
1534 | if (!LoadLibrary("SISConePlugin", mode, kTRUE)) return kFALSE; | |
1535 | } | |
1536 | else{ | |
1537 | // par files plus FASTJET needs some extra work... need to change | |
1538 | // the loading sequence in the auto generated .C file | |
1539 | if (!LoadLibrary("libCGAL.so", mode, kTRUE)) return kFALSE; | |
1540 | if (!LoadLibrary("libfastjet.so", mode, kTRUE)) return kFALSE; | |
1541 | if (!LoadLibrary("libsiscone.so", mode, kTRUE)) return kFALSE; | |
1542 | if (!LoadLibrary("libSISConePlugin.so", mode, kTRUE)) return kFALSE; | |
1543 | } | |
1544 | if (!LoadLibrary("FASTJETAN", mode, kTRUE)) return kFALSE; | |
1545 | } | |
1546 | if(iPWG4JetTasks){ | |
1547 | if (!LoadLibrary("PWG4JetTasks", mode, kTRUE)) return kFALSE; | |
1548 | } | |
1549 | ||
1550 | if(iPWG1QASym){ | |
1551 | if (!LoadSource(Form("%s/PWG1/AliAnalysisTaskQASym.cxx",gSystem->ExpandPathName("$ALICE_ROOT")), mode, kTRUE))return kFALSE; | |
1552 | } | |
1553 | if(iPWG4TmpSourceSara){ | |
1554 | if(!kUsePAR)gSystem->AddIncludePath("-I$ALICE_ROOT/include/JetTasks"); // ugly hack!! | |
1555 | if(!LoadSource(Form("%s/PWG4/JetTasks/AliAnalysisTaskEta.cxx",gSystem->ExpandPathName("$ALICE_ROOT")), mode, kTRUE))return kFALSE; | |
1556 | } | |
1557 | ||
1558 | if (iPWG4PartCorrLibs) { | |
1559 | if (!LoadLibrary("PWG4PartCorrBase", mode, kTRUE) || | |
1560 | !LoadLibrary("PWG4PartCorrDep", mode, kTRUE)) return kFALSE; | |
1561 | } | |
1562 | if(iPWG4JCORRAN){ | |
1563 | // PWG4 particle correlations | |
1564 | if(!LoadLibrary("PWG4JCORRAN",mode,kTRUE))return kFALSE; | |
1565 | } | |
1566 | if (iPWG4JetCorr) { | |
1567 | if (!LoadLibrary("PWG4JetCorrel", mode, kTRUE)) return kFALSE; | |
1568 | } | |
1569 | if (iPWG4omega3pi) { | |
1570 | if (!LoadLibrary("PWG4omega3pi", mode, kTRUE)) return kFALSE; | |
1571 | } | |
1572 | if (iPWG4GammaConvLib) { | |
1573 | if (!LoadLibrary("PWG4GammaConv", mode, kTRUE)) return kFALSE; | |
1574 | } | |
1575 | ||
1576 | ::Info("AnalysisTrainPWG4Jets.C::LoadAnalysisLibraries", "Load other libraries: SUCCESS"); | |
1577 | return kTRUE; | |
1578 | } | |
1579 | ||
1580 | //______________________________________________________________________________ | |
1581 | Bool_t LoadLibrary(const char *module, const char *mode, Bool_t rec=kFALSE) | |
1582 | { | |
1583 | // Load a module library in a given mode. Reports success. | |
1584 | Int_t imode = -1; | |
1585 | Int_t result; | |
1586 | TString smodule(module); | |
1587 | if (!strcmp(mode, "LOCAL")) imode = 0; | |
1588 | if (!strcmp(mode, "PROOF")) imode = 1; | |
1589 | if (!strcmp(mode, "GRID")) imode = 2; | |
1590 | TString mod(module); | |
1591 | if (!mod.Length()) { | |
1592 | ::Error("AnalysisTrainPWG4Jets.C::LoadLibrary", "Empty module name"); | |
1593 | return kFALSE; | |
1594 | } | |
1595 | // If a library is specified, just load it | |
1596 | if (smodule.EndsWith(".so")) { | |
1597 | mod.Remove(mod.Index(".so")); | |
1598 | result = gSystem->Load(mod); | |
1599 | if (result < 0) { | |
1600 | ::Error("AnalysisTrainPWG4Jets.C::LoadLibrary", "Could not load library %s", module); | |
1601 | return kFALSE; | |
1602 | } | |
1603 | if (rec) anaLibs += Form("%s.so ",mod.Data()); | |
1604 | if (rec) anaLibsExtra += Form("%s.so ",mod.Data()); | |
1605 | return kTRUE; | |
1606 | } | |
1607 | // Check if the library is already loaded | |
1608 | if (strlen(gSystem->GetLibraries(Form("%s.so", module), "", kFALSE)) > 0) | |
1609 | return kTRUE; | |
1610 | switch (imode) { | |
1611 | case 0: | |
1612 | case 2: | |
1613 | if (kUsePAR) { | |
1614 | result = SetupPar(module); | |
1615 | if (rec) anaPars += Form("%s.par ", module); | |
1616 | } else { | |
1617 | result = gSystem->Load(Form("lib%s.so", module)); | |
1618 | if (rec) anaLibs += Form("lib%s.so ", module); | |
1619 | } | |
1620 | break; | |
1621 | case 1: | |
1622 | if(!gSystem->AccessPathName(module)){ | |
1623 | ::Info("AnalysisTrainPWG4Jets.C::LoadLibrary", "Removing directory %s",module); | |
1624 | gSystem->Exec(Form("rm -rf %s",module)); | |
1625 | } | |
1626 | result = gProof->UploadPackage(module); | |
1627 | if (result<0) { | |
1628 | result = gProof->UploadPackage(gSystem->ExpandPathName(Form("$ALICE_ROOT/%s.par", module))); | |
1629 | if (result<0) { | |
1630 | ::Error("AnalysisTrainPWG4Jets.C::LoadLibrary", "Could not find module %s.par in current directory nor in $ALICE_ROOT", module); | |
1631 | return kFALSE; | |
1632 | } | |
1633 | } | |
1634 | result = gProof->EnablePackage(module); | |
1635 | break; | |
1636 | default: | |
1637 | return kFALSE; | |
1638 | } | |
1639 | if (result < 0) { | |
1640 | ::Error("AnalysisTrainPWG4Jets.C::LoadLibrary", "Could not load module %s", module); | |
1641 | return kFALSE; | |
1642 | } | |
1643 | return kTRUE; | |
1644 | } | |
1645 | ||
1646 | ||
1647 | ||
1648 | //______________________________________________________________________________ | |
1649 | Bool_t LoadSource(const char *source, const char *mode, Bool_t rec=kFALSE) | |
1650 | { | |
1651 | // Load a module library in a given mode. Reports success. | |
1652 | Int_t imode = -1; | |
1653 | Int_t result = -1; | |
1654 | if (!strcmp(mode, "LOCAL")) imode = 0; | |
1655 | if (!strcmp(mode, "PROOF")) imode = 1; | |
1656 | if (!strcmp(mode, "GRID")) imode = 2; | |
1657 | TString ssource(source); | |
1658 | TString basename = gSystem->BaseName(ssource.Data()); | |
1659 | if (!ssource.Length()) { | |
1660 | ::Error("AnalysisTrainPWG4Jets.C::LoadSource", "Empty task name"); | |
1661 | return kFALSE; | |
1662 | } | |
1663 | // we have a source code so compile it | |
1664 | if (ssource.EndsWith(".cxx")) { | |
1665 | // need to copy it here other wise the path is also used on grid... | |
1666 | ssource.Remove(ssource.Index(".cxx")); | |
1667 | basename.Remove(basename.Index(".cxx")); | |
1668 | Printf("LoadSources:: Copying... path %s{cxx,h}",ssource.Data()); | |
1669 | gSystem->Exec(Form("cp %s.cxx . ",ssource.Data())); | |
1670 | gSystem->Exec(Form("cp %s.h . ",ssource.Data())); | |
1671 | // Path to code | |
1672 | // only needed for local compilation, in grid and proof mode | |
1673 | // the task headers are uploaded | |
1674 | // path.Remove(path.Index(gSystem->BaseName(path.Data()))); | |
1675 | // Printf("LoadSources:: Including path %s",path.Data()); | |
1676 | // if(path.Length()>0)gROOT->ProcessLine(Form(".include %s",path.Data())); | |
1677 | Printf("LoadSources:: Loading... path %s",basename.Data()); | |
1678 | switch (imode) { | |
1679 | case 0: | |
1680 | result = gROOT->LoadMacro(Form("%s.cxx++g",basename.Data())); | |
1681 | break; | |
1682 | case 1: | |
1683 | result = gProof->LoadMacro(Form("%s.cxx++g",basename.Data())); | |
1684 | break; | |
1685 | case 2: | |
1686 | result = gROOT->LoadMacro(Form("%s.cxx++g",basename.Data())); | |
1687 | if (rec){ | |
1688 | // what we want to compile | |
1689 | anaSources += Form("%s.cxx ",basename.Data()); | |
1690 | // what we need as input... | |
1691 | anaLibs += Form("%s.cxx %s.h ",basename.Data(),basename.Data()); | |
1692 | } | |
1693 | break; | |
1694 | default: | |
1695 | return kFALSE; | |
1696 | } | |
1697 | } | |
1698 | if (result < 0) { | |
1699 | ::Error("AnalysisTrainPWG4Jets.C::LoadSources", "Could not load source %s", source); | |
1700 | return kFALSE; | |
1701 | } | |
1702 | return kTRUE; | |
1703 | } | |
1704 | ||
1705 | ||
1706 | //______________________________________________________________________________ | |
1707 | TChain *CreateChain(const char *mode, const char *plugin_mode) | |
1708 | { | |
1709 | // Create the input chain | |
1710 | Int_t imode = -1; | |
1711 | if (!strcmp(mode, "LOCAL")) imode = 0; | |
1712 | if (!strcmp(mode, "PROOF")) imode = 1; | |
1713 | if (!strcmp(mode, "GRID")) imode = 2; | |
1714 | TChain *chain = NULL; | |
1715 | // Local chain | |
1716 | switch (imode) { | |
1717 | case 0: | |
1718 | if (iAODanalysis) { | |
1719 | if (!kLocalXMLDataset.Length()) { | |
1720 | // Local AOD | |
1721 | chain = new TChain("aodTree"); | |
1722 | TString line; | |
1723 | ifstream in; | |
1724 | in.open(kLocalDataList.Data()); | |
1725 | Int_t ic = 0; | |
1726 | while (in.good()) { | |
1727 | in >> line; | |
1728 | if (line.Length() == 0) continue; | |
1729 | Printf("%d adding %s",ic,line.Data()); | |
1730 | chain->Add(line.Data()); | |
1731 | ic++; | |
1732 | } | |
1733 | } else { | |
1734 | // Interactive AOD | |
1735 | chain = CreateChainSingle(kLocalXMLDataset, "aodTree"); | |
1736 | } | |
1737 | } else { | |
1738 | if (!kLocalXMLDataset.Length()) { | |
1739 | // Local ESD | |
1740 | chain = new TChain("esdTree"); | |
1741 | TString line; | |
1742 | ifstream in; | |
1743 | in.open(kLocalDataList.Data()); | |
1744 | while (in.good()) { | |
1745 | in >> line; | |
1746 | if (line.Length() == 0) continue; | |
1747 | cout << " line = " << line << endl; | |
1748 | chain->Add(line.Data()); | |
1749 | } | |
1750 | } else { | |
1751 | // Interactive ESD | |
1752 | chain = CreateChainSingle(kLocalXMLDataset, "esdTree"); | |
1753 | } | |
1754 | } | |
1755 | break; | |
1756 | case 1: | |
1757 | break; | |
1758 | case 2: | |
1759 | if (kPluginUse) { | |
1760 | // AliAnalysisGrid *alienHandler = CreateAlienHandler(plugin_mode); | |
1761 | // AliAnalysisManager::GetAnalysisManager()->SetGridHandler(alienHandler); | |
1762 | } else { | |
1763 | TString treeName = "esdTree"; | |
1764 | if (iAODanalysis) treeName = "aodTree"; | |
1765 | chain = CreateChainSingle("wn.xml", treeName); | |
1766 | } | |
1767 | break; | |
1768 | default: | |
1769 | } | |
1770 | if (chain && chain->GetNtrees()) return chain; | |
1771 | return NULL; | |
1772 | } | |
1773 | ||
1774 | //______________________________________________________________________________ | |
1775 | TChain* CreateChainSingle(const char* xmlfile, const char *treeName) | |
1776 | { | |
1777 | printf("*******************************\n"); | |
1778 | printf("*** Getting the ESD Chain ***\n"); | |
1779 | printf("*******************************\n"); | |
1780 | TAlienCollection * myCollection = TAlienCollection::Open(xmlfile); | |
1781 | ||
1782 | if (!myCollection) { | |
1783 | ::Error("AnalysisTrainPWG4Jets.C::CreateChainSingle", "Cannot create an AliEn collection from %s", xmlfile) ; | |
1784 | return NULL ; | |
1785 | } | |
1786 | ||
1787 | TChain* chain = new TChain(treeName); | |
1788 | myCollection->Reset() ; | |
1789 | while ( myCollection->Next() ) chain->Add(myCollection->GetTURL("")) ; | |
1790 | chain->ls(); | |
1791 | return chain; | |
1792 | } | |
1793 | ||
1794 | //______________________________________________________________________________ | |
1795 | Int_t SetupPar(char* pararchivename) | |
1796 | { | |
1797 | if (!pararchivename || !strlen(pararchivename)) return -1; | |
1798 | char processline[1024]; | |
1799 | if (gSystem->AccessPathName(Form("%s.par", pararchivename))) { | |
1800 | if (!gSystem->AccessPathName(Form("%s/%s.par", gSystem->Getenv("ALICE_ROOT"),pararchivename))) { | |
1801 | ::Info("AnalysisTrainPWG4Jets.C::SetupPar", "Getting %s.par from $ALICE_ROOT", pararchivename); | |
1802 | TFile::Cp(gSystem->ExpandPathName(Form("$ALICE_ROOT/%s.par", pararchivename)), | |
1803 | Form("%s.par",pararchivename)); | |
1804 | } else { | |
1805 | ::Error("AnalysisTrainPWG4Jets.C::SetupPar", "Cannot find %s.par", pararchivename); | |
1806 | return -1; | |
1807 | } | |
1808 | } | |
1809 | if (kPluginUse && kSaveTrain) gSystem->Exec(Form("ln -s ../%s.par %s",pararchivename, kTrainName.Data())); | |
1810 | gSystem->Exec(Form("tar xvzf %s.par", pararchivename)); | |
1811 | ||
1812 | TString ocwd = gSystem->WorkingDirectory(); | |
1813 | if (!gSystem->ChangeDirectory(pararchivename)) return -1; | |
1814 | ||
1815 | // check for BUILD.sh and execute | |
1816 | if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) { | |
1817 | printf("*******************************\n"); | |
1818 | printf("*** Building PAR archive ***\n"); | |
1819 | printf("*******************************\n"); | |
1820 | if (gSystem->Exec("PROOF-INF/BUILD.sh")) { | |
1821 | Error("runProcess","Cannot Build the PAR Archive! - Abort!"); | |
1822 | return -1; | |
1823 | } | |
1824 | } | |
1825 | ||
1826 | // check for SETUP.C and execute | |
1827 | if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) { | |
1828 | printf("*******************************\n"); | |
1829 | printf("*** Setup PAR archive ***\n"); | |
1830 | printf("*******************************\n"); | |
1831 | gROOT->Macro("PROOF-INF/SETUP.C"); | |
1832 | } | |
1833 | if (!gSystem->ChangeDirectory(ocwd.Data())){ | |
1834 | Error("Change back directory",Form("Cannot change to %s",ocwd.Data())); | |
1835 | return -1; | |
1836 | } | |
1837 | return 0; | |
1838 | } | |
1839 | ||
1840 | //______________________________________________________________________________ | |
1841 | AliAnalysisAlien* CreateAlienHandler(const char *plugin_mode) | |
1842 | { | |
1843 | // Check if user has a valid token, otherwise make one. This has limitations. | |
1844 | // One can always follow the standard procedure of calling alien-token-init then | |
1845 | // source /tmp/gclient_env_$UID in the current shell. | |
1846 | // if (!AliAnalysisGrid::CreateToken()) return NULL; | |
1847 | AliAnalysisAlien *plugin = new AliAnalysisAlien(); | |
1848 | // Set the run mode (can be "full", "test", "offline", "submit" or "terminate") | |
1849 | plugin->SetRunMode(plugin_mode); | |
1850 | if (kPluginUseProductionMode) plugin->SetProductionMode(); | |
1851 | plugin->SetJobTag(kJobTag); | |
1852 | plugin->SetNtestFiles(1); | |
1853 | // plugin->SetPreferedSE("ALICE::NIHAM::File"); | |
1854 | // Set versions of used packages | |
1855 | plugin->SetAPIVersion("V1.1x"); | |
1856 | // plugin->SetAPIVersion("V1.0x"); | |
1857 | // plugin->SetAPIVersion("V2.4"); | |
1858 | plugin->SetROOTVersion(kPluginRootVersion); | |
1859 | plugin->SetAliROOTVersion(kPluginAliRootVersion); | |
1860 | // Declare input data to be processed. | |
1861 | // Method 1: Create automatically XML collections using alien 'find' command. | |
1862 | // Define production directory LFN | |
1863 | plugin->SetGridDataDir(kGridDatadir.Data()); | |
1864 | // Set data search pattern | |
1865 | if (iAODanalysis) plugin->SetDataPattern(" *AliAOD.Jets.root"); | |
1866 | // else plugin->SetDataPattern(Form(" %s/*/*ESD.tag.root",kGridPassPattern.Data())); | |
1867 | else plugin->SetDataPattern(Form(" %s/*/*AliESDs.root",kGridPassPattern.Data())); | |
1868 | // ...then add run numbers to be considered | |
1869 | // plugin->SetRunRange(kGridRunRange[0], kGridRunRange[1]); | |
1870 | for (Int_t i=kGridRunRange[0]; i<=kGridRunRange[1]; i++) { | |
1871 | Printf("AnalysisTrainPWG4Jets Adding run number %s", Form(kGridRunPattern.Data(),i)); | |
1872 | plugin->AddRunNumber(Form(kGridRunPattern.Data(),i)); | |
1873 | } | |
1874 | ||
1875 | if(kGridLocalRunList.Length()>0){ | |
1876 | ifstream in1; | |
1877 | in1.open(kGridLocalRunList.Data()); | |
1878 | int iRun; | |
1879 | int icount = 0; | |
1880 | /* | |
1881 | char c; | |
1882 | char cLine[250]; | |
1883 | while(!in1.eof()){ | |
1884 | c = in1.get(); | |
1885 | if ( (c >= '0') && (c <= '9') ) | |
1886 | { | |
1887 | in1.putback (c)s; | |
1888 | in1>>iRun; | |
1889 | Printf("AnalysisTrainPWG4Jets Adding run number from File %s", Form(kGridRunPattern.Data(),iRun)); | |
1890 | plugin->AddRunNumber(Form(kGridRunPattern.Data(),iRun)); | |
1891 | } | |
1892 | else | |
1893 | { | |
1894 | in1.putback (c); | |
1895 | in1.getline(cLine,250); | |
1896 | ||
1897 | } | |
1898 | } | |
1899 | */ | |
1900 | ||
1901 | Int_t nRun = 0; | |
1902 | ||
1903 | // just use run numbers, negatives will be excluded | |
1904 | while(in1>>iRun){ | |
1905 | if(iRun>=0){ | |
1906 | if(iRun>=0&&nRun>=kGridOffsetRunFromList&&(nRun<kGridMaxRunsFromList)){ | |
1907 | Printf("AnalysisTrainPWG4Jets Adding run number from File %d: %s",nRun,Form(kGridRunPattern.Data(),iRun)); | |
1908 | plugin->AddRunNumber(Form(kGridRunPattern.Data(),iRun)); | |
1909 | ||
1910 | } | |
1911 | else{ | |
1912 | Printf("AnalysisTrainPWG4Jets Skipping run number from File %d: %d",nRun, iRun); | |
1913 | } | |
1914 | nRun++; | |
1915 | } | |
1916 | else{ | |
1917 | Printf("AnalysisTrainPWG4Jets Skipping run number from File %d: %d",nRun, iRun); | |
1918 | } | |
1919 | } | |
1920 | } | |
1921 | ||
1922 | // Method 2: Declare existing data files (raw collections, xml collections, root file) | |
1923 | // If no path mentioned data is supposed to be in the work directory (see SetGridWorkingDir()) | |
1924 | // XML collections added via this method can be combined with the first method if | |
1925 | // the content is compatible (using or not tags) | |
1926 | // plugin->AddDataFile("tag.xml"); | |
1927 | // plugin->AddDataFile("/alice/data/2008/LHC08c/000057657/raw/Run57657.Merged.RAW.tag.root"); | |
1928 | // Define alien work directory where all files will be copied. Relative to alien $HOME. | |
1929 | TString alien_workdir = ""; | |
1930 | ||
1931 | if (iAODanalysis) alien_workdir += "analysisAOD"; | |
1932 | else alien_workdir += "analysisESD"; | |
1933 | if(kGridDataSet.Length()>0)alien_workdir += Form("/%s",kGridDataSet.Data()); | |
1934 | plugin->SetGridWorkingDir(alien_workdir.Data()); | |
1935 | ||
1936 | // Declare alien output directory. Relative to working directory. | |
1937 | if (!kGridOutdir.Length()) kGridOutdir = Form("output_%s",kTrainName.Data()); | |
1938 | plugin->SetGridOutputDir(kGridOutdir); | |
1939 | ||
1940 | // Add external packages | |
1941 | if (iJETAN||iDIJETAN) { | |
1942 | plugin->AddExternalPackage("boost::v1_43_0"); | |
1943 | plugin->AddExternalPackage("cgal::v3.6"); | |
1944 | plugin->AddExternalPackage("fastjet::v2.4.2"); | |
1945 | } | |
1946 | ||
1947 | ||
1948 | // set extra libs before par file compilation | |
1949 | anaLibs += kGridExtraFiles; | |
1950 | anaLibs = anaLibs.Strip(); | |
1951 | Printf("anaLibs %s",anaLibs.Data()); | |
1952 | Printf("anaLibsExtra %s",anaLibsExtra.Data()); | |
1953 | ||
1954 | if (anaLibs.Length()) plugin->SetAdditionalLibs(anaLibs.Data()); | |
1955 | if (anaLibsExtra.Length()) plugin->SetAdditionalRootLibs(anaLibsExtra.Data()); | |
1956 | ||
1957 | TString ana_sources = ""; | |
1958 | TString ana_add = ""; | |
1959 | if (kUsePAR && anaPars.Length()) { | |
1960 | printf("%s\n", anaPars.Data()); | |
1961 | TObjArray *arr; | |
1962 | TObjString *objstr; | |
1963 | arr = anaPars.Tokenize(" "); | |
1964 | TIter next(arr); | |
1965 | while ((objstr=(TObjString*)next())) plugin->EnablePackage(objstr->GetString()); | |
1966 | delete arr; | |
1967 | } | |
1968 | ||
1969 | // Declare the analysis source files names separated by blancs. To be compiled runtime | |
1970 | // using ACLiC on the worker nodes. | |
1971 | ana_sources = anaSources.Strip(); | |
1972 | // Declare all libraries (other than the default ones for the framework. These will be | |
1973 | // loaded by the generated analysis macro. Add all extra files (task .cxx/.h) here. | |
1974 | ||
1975 | if (ana_sources.Length()) plugin->SetAnalysisSource(ana_sources); | |
1976 | plugin->SetExecutableCommand(kPluginExecutableCommand.Data()); | |
1977 | // Declare the output file names separated by blancs. | |
1978 | // (can be like: file.root or file.root@ALICE::Niham::File) | |
1979 | plugin->SetMergeExcludes(kGridMergeExclude); | |
1980 | plugin->SetMaxMergeFiles(kGridMaxMergeFiles); | |
1981 | plugin->SetNrunsPerMaster(kGridRunsPerMaster); | |
1982 | plugin->SetMergeViaJDL(kPluginMergeViaJDL); | |
1983 | // Use fastread option | |
1984 | plugin->SetFastReadOption(kPluginFastReadOption); | |
1985 | // UseOverwrite mode | |
1986 | plugin->SetOverwriteMode(kPluginOverwriteMode); | |
1987 | // Optionally define the files to be archived. | |
1988 | // plugin->SetOutputArchive("log_archive.zip:stdout,stderr@ALICE::NIHAM::File root_archive.zip:AliAOD.root,AOD.tag.root@ALICE::NIHAM::File"); | |
1989 | plugin->SetOutputToRunNo(kPluginOutputToRunNumber); // write the output to subdirs named after run number | |
1990 | ||
1991 | // Put default output files to archive | |
1992 | TString listhists = ""; | |
1993 | TString listaods = ""; | |
1994 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
1995 | TIter next(mgr->GetOutputs()); | |
1996 | AliAnalysisDataContainer *output; | |
1997 | while ((output=(AliAnalysisDataContainer*)next())) { | |
1998 | const char *filename = output->GetFileName(); | |
1999 | if (!(strcmp(filename, "default"))) { | |
2000 | if (!mgr->GetOutputEventHandler()) continue; | |
2001 | filename = mgr->GetOutputEventHandler()->GetOutputFileName(); | |
2002 | if (listaods.Length()) listaods += " "; | |
2003 | listaods += filename; | |
2004 | } else { | |
2005 | if(!listhists.Contains(filename)){ | |
2006 | if (listhists.Length()) listhists += " "; | |
2007 | listhists += filename; | |
2008 | } | |
2009 | } | |
2010 | } | |
2011 | ||
2012 | if (mgr->GetExtraFiles().Length()) { | |
2013 | if (listaods.Length()) listaods += " "; | |
2014 | listaods += mgr->GetExtraFiles(); | |
2015 | } | |
2016 | ||
2017 | // if we do not fill the aod we do not need to store it | |
2018 | // kGridMergeExclude = listaods; | |
2019 | ||
2020 | if(kSaveAOD>=0){ | |
2021 | TString outputFiles = ""; | |
2022 | outputFiles += mgr->GetExtraFiles(); | |
2023 | if (listhists.Length()) outputFiles += " "; | |
2024 | outputFiles += listhists; | |
2025 | plugin->SetDefaultOutputs(kFALSE); | |
2026 | Printf("%s:%d Starting with the files %s",(char*)__FILE__,__LINE__,outputFiles.Data()); | |
2027 | // remove | |
2028 | // no harm done when we try to remove something that is not there :) | |
2029 | if(!(kSaveAOD&(1<<0))){ | |
2030 | outputFiles.ReplaceAll("AliAOD.root ",""); | |
2031 | listaods.ReplaceAll("AliAOD.root ",""); | |
2032 | } | |
2033 | if(!(kSaveAOD&(1<<1))){ | |
2034 | if(kDeltaAODJetName.Length())outputFiles.ReplaceAll(kDeltaAODJetName.Data(),""); | |
2035 | if(kDeltaAODJetName.Length())listaods.ReplaceAll(kDeltaAODJetName.Data(),""); | |
2036 | ||
2037 | } | |
2038 | if(!(kSaveAOD&(1<<2))){ | |
2039 | if(kDeltaAODPartCorrName.Length())outputFiles.ReplaceAll(kDeltaAODPartCorrName.Data(),""); | |
2040 | if(kDeltaAODPartCorrName.Length())listaods.ReplaceAll(kDeltaAODPartCorrName.Data(),""); | |
2041 | } | |
2042 | if(!(kSaveAOD&(1<<3))){ | |
2043 | if(kDeltaAODJCORRANName.Length())outputFiles.ReplaceAll(kDeltaAODJCORRANName.Data(),""); | |
2044 | if(kDeltaAODJCORRANName.Length())listaods.ReplaceAll(kDeltaAODJCORRANName.Data(),""); | |
2045 | } | |
2046 | ||
2047 | // | |
2048 | plugin->SetDefaultOutputs(kFALSE); | |
2049 | Printf("%s:%d Saving the files %s",(char*)__FILE__,__LINE__,outputFiles.Data()); | |
2050 | plugin->SetOutputFiles(outputFiles.Data()); | |
2051 | } | |
2052 | ||
2053 | TString outputArchive; | |
2054 | outputArchive = Form("log_archive.zip:std*@%s","disk=1"); | |
2055 | listaods.ReplaceAll(" ", ","); | |
2056 | listhists.ReplaceAll(" ", ","); | |
2057 | if (listhists.Length()){ | |
2058 | outputArchive += " "; | |
2059 | outputArchive += "root_archive.zip:"; | |
2060 | outputArchive += listhists; | |
2061 | if (listaods.Length()){ | |
2062 | outputArchive += ","; | |
2063 | outputArchive += listaods; | |
2064 | } | |
2065 | outputArchive += Form("@%s", kGridOutputStorages.Data()); | |
2066 | } | |
2067 | else{ | |
2068 | ||
2069 | if (listaods.Length()){ | |
2070 | // we have only aod'ish output | |
2071 | outputArchive += " "; | |
2072 | outputArchive += "root_archive.zip:"; | |
2073 | outputArchive += listaods; | |
2074 | outputArchive += Form("@%s", kGridOutputStorages.Data()); | |
2075 | } | |
2076 | else{ | |
2077 | // no other outputs than std.. | |
2078 | ::Fatal("AnalysisTrainPWG4Jets", "No task output !"); | |
2079 | } | |
2080 | } | |
2081 | ||
2082 | plugin->SetDefaultOutputs(kFALSE); | |
2083 | plugin->SetOutputArchive(outputArchive); | |
2084 | ||
2085 | ||
2086 | // Optionally set a name for the generated analysis macro (default MyAnalysis.C) | |
2087 | plugin->SetAnalysisMacro(Form("%s.C", kTrainName.Data())); | |
2088 | // Optionally set maximum number of input files/subjob (default 100, put 0 to ignore) | |
2089 | plugin->SetSplitMaxInputFileNumber(kGridFilesPerJob); | |
2090 | // Optionally set number of failed jobs that will trigger killing waiting sub-jobs. | |
2091 | // plugin->SetMaxInitFailed(5); | |
2092 | // Optionally resubmit threshold. | |
2093 | // plugin->SetMasterResubmitThreshold(90); | |
2094 | // Optionally set time to live (default 30000 sec) | |
2095 | plugin->SetTTL(54000); // 15h... | |
2096 | // Optionally set input format (default xml-single) | |
2097 | plugin->SetInputFormat("xml-single"); | |
2098 | // Optionally modify the name of the generated JDL (default analysis.jdl) | |
2099 | plugin->SetJDLName(Form("%s.jdl", kTrainName.Data())); | |
2100 | // Optionally modify the executable name (default analysis.sh) | |
2101 | plugin->SetExecutable(Form("%s.sh", kTrainName.Data())); | |
2102 | // Optionally modify job price (default 1) | |
2103 | plugin->SetPrice(1); | |
2104 | // Optionally modify split mode (default 'se') | |
2105 | plugin->SetSplitMode("se"); | |
2106 | return plugin; | |
2107 | } | |
2108 | ||
2109 | //______________________________________________________________________________ | |
2110 | void WriteConfig() | |
2111 | { | |
2112 | // Write train configuration in a file. The file name has the format: | |
2113 | // train_[trainName]_ddMonthyyyy_time.C | |
2114 | if (kUseDate) { | |
2115 | gSystem->Exec("date +%d%b%Y_%Hh%M > date.tmp"); | |
2116 | ifstream fdate("date.tmp"); | |
2117 | if (!fdate.is_open()) { | |
2118 | ::Error("AnalysisTrainPWG4Jets.C::Export","Could not generate file name"); | |
2119 | return; | |
2120 | } | |
2121 | const char date[64]; | |
2122 | fdate.getline(date,64); | |
2123 | fdate.close(); | |
2124 | gSystem->Exec("rm date.tmp"); | |
2125 | kTrainName = Form("train_%s_%s", kTrainName.Data(), date); | |
2126 | } else { | |
2127 | kTrainName = Form("train_%s", kTrainName.Data()); | |
2128 | } | |
2129 | TString cdir = gSystem->WorkingDirectory(); | |
2130 | gSystem->MakeDirectory(kTrainName); | |
2131 | gSystem->ChangeDirectory(kTrainName); | |
2132 | ofstream out; | |
2133 | out.open(Form("%sConfig.C",kTrainName.Data()), ios::out); | |
2134 | if (out.bad()) { | |
2135 | ::Error("AnalysisTrainPWG4Jets.C::Export", "Cannot open ConfigTrain.C for writing"); | |
2136 | return; | |
2137 | } | |
2138 | out << "{" << endl; | |
2139 | out << " kTrainName = " << "\"" << kTrainName.Data() << "\";" << endl; | |
2140 | out << " kProofCluster = " << "\"" << kProofCluster.Data() << "\";" << endl; | |
2141 | out << " kProofUseAFPAR = " << kProofUseAFPAR << ";" << endl; | |
2142 | if (kProofUseAFPAR) | |
2143 | out << " kProofAFversion = " << kProofAFversion.Data() << ";" << endl; | |
2144 | out << " kProofDataSet = " << "\"" << kProofDataSet.Data() << "\";" << endl; | |
2145 | out << " kPluginUse = " << kPluginUse << ";" << endl; | |
2146 | out << " kUsePAR = " << kUsePAR << ";" << endl; | |
2147 | out << " kUseCPAR = " << kUseCPAR << ";" << endl; | |
2148 | out << " kPluginRootVersion = " << "\"" << kPluginRootVersion.Data() << "\";" << endl; | |
2149 | out << " kPluginAliRootVersion = " << "\"" << kPluginAliRootVersion.Data() << "\";" << endl; | |
2150 | out << " kGridDatadir = " << "\"" << kGridDatadir.Data() << "\";" << endl; | |
2151 | if (!kGridOutdir.Length()) kGridOutdir = Form("output_%s",kTrainName.Data()); | |
2152 | out << " kGridOutdir = " << "\"" << kGridOutdir.Data() << "\";" << endl; | |
2153 | out << " kGridMaxMergeFiles = " << kGridMaxMergeFiles << ";" << endl; | |
2154 | out << " kGridMergeExclude = " << "\"" << kGridMergeExclude.Data() << "\";" << endl; | |
2155 | out << " kGridRunsPerMaster = " << kGridRunsPerMaster << ";" << endl; | |
2156 | out << " kGridFilesPerJob = " << kGridFilesPerJob << ";" << endl; | |
2157 | out << " kGridRunRange[0] = " << kGridRunRange[0] << ";" << endl; | |
2158 | out << " kGridRunRange[1] = " << kGridRunRange[1] << ";" << endl; | |
2159 | out << " kUseDebug = " << kUseDebug << ";" << endl; | |
2160 | out << " kUseMC = " << kUseMC << ";" << endl; | |
2161 | out << " kUseESDTags = " << kUseESDTags << ";" << endl; | |
2162 | out << " kUseKinefilter = " << kUseKinefilter << ";" << endl; | |
2163 | out << " kUseTR = " << kUseTR << ";" << endl; | |
2164 | out << " kUseAODTags = " << kUseAODTags << ";" << endl; | |
2165 | out << " kSaveTrain = " << "kFALSE;" << endl << endl; | |
2166 | out << " // Analysis modules" << endl; | |
2167 | out << " iAODanalysis = " << iAODanalysis << ";" << endl; | |
2168 | out << " iAODhandler = " << iAODhandler << ";" << endl; | |
2169 | out << " iESDfilter = " << iESDfilter << ";" << endl; | |
2170 | out << " iJETAN = " << iJETAN << ";" << endl; | |
2171 | out << "// Configuration fot the wagons" << endl; | |
2172 | out << "}" << endl; | |
2173 | ::Info("AnalysisTrainPWG4Jets.C::WriteConfig", "Train configuration wrote to file %s", Form("config_%s.C", kTrainName.Data())); | |
2174 | gSystem->ChangeDirectory(cdir); | |
2175 | } | |
2176 | ||
2177 | //______________________________________________________________________________ | |
2178 | Bool_t LoadConfig(const char *filename) | |
2179 | { | |
2180 | // Read train configuration from file | |
2181 | if (gSystem->AccessPathName(filename)) { | |
2182 | ::Error("AnalysisTrainPWG4Jets.C::LoadConfig", "Config file name not found"); | |
2183 | return kFALSE; | |
2184 | } | |
2185 | gROOT->ProcessLine(Form(".x %s", filename)); | |
2186 | ::Info("AnalysisTrainPWG4Jets.C::LoadConfig", "Train configuration loaded from file %s", filename); | |
2187 | return kTRUE; | |
2188 | } | |
2189 | ||
2190 | Bool_t PatchJDL(){ | |
2191 | Printf(">>> Patching JDL"); | |
2192 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
2193 | AliAnalysisAlien* gridHandler = (AliAnalysisAlien*)mgr->GetGridHandler(); | |
2194 | TGridJDL *jdl = gridHandler->GetGridJDL(); | |
2195 | if(iJETAN)jdl->AddToPackages("fastjet","v2.4.0"); | |
2196 | gridHandler->WriteJDL(kFALSE); | |
2197 | Printf("<<< Patching JDL"); | |
2198 | return kTRUE; | |
2199 | } | |
2200 | ||
2201 | Bool_t PatchAnalysisMacro(){ | |
2202 | Printf(">>> Patching AnalysisMacro"); | |
2203 | gSystem->Exec(Form("mv %s.C %s.C_tmp",kTrainName.Data(),kTrainName.Data())); | |
2204 | ||
2205 | ifstream in1; | |
2206 | in1.open(Form("%s.C_tmp", kTrainName.Data())); | |
2207 | char cLine[250]; | |
2208 | TString st; | |
2209 | while(in1.getline(cLine,250)){ | |
2210 | st += cLine; | |
2211 | st += "\n"; | |
2212 | } | |
2213 | Int_t index= -1; | |
2214 | index = st.Index("gSystem->Load(\"libPhysics\");"); | |
2215 | index += strlen("gSystem->Load(\"libPhysics\");"); | |
2216 | /* | |
2217 | TObjArray *arr; | |
2218 | TObjString *objstr; | |
2219 | arr = anaLibs.Tokenize(" "); | |
2220 | TIter next(arr); | |
2221 | ||
2222 | add += "\n\n // added by CKB \n"; | |
2223 | while ((objstr=(TObjString*)next())){ | |
2224 | if(objstr->GetString().Contains("PWG3"))continue; | |
2225 | if(objstr->GetString().EndsWith(".so"))add += Form("gSystem->Load(\"%s\");\n",objstr->GetString().Data()); | |
2226 | } | |
2227 | delete arr; | |
2228 | */ | |
2229 | // add += Form("AliLog::SetGlobalLogLevel(%d);\n",AliLog::GetGlobalLogLevel()); | |
2230 | TString add = ""; | |
2231 | ||
2232 | if(index<0)Printf("%s:%d index out of bounds",(char*)__FILE__,__LINE__); | |
2233 | add += "\n\n // added by CKB \n"; | |
2234 | if(kErrorIgnoreLevel>0)add += Form("gErrorIgnoreLevel = %d;\n",kErrorIgnoreLevel); | |
2235 | add += "\n gSystem->AddIncludePath(\"./\"); \n"; | |
2236 | add += "\n gSystem->SetFPEMask(); \n"; | |
2237 | ||
2238 | ||
2239 | if(gGrid&&kPluginAliRootVersion.Length()==0){ | |
2240 | /* | |
2241 | add += "\n // Dirty hack for TRD reference data \n"; | |
2242 | add += "\n gSystem->Setenv(\"ALICE_ROOT\",\""; | |
2243 | add += Form("alien://%s/rootfiles/",gGrid->GetHomeDirectory()); | |
2244 | add += "\"); \n"; | |
2245 | */ | |
2246 | } | |
2247 | ||
2248 | add += "// BKC \n\n"; | |
2249 | st.Insert(index,add.Data()); | |
2250 | ||
2251 | if(kUseDebug){ | |
2252 | // st.Insert(index,"\n gROOT->ProcessLine(\".trace\"); // CKB \n"); | |
2253 | } | |
2254 | ||
2255 | if(kUseCPAR&&kPluginAliRootVersion.Length()==0){ | |
2256 | index = st.Index("gSystem->AddIncludePath(\"-I$"); // uncommen $ALICE_ROOT include for par files | |
2257 | if(index<0)Printf("%s:%d index out of bounds",(char*)__FILE__,__LINE__); | |
2258 | st.Insert(index,"// CKB comment out whehn no aliroot is provided \n //"); | |
2259 | } | |
2260 | ||
2261 | if(AliLog::GetGlobalLogLevel()==AliLog::kFatal){ | |
2262 | index = st.Index("AliLog::SetGlobal"); // ncomment setting of log level, do my own | |
2263 | if(index<0)Printf("%s:%d index out of bounds",(char*)__FILE__,__LINE__); | |
2264 | st.Insert(index,"AliLog::SetGlobalLogLevel(AliLog::kFatal);// CKB \n // CKB comment out for own setting \n //"); | |
2265 | } | |
2266 | ||
2267 | ofstream out; | |
2268 | out.open(Form("%s.C", kTrainName.Data())); | |
2269 | if (out.bad()) { | |
2270 | return kFALSE; | |
2271 | } | |
2272 | out << st << endl; | |
2273 | Printf("<<< Patching AnalysisMacro"); | |
2274 | ||
2275 | ||
2276 | ||
2277 | ||
2278 | ||
2279 | Printf(">>> Patching Merge Macro"); | |
2280 | gSystem->Exec(Form("mv %s_merge.C %s_merge.C_tmp",kTrainName.Data(),kTrainName.Data())); | |
2281 | ||
2282 | ifstream in2; | |
2283 | in2.open(Form("%s_merge.C_tmp", kTrainName.Data())); | |
2284 | TString st2; | |
2285 | while(in2.getline(cLine,250)){ | |
2286 | st2 += cLine; | |
2287 | st2 += "\n"; | |
2288 | } | |
2289 | index = st2.Index("gSystem->Load(\"libPhysics\");"); | |
2290 | index += strlen("gSystem->Load(\"libPhysics\");"); | |
2291 | TString add2 = ""; | |
2292 | add2 += "\n gSystem->AddIncludePath(\"./\"); \n"; | |
2293 | if(gGrid&&kPluginAliRootVersion.Length()==0){ | |
2294 | /* | |
2295 | add2 += "\n // Dirty hack for TRD reference data \n"; | |
2296 | add2 += "\n gSystem->Setenv(\"ALICE_ROOT\",\""; | |
2297 | add2 += Form("alien://%s/rootfiles/",gGrid->GetHomeDirectory()); | |
2298 | add2 += "\"); \n"; | |
2299 | */ | |
2300 | } | |
2301 | add2 += "// BKC \n\n"; | |
2302 | if(index<0)Printf("%s:%d index out of bounds",(char*)__FILE__,__LINE__); | |
2303 | st2.Insert(index,add.Data()); | |
2304 | ||
2305 | ||
2306 | if(kUseDebug){ | |
2307 | // st2.Insert(index,"\n gROOT->ProcessLine(\".trace\"); // CKB \n"); | |
2308 | } | |
2309 | ||
2310 | if(kUseCPAR&&kPluginAliRootVersion.Length()==0){ | |
2311 | index = st2.Index("gSystem->AddIncludePath(\"-I$"); // uncomment $ALICE_ROOT include for par files | |
2312 | if(index<0)Printf("%s:%d index out of bounds",(char*)__FILE__,__LINE__); | |
2313 | st2.Insert(index,"// CKB comment out whehn no aliroot is provided \n //"); | |
2314 | } | |
2315 | ||
2316 | // do not exclude the extra files from merign, this is done explicitly in this train script | |
2317 | // index = st2.Index("mergeExcludes +="); // uncommen $ALICE_ROOT include for par files | |
2318 | // if(index<0)Printf("%s:%d index out of bounds",(char*)__FILE__,__LINE__); | |
2319 | // st2.Insert(index,"// CKB comment out, handled explicitly by the train macro \n //"); | |
2320 | ||
2321 | ||
2322 | ofstream out2; | |
2323 | out2.open(Form("%s_merge.C", kTrainName.Data())); | |
2324 | if (out2.bad()) { | |
2325 | return kFALSE; | |
2326 | } | |
2327 | out2 << st2 << endl; | |
2328 | Printf("<<< Patching Merging Macro"); | |
2329 | ||
2330 | ||
2331 | ||
2332 | return kTRUE; | |
2333 | ||
2334 | } |