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