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