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