AliPhysics  aaf9c62 (aaf9c62)
AOD.C
Go to the documentation of this file.
1 
26 const char *cdbPath = "raw://";
27 Bool_t cholm = false;
33 {
40  virtual Bool_t UseCDBconnect() const = 0;
42  virtual Bool_t UsePhysicsSelection() const = 0;
44  virtual Bool_t UseTender() const = 0;
46  virtual Bool_t UseCentrality() const = 0;
48  virtual Bool_t UseV0tender() const = 0;
50  virtual Bool_t UseDBG() const = 0;
52  virtual Bool_t UseMC() const = 0;
54  virtual Bool_t UseKFILTER() const = 0;
56  virtual Bool_t UseTR() const = 0;
58  virtual Bool_t UseCORRFW() const = 0;
60  virtual Bool_t UseAODTAGS() const = 0;
62  virtual Bool_t UseSysInfo() const = 0;
63  /* @} */
64 
71  virtual Bool_t UseAODhandler() const = 0;
73  virtual Bool_t UseESDfilter() const = 0;
75  virtual Bool_t UsePWGMuonTrain() const = 0;
77  virtual Bool_t UseMUONcopyAOD() const = 0;
79  virtual Bool_t UseJETAN() const = 0;
81  virtual Bool_t UseJETANdelta() const = 0;
83  virtual Bool_t UsePWGHFvertexing() const = 0;
85  virtual Bool_t UsePWGDQJPSIfilter() const = 0;
87  virtual Bool_t UsePWGHFd2h() const = 0;
89  virtual Bool_t UsePIDResponse() const = 0;
91  virtual Bool_t UsePWGLFForward() const = 0;
92  /* @} */
99  virtual void PrintOne(const char* title, Bool_t use) const
100  {
101  Printf("%-30s : %3s", title, use ? "yes" : "no");
102  }
107  virtual void Print() const {
108  PrintOne("Connect to CDB", UseCDBconnect());
109  PrintOne("Use physics selection", UsePhysicsSelection());
110  PrintOne("Use tender wagon", UseTender());
111  PrintOne("Use centrality", UseCentrality());
112  PrintOne("Use V0 correction in tender", UseV0tender());
113  PrintOne("Activate debugging", UseDBG());
114  PrintOne("Use MC info", UseMC());
115  PrintOne("Use Kinematics filter", UseKFILTER());
116  PrintOne("Use track references", UseTR());
117  PrintOne("Use correction framework", UseCORRFW());
118  PrintOne("Use AOD tags", UseAODTAGS());
119  PrintOne("Use sys info", UseSysInfo());
120  PrintOne("Produces an AOD or dAOD's", UseAODhandler());
121  PrintOne("ESD to AOD filter", UseESDfilter());
122  PrintOne("Use Muon train ", UsePWGMuonTrain());
123  PrintOne("Copy muon events", UseMUONcopyAOD());
124  PrintOne("Jet analysis (PWG4)", UseJETAN());
125  PrintOne("Jet delta AODs", UseJETANdelta());
126  PrintOne("Vertexing HF task (PWG3)", UsePWGHFvertexing());
127  PrintOne("JPSI filtering (PWG3)", UsePWGDQJPSIfilter());
128  PrintOne("D0->2 hadrons (PWG3)", UsePWGHFd2h());
129  PrintOne("PID response", UsePIDResponse());
130  PrintOne("Forward mult task (PWGLF)", UsePWGLFForward());
131  }
132 };
133 
135 
136 //====================================================================
144 Bool_t LoadLibrary(const char *module)
145 {
146  // Load a module library in a given mode. Reports success.
147  Int_t result = 0;
148  TString mod(module);
149  ::Info("LoadLibrary", "Loading %s", module);
150  gROOT->IncreaseDirLevel();
151 
152  if (mod.IsNull()) {
153  ::Error("AnalysisTrainNew.C::LoadLibrary", "Empty module name");
154  gROOT->DecreaseDirLevel();
155  return kFALSE;
156  }
157 
158  // If a library is specified, just load it
159  if (mod.EndsWith(".so")) {
160  mod.Remove(mod.Index(".so"));
161  ::Info("LoadLibrary", "Loading library: %s", mod.Data());
162  result = gSystem->Load(mod);
163  if (result < 0) {
164  ::Error("AnalysisTrainNew.C::LoadLibrary",
165  "Could not load library %s", module);
166  }
167  gROOT->DecreaseDirLevel();
168  return (result >= 0);
169  }
170  // Check if the library is already loaded
171  if (strlen(gSystem->GetLibraries(module, "", kFALSE)) > 0) {
172  ::Info("LoadLibrary", "Module %s already loaded", module);
173  gROOT->DecreaseDirLevel();
174  return kTRUE;
175  }
176 
177  ::Info("LoadLibrary", "Trying to load lib%s", module);
178  result = gSystem->Load(Form("lib%s", module));
179  if (result < 0)
180  ::Error("AnalysisTrainNew.C::LoadLibrary",
181  "Could not load module %s", module);
182  ::Info("LoadLibrary", "Module %s, successfully loaded", module);
183  gROOT->DecreaseDirLevel();
184  return (result >= 0);
185 }
186 
187 //====================================================================
194 {
195  // Load common analysis libraries.
196  if (!gSystem->Getenv("ALICE_PHYSICS")) {
197  ::Error("AnalysisTrainNew.C::LoadCommonLibraries",
198  "Analysis train requires that analysis libraries are "
199  "compiled with a local AliRoot");
200  return kFALSE;
201  }
202 
203  Bool_t success = kTRUE;
204  // Load framework classes. Par option ignored here.
205  success &= LoadLibrary("libSTEERBase.so");
206  success &= LoadLibrary("libESD.so");
207  success &= LoadLibrary("libAOD.so");
208  success &= LoadLibrary("libANALYSIS.so");
209  success &= LoadLibrary("libOADB.so");
210  success &= LoadLibrary("libANALYSISalice.so");
211  success &= LoadLibrary("libESDfilter.so");
212  success &= LoadLibrary("libCORRFW.so");
213  gROOT->ProcessLine(".include $ALICE_PHYSICS/include");
214  if (success) {
215  ::Info("AnalysisTrainNew.C::LoadCommodLibraries",
216  "Load common libraries: SUCCESS");
217  ::Info("AnalysisTrainNew.C::LoadCommodLibraries",
218  "Include path for Aclic compilation:\n%s",
219  gSystem->GetIncludePath());
220  } else {
221  ::Info("AnalysisTrainNew.C::LoadCommodLibraries",
222  "Load common libraries: FAILED");
223  }
224  return success;
225 }
226 
227 //====================================================================
234 {
235  // Load common analysis libraries.
236  if (aodCfg->UseTender() || aodCfg->UseCDBconnect()) {
237  if (!LoadLibrary("Tender") ||!LoadLibrary("TenderSupplies")) return kFALSE;
238  }
239  // CDBconnect
240  if ((aodCfg->UseCDBconnect() && !aodCfg->UseTender())
241  && !LoadLibrary("PWGPP")) return false;
242  if ((aodCfg->UseESDfilter() ||
243  (aodCfg->UsePWGMuonTrain() && detCfg->UseMUON())))
244  if (!LoadLibrary("PWGmuon")) return kFALSE;
245  // JETAN
246  if ((aodCfg->UseJETAN() || aodCfg->UseJETANdelta()))
247  if (!LoadLibrary("JETAN")) return kFALSE;
248  if (aodCfg->UseJETANdelta()) { // CINT doesn't like long '||' chains
249  if (!LoadLibrary("CGAL")) return false;
250  if (!LoadLibrary("fastjet")) return false;
251  if (!LoadLibrary("siscone")) return false;
252  if (!LoadLibrary("SISConePlugin")) return false;
253  if (!LoadLibrary("FASTJETAN")) return false;
254  }
255 
256  // PWG3 Vertexing HF
257  if (aodCfg->UsePWGHFvertexing() || aodCfg->UsePWGHFd2h())) {
258  // CINT doesn't like long '||' chains
259  if (!LoadLibrary("PWGflowBase")) return false;
260  if (!LoadLibrary("PWGflowTasks")) return false;
261  if (cholm) if (!LoadLibrary("PWGTRD")) return false;
262  if (!LoadLibrary("PWGHFvertexingHF")) return false;
263  }
264 
265  // PWG3 dielectron
266  if (aodCfg->UsePWGDQJPSIfilter() &&
267  !LoadLibrary("PWGDQdielectron")) return kFALSE;
268 
269  ::Info("AnalysisTrainNew.C::LoadAnalysisLibraries",
270  "Load other libraries: SUCCESS");
271  return kTRUE;
272 }
273 
274 //====================================================================
280 void AddAnalysisTasks(const char *cdb_location)
281 {
282  // === Add all analysis task wagons to the train ===================
283  //
284  // --- Some constants ----------------------------------------------
285  TString ali = "$(ALICE_PHYSICS)";
286  TString ana = ali + "/ANALYSIS";
287  TString oadb = ali + "/OADB";
288  TString pwghf = ali + "/PWGHF";
289  TString pwglf = ali + "/PWGLF";
290  TString pwgje = ali + "/PWGJE";
291  TString pwgdq = ali + "/PWGDQ";
292  TString pwgpp = ali + "/PWGPP";
293 
294  // --- Get the analysis manager ------------------------------------
295  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
296  AliAnalysisManager::SetCommonFileName("AODQA.root");
297 
298  // --- PIDResponse(JENS) -------------------------------------------
299  if (aodCfg->UsePIDResponse()) {
300  gROOT->LoadMacro(ana+"/macros/AddTaskPIDResponse.C");
301  AliAnalysisTaskPIDResponse *PIDResponse = AddTaskPIDResponse(kTRUE);
302  }
303 
304  // --- CDB connection ----------------------------------------------
305  if (aodCfg->UseCDBconnect() && !aodCfg->UseTender()) {
306  gROOT->LoadMacro(pwgpp+"/PilotTrain/AddTaskCDBconnect.C");
307  AliTaskCDBconnect *taskCDB = AddTaskCDBconnect(cdb_location, grp->run);
308  if (!taskCDB) return;
309 
310  AliCDBManager *cdb = AliCDBManager::Instance();
311  // cdb->SetDefaultStorage(cdb_location);
312  cdb->SetDefaultStorageFromRun(grp->run);
313  }
314  if (aodCfg->UseTender()) {
315  gROOT->LoadMacro(ana+"/TenderSupplies/AddTaskTender.C");
316  AliAnalysisTaskSE *tender = AddTaskTender(aodCfg->UseV0tender());
317  }
318 
319  // --- Physics selection -------------------------------------------
320  if (aodCfg->UsePhysicsSelection()) {
321  // Physics selection task
322  gROOT->LoadMacro(oadb+"/macros/AddTaskPhysicsSelection.C");
323  mgr->RegisterExtraFile("event_stat.root");
324  AliPhysicsSelectionTask *physSelTask =
325  AddTaskPhysicsSelection(aodCfg->UseMC());
326  }
327 
328  // --- Centrality (only Pb-Pb) -------------------------------------
329  if (aodCfg->UseCentrality()) {
330  gROOT->LoadMacro(oadb+"/macros/AddTaskCentrality.C");
331  AliCentralitySelectionTask *taskCentrality = AddTaskCentrality();
332  taskCentrality->SetMCInput();
333  }
334 
335  // --- PWGLF - Forward (cholm@nbi.dk) -----------------------------
336  if (aodCfg->UsePWGLFForward() &&
337  aodCfg->UsePhysicsSelection() &&
338  detCfg->UseFMD()) {
339  gROOT->LoadMacro(pwglf+"/FORWARD/analysis2/AddTaskForwardMult.C");
340  // Arguments are
341  // mc Assume MC input
342  // runNo Run number to do local initialization - not used
343  // sys Collision system (1:pp,2:PbPb,3:pPb/Pbp) - not used
344  // sNN Collision energy in GeV - not used
345  // field L3 magnetic field strength - not used
346  // config Configuration script
347  // corrdir Possible directory containing custom OADB corrections
348  // HACK load custom corrections
349  Info("", "Adding forward AOD task with mc=%d",
350  aodCfg->UseMC() && aodCfg->UseTR());
351  AddTaskForwardMult(aodCfg->UseMC() && aodCfg->UseTR(),0,0,0,0,
352  "ForwardAODConfig.C",".");
353  gROOT->LoadMacro(pwglf+"/FORWARD/analysis2/AddTaskCentralMult.C");
354  AddTaskCentralMult(aodCfg->UseMC() && aodCfg->UseTR(),0,0,0,0,
355  "CentralAODConfig.C");
356  const char* hack2="AliForwardCorrectionManager::Instance().Print(\"R\")";
357  gROOT->ProcessLine(hack2);
358  }
359 
360 
361  // --- ESD filter --------------------------------------------------
362  if (aodCfg->UseESDfilter()) {
363  // ESD filter task configuration.
364  gROOT->LoadMacro(ana+"/ESDfilter/macros/AddTaskESDFilter.C");
365  if (aodCfg->UseMUONcopyAOD() && detCfg->UseMUON()) {
366  printf("Registering delta AOD file\n");
367  mgr->RegisterExtraFile("AliAOD.Muons.root");
368  mgr->RegisterExtraFile("AliAOD.Dimuons.root");
369  }
370  UInt_t runFlag = (grp->Year()%100)*100;
371  AliAnalysisTaskESDfilter *taskesdfilter =
372  AddTaskESDFilter(aodCfg->UseKFILTER(),
373  aodCfg->UseMUONcopyAOD(), // write Muon AOD
374  kFALSE, // write dimuon AOD
375  kFALSE, // usePhysicsSelection
376  kFALSE, // centrality OBSOLETE
377  kTRUE, // enable TPS only tracks
378  kFALSE, // disable cascades
379  kFALSE, // disable kinks
380  runFlag); // run flag (YY00)
381  }
382 
383  TString configPWGHFd2h =
384  (grp->IsPP() ?
385  pwghf+"/vertexingHF/ConfigVertexingHF.C" :
386  pwghf+"/vertexingHF/ConfigVertexingHF_Pb_AllCent.C");
387 
388  // --- PWG3 vertexing ----------------------------------------------
389  if (aodCfg->UsePWGHFvertexing()) {
390  gROOT->LoadMacro(pwghf+"/vertexingHF/macros/AddTaskVertexingHF.C");
391 
392  if (!aodCfg->UsePWGHFd2h())
393  TFile::Cp(gSystem->ExpandPathName(configPWG3d2h.Data()),
394  "file:ConfigVertexingHF.C");
395 
397  if (!taskvertexingHF)
398  ::Warning("AnalysisTrainNew",
399  "AliAnalysisTaskSEVertexingHF cannot run for this train "
400  "conditions - EXCLUDED");
401  else
402  mgr->RegisterExtraFile("AliAOD.VertexingHF.root");
403 
404  taskvertexingHF->SelectCollisionCandidates(0);
405  }
406 
407  // ---- PWG3 JPSI filtering (only pp) ------------------------------
408  if (aodCfg->UsePWGDQJPSIfilter()) {
409  gROOT->LoadMacro(pwgdq+"/dielectron/macros/AddTaskJPSIFilter.C");
410  AliAnalysisTaskSE *taskJPSIfilter = AddTaskJPSIFilter();
411 
412  if (!taskJPSIfilter)
413  ::Warning("AnalysisTrainNew",
414  "AliAnalysisTaskDielectronFilter cannot run for this train "
415  "conditions - EXCLUDED");
416  else
417  mgr->RegisterExtraFile("AliAOD.Dielectron.root");
418 
419  taskJPSIfilter->SelectCollisionCandidates(0);
420  }
421 
422  // --- PWG3 D2h ----------------------------------------------------
423  if (aodCfg->UsePWGHFd2h() && aodCfg->UsePWGHFvertexing()) {
424  gROOT->LoadMacro(pwghf+"/vertexingHF/AddD2HTrain.C");
425  TFile::Cp(gSystem->ExpandPathName(configPWGHFd2h.Data()),
426  "file:ConfigVertexingHF.C");
427  AddD2HTrain(kFALSE, 1,0,0,0,0,0,0,0,0,0,0);
428  }
429 
430  // --- Jet analysis ------------------------------------------------
431 
432  // Configurations flags, move up?
433  if (aodCfg->UseJETAN()) {
434 #if 0
435  Warning("", "JET analysis disabled - major restructuring ofg JETAN");
436 #else
437  TString jetAOD = "AliAOD.Jets.root";
438  UInt_t highPtMask = 768;// from esd filter
439  TString subtractBranches = "";
440  UInt_t psFlag = 0;
441 
442  Info("", "Loading macro %s/macros/AddTaskJets.C", pwgje.Data());
443  gROOT->LoadMacro(pwgje+"/macros/AddTaskJets.C");
444  // Default jet reconstructor running on ESD's
445  // no background subtraction
446  AliAnalysisTask* task = AddTaskJets("AOD","UA1",0.4F,highPtMask,1.F,0);
447  if (!task)
448  ::Fatal("AnalysisTrainNew",
449  "AliAnalysisTaskJets cannot run for this train "
450  "conditions - EXCLUDED");
451 
452  AliAnalysisTaskJets* taskjets = static_cast<AliAnalysisTaskJets*>(task);
453  if(!jetAOD.IsNull()) taskjets->SetNonStdOutputFile(jetAOD);
454 
455  if (aodCfg->UseJETANdelta()) {
456  // need to modify this accordingly in the add task jets
457  // AddTaskJetsDelta("AliAOD.Jets.root");
458  mgr->RegisterExtraFile(jetAOD);
459  TString cTmp("");
460 
461  if(grp->IsAA()){
462  // UA1 intrinsic background subtraction
463  // background subtraction
464  taskjets = AddTaskJets("AOD","UA1",0.4,highPtMask,1.,2);
465  if(!jetAOD.IsNull()) taskjets->SetNonStdOutputFile(jetAOD);
466  }
467  // SICONE
468  //no background subtration to be done later....
469  taskjets = AddTaskJets("AOD","SISCONE",0.4,highPtMask,0.15,0);
470  if(!jetAOD.IsNull()) taskjets->SetNonStdOutputFile(jetAOD.Data());
471  cTmp = taskjets->GetNonStdBranch();
472  if(!cTmp.IsNull()) subtractBranches += Form("%s ",cTmp.Data());
473 
474  // Add the clusters..
475  gROOT->LoadMacro(pwgje+"/macros/AddTaskJetCluster.C");
476  AliAnalysisTaskJetCluster *taskCl = 0;
477  Float_t fCenUp = 0;
478  Float_t fCenLo = 0;
479  Float_t fTrackEtaWindow = 0.9;
480  // this one is for the background and random jets, random cones
481  // with no skip
482  taskCl = AddTaskJetCluster("AOD","",highPtMask,
483  psFlag,"KT",0.4,0,1,
484  jetAOD,0.15,
485  fTrackEtaWindow,0);
486  taskCl->SetBackgroundCalc(kTRUE);
487  taskCl->SetNRandomCones(10);
488  taskCl->SetCentralityCut(fCenLo,fCenUp);
489  taskCl->SetGhostEtamax(fTrackEtaWindow);
490  TString bkgBranch = Form("%s_%s",
491  AliAODJetEventBackground::StdBranchName(),
492  taskCl->GetJetOutputBranch());
493 
494  taskCl = AddTaskJetCluster("AOD", "", highPtMask, psFlag, "ANTIKT",
495  0.4, 2, 1, jetAOD, 0.15);
496  taskCl->SetCentralityCut(fCenLo,fCenUp);
497  if(grp->IsAA()) taskCl->SetBackgroundBranch(bkgBranch.Data());
498 
499  taskCl->SetNRandomCones(10);
500  subtractBranches += Form("%s ",taskCl->GetJetOutputBranch());
501 
502  taskCl = AddTaskJetCluster("AOD", "", highPtMask, psFlag, "ANTIKT",
503  0.2, 0 , 1, jetAOD, 0.15);
504  taskCl->SetCentralityCut(fCenLo,fCenUp);
505  if(grp->IsAA())taskCl->SetBackgroundBranch(bkgBranch);
506 
507  subtractBranches += Form("%s ",taskCl->GetJetOutputBranch());
508 
509  // DO THE BACKGROUND SUBTRACTION
510  if(grp->IsAA() && !subtractBranches.IsNull()) {
511  gROOT->LoadMacro(pwgje+"/macros/AddTaskJetBackgroundSubtract.C");
512  AliAnalysisTaskJetBackgroundSubtract *taskSubtract = 0;
513  taskSubtract = AddTaskJetBackgroundSubtract(subtractBranches,1,
514  "B0","B%d");
515  taskSubtract->SetBackgroundBranch(bkgBranch);
516  if(!jetAOD.IsNull()) taskSubtract->SetNonStdOutputFile(jetAOD.Data());
517  }
518  }
519 #endif
520  }
521 }
522 
523 
524 
525 //====================================================================
533 {
534  // Create the input chain
535  chain = new TChain("esdTree");
536  if (gSystem->AccessPathName("AliESDs.root"))
537  ::Error("AnalysisTrainNew.C::CreateChain",
538  "File: AliESDs.root not in ./data dir");
539  else
540  chain->Add("AliESDs.root");
541  if (chain->GetNtrees()) return chain;
542  return NULL;
543 }
544 
550 {
551  std::ofstream out;
552  out.open("outputs_valid", ios::out);
553  out.close();
554 }
555 //====================================================================
562 void AODMerge(const char* dir, Int_t stage)
563 {
564  // Merging method. No staging and no terminate phase.
565  TStopwatch timer; timer.Start();
566  TString outputDir = dir;
567  TObjArray outputFiles;
568  // outputFiles.Add(new TObjString("EventStat_temp.root"));
569  outputFiles.Add(new TObjString("AODQA.root"));
570  outputFiles.Add(new TObjString("pyxsec_hists.root"));
571 
572  Bool_t mergeTrees = stage <= 1;
573  if (mergeTrees) {
574  outputFiles.Add(new TObjString("AliAOD.root"));
575  if (aodCfg->UsePWGHFvertexing())
576  outputFiles.Add(new TObjString("AliAOD.VertexingHF.root"));
577  if (aodCfg->UseESDfilter() &&
578  aodCfg->UseMUONcopyAOD() &&
579  detCfg->UseMUON())
580  outputFiles.Add(new TObjString("AliAOD.Muons.root"));
581  if (aodCfg->UseJETAN())
582  outputFiles.Add(new TObjString("AliAOD.Jets.root"));
583  if (aodCfg->UsePWGDQJPSIfilter())
584  outputFiles.Add(new TObjString("AliAOD.Dielectron.root"));
585  }
586 
587  TString mergeExcludes = "";
588  TIter iter(&outputFiles);
589  TObjString* str = 0;
590  Bool_t merged = kTRUE;
591  while ((str = static_cast<TObjString*>(iter()))) {
592  TString& outputFile = str->GetString();
593  // Skip already merged outputs
594  if (!gSystem->AccessPathName(outputFile)) {
595  ::Warning("Merge","Output file <%s> found. Not merging again.",
596  outputFile.Data());
597  continue;
598  }
599  if (mergeExcludes.Contains(outputFile.Data())) continue;
600  merged = AliAnalysisAlien::MergeOutput(outputFile,
601  outputDir,
602  10,
603  stage);
604  if (!merged) {
605  ::Error("Merge", "Cannot merge %s\n", outputFile.Data());
606  continue;
607  }
608  }
609 
610  // all outputs merged, validate
611  if (!outputDir.Contains("stage")) {
612  ValidateOutput();
613  timer.Print();
614  return;
615  }
616 
617  // --- set up to run terminate -------------------------------------
618  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
619  mgr->SetSkipTerminate(kFALSE);
620  if (!mgr->InitAnalysis()) return;
621 
622  mgr->PrintStatus();
623  mgr->SetGridHandler(new AliAnalysisAlien);
624  mgr->StartAnalysis("gridterminate",0);
625  ValidateOutput();
626  timer.Print();
627 
628 }
629 
630 //====================================================================
638 void AOD(UInt_t run, const char* xmlfile=0, Int_t stage=0)
639 {
640  TString host(gSystem->HostName());
641  cholm = host.BeginsWith("hehi");
642  if (cholm) TGrid::Connect("alien:");
643 
644  // -----------------------------------------------------------------
645  //
646  // Get GRP parameters. Defines global "grp" as a pointer to GRPData
647  //
648  gROOT->Macro(Form("GRP.C(%d)", run));
649  gROOT->Macro("AODConfig.C");
650  gROOT->Macro("BaseConfig.C");
651  gROOT->Macro("DetConfig.C");
652 
653  // --- Some settings -----------------------------------------------
654  // Set temporary merging directory to current one
655  gSystem->Setenv("TMPDIR", gSystem->pwd());
656  // Set temporary compilation directory to current one
657  gSystem->SetBuildDir(gSystem->pwd(), kTRUE);
658 
659  // --- Friendly message --------------------------------------------
660  printf("===================================================\n");
661  printf("=========== RUNNING FILTERING TRAIN ==========\n");
662  printf("===================================================\n");
663  printf("= Configuring analysis train for:\n");
664  aodCfg->Print();
665 
666  // Load common libraries and set include path
667  if (!LoadCommonLibraries()) {
668  ::Error("AnalysisTrain", "Could not load common libraries");
669  return;
670  }
671 
672  // === Make the analysis manager and connect event handlers ========
673  //
674  // --- Analysis manager and load libraries -------------------------
675  AliAnalysisManager *mgr = new AliAnalysisManager("Filter","Production train");
676  mgr->SetRunFromPath(grp->run);
677  if (aodCfg->UseSysInfo()) mgr->SetNSysInfo(100);
678  if (!LoadAnalysisLibraries()) {
679  ::Error("AnalysisTrain", "Could not load analysis libraries");
680  return;
681  }
682 
683  // --- Create ESD input handler ------------------------------------
684  AliESDInputHandler *esdHandler = new AliESDInputHandler();
685  mgr->SetInputEventHandler(esdHandler);
686 
687  // --- Monte Carlo handler -----------------------------------------
688  if (aodCfg->UseMC()) {
689  AliMCEventHandler* mcHandler = new AliMCEventHandler();
690  mgr->SetMCtruthEventHandler(mcHandler);
691  mcHandler->SetPreReadMode(1);
692  mcHandler->SetReadTR(aodCfg->UseTR());
693  }
694 
695  // --- AOD output handler ------------------------------------------
696  if (aodCfg->UseAODhandler()) {
697  AliAODHandler* aodHandler = new AliAODHandler();
698  aodHandler->SetOutputFileName("AliAOD.root");
699  mgr->SetOutputEventHandler(aodHandler);
700  }
701 
702  // === Set up tasks ================================================
703  //
704  // --- Create tasks ------------------------------------------------
706 
707  // --- Debugging if needed -----------------------------------------
708  if (aodCfg->UseDBG()) mgr->SetDebugLevel(3);
709 
710 
711  // --- If merging, do so here and exit -----------------------------
712  if (stage > 0) {
713  AODMerge(xmlfile, stage);
714  return;
715  }
716  // === Run the analysis ============================================
717  //
718  // --- Make our chain ----------------------------------------------
719  TChain *chain = CreateChain();
720  if (!chain) return;
721 
722  // --- Run the thing -----------------------------------------------
723  TStopwatch timer;
724  timer.Start();
725  if (!mgr->InitAnalysis()) return;
726 
727 
728  mgr->PrintStatus();
729  mgr->SetSkipTerminate(kTRUE);
730  mgr->StartAnalysis("local", chain);
731  timer.Print();
732 }
733 
734 //
735 // EOF
736 //
737 
UInt_t run
Definition: GRP.C:102
void AODMerge(const char *dir, Int_t stage)
Definition: AOD.C:562
AliAnalysisTask * AddTaskForwardMult(Bool_t mc, ULong_t runNo=0, UShort_t sys=0, UShort_t sNN=0, Short_t field=0, const char *config="ForwardAODConfig.C", const char *corrs=0, const char *dead=0)
virtual Bool_t UseCentrality() const =0
AliAnalysisTaskSEVertexingHF * AddTaskVertexingHF(Int_t collisionSystem, TString localdir="", TString configfilename="", Int_t runnumber=-1, TString strPeriod="", const char *fname="AliAOD.VertexingHF.root")
virtual Bool_t UsePWGHFvertexing() const =0
const char * title
Definition: MakeQAPdf.C:27
virtual Bool_t UseTender() const =0
virtual Bool_t UsePIDResponse() const =0
UInt_t Year() const
Definition: GRP.C:196
Bool_t LoadAnalysisLibraries()
Definition: AOD.C:233
const char * cdbPath
Definition: AOD.C:26
virtual Bool_t UseV0tender() const =0
TSystem * gSystem
virtual Bool_t UsePWGHFd2h() const =0
virtual Bool_t UseSysInfo() const =0
virtual Bool_t UseTR() const =0
void ana(anaModes mode=mLocal)
Definition: ana.C:986
virtual Bool_t UsePWGMuonTrain() const =0
virtual Bool_t UseCDBconnect() const =0
virtual Bool_t UseFMD() const
Definition: BaseConfig.C:21
Int_t AddD2HTrain(Bool_t readMC=kTRUE, Int_t addQA=1, Int_t addD0Mass=1, Int_t addD0MassLS=1, Int_t addDplus=1, Int_t addLSD0=0, Int_t addCFD0=0, Int_t addPromptD0=1, Int_t addDs=0, Int_t addDStar=1, Int_t addDStarJets=0, Int_t addCFDStar=0)
Definition: AddD2HTrain.C:1
TChain * CreateChain()
Definition: AOD.C:532
virtual Bool_t UseESDfilter() const =0
virtual Bool_t UseMUONcopyAOD() const =0
virtual Bool_t UseMC() const =0
virtual Bool_t UseMUON() const
Definition: BaseConfig.C:26
Bool_t IsAA() const
Definition: GRP.C:159
int Int_t
Definition: External.C:63
unsigned int UInt_t
Definition: External.C:33
float Float_t
Definition: External.C:68
void AddAnalysisTasks(const char *cdb_location)
Definition: AOD.C:280
Bool_t cholm
Definition: AOD.C:27
virtual Bool_t UseAODhandler() const =0
virtual Bool_t UseCORRFW() const =0
void ValidateOutput()
Definition: AOD.C:549
void AOD(UInt_t run, const char *xmlfile=0, Int_t stage=0)
Definition: AOD.C:638
virtual void PrintOne(const char *title, Bool_t use) const
Definition: AOD.C:99
virtual Bool_t UseKFILTER() const =0
GRPData * grp
Definition: GRP.C:361
Bool_t IsPP() const
Definition: GRP.C:141
Bool_t LoadCommonLibraries()
Definition: AOD.C:193
VirtualDetCfg * detCfg
Definition: BaseConfig.C:139
virtual Bool_t UseDBG() const =0
virtual Bool_t UsePWGLFForward() const =0
Bool_t LoadLibrary(const char *module)
Definition: AOD.C:144
bool Bool_t
Definition: External.C:53
AliAnalysisTask * AddTaskCentralMult(Bool_t mc=false, ULong_t runNo=0, UShort_t sys=0, UShort_t sNN=0, Short_t field=0, const char *config="CentralAODConfig.C", const char *corrs=0)
virtual Bool_t UsePWGDQJPSIfilter() const =0
virtual Bool_t UseJETAN() const =0
virtual void Print() const
Definition: AOD.C:107
virtual Bool_t UsePhysicsSelection() const =0
VirtualAODCfg * aodCfg
Definition: AOD.C:134
virtual Bool_t UseAODTAGS() const =0
virtual Bool_t UseJETANdelta() const =0
TDirectoryFile * dir