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