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