AliPhysics  068200c (068200c)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrainSetup.C
Go to the documentation of this file.
1 
16 #ifndef TRAINSETUP_C
17 #define TRAINSETUP_C
18 #ifndef __CINT__
19 # include "Railway.C"
20 # include "Option.C"
21 # include <TDatime.h>
22 # include <TUrl.h>
23 # include <TString.h>
24 # include <TApplication.h>
25 # include <TStopwatch.h>
26 # include <AliAnalysisManager.h>
27 # include <AliVEvent.h>
28 # include <AliVEventHandler.h>
29 # include <AliPhysicsSelection.h>
30 # include <AliPhysicsSelectionTask.h>
31 # include <AliCentralitySelectionTask.h>
32 # include <AliESDInputHandler.h>
33 # include <AliESDInputHandlerRP.h>
34 # include <AliAODInputHandler.h>
35 # include <AliAODHandler.h>
36 # include <AliMCEventHandler.h>
37 # include <ctime>
38 #else
39 struct Railway;
40 struct OptionList;
41 class TDatime;
42 class TUrl;
43 class TString;
44 class TStopwatch;
45 class AliVEventHandler;
46 class AliAnalysisManager;
47 class AliInputEventHandler;
48 #endif
49 class AliAnalysisTask;
50 
51 //====================================================================
60 struct TrainSetup
61 {
65  enum {
67  };
73  TrainSetup(const TString& name)
74  : fName(name),
75  fEscapedName(name),
76  fDatimeString(""),
77  fOptions(),
78  fRailway(0)
79  {
80  fOptions.Add("help", "Show help", false);
81  fOptions.Add("date", "YYYY-MM-DD HH:MM", "Set date", "now");
82  fOptions.Add("ps", "MODE", "Physics selection mode", "");
83  fOptions.Add("verbose", "LEVEL", "Set verbosity level", 0);
84  fOptions.Add("url", "URL", "Job location & input URL","");
85  fOptions.Add("overwrite","Allow overwrite", false);
86  fOptions.Add("events", "N", "Number of events to analyse",-1);
87  fOptions.Add("type", "ESD|AOD|USER", "Input data stype", "");
88  fOptions.Add("setup", "Only do the setup", false);
89  fOptions.Add("branches", "Load only requested branches", false);
90  fOptions.Add("version", "Print version and exit", false);
91  fOptions.Add("tender", "WHICH", "Specify tender supplies","");
92  fOptions.Add("ocdb", "(TENDER_SNAPSHOT)","Enable OCDB", "");
93  fOptions.Add("friends","(AOD_FRIENDS)","Enable friends (list of files)","");
94  fOptions.Add("cent-oadb","PERIOD","Alternative OADB for centrality","");
95  fOptions.Add("no-link", "Do not make symlink to output", false);
96  fOptions.Add("old-cent", "Add old centrality task to train", false);
97  fOptions.Add("aod-cent", "Recalculate centrality in AODs", false);
98  fDatimeString = "";
100  }
107  : fName(o.fName),
110  fOptions(o.fOptions),
111  fRailway(o.fRailway)
112  {}
121  {
122  if (&o == this) return *this;
123  fName = o.fName;
126  fOptions = o.fOptions;
127  fRailway = o.fRailway;
128  return *this;
129  }
130 
134  virtual ~TrainSetup() {}
135  /* @} */
136  //__________________________________________________________________
147  {
148  // --- Print the version number ----------------------------------
149  Info("Init", "Running with TrainSetup version %d", kVersion);
150 
151  // --- Create the helper -----------------------------------------
152  TString url = fOptions.Get("url");
153  Int_t verbose = fOptions.AsInt("verbose");
154 
155  fRailway = Railway::Create(url.Data(), verbose);
156  if (!fRailway) {
157  Error("Init", "Failed to make the worker for URL %s", url.Data());
158  return false;
159  }
160 
161  // --- Check the type, if possible -------------------------------
162  UShort_t type = fRailway->InputType();
163  Bool_t mc = fRailway->IsMC();
164  if (fOptions.Has("type")) {
165  const TString& it = fOptions.Get("type");
166  if (it.EqualTo("ESD",TString::kIgnoreCase)) type = Railway::kESD;
167  else if (it.EqualTo("AOD",TString::kIgnoreCase)) type = Railway::kAOD;
168  else if (it.EqualTo("user",TString::kIgnoreCase))
169  type = Railway::kUser;
170  }
171 
172  // --- Rewrite the escpaed name ----------------------------------
173  if (fOptions.Has("date")) {
174  fDatimeString = fOptions.Get("date");
176  }
177 
178  // --- Get current directory and set-up sub-directory ------------
179  TString cwd = gSystem->WorkingDirectory();
180  if (!SetupWorkingDirectory()) return false;
181 
182  // --- Do initial helper setup -----------------------------------
183  if (!fRailway->PreSetup()) return false;
184 
185  // --- Load ROOT libraries ---------------------------------------
186  if (!fRailway->LoadROOT()) return false;
187 
188  // --- Load AliROOT libraries ------------------------------------
189  if (!fRailway->LoadAliROOT()) return false;
190 
191  // --- Load AliROOT libraries ------------------------------------
192  if (!fRailway->LoadAliPhysics()) return false;
193 
194  // --- Create analysis manager -----------------------------------
196 
197  // In test mode, collect system information on every event
198  // if (oper == kTest) mgr->SetNSysInfo(1);
199  if (verbose > 0) mgr->SetDebugLevel(verbose);
200  mgr->SetAutoBranchLoading(!fOptions.Has("branches"));
201  if (fRailway->Mode() == Railway::kLocal)
202  mgr->SetUseProgressBar(kTRUE, 100);
203 
204  // --- ESD input handler ------------------------------------------
205  AliVEventHandler* inputHandler = CreateInputHandler(type);
206  if (inputHandler) mgr->SetInputEventHandler(inputHandler);
207 
208  // --- Monte-Carlo ------------------------------------------------
209  AliVEventHandler* mcHandler = CreateMCHandler(type,mc);
210  if (mcHandler) mgr->SetMCtruthEventHandler(mcHandler);
211 
212  // --- AOD output handler -----------------------------------------
213  AliVEventHandler* outputHandler = CreateOutputHandler(type);
214  if (outputHandler) mgr->SetOutputEventHandler(outputHandler);
215 
216  // --- Include analysis macro path in search path ----------------
217  gROOT->SetMacroPath(Form("%s:%s:$ALICE_ROOT/ANALYSIS/macros:"
218  "$ALICE_PHYSICS/OADB/macros",
219  cwd.Data(), gROOT->GetMacroPath()));
220 
221  // --- Tender/OCDB -----------------------------------------------
222  if (type == Railway::kESD) {
223  TString supplies = fOptions.Get("tender");
224  if (!supplies.IsNull()) {
225  AddTender(supplies);
226  }
227  else if (fOptions.AsBool("ocdb")) {
228  AddOCDBConnect();
229  }
230  }
231 
232  // --- Physics selction - only for ESD ---------------------------
233  if (type == Railway::kESD) CreatePhysicsSelection(mc, mgr);
234 
235  // --- Create centrality task ------------------------------------
237 
238  // --- Create tasks ----------------------------------------------
239  CreateTasks(mgr);
240 
241  // --- Create monitor objects ------------------------------------
242  CreateMonitors();
243 
244  // --- Post set-up initialization of helper ----------------------
245  if (!fRailway->PostSetup()) return false;
246 
247  // --- Set debug level on defined tasks --------------------------
248  if (verbose > 0) {
249  TIter next(mgr->GetTasks());
250  AliAnalysisTask* sub = 0;
251  while ((sub = static_cast<AliAnalysisTask*>(next()))) {
252  AliAnalysisTaskSE* se = dynamic_cast<AliAnalysisTaskSE*>(sub);
253  if (!se) continue;
254  se->SetDebugLevel(verbose);
255  }
256  }
257 
258  // --- Print this setup ------------------------------------------
259  Print();
260 
261  // --- Initialise the train --------------------------------------
262  if (!mgr->InitAnalysis()) {
263  gSystem->ChangeDirectory(cwd.Data());
264  Error("Init","Failed to initialise train");
265  return false;
266  }
267 
268  // --- Enable progress bar ---------------------------------------
269  if (fRailway->Mode() != Railway::kGrid)
270  mgr->SetUseProgressBar(true, 100);
271 
272  // --- Save setup to disk ----------------------------------------
273  SaveSetup(true);
274 
275  // --- Some information ------------------------------------------
276  mgr->PrintStatus();
277  if (fRailway->Mode() != Railway::kLocal) {
278  TIter next(mgr->GetTasks());
279  AliAnalysisTask* sub = 0;
280  while ((sub = static_cast<AliAnalysisTask*>(next()))) {
281  sub->Print();
282  }
283  }
284  return true;
285  }
292  void PrintTimer(TStopwatch& timer, const char* where)
293  {
294  timer.Stop();
295  Double_t t = timer.RealTime();
296  Int_t h = Int_t(t / 3600); t -= h * 3600;
297  Int_t m = Int_t(t / 60); t -= m * 60;
298  if (t < 0) t = 0;
299  Info(where, "took %4d:%02d:%06.3f", h, m, t);
300  }
307  {
308  TString cwd = gSystem->WorkingDirectory();
309  Bool_t status = false;
310  TStopwatch timer;
311  timer.Start();
312  try {
313  if (!Init()) throw TString("Failed to intialize the train");
314  PrintTimer(timer, "Initialization");
315  timer.Continue();
316 
317  // Check if we're asked to only do the setup
318  if (fOptions.Has("setup")) {
319  status = true;
320  throw TString("Only did setup, no running");
321  }
322 
323  // if (r) SaveSetup(*r, nEvents, asShell);
324 
325  Long64_t nEvents = fOptions.AsLong("events", -1);
326  Long64_t ret = fRailway->Run(nEvents);
327  PrintTimer(timer, "Processing");
328  timer.Continue();
329 
330  // Make sure we go back
331  gSystem->ChangeDirectory(cwd.Data());
332 
333  // Return.
334  if (ret < 0) throw TString("Analysis failed");
335 
336  status = true;
337  }
338  catch (TString& e) {
339  if (status) Warning("Run", "%s", e.Data());
340  else Error("Run", "%s", e.Data());
341  }
342  if (fOptions.Has("date") &&
343  !fOptions.Get("date").EqualTo("none") &&
344  !fOptions.Has("no-link")) {
345  TString tmp = "";
346  TString escaped = EscapeName(fName, tmp);
347  gSystem->Exec(Form("rm -f last_%s", escaped.Data()));
348  gSystem->Exec(Form("ln -sf %s last_%s",
349  fEscapedName.Data(), escaped.Data()));
350  }
351  PrintTimer(timer, "Finish");
352  timer.Continue();
353  return status;
354  }
361  OptionList& Options() { return fOptions; }
366  void Print(Option_t* ="") const
367  {
368  std::cout << "Train: " << fName << " (" << fEscapedName << ")"
369  << std::endl;
370  fOptions.Show(std::cout);
371  if (fRailway) fRailway->Print();
372  }
380  Bool_t Version(std::ostream& o=std::cout)
381  {
382  if (!fOptions.Has("version")) return true;
383 
384  o << "TrainSetup version " << kVersion << std::endl;
385  return false;
386  }
395  Bool_t Help(std::ostream& o=std::cout, bool asProg=false)
396  {
397  if (!fOptions.Has("help")) return true;
398 
399  if (!asProg)
400  o << "Usage: RunTrain(NAME, CLASS, OPTIONS)";
401 
402  o << "\n\nTrain Options:\n";
403  fOptions.Help(o, asProg ? " --" : " ");
404  o << "\n";
405 
406  if (!fRailway && fOptions.Has("url")) {
407  TString url = fOptions.Get("url");
408  fRailway = Railway::Create(url.Data());
409  }
410  if (fRailway) {
411  o << fRailway->Desc() << " URL form:\n\n"
412  << " " << fRailway->UrlHelp() << "\n\n"
413  << "Options:\n";
414  fRailway->Options().Help(o, " ");
415  o << "\n";
416  }
417  else {
418  o << "Possible URL forms:\n\n";
419  Railway::ShowUrlHelp("LocalRailway");
420  Railway::ShowUrlHelp("ProofRailway");
421  Railway::ShowUrlHelp("LiteRailway");
422  Railway::ShowUrlHelp("VAFRailway");
423  Railway::ShowUrlHelp("AAFRailway");
424  Railway::ShowUrlHelp("AAFPluginRailway");
425  Railway::ShowUrlHelp("GridRailway");
426  o << "\n";
427  }
428  return false;
429  }
443  static Bool_t Main(const TString& name, const TString& cls,
444  const TCollection* opts,
445  Bool_t asProg=true,
446  Bool_t spawn=false)
447  {
448  Bool_t ret = false;
449  try {
450  if (cls.IsNull())
451  throw TString("No class name specified");
452  if (name.IsNull())
453  throw TString("No train name specified");
454  TString mkLib = gSystem->GetMakeSharedLib();
455  mkLib.ReplaceAll("-std=c++14", "-std=c++98");
456  // mkLib.Append("-ffpe-trap=invalid,zero,overflow,underflow,inexact");
457  gSystem->SetMakeSharedLib(mkLib);
458 
459  gROOT->ProcessLine("gSystem->RedirectOutput(\"build.log\",\"w\");");
460  Int_t error = 0;
461  Int_t r1 = gROOT->LoadMacro(Form("%s.C+g", cls.Data()), &error);
462  gROOT->ProcessLine("gSystem->RedirectOutput(0);");
463  if (r1 < 0 || error)
464  throw TString::Format("Failed to load setup %s: %d - see build.log",
465  cls.Data(), error);
466 
467  // Make our object using the interpreter
468  TString create = TString::Format("new %s(\"%s\")",
469  cls.Data(), name.Data());
470  gROOT->ProcessLine("gSystem->RedirectOutput(\"build.log\",\"a\");");
471  Long_t retP = gROOT->ProcessLine(create, &error);
472  gROOT->ProcessLine("gSystem->RedirectOutput(0);");
473  if (!retP || error)
474  throw TString::Format("Failed to make object of class %s "
475  "(see build.log): 0x%08lx/%d\n\t%s",
476  cls.Data(), retP, error, create.Data());
477 
478  TrainSetup* train = reinterpret_cast<TrainSetup*>(retP);
479 
480  // Now parse the options
481  if (!train->Options().Parse(opts))
482  throw TString("Failed to parse options");
483 
484  // Info("", "URL=%s", train->Options().Get("url").Data());
485 
486  // Check if we got a help request
487  if (!train->Help(std::cout, asProg)) {
488  ret = true;
489  throw TString("");
490  }
491  // Check if we got a version request
492  if (!train->Version(std::cout)) {
493  ret = true;
494  throw TString("");
495  }
496 
497  // return train->Init();
498  ret = train->Run();
499  }
500  catch (TString& e) {
501  if (!e.IsNull()) Error("Main", "%s", e.Data());
502  }
503  // Info("Main", "End of main loop (app=%p, asProg=%s, spawn=%s)",
504  // gApplication, asProg ? "true" : "false", spawn ? "true" : "false");
505  if (gApplication && asProg) {
506  if (!spawn) {
507  gSystem->Sleep(3);
508  gApplication->Terminate(ret ? 0 : 1);
509  }
510  }
511  return ret;
512  }
513 protected:
514  //__________________________________________________________________
526  virtual AliAnalysisManager* CreateAnalysisManager(const char* name)
527  {
528  return new AliAnalysisManager(name,"Analysis Train");
529  }
539  virtual AliVEventHandler* CreateInputHandler(UShort_t type,
540  Bool_t esdRecPoints=false)
541  {
542  Info("CreateInputHandler", "Making handler for %d (%d)",
543  type, esdRecPoints);
544  AliVEventHandler* ret = 0;
545  switch (type) {
546  case Railway::kESD: {
547  AliESDInputHandler* input = 0;
548  if (!esdRecPoints) input = new AliESDInputHandler();
549  else {
550  Info("CreateInputHandler", "Special handler for rec-points");
551  AliESDInputHandlerRP* esd = new AliESDInputHandlerRP();
552  // if (fRailway->Mode() != Railway::kGrid)
553  // esd->ReadFromDirectory();
554  input = esd;
555  }
556  input->SetReadFriends(fOptions.AsBool("friends"));
557  ret = input;
558  }
559  break;
560  case Railway::kAOD: {
561  AliAODInputHandler* input = new AliAODInputHandler();
562  TString fr = fOptions.Get("friends");
563  TObjArray* afr = fr.Tokenize(",+:");
564  TObject* ofr = 0;
565  TIter nfr(afr);
566  while ((ofr = nfr())) input->AddFriend(const_cast<char*>(ofr->GetName()));
567  afr->Delete();
568  ret = input;
569  }
570  break;
571  case Railway::kUser: return 0;
572  }
573  // Info("CreateInput", "Returning input handler %p", ret);
574  return ret;
575  }
583  virtual AliVEventHandler* CreateMCHandler(UShort_t /*type*/, bool mc)
584  {
585  if (!mc) return 0;
586  AliMCEventHandler* mcHandler = new AliMCEventHandler();
587  mcHandler->SetReadTR(true);
588  return mcHandler;
589  }
597  virtual AliVEventHandler* CreateOutputHandler(UShort_t type)
598  {
599  AliAODHandler* ret = new AliAODHandler();
600  switch (type) {
601  case Railway::kESD:
602  ret->SetOutputFileName("AliAOD.root");
603  break;
604  case Railway::kAOD:
605  ret->SetOutputFileName("AliAOD.pass2.root");
606  break;
607  case Railway::kUser:
608  break;
609  }
610 
611  return ret;
612  }
695  {
696  TString opt = fOptions.Get("ps");
697  // opt.ToUpper();
698 
699  if (opt.EqualTo("NONE",TString::kIgnoreCase)) return;
700 
701  // Possibly load as PAR
702  LoadOADB();
703 
704  AliPhysicsSelection* ps = 0;
705  AliInputEventHandler* input =
706  dynamic_cast<AliInputEventHandler*> (mgr->GetInputEventHandler());
707  if (!input) return;
708 
709  // --- Create object, either directory or via task ---------------
710  if (opt.Contains("BARE",TString::kIgnoreCase)) {
711  // --- Just create object and set on input handler -------------
712  ps = new AliPhysicsSelection();
713  if (mc) ps->SetAnalyzeMC();
714 
715  input->SetEventSelection(ps);
716  }
717  else {
718  // --- Create and add the task ---------------------------------
719  CoupleSECar("AddTaskPhysicsSelection.C", Form("%d", mc), AliVEvent::kAny);
720  mgr->RegisterExtraFile("event_stat.root");
721  // mgr->AddStatisticsTask(AliVEvent::kAny);
722 
723  // --- Retrive object from input handler -----------------------
724  ps = dynamic_cast<AliPhysicsSelection*>(input->GetEventSelection());
725  }
726  if (opt.Contains("CUSTOM",TString::kIgnoreCase)) {
727  // --- Load custom trigger definitions -------------------------
728  TString macro("CustomPS.C");
729  Int_t eq = opt.Index("custom=",7,0,TString::kIgnoreCase);
730  if (eq != kNPOS) {
731  Int_t end = opt.Index(".C",2,eq+7,TString::kIgnoreCase);
732  if (end != kNPOS) {
733  macro = opt(eq+7,end+2-eq-7);
734  }
735  }
736  fRailway->LoadAux(macro);
737  TString rmacro = gSystem->Which(gROOT->GetMacroPath(), macro);
738  if (rmacro.IsNull()) {
739  Error("CreatePhysicsSelection", "Custom PS script %s not found",
740  macro.Data());
741  return;
742  }
743  Info("CreatePhysicsSelection", "Loading custom PS from %s",rmacro.Data());
744  TString base(gSystem->BaseName(rmacro.Data()));
745  gROOT->Macro(Form("%s((AliPhysicsSelection*)%p)", base.Data(), ps));
746  }
747 
748  if (opt.Contains("ALL",TString::kIgnoreCase)) {
749  // --- Ignore trigger class when selecting events. This means -
750  // --- that we get offline+(A,C,E) events too ------------------
751  Info("CreatePhysicsSelection", "Skipping trigger selection");
752  ps->SetSkipTriggerClassSelection(true);
753  }
754  }
761  {
762  AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
763  AliVEventHandler* inp = mgr->GetInputEventHandler();
764  if (!inp) {
765  Warning("CreateCentralitySelection","No input handler");
766  return;
767  }
768 
769  // Check if input is AOD. Do not add MultSelection task, unless
770  // explicitly stated.
771  Bool_t isAOD = inp->IsA()->InheritsFrom(AliAODInputHandler::Class());
772  if (isAOD && !fOptions.AsBool("aod-cent")) {
773  Info("CreateCentralitySelection","No multiplicity selection for AOD input");
774  return;
775  }
776 
777  // Possibly load as PAR
778  LoadOADB();
779 
780  gROOT->SetMacroPath(Form("$ALICE_PHYSICS/OADB/COMMON/MULTIPLICITY/macros"
781  ":%s", gROOT->GetMacroPath()));
782  AliAnalysisTaskSE* task = CoupleSECar("AddTaskMultSelection.C","false");
783  FromOption(task, "AlternateOADBforEstimators", "cent-oadb", "");
784  if (fOptions.Has("cent-oadb")) {
785  TString centOADB = fOptions.AsString("cent-oadb");
786  if (centOADB.EndsWith(".root")) {
787  TString base(gSystem->BaseName(centOADB.Data()));
788  TString per(base);
789  per.ReplaceAll("OADB-","");
790  per.ReplaceAll(".root","");
791  SetOnTask(task, "AlternateOADBforEstimators", per);
792  fRailway->LoadAux(centOADB);
793  if (mc)
794  SetOnTask(task, "AlternateOADBFullManualBypassMC", base);
795  else
796  SetOnTask(task, "AlternateOADBFullManualBypas", base);
797  }
798  }
799  if (!task->HasBranches()) {
800  // Everything except tracks since that slows does things and is
801  // really only needed for reference multiplicities
802  task->SetBranches("ESD:AliESDRun.,AliESDHeader.,AliESDZDC.,"
803  "AliESDVZERO.,AliESDTZERO.,TPCVertex.,"
804  "SPDVertex.,PrimaryVertex.,AliMultiplicity."
805  "SPDPileupVertices,TrkPileupVertices,"
806  "AliESDAD. "
807  "AOD:header,vertices,AliAODTZERO,AliAODVZERO,"
808  "AliAODZDC,AliAODAD");
809  }
810  if (!fOptions.Has("old-cent")) return;
811  if (isAOD) return;
812 
813  task = CoupleSECar("AddTaskCentrality.C",
814  Form("true,%s", isAOD ? "true" : "false"));
815  AliCentralitySelectionTask* ctask =
816  dynamic_cast<AliCentralitySelectionTask*>(task);
817  if (!ctask) return;
818  if (mc) ctask->SetMCInput();
819  }
825  virtual void CreateTasks(AliAnalysisManager* mgr)=0;
826  /* @} */
827  // -----------------------------------------------------------------
840  virtual AliAnalysisTask* CoupleCar(const TString& macro,
841  const TString& args)
842  {
843  TString p = gSystem->Which(gROOT->GetMacroPath(), macro.Data());
844  if (p.IsNull()) {
845  Error("CoupleCar", "Macro %s not found", macro.Data());
846  return 0;
847  }
848  TString cmd(p);
849  if (!args.IsNull())
850  cmd.Append(TString::Format("(%s)", args.Data()));
851  Info("CoupleCar", "Execute %s", cmd.Data());
852  Int_t err;
853  Long_t ret = gROOT->Macro(cmd.Data(), &err, false);
854  if (!ret) {
855  Error("CoupleCar", "Failed to execute %s (%ld)", cmd.Data(), ret);
856  return 0;
857  }
858  return reinterpret_cast<AliAnalysisTask*>(ret);
859  }
867  virtual AliAnalysisTask* CoupleCar(const TString& macro)
868  {
869  TString args;
870  return CoupleCar(macro, args);
871  }
882  virtual AliAnalysisTaskSE* CoupleSECar(const TString& macro,
883  const TString& args,
884  UInt_t mask=0)
885  {
886  AliAnalysisTaskSE* task =
887  dynamic_cast<AliAnalysisTaskSE*>(CoupleCar(macro, args));
888  // Explicitly set mask
889  if (mask > 0) task->SelectCollisionCandidates(mask);
890  return task;
891  }
901  virtual AliAnalysisTaskSE* CoupleSECar(const TString& macro,
902  UInt_t mask=0)
903  {
904  TString args;
905  return CoupleSECar(macro, args, mask);
906  }
915  virtual AliAnalysisTask* FindCar(const TString& name,
916  Bool_t verbose=true) const
917  {
918  AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
919  if (!mgr) {
920  ::Warning("FindCar", "No manager defined");
921  return 0;
922  }
923  AliAnalysisTask* task = mgr->GetTask(name);
924  if (!task && verbose)
925  ::Warning("FindCar", "Task \"%s\" not found in train",
926  name.Data());
927  return task;
928  }
934  void LoadOADB(Bool_t asPar=false)
935  {
936  Bool_t usePar = asPar;
937  fRailway->UsePar(usePar); // Disabled pars temporarily
938  fRailway->LoadLibrary("OADB");
939  fRailway->UsePar(usePar); // Set to old value
940  }
941  /* @} */
946  virtual void AddOCDBConnect()
947  {
948  fRailway->LoadLibrary("PWGPP");
949  Long_t ret = gROOT->ProcessLine("new AliTaskCDBconnect(\"cdb\")");
950  if (!ret) {
951  Fatal("AddOCDBConnect", "Failed to add OCDB connection task");
952  return;
953  }
954  AliAnalysisTask* task = reinterpret_cast<AliAnalysisTask*>(ret);
955  if (!task->HasBranches()) task->SetBranches("ESD:AliESDRun. AOD:header");
956  AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
957 
958  mgr->AddTask(task);
959  mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
960  }
964  enum {
965  kTenderV0 = 0x0001,
966  kTenderTPC = 0x0002,
967  kTenderPtFix = 0x0004,
968  kTenderT0 = 0x0008,
969  kTenderTOF = 0x0010,
970  kTenderTRD = 0x0020,
971  kTenderVTX = 0x0040,
972  kTenderEMCAL = 0x0080,
973  kTenderPID = 0x0100,
974  kTenderHMPID = 0x0200,
975  kTenderPHOS = 0x0400
976  };
986  virtual void* AddTenderSupply(void* tender,
987  UShort_t flag,
988  Int_t debug)
989  {
990  if (flag == 0) return 0;
991 
992  TString c;
993  TString n;
994  switch (flag) {
995  case kTenderV0: n = "VZERO"; c = "VZERO"; break;
996  case kTenderTPC: n = "TPC"; c = "TPC"; break;
997  case kTenderPtFix: n = "TrackFix"; c = "PtInvFix"; break;
998  case kTenderT0: n = "T0"; c = "TZERO"; break;
999  case kTenderTOF: n = "TOF"; c = "TOF"; break;
1000  case kTenderTRD: n = "TRD"; c = "TRD"; break;
1001  case kTenderVTX: n = "Vtx"; c = "IP"; break;
1002  case kTenderEMCAL: n = "EMCAL"; c = "EMCAL"; break;
1003  case kTenderPID: n = "PID"; c = "PID"; break;
1004  case kTenderHMPID: n = "HMPID"; c = "HMPID"; break;
1005  case kTenderPHOS: n = "PHOS"; c = "PHOS"; break;
1006  default:
1007  Warning("AddTenderSupply", "Unknown tender flag: 0x%08x", flag);
1008  return 0;
1009  }
1010  TString m;
1011  switch (flag) {
1012  case kTenderV0: m = Form("s->SetDebug(%d);", debug); break;
1013  case kTenderEMCAL: // Fall through
1014  case kTenderTOF: // Fall through
1015  case kTenderTPC: // Fall through
1016  case kTenderPtFix: // Fall through
1017  case kTenderTRD: m = Form("s->SetDebugLevel(%d);", debug); break;
1018  }
1019 
1020  TString cls(Form("Ali%sTenderSupply", c.Data()));
1021  Long_t ret =
1022  gROOT->ProcessLine(Form("{ %s* s = new %s(\"%s\");"
1023  "((AliTender*)%p)->AddSupply(s);%s"
1024  "} s;",
1025  cls.Data(),
1026  cls.Data(),
1027  n.Data(),
1028  tender,
1029  m.Data()));
1030  void* ptr = reinterpret_cast<void*>(ret);
1031  Info("AddTenderSupply", "Adding supply %s (an %s object): %p",
1032  n.Data(), cls.Data(), ptr);
1033  return ptr;
1034  }
1039  virtual void AddTender(const TString& sup)
1040  {
1041  TString supplies = sup;
1042 
1043  UShort_t which = 0;
1044  supplies.ToUpper();
1045  if (supplies.Contains("V0") ||
1046  supplies.Contains("VZERO")) which |= kTenderV0 ;
1047  if (supplies.Contains("TPC")) which |= kTenderTPC ;
1048  if (supplies.Contains("PTFIX")) which |= kTenderPtFix ;
1049  if (supplies.Contains("T0")) which |= kTenderT0 ;
1050  if (supplies.Contains("TOF")) which |= kTenderTOF ;
1051  if (supplies.Contains("TRD")) which |= kTenderTRD ;
1052  if (supplies.Contains("VTX")) which |= kTenderVTX ;
1053  if (supplies.Contains("EMCAL")) which |= kTenderEMCAL ;
1054  if (supplies.Contains("PID")) which |= kTenderPID ;
1055 
1056  AddTender(which);
1057  }
1063  virtual void AddTender(UShort_t which)
1064  {
1065  if (which == 0) return;
1066 
1067  Int_t vrb = fOptions.AsInt("verbose", 3);
1068 
1069  fRailway->LoadLibrary("Tender");
1070  fRailway->LoadLibrary("TenderSupplies");
1071 
1072  Long_t ret = gROOT->ProcessLine("new AliTender(\"Tender\")");
1073  if (!ret) {
1074  Warning("AddTender", "Failed to make tender");
1075  return;
1076  }
1077  void* tender = reinterpret_cast<void*>(ret);
1078  gROOT->ProcessLine(Form("((AliTender*)%p)->SetCheckEventSelection(%d)",
1079  tender, (which & kTenderV0)));
1080  gROOT->ProcessLine(Form("((AliTender*)%p)->SetDebugLevel(%d)",
1081  tender, vrb));
1082 
1083  // OCDB settings for tender
1084  TString ocdb = fOptions.Get("ocdb");
1085  if (ocdb.IsNull())
1086  ocdb = "raw://";
1087  else if (ocdb.EndsWith(".root")) {
1088  fRailway->LoadLibrary("CDB");
1089  fRailway->LoadAux(ocdb);
1090  gROOT->ProcessLine(Form("AliCDBManager::Instance()->"
1091  "SetSnapshotMode(\"%s\");",
1092  ocdb.Data()));
1093  ocdb = "raw://";
1094  }
1095  gROOT->ProcessLine(Form("((AliTender*)%p)->SetDefaultCDBStorage(\"%s\")",
1096  tender, ocdb.Data()));
1097 
1098  AddTenderSupply(tender, which & kTenderV0, vrb);
1099  AddTenderSupply(tender, which & kTenderTPC, vrb);
1100  AddTenderSupply(tender, which & kTenderPtFix, vrb);
1101  AddTenderSupply(tender, which & kTenderT0, vrb);
1102  AddTenderSupply(tender, which & kTenderTOF, vrb);
1103  AddTenderSupply(tender, which & kTenderTRD, vrb);
1104  AddTenderSupply(tender, which & kTenderVTX, vrb);
1105  AddTenderSupply(tender, which & kTenderEMCAL, vrb);
1106  AddTenderSupply(tender, which & kTenderPID, vrb);
1107 
1108  gROOT->ProcessLine(Form("((AliTender*)%p)->GetSupplies()->Print()",tender));
1109 
1110  AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
1111  AliAnalysisTask* tsk = reinterpret_cast<AliAnalysisTask*>(tender);
1112  mgr->AddTask(tsk);
1113  AliAnalysisDataContainer* cnt =
1114  mgr->CreateContainer("tender_event",
1115  AliESDEvent::Class(),
1116  AliAnalysisManager::kExchangeContainer,
1117  "default_tender");
1118  mgr->ConnectInput (tsk, 0, mgr->GetCommonInputContainer());
1119  mgr->ConnectOutput(tsk, 1, cnt);
1120 
1121  }
1122  /* @} */
1123  //------------------------------------------------------------------
1136  const char* what,
1137  UInt_t val)
1138  {
1139  SetOnTaskGeneric(task, what, Form("%u", val));
1140  }
1149  const char* what,
1150  Int_t val)
1151  {
1152  SetOnTaskGeneric(task, what, Form("%d", val));
1153  }
1162  const char* what,
1163  Long64_t val)
1164  {
1165  SetOnTaskGeneric(task, what, Form("%lld", val));
1166  }
1175  const char* what,
1176  Double_t val)
1177  {
1178  SetOnTaskGeneric(task, what, Form("%lg", val));
1179  }
1188  const char* what,
1189  Bool_t val)
1190  {
1191  SetOnTaskGeneric(task, what, Form("%d", val));
1192  }
1201  const char* what,
1202  const char* val)
1203  {
1204  SetOnTaskGeneric(task, what, Form("\"%s\"", val));
1205  }
1214  const char* what,
1215  const char* val)
1216  {
1217  const char* cls = task->ClassName();
1218  // Info("SetOnTask", "((%s)*%p)->Set%s(%s)", cls, task, what, val);
1219  gROOT->ProcessLine(Form("((%s*)%p)->Set%s(%s)",cls,task,what,val));
1220  }
1221  /* @} */
1222  //------------------------------------------------------------------
1236  const char* what,
1237  const char* opt,
1238  Double_t defval)
1239  {
1240  Double_t val = fOptions.AsDouble(opt,defval);;
1241  // Info("FromOption<D>"," %p, %s, %s, %f", task, what, opt, val);
1242  SetOnTask(task, what, val);
1243  }
1252  const char* what,
1253  const char* opt,
1254  Bool_t /*defval*/)
1255  {
1256  Bool_t val = fOptions.AsBool(opt);;
1257  // Info("FromOption<B>"," %p, %s, %s, %d", task, what, opt, val);
1258  SetOnTask(task, what, val);
1259  }
1269  const char* what,
1270  const char* opt,
1271  const char* defval)
1272  {
1273  TString val = fOptions.AsString(opt,defval);
1274  // Info("FromOption<S>"," %p, %s, %s, %s", task, what, opt, val);
1275  SetOnTask(task, what, val.Data());
1276  }
1286  const char* what,
1287  const char* opt,
1288  Int_t defval)
1289  {
1290  Int_t val = fOptions.AsInt(opt, defval);
1291  // Info("FromOption<I>"," %p, %s, %s, %d", task, what, opt, val);
1292  SetOnTask(task, what, val);
1293  }
1303  const char* what,
1304  const char* opt,
1305  Long64_t defval)
1306  {
1307  Long64_t val = fOptions.AsLong(opt, defval);
1308  // Info("FromOption<L>"," %p, %s, %s, %lld", task, what, opt, val);
1309  SetOnTask(task, what, val);
1310  }
1311  /* @} */
1312 
1313  // -----------------------------------------------------------------
1324  virtual Bool_t HasMCHandler() const
1325  {
1326  AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
1327  if (!mgr) return false;
1328  return mgr->GetMCtruthEventHandler() != 0;
1329  }
1330  /* @} */
1337  virtual const Char_t* ClassName() const = 0;
1338  /* @} */
1339  //__________________________________________________________________
1340  virtual void AddMonitor(const TString& name)
1341  {
1342  if (fRailway->Mode() != Railway::kProof) return;
1343  Warning("CreateMonitors", "Monitoring not supported yet (%s)", name.Data());
1344  }
1345  //__________________________________________________________________
1350  virtual void CreateMonitors()
1351  {
1352  }
1353  //__________________________________________________________________
1366  static TString EscapeName(const char* name, TString& datimeStr)
1367  {
1368  TString escaped = name;
1369  char c[] = { ' ', '/', '@', 0 };
1370  char* p = c;
1371  while (*p) {
1372  char tmp[] = { *p, '\0' };
1373  escaped.ReplaceAll(tmp, "_");
1374  p++;
1375  }
1376  if (!datimeStr.IsNull() &&
1377  !datimeStr.EqualTo("none", TString::kIgnoreCase)) {
1378  TDatime datime;
1379  if (datimeStr.EqualTo("now", TString::kIgnoreCase))
1380  datime.Set();
1381  else {
1382  // Try various formats
1383  struct tm t;
1384  const char* formats[] = { "%Ec", // Locale
1385  "%c", // Locale
1386  "%Ex EX", // Locale
1387  "%x %X", // Locale
1388  "%Y%m%d_%H%M", // YYYYMMDD_HHMM
1389  "%F %R", // ISO standard, no seconds
1390  0 };
1391  const char** f = formats;
1392  Bool_t found = false;
1393  while (*f && !found) {
1394  // Reset needed fields
1395  t.tm_year = 0;
1396  t.tm_mon = 0;
1397  t.tm_mday = 0;
1398  t.tm_hour = 0;
1399  t.tm_min = 0;
1400  // Stop processing on first match
1401  if (strptime(datimeStr.Data(), *f, &t) != 0) found = true;
1402  f++;
1403  }
1404  if (found) {
1405  t.tm_mon += 1; // Return 0-based month
1406  datime.Set(t.tm_year, t.tm_mon, t.tm_mday, t.tm_hour, t.tm_min, 0);
1407  }
1408  }
1409  if (datime.GetYear() <= 1995 ||
1410  datime.GetMonth() == 0 ||
1411  datime.GetDay() == 0) return escaped;
1412  datimeStr = Form("%04d%02d%02d_%02d%02d",
1413  datime.GetYear(),
1414  datime.GetMonth(),
1415  datime.GetDay(),
1416  datime.GetHour(),
1417  datime.GetMinute());
1418  escaped.Append(Form("_%s", datimeStr.Data()));
1419  }
1420  return escaped;
1421  }
1428  {
1429  // Get the name of the target directory
1430  TString& nam = fEscapedName;
1431 
1432  // Check if the directory exists already
1433  Bool_t exists = gSystem->AccessPathName(nam.Data()) == 0;
1434  if (fRailway->Operation() == Railway::kTerminate && !exists) {
1435  Error("SetupWorkingDirectory", "File/directory %s does not exists",
1436  nam.Data());
1437  return false;
1438  }
1439 
1440  Bool_t overwrite = fOptions.Has("overwrite");
1441  // If we're not allowed to overwrite, then complain
1442  if (!overwrite && exists) {
1443  Error("SetupWorkingDirectory", "File/directory %s already exists",
1444  nam.Data());
1445  return false;
1446  }
1447 
1448  // Make the target directory if it doesn't exists
1449  if (!exists) {
1450  if (gSystem->MakeDirectory(nam.Data())) {
1451  Error("SetupWorkingDirectory", "Failed to make directory '%s'",
1452  nam.Data());
1453  return false;
1454  }
1455  }
1456 
1457  // Change directory to target directory
1458  if (!gSystem->ChangeDirectory(nam.Data())) {
1459  Error("SetupWorkingDirectory", "Failed to change directory to %s",
1460  nam.Data());
1461  return false;
1462  }
1463  // Info("SetupWorkingDirectory", "Made subdirectory %s, and cd'ed there",
1464  // nam.Data());
1465  return true;
1466  }
1467  /* @} */
1468  // -----------------------------------------------------------------
1478  virtual void SaveSetup(Bool_t asShellScript)
1479  {
1480  OptionList tmp(fOptions);
1481  const OptionList* uopts = (fRailway ? &fRailway->Options() : 0);
1482  if (tmp.Find("overwrite")) tmp.Set("overwrite");
1483  if (tmp.Find("date") && fEscapedName.Length() > fName.Length()+1) {
1484  Int_t n = fName.Length()+1;
1485  tmp.Set("date", fEscapedName(n, fEscapedName.Length()-n));
1486  }
1487  if (asShellScript)
1488  SaveSetupShell("rerun", ClassName(), fName, tmp, uopts);
1489  SaveSetupROOT("ReRun", ClassName(), fName, tmp, uopts);
1490  if (fRailway) fRailway->AuxSave(fEscapedName, asShellScript);
1492  }
1502  static void SaveSetupShell(const TString& out, const TString& cls,
1503  const TString& name, const OptionList& opts,
1504  const OptionList* uopts)
1505  {
1506  std::ofstream o(Form("%s.sh", out.Data()));
1507  TString url = opts.Get("url");
1508  OptionList tmp(opts);
1509  tmp.Set("url", "${url}");
1510  o << "#!/bin/bash\n\n"
1511  << "class=\"" << cls << "\"\n"
1512  << "name=\"" << name << "\"\n"
1513  << "url=\"" << url << "\"\n\n"
1514  << "# Available options\n"
1515  << "# \n";
1516  tmp.Help(o, "# --");
1517  if (uopts) {
1518  o << "#\n"
1519  << "# Available URI options\n"
1520  << "# \n";
1521  uopts->Help(o, "# ");
1522  }
1523  o << "#\n"
1524  << "opts=(--class=$class \\\n"
1525  << " --name=$name";
1526  tmp.Store(o, " \\\n --", "", true);
1527  o << ")\n\n"
1528  << "echo \"Running runTrain ${opts[@]} $@\"\n"
1529  << "runTrain \"${opts[@]}\" $@\n\n"
1530  << "# EOF" << std::endl;
1531  o.close();
1532  gSystem->Exec(Form("chmod a+x %s.sh", out.Data()));
1533  }
1543  static void SaveSetupROOT(const TString& out, const TString& cls,
1544  const TString& name, const OptionList& opts,
1545  const OptionList* uopts)
1546  {
1547  OptionList tmp(opts);
1548  tmp.Remove("url");
1549 
1550  std::ofstream o(Form("%s.C", out.Data()));
1551  o << "// Available options:\n"
1552  << "// \n";
1553  tmp.Help(o, "// ");
1554  if (uopts) {
1555  o << "// \n"
1556  << "// Available URI options\n";
1557  uopts->Help(o, "// ");
1558  }
1559  o << "//\n"
1560  << "Bool_t " << out << "()\n"
1561  << "{\n"
1562  << " TString name(\"" << name << "\");\n"
1563  << " TString cls(\"" << cls << "\");\n"
1564  << " TUrl uri(\"" << opts.Get("url") << "\");\n"
1565  << " \n"
1566  << " TString opts(";
1567  tmp.Store(o, "\"", ",\"\n ", false);
1568  o << ");\n\n"
1569  << " TString path(";
1570  TString path(gROOT->GetMacroPath());
1571  TObjArray* elements = path.Tokenize(":");
1572  TObjString* element = 0;
1573  TIter next(elements);
1574  while ((element = static_cast<TObjString*>(next()))) {
1575  if (element->String().IsNull()) continue;
1576  o << "\n \"" << element->GetName() << ":\"";
1577  }
1578  elements->Delete();
1579  o << ");\n"
1580  << " path.Append(\"$ALICE_PHYSICS/PWGLF/FORWARD/trains\");\n"
1581  << " gROOT->SetMacroPath(path);\n\n"
1582  << " gROOT->LoadMacro(\"RunTrain.C\");\n\n"
1583  << " return RunTrain(name, cls, uri, opts);\n"
1584  << "}\n"
1585  << "//\n"
1586  << "// EOF\n"
1587  << "//" << std::endl;
1588  o.close();
1589  }
1603  virtual void PostShellCode(std::ostream& o)
1604  {
1605  o << " echo \"Nothing to do for " << ClassName()
1606  << " train\"" << std::endl;
1607  }
1625  {
1626  std::ofstream f("post.sh");
1627  if (!f) {
1628  Error("SavePostAll", "Failed to open post.sh script");
1629  return;
1630  }
1631  f << "#!/bin/bash\n"
1632  << "# Generated by " << ClassName() << "\n"
1633  << "set -e\n"
1634  << "\n"
1635  << "dest=$1\n"
1636  << "prefix=\n"
1637  << "\n"
1638  << "doall() {"
1639  << std::endl;
1640  PostShellCode(f);
1641  f << "}\n"
1642  << "\n"
1643  << "if test ! -f Download.C ;then\n"
1644  << " doall\n"
1645  << " exit\n"
1646  << "fi\n"
1647  << "\n"
1648  << "if test ! -f .download ; then\n"
1649  << " aliroot -l -b -q Download.C\\(1\\)\n"
1650  << " touch .download\n"
1651  << "fi\n"
1652  << "prefix=../\n"
1653  << "\n"
1654  << "for i in root_archive_*.zip ; do\n"
1655  << " d=`basename $i .zip` \n"
1656  << " if test ! -d $d ; then\n"
1657  << " echo \"Directory $d missing\"\n"
1658  << " continue\n"
1659  << " fi\n"
1660  << " \n"
1661  << " (cd $d && doall)\n"
1662  << "done\n"
1663  << "# EOF"
1664  << std::endl;
1665  f.close();
1666  gSystem->Exec("chmod a+x post.sh");
1667  }
1668  /* @} */
1674 };
1675 #endif
Double_t AsDouble(const TString &name, Double_t def=0) const
Definition: Option.C:673
virtual void CreateCentralitySelection(Bool_t mc)
Definition: TrainSetup.C:760
virtual void CreateMonitors()
Definition: TrainSetup.C:1350
void SetOnTaskGeneric(AliAnalysisTaskSE *task, const char *what, const char *val)
Definition: TrainSetup.C:1213
virtual AliVEventHandler * CreateInputHandler(UShort_t type, Bool_t esdRecPoints=false)
Definition: TrainSetup.C:539
void Help(std::ostream &o, const char *prefix=" ") const
Definition: Option.C:903
double Double_t
Definition: External.C:58
void SavePostShellScript()
Definition: TrainSetup.C:1624
TString fDatimeString
Definition: TrainSetup.C:1671
Bool_t Run()
Definition: TrainSetup.C:306
const int debug
Definition: scanAll.C:15
const char * url
Railway * fRailway
Definition: TrainSetup.C:1673
void FromOption(AliAnalysisTaskSE *task, const char *what, const char *opt, Bool_t)
Definition: TrainSetup.C:1251
static Railway * Create(const TUrl &url, Int_t verbose=0)
Definition: Railway.C:673
TString fName
Definition: TrainSetup.C:1669
Bool_t Help(std::ostream &o=std::cout, bool asProg=false)
Definition: TrainSetup.C:395
long long Long64_t
Definition: External.C:43
Option * Find(const TString &name) const
Definition: Option.C:401
virtual void AddOCDBConnect()
Definition: TrainSetup.C:946
void FromOption(AliAnalysisTaskSE *task, const char *what, const char *opt, const char *defval)
Definition: TrainSetup.C:1268
Bool_t AsBool(const TString &name) const
Definition: Option.C:631
virtual Bool_t LoadAliPhysics()
Definition: Railway.C:298
virtual Long64_t Run(Long64_t nEvents=-1)=0
TSystem * gSystem
virtual AliAnalysisTask * FindCar(const TString &name, Bool_t verbose=true) const
Definition: TrainSetup.C:915
char Char_t
Definition: External.C:18
virtual void Print(Option_t *="") const
Definition: Railway.C:430
void SetOnTask(AliAnalysisTaskSE *task, const char *what, const char *val)
Definition: TrainSetup.C:1200
virtual const Char_t * UrlHelp() const =0
virtual ~TrainSetup()
Definition: TrainSetup.C:134
void Store(std::ostream &o, const char *prefix="", const char *delim=",", bool quote=true, bool onlySet=false) const
Definition: Option.C:951
virtual void AddTender(UShort_t which)
Definition: TrainSetup.C:1063
TCanvas * c
Definition: TestFitELoss.C:172
virtual AliVEventHandler * CreateMCHandler(UShort_t, bool mc)
Definition: TrainSetup.C:583
Int_t AsInt(const TString &name, Int_t def=0) const
Definition: Option.C:645
virtual void AuxSave(const TString &, Bool_t)
Definition: Railway.C:460
const char * AsString(const TString &name, const TString &def="") const
Definition: Option.C:687
virtual Bool_t LoadAliROOT()
Definition: Railway.C:279
static void SaveSetupShell(const TString &out, const TString &cls, const TString &name, const OptionList &opts, const OptionList *uopts)
Definition: TrainSetup.C:1502
static TString EscapeName(const char *name, TString &datimeStr)
Definition: TrainSetup.C:1366
virtual const char * Desc() const =0
void SetOnTask(AliAnalysisTaskSE *task, const char *what, Bool_t val)
Definition: TrainSetup.C:1187
virtual AliAnalysisTaskSE * CoupleSECar(const TString &macro, UInt_t mask=0)
Definition: TrainSetup.C:901
void FromOption(AliAnalysisTaskSE *task, const char *what, const char *opt, Int_t defval)
Definition: TrainSetup.C:1285
virtual AliVEventHandler * CreateOutputHandler(UShort_t type)
Definition: TrainSetup.C:597
virtual Bool_t LoadROOT()
Definition: Railway.C:265
Definition: External.C:92
Long64_t AsLong(const TString &name, Long64_t def=0) const
Definition: Option.C:659
const TString & Get(const TString &name) const
Definition: Option.C:596
virtual Bool_t PreSetup()=0
virtual AliAnalysisTask * CoupleCar(const TString &macro)
Definition: TrainSetup.C:867
OptionList & Options()
Definition: TrainSetup.C:361
static void ShowUrlHelp(const TString &cl)
Definition: Railway.C:151
virtual UShort_t Mode() const =0
Bool_t Has(const TString &name) const
Definition: Option.C:584
int Int_t
Definition: External.C:63
void Print(Option_t *="") const
Definition: TrainSetup.C:366
virtual void CreateTasks(AliAnalysisManager *mgr)=0
unsigned int UInt_t
Definition: External.C:33
TrainSetup(const TrainSetup &o)
Definition: TrainSetup.C:106
virtual Bool_t PostSetup()=0
const OptionList & Options() const
Definition: Railway.C:454
virtual AliAnalysisManager * CreateAnalysisManager(const char *name)
Definition: TrainSetup.C:526
void Set(const TString &name, const TString &value)
Definition: Option.C:736
void PrintTimer(TStopwatch &timer, const char *where)
Definition: TrainSetup.C:292
virtual Bool_t IsMC() const
Definition: Railway.C:354
TrainSetup & operator=(const TrainSetup &o)
Definition: TrainSetup.C:120
Double_t nEvents
plot quality messages
virtual Short_t InputType() const
Definition: Railway.C:338
void SetOnTask(AliAnalysisTaskSE *task, const char *what, Int_t val)
Definition: TrainSetup.C:1148
void LoadOADB(Bool_t asPar=false)
Definition: TrainSetup.C:934
void FromOption(AliAnalysisTaskSE *task, const char *what, const char *opt, Long64_t defval)
Definition: TrainSetup.C:1302
Option * Add(const TString &name, const TString &arg, const TString &desc, const TString &val="")
Definition: Option.C:421
TrainSetup(const TString &name)
Definition: TrainSetup.C:73
void SetOnTask(AliAnalysisTaskSE *task, const char *what, Double_t val)
Definition: TrainSetup.C:1174
virtual void SaveSetup(Bool_t asShellScript)
Definition: TrainSetup.C:1478
virtual Bool_t LoadAux(const TString &name, Bool_t copy=false)
Definition: Railway.C:255
Bool_t SetupWorkingDirectory()
Definition: TrainSetup.C:1427
Base class for analysis helpers.
void FromOption(AliAnalysisTaskSE *task, const char *what, const char *opt, Double_t defval)
Definition: TrainSetup.C:1235
virtual void * AddTenderSupply(void *tender, UShort_t flag, Int_t debug)
Definition: TrainSetup.C:986
OptionList fOptions
Definition: TrainSetup.C:1672
virtual Bool_t HasMCHandler() const
Definition: TrainSetup.C:1324
unsigned short UShort_t
Definition: External.C:28
virtual UShort_t Operation() const
Definition: Railway.C:327
const char Option_t
Definition: External.C:48
Bool_t Init()
Definition: TrainSetup.C:146
void Show(std::ostream &o, const char *prefix=" ") const
Definition: Option.C:928
virtual const Char_t * ClassName() const =0
virtual void UsePar(Bool_t &use)
Definition: Railway.C:671
bool Bool_t
Definition: External.C:53
static Bool_t Main(const TString &name, const TString &cls, const TCollection *opts, Bool_t asProg=true, Bool_t spawn=false)
Definition: TrainSetup.C:443
void SetOnTask(AliAnalysisTaskSE *task, const char *what, Long64_t val)
Definition: TrainSetup.C:1161
virtual AliAnalysisTask * CoupleCar(const TString &macro, const TString &args)
Definition: TrainSetup.C:840
virtual void AddMonitor(const TString &name)
Definition: TrainSetup.C:1340
Bool_t Version(std::ostream &o=std::cout)
Definition: TrainSetup.C:380
virtual void AddTender(const TString &sup)
Definition: TrainSetup.C:1039
virtual void PostShellCode(std::ostream &o)
Definition: TrainSetup.C:1603
TString fEscapedName
Definition: TrainSetup.C:1670
virtual void CreatePhysicsSelection(Bool_t mc, AliAnalysisManager *mgr)
Definition: TrainSetup.C:694
virtual AliAnalysisTaskSE * CoupleSECar(const TString &macro, const TString &args, UInt_t mask=0)
Definition: TrainSetup.C:882
virtual Bool_t LoadLibrary(const TString &name, Bool_t slave=true, Bool_t forcePar=false)=0
void Remove(const TString &name)
Definition: Option.C:564
static void SaveSetupROOT(const TString &out, const TString &cls, const TString &name, const OptionList &opts, const OptionList *uopts)
Definition: TrainSetup.C:1543
void SetOnTask(AliAnalysisTaskSE *task, const char *what, UInt_t val)
Definition: TrainSetup.C:1135