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