AliPhysics  45843cc (45843cc)
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",
774  "No multiplicity selection for AOD input");
775  return;
776  }
777 
778  // Possibly load as PAR
779  LoadOADB();
780 
781  gROOT->SetMacroPath(Form("$ALICE_PHYSICS/OADB/COMMON/MULTIPLICITY/macros"
782  ":%s", gROOT->GetMacroPath()));
783  AliAnalysisTaskSE* task = CoupleSECar("AddTaskMultSelection.C","false");
784  FromOption(task, "AlternateOADBforEstimators", "cent-oadb", "");
785  if (fOptions.Has("cent-oadb")) {
786  TString centOADB = fOptions.AsString("cent-oadb");
787  if (centOADB.EndsWith(".root")) {
788  TString base(gSystem->BaseName(centOADB.Data()));
789  TString per(base);
790  per.ReplaceAll("OADB-","");
791  per.ReplaceAll(".root","");
792  SetOnTask(task, "AlternateOADBforEstimators", per);
793  fRailway->LoadAux(centOADB);
794  if (mc)
795  SetOnTask(task, "AlternateOADBFullManualBypassMC", base);
796  else
797  SetOnTask(task, "AlternateOADBFullManualBypas", base);
798  }
799  }
800  if (!task->HasBranches()) {
801  // Everything except tracks since that slows does things and is
802  // really only needed for reference multiplicities
803  task->SetBranches("ESD:AliESDRun.,AliESDHeader.,AliESDZDC.,"
804  "AliESDVZERO.,AliESDTZERO.,TPCVertex.,"
805  "SPDVertex.,PrimaryVertex.,AliMultiplicity."
806  "SPDPileupVertices,TrkPileupVertices,"
807  "AliESDAD. "
808  "AOD:header,vertices,AliAODTZERO,AliAODVZERO,"
809  "AliAODZDC,AliAODAD");
810  }
811  if (!fOptions.Has("old-cent")) return;
812  if (isAOD) return;
813 
814  task = CoupleSECar("AddTaskCentrality.C",
815  Form("true,%s", isAOD ? "true" : "false"));
816  AliCentralitySelectionTask* ctask =
817  dynamic_cast<AliCentralitySelectionTask*>(task);
818  if (!ctask) return;
819  if (mc) ctask->SetMCInput();
820  }
826  virtual void CreateTasks(AliAnalysisManager* mgr)=0;
827  /* @} */
828  // -----------------------------------------------------------------
841  virtual AliAnalysisTask* CoupleCar(const TString& macro,
842  const TString& args)
843  {
844  TString p = gSystem->Which(gROOT->GetMacroPath(), macro.Data());
845  if (p.IsNull()) {
846  Error("CoupleCar", "Macro %s not found", macro.Data());
847  return 0;
848  }
849  TString cmd(p);
850  if (!args.IsNull())
851  cmd.Append(TString::Format("(%s)", args.Data()));
852  Info("CoupleCar", "Execute %s", cmd.Data());
853  Int_t err;
854  Long_t ret = gROOT->Macro(cmd.Data(), &err, false);
855  if (!ret) {
856  Error("CoupleCar", "Failed to execute %s (%ld)", cmd.Data(), ret);
857  return 0;
858  }
859  return reinterpret_cast<AliAnalysisTask*>(ret);
860  }
868  virtual AliAnalysisTask* CoupleCar(const TString& macro)
869  {
870  TString args;
871  return CoupleCar(macro, args);
872  }
883  virtual AliAnalysisTaskSE* CoupleSECar(const TString& macro,
884  const TString& args,
885  UInt_t mask=0)
886  {
887  AliAnalysisTaskSE* task =
888  dynamic_cast<AliAnalysisTaskSE*>(CoupleCar(macro, args));
889  // Explicitly set mask
890  if (mask > 0) task->SelectCollisionCandidates(mask);
891  return task;
892  }
902  virtual AliAnalysisTaskSE* CoupleSECar(const TString& macro,
903  UInt_t mask=0)
904  {
905  TString args;
906  return CoupleSECar(macro, args, mask);
907  }
916  virtual AliAnalysisTask* FindCar(const TString& name,
917  Bool_t verbose=true) const
918  {
919  AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
920  if (!mgr) {
921  ::Warning("FindCar", "No manager defined");
922  return 0;
923  }
924  AliAnalysisTask* task = mgr->GetTask(name);
925  if (!task && verbose)
926  ::Warning("FindCar", "Task \"%s\" not found in train",
927  name.Data());
928  return task;
929  }
935  void LoadOADB(Bool_t asPar=false)
936  {
937  Bool_t usePar = asPar;
938  fRailway->UsePar(usePar); // Disabled pars temporarily
939  fRailway->LoadLibrary("OADB");
940  fRailway->UsePar(usePar); // Set to old value
941  }
942  /* @} */
947  virtual void AddOCDBConnect()
948  {
949  fRailway->LoadLibrary("PWGPP");
950  Long_t ret = gROOT->ProcessLine("new AliTaskCDBconnect(\"cdb\")");
951  if (!ret) {
952  Fatal("AddOCDBConnect", "Failed to add OCDB connection task");
953  return;
954  }
955  AliAnalysisTask* task = reinterpret_cast<AliAnalysisTask*>(ret);
956  if (!task->HasBranches()) task->SetBranches("ESD:AliESDRun. AOD:header");
957  AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
958 
959  mgr->AddTask(task);
960  mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
961  }
965  enum {
966  kTenderV0 = 0x0001,
967  kTenderTPC = 0x0002,
968  kTenderPtFix = 0x0004,
969  kTenderT0 = 0x0008,
970  kTenderTOF = 0x0010,
971  kTenderTRD = 0x0020,
972  kTenderVTX = 0x0040,
973  kTenderEMCAL = 0x0080,
974  kTenderPID = 0x0100,
975  kTenderHMPID = 0x0200,
976  kTenderPHOS = 0x0400
977  };
987  virtual void* AddTenderSupply(void* tender,
988  UShort_t flag,
989  Int_t debug)
990  {
991  if (flag == 0) return 0;
992 
993  TString c;
994  TString n;
995  switch (flag) {
996  case kTenderV0: n = "VZERO"; c = "VZERO"; break;
997  case kTenderTPC: n = "TPC"; c = "TPC"; break;
998  case kTenderPtFix: n = "TrackFix"; c = "PtInvFix"; break;
999  case kTenderT0: n = "T0"; c = "TZERO"; break;
1000  case kTenderTOF: n = "TOF"; c = "TOF"; break;
1001  case kTenderTRD: n = "TRD"; c = "TRD"; break;
1002  case kTenderVTX: n = "Vtx"; c = "IP"; break;
1003  case kTenderEMCAL: n = "EMCAL"; c = "EMCAL"; break;
1004  case kTenderPID: n = "PID"; c = "PID"; break;
1005  case kTenderHMPID: n = "HMPID"; c = "HMPID"; break;
1006  case kTenderPHOS: n = "PHOS"; c = "PHOS"; break;
1007  default:
1008  Warning("AddTenderSupply", "Unknown tender flag: 0x%08x", flag);
1009  return 0;
1010  }
1011  TString m;
1012  switch (flag) {
1013  case kTenderV0: m = Form("s->SetDebug(%d);", debug); break;
1014  case kTenderEMCAL: // Fall through
1015  case kTenderTOF: // Fall through
1016  case kTenderTPC: // Fall through
1017  case kTenderPtFix: // Fall through
1018  case kTenderTRD: m = Form("s->SetDebugLevel(%d);", debug); break;
1019  }
1020 
1021  TString cls(Form("Ali%sTenderSupply", c.Data()));
1022  Long_t ret =
1023  gROOT->ProcessLine(Form("{ %s* s = new %s(\"%s\");"
1024  "((AliTender*)%p)->AddSupply(s);%s"
1025  "} s;",
1026  cls.Data(),
1027  cls.Data(),
1028  n.Data(),
1029  tender,
1030  m.Data()));
1031  void* ptr = reinterpret_cast<void*>(ret);
1032  Info("AddTenderSupply", "Adding supply %s (an %s object): %p",
1033  n.Data(), cls.Data(), ptr);
1034  return ptr;
1035  }
1040  virtual void AddTender(const TString& sup)
1041  {
1042  TString supplies = sup;
1043 
1044  UShort_t which = 0;
1045  supplies.ToUpper();
1046  if (supplies.Contains("V0") ||
1047  supplies.Contains("VZERO")) which |= kTenderV0 ;
1048  if (supplies.Contains("TPC")) which |= kTenderTPC ;
1049  if (supplies.Contains("PTFIX")) which |= kTenderPtFix ;
1050  if (supplies.Contains("T0")) which |= kTenderT0 ;
1051  if (supplies.Contains("TOF")) which |= kTenderTOF ;
1052  if (supplies.Contains("TRD")) which |= kTenderTRD ;
1053  if (supplies.Contains("VTX")) which |= kTenderVTX ;
1054  if (supplies.Contains("EMCAL")) which |= kTenderEMCAL ;
1055  if (supplies.Contains("PID")) which |= kTenderPID ;
1056 
1057  AddTender(which);
1058  }
1064  virtual void AddTender(UShort_t which)
1065  {
1066  if (which == 0) return;
1067 
1068  Int_t vrb = fOptions.AsInt("verbose", 3);
1069 
1070  fRailway->LoadLibrary("Tender");
1071  fRailway->LoadLibrary("TenderSupplies");
1072 
1073  Long_t ret = gROOT->ProcessLine("new AliTender(\"Tender\")");
1074  if (!ret) {
1075  Warning("AddTender", "Failed to make tender");
1076  return;
1077  }
1078  void* tender = reinterpret_cast<void*>(ret);
1079  gROOT->ProcessLine(Form("((AliTender*)%p)->SetCheckEventSelection(%d)",
1080  tender, (which & kTenderV0)));
1081  gROOT->ProcessLine(Form("((AliTender*)%p)->SetDebugLevel(%d)",
1082  tender, vrb));
1083 
1084  // OCDB settings for tender
1085  TString ocdb = fOptions.Get("ocdb");
1086  if (ocdb.IsNull())
1087  ocdb = "raw://";
1088  else if (ocdb.EndsWith(".root")) {
1089  fRailway->LoadLibrary("CDB");
1090  fRailway->LoadAux(ocdb);
1091  gROOT->ProcessLine(Form("AliCDBManager::Instance()->"
1092  "SetSnapshotMode(\"%s\");",
1093  ocdb.Data()));
1094  ocdb = "raw://";
1095  }
1096  gROOT->ProcessLine(Form("((AliTender*)%p)->SetDefaultCDBStorage(\"%s\")",
1097  tender, ocdb.Data()));
1098 
1099  AddTenderSupply(tender, which & kTenderV0, vrb);
1100  AddTenderSupply(tender, which & kTenderTPC, vrb);
1101  AddTenderSupply(tender, which & kTenderPtFix, vrb);
1102  AddTenderSupply(tender, which & kTenderT0, vrb);
1103  AddTenderSupply(tender, which & kTenderTOF, vrb);
1104  AddTenderSupply(tender, which & kTenderTRD, vrb);
1105  AddTenderSupply(tender, which & kTenderVTX, vrb);
1106  AddTenderSupply(tender, which & kTenderEMCAL, vrb);
1107  AddTenderSupply(tender, which & kTenderPID, vrb);
1108 
1109  gROOT->ProcessLine(Form("((AliTender*)%p)->GetSupplies()->Print()",tender));
1110 
1111  AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
1112  AliAnalysisTask* tsk = reinterpret_cast<AliAnalysisTask*>(tender);
1113  mgr->AddTask(tsk);
1114  AliAnalysisDataContainer* cnt =
1115  mgr->CreateContainer("tender_event",
1116  AliESDEvent::Class(),
1117  AliAnalysisManager::kExchangeContainer,
1118  "default_tender");
1119  mgr->ConnectInput (tsk, 0, mgr->GetCommonInputContainer());
1120  mgr->ConnectOutput(tsk, 1, cnt);
1121 
1122  }
1123  /* @} */
1124  //------------------------------------------------------------------
1137  const char* what,
1138  UInt_t val)
1139  {
1140  SetOnTaskGeneric(task, what, Form("%u", val));
1141  }
1150  const char* what,
1151  Int_t val)
1152  {
1153  SetOnTaskGeneric(task, what, Form("%d", val));
1154  }
1163  const char* what,
1164  Long64_t val)
1165  {
1166  SetOnTaskGeneric(task, what, Form("%lld", val));
1167  }
1176  const char* what,
1177  Double_t val)
1178  {
1179  SetOnTaskGeneric(task, what, Form("%lg", val));
1180  }
1189  const char* what,
1190  Bool_t val)
1191  {
1192  SetOnTaskGeneric(task, what, Form("%d", val));
1193  }
1202  const char* what,
1203  const char* val)
1204  {
1205  SetOnTaskGeneric(task, what, Form("\"%s\"", val));
1206  }
1215  const char* what,
1216  const char* val)
1217  {
1218  const char* cls = task->ClassName();
1219  // Info("SetOnTask", "((%s)*%p)->Set%s(%s)", cls, task, what, val);
1220  gROOT->ProcessLine(Form("((%s*)%p)->Set%s(%s)",cls,task,what,val));
1221  }
1222  /* @} */
1223  //------------------------------------------------------------------
1237  const char* what,
1238  const char* opt,
1239  Double_t defval)
1240  {
1241  Double_t val = fOptions.AsDouble(opt,defval);;
1242  // Info("FromOption<D>"," %p, %s, %s, %f", task, what, opt, val);
1243  SetOnTask(task, what, val);
1244  }
1253  const char* what,
1254  const char* opt,
1255  Bool_t /*defval*/)
1256  {
1257  Bool_t val = fOptions.AsBool(opt);;
1258  // Info("FromOption<B>"," %p, %s, %s, %d", task, what, opt, val);
1259  SetOnTask(task, what, val);
1260  }
1270  const char* what,
1271  const char* opt,
1272  const char* defval)
1273  {
1274  TString val = fOptions.AsString(opt,defval);
1275  // Info("FromOption<S>"," %p, %s, %s, %s", task, what, opt, val);
1276  SetOnTask(task, what, val.Data());
1277  }
1287  const char* what,
1288  const char* opt,
1289  Int_t defval)
1290  {
1291  Int_t val = fOptions.AsInt(opt, defval);
1292  // Info("FromOption<I>"," %p, %s, %s, %d", task, what, opt, val);
1293  SetOnTask(task, what, val);
1294  }
1304  const char* what,
1305  const char* opt,
1306  Long64_t defval)
1307  {
1308  Long64_t val = fOptions.AsLong(opt, defval);
1309  // Info("FromOption<L>"," %p, %s, %s, %lld", task, what, opt, val);
1310  SetOnTask(task, what, val);
1311  }
1312  /* @} */
1313 
1314  // -----------------------------------------------------------------
1325  virtual Bool_t HasMCHandler() const
1326  {
1327  AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
1328  if (!mgr) return false;
1329  return mgr->GetMCtruthEventHandler() != 0;
1330  }
1331  /* @} */
1338  virtual const Char_t* ClassName() const = 0;
1339  /* @} */
1340  //__________________________________________________________________
1341  virtual void AddMonitor(const TString& name)
1342  {
1343  if (fRailway->Mode() != Railway::kProof) return;
1344  Warning("CreateMonitors", "Monitoring not supported yet (%s)", name.Data());
1345  }
1346  //__________________________________________________________________
1351  virtual void CreateMonitors()
1352  {
1353  }
1354  //__________________________________________________________________
1367  static TString EscapeName(const char* name, TString& datimeStr)
1368  {
1369  TString escaped = name;
1370  char c[] = { ' ', '/', '@', 0 };
1371  char* p = c;
1372  while (*p) {
1373  char tmp[] = { *p, '\0' };
1374  escaped.ReplaceAll(tmp, "_");
1375  p++;
1376  }
1377  if (!datimeStr.IsNull() &&
1378  !datimeStr.EqualTo("none", TString::kIgnoreCase)) {
1379  TDatime datime;
1380  if (datimeStr.EqualTo("now", TString::kIgnoreCase))
1381  datime.Set();
1382  else {
1383  // Try various formats
1384  struct tm t;
1385  const char* formats[] = { "%Ec", // Locale
1386  "%c", // Locale
1387  "%Ex EX", // Locale
1388  "%x %X", // Locale
1389  "%Y%m%d_%H%M", // YYYYMMDD_HHMM
1390  "%F %R", // ISO standard, no seconds
1391  0 };
1392  const char** f = formats;
1393  Bool_t found = false;
1394  while (*f && !found) {
1395  // Reset needed fields
1396  t.tm_year = 0;
1397  t.tm_mon = 0;
1398  t.tm_mday = 0;
1399  t.tm_hour = 0;
1400  t.tm_min = 0;
1401  // Stop processing on first match
1402  if (strptime(datimeStr.Data(), *f, &t) != 0) found = true;
1403  f++;
1404  }
1405  if (found) {
1406  t.tm_mon += 1; // Return 0-based month
1407  datime.Set(t.tm_year, t.tm_mon, t.tm_mday, t.tm_hour, t.tm_min, 0);
1408  }
1409  }
1410  if (datime.GetYear() <= 1995 ||
1411  datime.GetMonth() == 0 ||
1412  datime.GetDay() == 0) return escaped;
1413  datimeStr = Form("%04d%02d%02d_%02d%02d",
1414  datime.GetYear(),
1415  datime.GetMonth(),
1416  datime.GetDay(),
1417  datime.GetHour(),
1418  datime.GetMinute());
1419  escaped.Append(Form("_%s", datimeStr.Data()));
1420  }
1421  return escaped;
1422  }
1429  {
1430  // Get the name of the target directory
1431  TString& nam = fEscapedName;
1432 
1433  // Check if the directory exists already
1434  Bool_t exists = gSystem->AccessPathName(nam.Data()) == 0;
1435  if (fRailway->Operation() == Railway::kTerminate && !exists) {
1436  Error("SetupWorkingDirectory", "File/directory %s does not exists",
1437  nam.Data());
1438  return false;
1439  }
1440 
1441  Bool_t overwrite = fOptions.Has("overwrite");
1442  // If we're not allowed to overwrite, then complain
1443  if (!overwrite && exists) {
1444  Error("SetupWorkingDirectory", "File/directory %s already exists",
1445  nam.Data());
1446  return false;
1447  }
1448 
1449  // Make the target directory if it doesn't exists
1450  if (!exists) {
1451  if (gSystem->MakeDirectory(nam.Data())) {
1452  Error("SetupWorkingDirectory", "Failed to make directory '%s'",
1453  nam.Data());
1454  return false;
1455  }
1456  }
1457 
1458  // Change directory to target directory
1459  if (!gSystem->ChangeDirectory(nam.Data())) {
1460  Error("SetupWorkingDirectory", "Failed to change directory to %s",
1461  nam.Data());
1462  return false;
1463  }
1464  // Info("SetupWorkingDirectory", "Made subdirectory %s, and cd'ed there",
1465  // nam.Data());
1466  return true;
1467  }
1468  /* @} */
1469  // -----------------------------------------------------------------
1479  virtual void SaveSetup(Bool_t asShellScript)
1480  {
1481  OptionList tmp(fOptions);
1482  const OptionList* uopts = (fRailway ? &fRailway->Options() : 0);
1483  if (tmp.Find("overwrite")) tmp.Set("overwrite");
1484  if (tmp.Find("date") && fEscapedName.Length() > fName.Length()+1) {
1485  Int_t n = fName.Length()+1;
1486  tmp.Set("date", fEscapedName(n, fEscapedName.Length()-n));
1487  }
1488  if (asShellScript)
1489  SaveSetupShell("rerun", ClassName(), fName, tmp, uopts);
1490  SaveSetupROOT("ReRun", ClassName(), fName, tmp, uopts);
1491  if (fRailway) fRailway->AuxSave(fEscapedName, asShellScript);
1493  }
1503  static void SaveSetupShell(const TString& out, const TString& cls,
1504  const TString& name, const OptionList& opts,
1505  const OptionList* uopts)
1506  {
1507  std::ofstream o(Form("%s.sh", out.Data()));
1508  TString url = opts.Get("url");
1509  OptionList tmp(opts);
1510  tmp.Set("url", "${url}");
1511  o << "#!/bin/bash\n\n"
1512  << "class=\"" << cls << "\"\n"
1513  << "name=\"" << name << "\"\n"
1514  << "url=\"" << url << "\"\n\n"
1515  << "# Available options\n"
1516  << "# \n";
1517  tmp.Help(o, "# --");
1518  if (uopts) {
1519  o << "#\n"
1520  << "# Available URI options\n"
1521  << "# \n";
1522  uopts->Help(o, "# ");
1523  }
1524  o << "#\n"
1525  << "opts=(--class=$class \\\n"
1526  << " --name=$name";
1527  tmp.Store(o, " \\\n --", "", true);
1528  o << ")\n\n"
1529  << "echo \"Running runTrain ${opts[@]} $@\"\n"
1530  << "runTrain \"${opts[@]}\" $@\n\n"
1531  << "# EOF" << std::endl;
1532  o.close();
1533  gSystem->Exec(Form("chmod a+x %s.sh", out.Data()));
1534  }
1544  static void SaveSetupROOT(const TString& out, const TString& cls,
1545  const TString& name, const OptionList& opts,
1546  const OptionList* uopts)
1547  {
1548  OptionList tmp(opts);
1549  tmp.Remove("url");
1550 
1551  std::ofstream o(Form("%s.C", out.Data()));
1552  o << "// Available options:\n"
1553  << "// \n";
1554  tmp.Help(o, "// ");
1555  if (uopts) {
1556  o << "// \n"
1557  << "// Available URI options\n";
1558  uopts->Help(o, "// ");
1559  }
1560  o << "//\n"
1561  << "Bool_t " << out << "()\n"
1562  << "{\n"
1563  << " TString name(\"" << name << "\");\n"
1564  << " TString cls(\"" << cls << "\");\n"
1565  << " TUrl uri(\"" << opts.Get("url") << "\");\n"
1566  << " \n"
1567  << " TString opts(";
1568  tmp.Store(o, "\"", ",\"\n ", false);
1569  o << ");\n\n"
1570  << " TString path(";
1571  TString path(gROOT->GetMacroPath());
1572  TObjArray* elements = path.Tokenize(":");
1573  TObjString* element = 0;
1574  TIter next(elements);
1575  while ((element = static_cast<TObjString*>(next()))) {
1576  if (element->String().IsNull()) continue;
1577  o << "\n \"" << element->GetName() << ":\"";
1578  }
1579  elements->Delete();
1580  o << ");\n"
1581  << " path.Append(\"$ALICE_PHYSICS/PWGLF/FORWARD/trains\");\n"
1582  << " gROOT->SetMacroPath(path);\n\n"
1583  << " gROOT->LoadMacro(\"RunTrain.C\");\n\n"
1584  << " return RunTrain(name, cls, uri, opts);\n"
1585  << "}\n"
1586  << "//\n"
1587  << "// EOF\n"
1588  << "//" << std::endl;
1589  o.close();
1590  }
1604  virtual void PostShellCode(std::ostream& o)
1605  {
1606  o << " echo \"Nothing to do for " << ClassName()
1607  << " train\"" << std::endl;
1608  }
1626  {
1627  std::ofstream f("post.sh");
1628  if (!f) {
1629  Error("SavePostAll", "Failed to open post.sh script");
1630  return;
1631  }
1632  f << "#!/bin/bash\n"
1633  << "# Generated by " << ClassName() << "\n"
1634  << "set -e\n"
1635  << "\n"
1636  << "dest=$1\n"
1637  << "prefix=\n"
1638  << "\n"
1639  << "doall() {"
1640  << std::endl;
1641  PostShellCode(f);
1642  f << "}\n"
1643  << "\n"
1644  << "if test ! -f Download.C ;then\n"
1645  << " doall\n"
1646  << " exit\n"
1647  << "fi\n"
1648  << "\n"
1649  << "if test ! -f .download ; then\n"
1650  << " aliroot -l -b -q Download.C\\(1\\)\n"
1651  << " touch .download\n"
1652  << "fi\n"
1653  << "prefix=../\n"
1654  << "\n"
1655  << "for i in root_archive_*.zip ; do\n"
1656  << " d=`basename $i .zip` \n"
1657  << " if test ! -d $d ; then\n"
1658  << " echo \"Directory $d missing\"\n"
1659  << " continue\n"
1660  << " fi\n"
1661  << " \n"
1662  << " (cd $d && doall)\n"
1663  << "done\n"
1664  << "# EOF"
1665  << std::endl;
1666  f.close();
1667  gSystem->Exec("chmod a+x post.sh");
1668  }
1669  /* @} */
1675 };
1676 #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:1351
void SetOnTaskGeneric(AliAnalysisTaskSE *task, const char *what, const char *val)
Definition: TrainSetup.C:1214
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:1625
TString fDatimeString
Definition: TrainSetup.C:1672
Bool_t Run()
Definition: TrainSetup.C:306
const int debug
Definition: scanAll.C:15
const char * url
Railway * fRailway
Definition: TrainSetup.C:1674
void FromOption(AliAnalysisTaskSE *task, const char *what, const char *opt, Bool_t)
Definition: TrainSetup.C:1252
static Railway * Create(const TUrl &url, Int_t verbose=0)
Definition: Railway.C:673
TString fName
Definition: TrainSetup.C:1670
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:947
void FromOption(AliAnalysisTaskSE *task, const char *what, const char *opt, const char *defval)
Definition: TrainSetup.C:1269
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:916
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:1201
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:1064
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:1503
static TString EscapeName(const char *name, TString &datimeStr)
Definition: TrainSetup.C:1367
virtual const char * Desc() const =0
void SetOnTask(AliAnalysisTaskSE *task, const char *what, Bool_t val)
Definition: TrainSetup.C:1188
virtual AliAnalysisTaskSE * CoupleSECar(const TString &macro, UInt_t mask=0)
Definition: TrainSetup.C:902
void FromOption(AliAnalysisTaskSE *task, const char *what, const char *opt, Int_t defval)
Definition: TrainSetup.C:1286
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:868
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:1149
void LoadOADB(Bool_t asPar=false)
Definition: TrainSetup.C:935
void FromOption(AliAnalysisTaskSE *task, const char *what, const char *opt, Long64_t defval)
Definition: TrainSetup.C:1303
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:1175
virtual void SaveSetup(Bool_t asShellScript)
Definition: TrainSetup.C:1479
virtual Bool_t LoadAux(const TString &name, Bool_t copy=false)
Definition: Railway.C:255
Bool_t SetupWorkingDirectory()
Definition: TrainSetup.C:1428
Base class for analysis helpers.
void FromOption(AliAnalysisTaskSE *task, const char *what, const char *opt, Double_t defval)
Definition: TrainSetup.C:1236
virtual void * AddTenderSupply(void *tender, UShort_t flag, Int_t debug)
Definition: TrainSetup.C:987
OptionList fOptions
Definition: TrainSetup.C:1673
virtual Bool_t HasMCHandler() const
Definition: TrainSetup.C:1325
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:1162
virtual AliAnalysisTask * CoupleCar(const TString &macro, const TString &args)
Definition: TrainSetup.C:841
virtual void AddMonitor(const TString &name)
Definition: TrainSetup.C:1341
Bool_t Version(std::ostream &o=std::cout)
Definition: TrainSetup.C:380
virtual void AddTender(const TString &sup)
Definition: TrainSetup.C:1040
virtual void PostShellCode(std::ostream &o)
Definition: TrainSetup.C:1604
TString fEscapedName
Definition: TrainSetup.C:1671
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:883
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:1544
void SetOnTask(AliAnalysisTaskSE *task, const char *what, UInt_t val)
Definition: TrainSetup.C:1136