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