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