AliPhysics  9ce65a0 (9ce65a0)
 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  // esd->ReadFromDirectory();
553  input = esd;
554  }
555  input->SetReadFriends(fOptions.AsBool("friends"));
556  ret = input;
557  }
558  break;
559  case Railway::kAOD: {
560  AliAODInputHandler* input = new AliAODInputHandler();
561  TString fr = fOptions.Get("friends");
562  TObjArray* afr = fr.Tokenize(",+:");
563  TObject* ofr = 0;
564  TIter nfr(afr);
565  while ((ofr = nfr())) input->AddFriend(const_cast<char*>(ofr->GetName()));
566  afr->Delete();
567  ret = input;
568  }
569  break;
570  case Railway::kUser: return 0;
571  }
572  // Info("CreateInput", "Returning input handler %p", ret);
573  return ret;
574  }
582  virtual AliVEventHandler* CreateMCHandler(UShort_t /*type*/, bool mc)
583  {
584  if (!mc) return 0;
585  AliMCEventHandler* mcHandler = new AliMCEventHandler();
586  mcHandler->SetReadTR(true);
587  return mcHandler;
588  }
596  virtual AliVEventHandler* CreateOutputHandler(UShort_t type)
597  {
598  AliAODHandler* ret = new AliAODHandler();
599  switch (type) {
600  case Railway::kESD:
601  ret->SetOutputFileName("AliAOD.root");
602  break;
603  case Railway::kAOD:
604  ret->SetOutputFileName("AliAOD.pass2.root");
605  break;
606  case Railway::kUser:
607  break;
608  }
609 
610  return ret;
611  }
694  {
695  TString opt = fOptions.Get("ps");
696  // opt.ToUpper();
697 
698  if (opt.EqualTo("NONE",TString::kIgnoreCase)) return;
699 
700  // Possibly load as PAR
701  LoadOADB();
702 
703  AliPhysicsSelection* ps = 0;
704  AliInputEventHandler* input =
705  dynamic_cast<AliInputEventHandler*> (mgr->GetInputEventHandler());
706  if (!input) return;
707 
708  // --- Create object, either directory or via task ---------------
709  if (opt.Contains("BARE",TString::kIgnoreCase)) {
710  // --- Just create object and set on input handler -------------
711  ps = new AliPhysicsSelection();
712  if (mc) ps->SetAnalyzeMC();
713 
714  input->SetEventSelection(ps);
715  }
716  else {
717  // --- Create and add the task ---------------------------------
718  CoupleSECar("AddTaskPhysicsSelection.C", Form("%d", mc), AliVEvent::kAny);
719  mgr->RegisterExtraFile("event_stat.root");
720  // mgr->AddStatisticsTask(AliVEvent::kAny);
721 
722  // --- Retrive object from input handler -----------------------
723  ps = dynamic_cast<AliPhysicsSelection*>(input->GetEventSelection());
724  }
725  if (opt.Contains("CUSTOM",TString::kIgnoreCase)) {
726  // --- Load custom trigger definitions -------------------------
727  TString macro("CustomPS.C");
728  Int_t eq = opt.Index("custom=",7,0,TString::kIgnoreCase);
729  if (eq != kNPOS) {
730  Int_t end = opt.Index(".C",2,eq+7,TString::kIgnoreCase);
731  if (end != kNPOS) {
732  macro = opt(eq+7,end+2-eq-7);
733  }
734  }
735  fRailway->LoadAux(macro);
736  TString rmacro = gSystem->Which(gROOT->GetMacroPath(), macro);
737  if (rmacro.IsNull()) {
738  Error("CreatePhysicsSelection", "Custom PS script %s not found",
739  macro.Data());
740  return;
741  }
742  Info("CreatePhysicsSelection", "Loading custom PS from %s",rmacro.Data());
743  TString base(gSystem->BaseName(rmacro.Data()));
744  gROOT->Macro(Form("%s((AliPhysicsSelection*)%p)", base.Data(), ps));
745  }
746 
747  if (opt.Contains("ALL",TString::kIgnoreCase)) {
748  // --- Ignore trigger class when selecting events. This means -
749  // --- that we get offline+(A,C,E) events too ------------------
750  Info("CreatePhysicsSelection", "Skipping trigger selection");
751  ps->SetSkipTriggerClassSelection(true);
752  }
753  }
760  {
761  AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
762  AliVEventHandler* inp = mgr->GetInputEventHandler();
763  if (!inp) return;
764 
765  // Check if input is AOD. Do not add MultSelection task, unless
766  // explicitly stated.
767  Bool_t isAOD = inp->IsA()->InheritsFrom(AliAODInputHandler::Class());
768  if (isAOD && !fOptions.AsBool("aod-cent")) return;
769 
770  // Possibly load as PAR
771  LoadOADB();
772 
773  gROOT->SetMacroPath(Form("$ALICE_PHYSICS/OADB/COMMON/MULTIPLICITY/macros"
774  ":%s", gROOT->GetMacroPath()));
775  AliAnalysisTaskSE* task = CoupleSECar("AddTaskMultSelection.C","false");
776  FromOption(task, "AlternateOADBforEstimators", "cent-oadb", "");
777  if (fOptions.Has("cent-oadb")) {
778  TString centOADB = fOptions.AsString("cent-oadb");
779  if (centOADB.EndsWith(".root")) {
780  TString base(gSystem->BaseName(centOADB.Data()));
781  TString per(base);
782  per.ReplaceAll("OADB-","");
783  per.ReplaceAll(".root","");
784  SetOnTask(task, "AlternateOADBforEstimators", per);
785  fRailway->LoadAux(centOADB);
786  if (mc)
787  SetOnTask(task, "AlternateOADBFullManualBypassMC", base);
788  else
789  SetOnTask(task, "AlternateOADBFullManualBypas", base);
790  }
791  }
792  if (!task->HasBranches()) {
793  // Everything except tracks since that slows does things and is
794  // really only needed for reference multiplicities
795  task->SetBranches("ESD:AliESDRun.,AliESDHeader.,AliESDZDC.,"
796  "AliESDVZERO.,AliESDTZERO.,TPCVertex.,"
797  "SPDVertex.,PrimaryVertex.,AliMultiplicity."
798  "SPDPileupVertices,TrkPileupVertices,"
799  "AliESDAD. "
800  "AOD:header,vertices,AliAODTZERO,AliAODVZERO,"
801  "AliAODZDC,AliAODAD");
802  }
803  if (!fOptions.Has("old-cent")) return;
804  if (isAOD) return;
805 
806  task = CoupleSECar("AddTaskCentrality.C",
807  Form("true,%s", isAOD ? "true" : "false"));
808  AliCentralitySelectionTask* ctask =
809  dynamic_cast<AliCentralitySelectionTask*>(task);
810  if (!ctask) return;
811  if (mc) ctask->SetMCInput();
812  }
818  virtual void CreateTasks(AliAnalysisManager* mgr)=0;
819  /* @} */
820  // -----------------------------------------------------------------
833  virtual AliAnalysisTask* CoupleCar(const TString& macro,
834  const TString& args)
835  {
836  TString p = gSystem->Which(gROOT->GetMacroPath(), macro.Data());
837  if (p.IsNull()) {
838  Error("CoupleCar", "Macro %s not found", macro.Data());
839  return 0;
840  }
841  TString cmd(p);
842  if (!args.IsNull())
843  cmd.Append(TString::Format("(%s)", args.Data()));
844  Info("CoupleCar", "Execute %s", cmd.Data());
845  Int_t err;
846  Long_t ret = gROOT->Macro(cmd.Data(), &err, false);
847  if (!ret) {
848  Error("CoupleCar", "Failed to execute %s (%ld)", cmd.Data(), ret);
849  return 0;
850  }
851  return reinterpret_cast<AliAnalysisTask*>(ret);
852  }
860  virtual AliAnalysisTask* CoupleCar(const TString& macro)
861  {
862  TString args;
863  return CoupleCar(macro, args);
864  }
875  virtual AliAnalysisTaskSE* CoupleSECar(const TString& macro,
876  const TString& args,
877  UInt_t mask=0)
878  {
879  AliAnalysisTaskSE* task =
880  dynamic_cast<AliAnalysisTaskSE*>(CoupleCar(macro, args));
881  // Explicitly set mask
882  if (mask > 0) task->SelectCollisionCandidates(mask);
883  return task;
884  }
894  virtual AliAnalysisTaskSE* CoupleSECar(const TString& macro,
895  UInt_t mask=0)
896  {
897  TString args;
898  return CoupleSECar(macro, args, mask);
899  }
908  virtual AliAnalysisTask* FindCar(const TString& name,
909  Bool_t verbose=true) const
910  {
911  AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
912  if (!mgr) {
913  ::Warning("FindCar", "No manager defined");
914  return 0;
915  }
916  AliAnalysisTask* task = mgr->GetTask(name);
917  if (!task && verbose)
918  ::Warning("FindCar", "Task \"%s\" not found in train",
919  name.Data());
920  return task;
921  }
927  void LoadOADB(Bool_t asPar=false)
928  {
929  Bool_t usePar = asPar;
930  fRailway->UsePar(usePar); // Disabled pars temporarily
931  fRailway->LoadLibrary("OADB");
932  fRailway->UsePar(usePar); // Set to old value
933  }
934  /* @} */
939  virtual void AddOCDBConnect()
940  {
941  fRailway->LoadLibrary("PWGPP");
942  Long_t ret = gROOT->ProcessLine("new AliTaskCDBconnect(\"cdb\")");
943  if (!ret) {
944  Fatal("AddOCDBConnect", "Failed to add OCDB connection task");
945  return;
946  }
947  AliAnalysisTask* task = reinterpret_cast<AliAnalysisTask*>(ret);
948  if (!task->HasBranches()) task->SetBranches("ESD:AliESDRun. AOD:header");
949  AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
950 
951  mgr->AddTask(task);
952  mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
953  }
957  enum {
958  kTenderV0 = 0x0001,
959  kTenderTPC = 0x0002,
960  kTenderPtFix = 0x0004,
961  kTenderT0 = 0x0008,
962  kTenderTOF = 0x0010,
963  kTenderTRD = 0x0020,
964  kTenderVTX = 0x0040,
965  kTenderEMCAL = 0x0080,
966  kTenderPID = 0x0100,
967  kTenderHMPID = 0x0200,
968  kTenderPHOS = 0x0400
969  };
979  virtual void* AddTenderSupply(void* tender,
980  UShort_t flag,
981  Int_t debug)
982  {
983  if (flag == 0) return 0;
984 
985  TString c;
986  TString n;
987  switch (flag) {
988  case kTenderV0: n = "VZERO"; c = "VZERO"; break;
989  case kTenderTPC: n = "TPC"; c = "TPC"; break;
990  case kTenderPtFix: n = "TrackFix"; c = "PtInvFix"; break;
991  case kTenderT0: n = "T0"; c = "TZERO"; break;
992  case kTenderTOF: n = "TOF"; c = "TOF"; break;
993  case kTenderTRD: n = "TRD"; c = "TRD"; break;
994  case kTenderVTX: n = "Vtx"; c = "IP"; break;
995  case kTenderEMCAL: n = "EMCAL"; c = "EMCAL"; break;
996  case kTenderPID: n = "PID"; c = "PID"; break;
997  case kTenderHMPID: n = "HMPID"; c = "HMPID"; break;
998  case kTenderPHOS: n = "PHOS"; c = "PHOS"; break;
999  default:
1000  Warning("AddTenderSupply", "Unknown tender flag: 0x%08x", flag);
1001  return 0;
1002  }
1003  TString m;
1004  switch (flag) {
1005  case kTenderV0: m = Form("s->SetDebug(%d);", debug); break;
1006  case kTenderEMCAL: // Fall through
1007  case kTenderTOF: // Fall through
1008  case kTenderTPC: // Fall through
1009  case kTenderPtFix: // Fall through
1010  case kTenderTRD: m = Form("s->SetDebugLevel(%d);", debug); break;
1011  }
1012 
1013  TString cls(Form("Ali%sTenderSupply", c.Data()));
1014  Long_t ret =
1015  gROOT->ProcessLine(Form("{ %s* s = new %s(\"%s\");"
1016  "((AliTender*)%p)->AddSupply(s);%s"
1017  "} s;",
1018  cls.Data(),
1019  cls.Data(),
1020  n.Data(),
1021  tender,
1022  m.Data()));
1023  void* ptr = reinterpret_cast<void*>(ret);
1024  Info("AddTenderSupply", "Adding supply %s (an %s object): %p",
1025  n.Data(), cls.Data(), ptr);
1026  return ptr;
1027  }
1032  virtual void AddTender(const TString& sup)
1033  {
1034  TString supplies = sup;
1035 
1036  UShort_t which = 0;
1037  supplies.ToUpper();
1038  if (supplies.Contains("V0") ||
1039  supplies.Contains("VZERO")) which |= kTenderV0 ;
1040  if (supplies.Contains("TPC")) which |= kTenderTPC ;
1041  if (supplies.Contains("PTFIX")) which |= kTenderPtFix ;
1042  if (supplies.Contains("T0")) which |= kTenderT0 ;
1043  if (supplies.Contains("TOF")) which |= kTenderTOF ;
1044  if (supplies.Contains("TRD")) which |= kTenderTRD ;
1045  if (supplies.Contains("VTX")) which |= kTenderVTX ;
1046  if (supplies.Contains("EMCAL")) which |= kTenderEMCAL ;
1047  if (supplies.Contains("PID")) which |= kTenderPID ;
1048 
1049  AddTender(which);
1050  }
1056  virtual void AddTender(UShort_t which)
1057  {
1058  if (which == 0) return;
1059 
1060  Int_t vrb = fOptions.AsInt("verbose", 3);
1061 
1062  fRailway->LoadLibrary("Tender");
1063  fRailway->LoadLibrary("TenderSupplies");
1064 
1065  Long_t ret = gROOT->ProcessLine("new AliTender(\"Tender\")");
1066  if (!ret) {
1067  Warning("AddTender", "Failed to make tender");
1068  return;
1069  }
1070  void* tender = reinterpret_cast<void*>(ret);
1071  gROOT->ProcessLine(Form("((AliTender*)%p)->SetCheckEventSelection(%d)",
1072  tender, (which & kTenderV0)));
1073  gROOT->ProcessLine(Form("((AliTender*)%p)->SetDebugLevel(%d)",
1074  tender, vrb));
1075 
1076  // OCDB settings for tender
1077  TString ocdb = fOptions.Get("ocdb");
1078  if (ocdb.IsNull())
1079  ocdb = "raw://";
1080  else if (ocdb.EndsWith(".root")) {
1081  fRailway->LoadLibrary("CDB");
1082  fRailway->LoadAux(ocdb);
1083  gROOT->ProcessLine(Form("AliCDBManager::Instance()->"
1084  "SetSnapshotMode(\"%s\");",
1085  ocdb.Data()));
1086  ocdb = "raw://";
1087  }
1088  gROOT->ProcessLine(Form("((AliTender*)%p)->SetDefaultCDBStorage(\"%s\")",
1089  tender, ocdb.Data()));
1090 
1091  AddTenderSupply(tender, which & kTenderV0, vrb);
1092  AddTenderSupply(tender, which & kTenderTPC, vrb);
1093  AddTenderSupply(tender, which & kTenderPtFix, vrb);
1094  AddTenderSupply(tender, which & kTenderT0, vrb);
1095  AddTenderSupply(tender, which & kTenderTOF, vrb);
1096  AddTenderSupply(tender, which & kTenderTRD, vrb);
1097  AddTenderSupply(tender, which & kTenderVTX, vrb);
1098  AddTenderSupply(tender, which & kTenderEMCAL, vrb);
1099  AddTenderSupply(tender, which & kTenderPID, vrb);
1100 
1101  gROOT->ProcessLine(Form("((AliTender*)%p)->GetSupplies()->Print()",tender));
1102 
1103  AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
1104  AliAnalysisTask* tsk = reinterpret_cast<AliAnalysisTask*>(tender);
1105  mgr->AddTask(tsk);
1106  AliAnalysisDataContainer* cnt =
1107  mgr->CreateContainer("tender_event",
1108  AliESDEvent::Class(),
1109  AliAnalysisManager::kExchangeContainer,
1110  "default_tender");
1111  mgr->ConnectInput (tsk, 0, mgr->GetCommonInputContainer());
1112  mgr->ConnectOutput(tsk, 1, cnt);
1113 
1114  }
1115  /* @} */
1116  //------------------------------------------------------------------
1129  const char* what,
1130  UInt_t val)
1131  {
1132  SetOnTaskGeneric(task, what, Form("%u", val));
1133  }
1142  const char* what,
1143  Int_t val)
1144  {
1145  SetOnTaskGeneric(task, what, Form("%d", val));
1146  }
1155  const char* what,
1156  Long64_t val)
1157  {
1158  SetOnTaskGeneric(task, what, Form("%lld", val));
1159  }
1168  const char* what,
1169  Double_t val)
1170  {
1171  SetOnTaskGeneric(task, what, Form("%lg", val));
1172  }
1181  const char* what,
1182  Bool_t val)
1183  {
1184  SetOnTaskGeneric(task, what, Form("%d", val));
1185  }
1194  const char* what,
1195  const char* val)
1196  {
1197  SetOnTaskGeneric(task, what, Form("\"%s\"", val));
1198  }
1207  const char* what,
1208  const char* val)
1209  {
1210  const char* cls = task->ClassName();
1211  // Info("SetOnTask", "((%s)*%p)->Set%s(%s)", cls, task, what, val);
1212  gROOT->ProcessLine(Form("((%s*)%p)->Set%s(%s)",cls,task,what,val));
1213  }
1214  /* @} */
1215  //------------------------------------------------------------------
1229  const char* what,
1230  const char* opt,
1231  Double_t defval)
1232  {
1233  Double_t val = fOptions.AsDouble(opt,defval);;
1234  // Info("FromOption<D>"," %p, %s, %s, %f", task, what, opt, val);
1235  SetOnTask(task, what, val);
1236  }
1245  const char* what,
1246  const char* opt,
1247  Bool_t /*defval*/)
1248  {
1249  Bool_t val = fOptions.AsBool(opt);;
1250  // Info("FromOption<B>"," %p, %s, %s, %d", task, what, opt, val);
1251  SetOnTask(task, what, val);
1252  }
1262  const char* what,
1263  const char* opt,
1264  const char* defval)
1265  {
1266  TString val = fOptions.AsString(opt,defval);
1267  // Info("FromOption<S>"," %p, %s, %s, %s", task, what, opt, val);
1268  SetOnTask(task, what, val.Data());
1269  }
1279  const char* what,
1280  const char* opt,
1281  Int_t defval)
1282  {
1283  Int_t val = fOptions.AsInt(opt, defval);
1284  // Info("FromOption<I>"," %p, %s, %s, %d", task, what, opt, val);
1285  SetOnTask(task, what, val);
1286  }
1296  const char* what,
1297  const char* opt,
1298  Long64_t defval)
1299  {
1300  Long64_t val = fOptions.AsLong(opt, defval);
1301  // Info("FromOption<L>"," %p, %s, %s, %lld", task, what, opt, val);
1302  SetOnTask(task, what, val);
1303  }
1304  /* @} */
1305 
1306  // -----------------------------------------------------------------
1317  virtual Bool_t HasMCHandler() const
1318  {
1319  AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
1320  if (!mgr) return false;
1321  return mgr->GetMCtruthEventHandler() != 0;
1322  }
1323  /* @} */
1330  virtual const Char_t* ClassName() const = 0;
1331  /* @} */
1332  //__________________________________________________________________
1333  virtual void AddMonitor(const TString& name)
1334  {
1335  if (fRailway->Mode() != Railway::kProof) return;
1336  Warning("CreateMonitors", "Monitoring not supported yet (%s)", name.Data());
1337  }
1338  //__________________________________________________________________
1343  virtual void CreateMonitors()
1344  {
1345  }
1346  //__________________________________________________________________
1359  static TString EscapeName(const char* name, TString& datimeStr)
1360  {
1361  TString escaped = name;
1362  char c[] = { ' ', '/', '@', 0 };
1363  char* p = c;
1364  while (*p) {
1365  char tmp[] = { *p, '\0' };
1366  escaped.ReplaceAll(tmp, "_");
1367  p++;
1368  }
1369  if (!datimeStr.IsNull() &&
1370  !datimeStr.EqualTo("none", TString::kIgnoreCase)) {
1371  TDatime datime;
1372  if (datimeStr.EqualTo("now", TString::kIgnoreCase))
1373  datime.Set();
1374  else {
1375  // Try various formats
1376  struct tm t;
1377  const char* formats[] = { "%Ec", // Locale
1378  "%c", // Locale
1379  "%Ex EX", // Locale
1380  "%x %X", // Locale
1381  "%Y%m%d_%H%M", // YYYYMMDD_HHMM
1382  "%F %R", // ISO standard, no seconds
1383  0 };
1384  const char** f = formats;
1385  Bool_t found = false;
1386  while (*f && !found) {
1387  // Reset needed fields
1388  t.tm_year = 0;
1389  t.tm_mon = 0;
1390  t.tm_mday = 0;
1391  t.tm_hour = 0;
1392  t.tm_min = 0;
1393  // Stop processing on first match
1394  if (strptime(datimeStr.Data(), *f, &t) != 0) found = true;
1395  f++;
1396  }
1397  if (found) {
1398  t.tm_mon += 1; // Return 0-based month
1399  datime.Set(t.tm_year, t.tm_mon, t.tm_mday, t.tm_hour, t.tm_min, 0);
1400  }
1401  }
1402  if (datime.GetYear() <= 1995 ||
1403  datime.GetMonth() == 0 ||
1404  datime.GetDay() == 0) return escaped;
1405  datimeStr = Form("%04d%02d%02d_%02d%02d",
1406  datime.GetYear(),
1407  datime.GetMonth(),
1408  datime.GetDay(),
1409  datime.GetHour(),
1410  datime.GetMinute());
1411  escaped.Append(Form("_%s", datimeStr.Data()));
1412  }
1413  return escaped;
1414  }
1421  {
1422  // Get the name of the target directory
1423  TString& nam = fEscapedName;
1424 
1425  // Check if the directory exists already
1426  Bool_t exists = gSystem->AccessPathName(nam.Data()) == 0;
1427  if (fRailway->Operation() == Railway::kTerminate && !exists) {
1428  Error("SetupWorkingDirectory", "File/directory %s does not exists",
1429  nam.Data());
1430  return false;
1431  }
1432 
1433  Bool_t overwrite = fOptions.Has("overwrite");
1434  // If we're not allowed to overwrite, then complain
1435  if (!overwrite && exists) {
1436  Error("SetupWorkingDirectory", "File/directory %s already exists",
1437  nam.Data());
1438  return false;
1439  }
1440 
1441  // Make the target directory if it doesn't exists
1442  if (!exists) {
1443  if (gSystem->MakeDirectory(nam.Data())) {
1444  Error("SetupWorkingDirectory", "Failed to make directory '%s'",
1445  nam.Data());
1446  return false;
1447  }
1448  }
1449 
1450  // Change directory to target directory
1451  if (!gSystem->ChangeDirectory(nam.Data())) {
1452  Error("SetupWorkingDirectory", "Failed to change directory to %s",
1453  nam.Data());
1454  return false;
1455  }
1456  // Info("SetupWorkingDirectory", "Made subdirectory %s, and cd'ed there",
1457  // nam.Data());
1458  return true;
1459  }
1460  /* @} */
1461  // -----------------------------------------------------------------
1471  virtual void SaveSetup(Bool_t asShellScript)
1472  {
1473  OptionList tmp(fOptions);
1474  const OptionList* uopts = (fRailway ? &fRailway->Options() : 0);
1475  if (tmp.Find("overwrite")) tmp.Set("overwrite");
1476  if (tmp.Find("date") && fEscapedName.Length() > fName.Length()+1) {
1477  Int_t n = fName.Length()+1;
1478  tmp.Set("date", fEscapedName(n, fEscapedName.Length()-n));
1479  }
1480  if (asShellScript)
1481  SaveSetupShell("rerun", ClassName(), fName, tmp, uopts);
1482  SaveSetupROOT("ReRun", ClassName(), fName, tmp, uopts);
1483  if (fRailway) fRailway->AuxSave(fEscapedName, asShellScript);
1485  }
1495  static void SaveSetupShell(const TString& out, const TString& cls,
1496  const TString& name, const OptionList& opts,
1497  const OptionList* uopts)
1498  {
1499  std::ofstream o(Form("%s.sh", out.Data()));
1500  TString url = opts.Get("url");
1501  OptionList tmp(opts);
1502  tmp.Set("url", "${url}");
1503  o << "#!/bin/bash\n\n"
1504  << "class=\"" << cls << "\"\n"
1505  << "name=\"" << name << "\"\n"
1506  << "url=\"" << url << "\"\n\n"
1507  << "# Available options\n"
1508  << "# \n";
1509  tmp.Help(o, "# --");
1510  if (uopts) {
1511  o << "#\n"
1512  << "# Available URI options\n"
1513  << "# \n";
1514  uopts->Help(o, "# ");
1515  }
1516  o << "#\n"
1517  << "opts=(--class=$class \\\n"
1518  << " --name=$name";
1519  tmp.Store(o, " \\\n --", "", true);
1520  o << ")\n\n"
1521  << "echo \"Running runTrain ${opts[@]} $@\"\n"
1522  << "runTrain \"${opts[@]}\" $@\n\n"
1523  << "# EOF" << std::endl;
1524  o.close();
1525  gSystem->Exec(Form("chmod a+x %s.sh", out.Data()));
1526  }
1536  static void SaveSetupROOT(const TString& out, const TString& cls,
1537  const TString& name, const OptionList& opts,
1538  const OptionList* uopts)
1539  {
1540  OptionList tmp(opts);
1541  tmp.Remove("url");
1542 
1543  std::ofstream o(Form("%s.C", out.Data()));
1544  o << "// Available options:\n"
1545  << "// \n";
1546  tmp.Help(o, "// ");
1547  if (uopts) {
1548  o << "// \n"
1549  << "// Available URI options\n";
1550  uopts->Help(o, "// ");
1551  }
1552  o << "//\n"
1553  << "Bool_t " << out << "()\n"
1554  << "{\n"
1555  << " TString name(\"" << name << "\");\n"
1556  << " TString cls(\"" << cls << "\");\n"
1557  << " TUrl uri(\"" << opts.Get("url") << "\");\n"
1558  << " \n"
1559  << " TString opts(";
1560  tmp.Store(o, "\"", ",\"\n ", false);
1561  o << ");\n\n"
1562  << " TString path(";
1563  TString path(gROOT->GetMacroPath());
1564  TObjArray* elements = path.Tokenize(":");
1565  TObjString* element = 0;
1566  TIter next(elements);
1567  while ((element = static_cast<TObjString*>(next()))) {
1568  if (element->String().IsNull()) continue;
1569  o << "\n \"" << element->GetName() << ":\"";
1570  }
1571  elements->Delete();
1572  o << ");\n"
1573  << " path.Append(\"$ALICE_PHYSICS/PWGLF/FORWARD/trains\");\n"
1574  << " gROOT->SetMacroPath(path);\n\n"
1575  << " gROOT->LoadMacro(\"RunTrain.C\");\n\n"
1576  << " return RunTrain(name, cls, uri, opts);\n"
1577  << "}\n"
1578  << "//\n"
1579  << "// EOF\n"
1580  << "//" << std::endl;
1581  o.close();
1582  }
1596  virtual void PostShellCode(std::ostream& o)
1597  {
1598  o << " echo \"Nothing to do for " << ClassName()
1599  << " train\"" << std::endl;
1600  }
1618  {
1619  std::ofstream f("post.sh");
1620  if (!f) {
1621  Error("SavePostAll", "Failed to open post.sh script");
1622  return;
1623  }
1624  f << "#!/bin/bash\n"
1625  << "# Generated by " << ClassName() << "\n"
1626  << "set -e\n"
1627  << "\n"
1628  << "dest=$1\n"
1629  << "prefix=\n"
1630  << "\n"
1631  << "doall() {"
1632  << std::endl;
1633  PostShellCode(f);
1634  f << "}\n"
1635  << "\n"
1636  << "if test ! -f Download.C ;then\n"
1637  << " doall\n"
1638  << " exit\n"
1639  << "fi\n"
1640  << "\n"
1641  << "if test ! -f .download ; then\n"
1642  << " aliroot -l -b -q Download.C\\(1\\)\n"
1643  << " touch .download\n"
1644  << "fi\n"
1645  << "prefix=../\n"
1646  << "\n"
1647  << "for i in root_archive_*.zip ; do\n"
1648  << " d=`basename $i .zip` \n"
1649  << " if test ! -d $d ; then\n"
1650  << " echo \"Directory $d missing\"\n"
1651  << " continue\n"
1652  << " fi\n"
1653  << " \n"
1654  << " (cd $d && doall)\n"
1655  << "done\n"
1656  << "# EOF"
1657  << std::endl;
1658  f.close();
1659  gSystem->Exec("chmod a+x post.sh");
1660  }
1661  /* @} */
1667 };
1668 #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:759
virtual void CreateMonitors()
Definition: TrainSetup.C:1343
void SetOnTaskGeneric(AliAnalysisTaskSE *task, const char *what, const char *val)
Definition: TrainSetup.C:1206
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:1617
TString fDatimeString
Definition: TrainSetup.C:1664
Bool_t Run()
Definition: TrainSetup.C:306
const char * url
Railway * fRailway
Definition: TrainSetup.C:1666
void FromOption(AliAnalysisTaskSE *task, const char *what, const char *opt, Bool_t)
Definition: TrainSetup.C:1244
static Railway * Create(const TUrl &url, Int_t verbose=0)
Definition: Railway.C:653
TString fName
Definition: TrainSetup.C:1662
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:939
void FromOption(AliAnalysisTaskSE *task, const char *what, const char *opt, const char *defval)
Definition: TrainSetup.C:1261
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:908
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:1193
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:1056
TCanvas * c
Definition: TestFitELoss.C:172
virtual AliVEventHandler * CreateMCHandler(UShort_t, bool mc)
Definition: TrainSetup.C:582
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:1495
static TString EscapeName(const char *name, TString &datimeStr)
Definition: TrainSetup.C:1359
virtual const char * Desc() const =0
void SetOnTask(AliAnalysisTaskSE *task, const char *what, Bool_t val)
Definition: TrainSetup.C:1180
virtual AliAnalysisTaskSE * CoupleSECar(const TString &macro, UInt_t mask=0)
Definition: TrainSetup.C:894
void FromOption(AliAnalysisTaskSE *task, const char *what, const char *opt, Int_t defval)
Definition: TrainSetup.C:1278
virtual AliVEventHandler * CreateOutputHandler(UShort_t type)
Definition: TrainSetup.C:596
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:860
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
virtual Short_t InputType() const
Definition: Railway.C:338
void SetOnTask(AliAnalysisTaskSE *task, const char *what, Int_t val)
Definition: TrainSetup.C:1141
void LoadOADB(Bool_t asPar=false)
Definition: TrainSetup.C:927
void FromOption(AliAnalysisTaskSE *task, const char *what, const char *opt, Long64_t defval)
Definition: TrainSetup.C:1295
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:1167
virtual void SaveSetup(Bool_t asShellScript)
Definition: TrainSetup.C:1471
virtual Bool_t LoadAux(const TString &name, Bool_t copy=false)
Definition: Railway.C:255
Float_t nEvents[nProd]
Bool_t SetupWorkingDirectory()
Definition: TrainSetup.C:1420
Base class for analysis helpers.
void FromOption(AliAnalysisTaskSE *task, const char *what, const char *opt, Double_t defval)
Definition: TrainSetup.C:1228
virtual void * AddTenderSupply(void *tender, UShort_t flag, Int_t debug)
Definition: TrainSetup.C:979
OptionList fOptions
Definition: TrainSetup.C:1665
virtual Bool_t HasMCHandler() const
Definition: TrainSetup.C:1317
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:651
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:1154
virtual AliAnalysisTask * CoupleCar(const TString &macro, const TString &args)
Definition: TrainSetup.C:833
virtual void AddMonitor(const TString &name)
Definition: TrainSetup.C:1333
Bool_t Version(std::ostream &o=std::cout)
Definition: TrainSetup.C:380
virtual void AddTender(const TString &sup)
Definition: TrainSetup.C:1032
virtual void PostShellCode(std::ostream &o)
Definition: TrainSetup.C:1596
TString fEscapedName
Definition: TrainSetup.C:1663
virtual void CreatePhysicsSelection(Bool_t mc, AliAnalysisManager *mgr)
Definition: TrainSetup.C:693
virtual AliAnalysisTaskSE * CoupleSECar(const TString &macro, const TString &args, UInt_t mask=0)
Definition: TrainSetup.C:875
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:1536
void SetOnTask(AliAnalysisTaskSE *task, const char *what, UInt_t val)
Definition: TrainSetup.C:1128