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