AliPhysics  97a96ce (97a96ce)
 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  fDatimeString = "";
99  }
106  : fName(o.fName),
109  fOptions(o.fOptions),
110  fRailway(o.fRailway)
111  {}
120  {
121  if (&o == this) return *this;
122  fName = o.fName;
125  fOptions = o.fOptions;
126  fRailway = o.fRailway;
127  return *this;
128  }
129 
133  virtual ~TrainSetup() {}
134  /* @} */
135  //__________________________________________________________________
146  {
147  // --- Print the version number ----------------------------------
148  Info("Init", "Running with TrainSetup version %d", kVersion);
149 
150  // --- Create the helper -----------------------------------------
151  TString url = fOptions.Get("url");
152  Int_t verbose = fOptions.AsInt("verbose");
153 
154  fRailway = Railway::Create(url.Data(), verbose);
155  if (!fRailway) {
156  Error("Init", "Failed to make the worker for URL %s", url.Data());
157  return false;
158  }
159 
160  // --- Check the type, if possible -------------------------------
161  UShort_t type = fRailway->InputType();
162  Bool_t mc = fRailway->IsMC();
163  if (fOptions.Has("type")) {
164  const TString& it = fOptions.Get("type");
165  if (it.EqualTo("ESD",TString::kIgnoreCase)) type = Railway::kESD;
166  else if (it.EqualTo("AOD",TString::kIgnoreCase)) type = Railway::kAOD;
167  else if (it.EqualTo("user",TString::kIgnoreCase))
168  type = Railway::kUser;
169  }
170 
171  // --- Rewrite the escpaed name ----------------------------------
172  if (fOptions.Has("date")) {
173  fDatimeString = fOptions.Get("date");
175  }
176 
177  // --- Get current directory and set-up sub-directory ------------
178  TString cwd = gSystem->WorkingDirectory();
179  if (!SetupWorkingDirectory()) return false;
180 
181  // --- Do initial helper setup -----------------------------------
182  if (!fRailway->PreSetup()) return false;
183 
184  // --- Load ROOT libraries ---------------------------------------
185  if (!fRailway->LoadROOT()) return false;
186 
187  // --- Load AliROOT libraries ------------------------------------
188  if (!fRailway->LoadAliROOT()) return false;
189 
190  // --- Load AliROOT libraries ------------------------------------
191  if (!fRailway->LoadAliPhysics()) return false;
192 
193  // --- Create analysis manager -----------------------------------
195 
196  // In test mode, collect system information on every event
197  // if (oper == kTest) mgr->SetNSysInfo(1);
198  if (verbose > 0) mgr->SetDebugLevel(verbose);
199  mgr->SetAutoBranchLoading(!fOptions.Has("branches"));
200  if (fRailway->Mode() == Railway::kLocal)
201  mgr->SetUseProgressBar(kTRUE, 100);
202 
203  // --- ESD input handler ------------------------------------------
204  AliVEventHandler* inputHandler = CreateInputHandler(type);
205  if (inputHandler) mgr->SetInputEventHandler(inputHandler);
206 
207  // --- Monte-Carlo ------------------------------------------------
208  AliVEventHandler* mcHandler = CreateMCHandler(type,mc);
209  if (mcHandler) mgr->SetMCtruthEventHandler(mcHandler);
210 
211  // --- AOD output handler -----------------------------------------
212  AliVEventHandler* outputHandler = CreateOutputHandler(type);
213  if (outputHandler) mgr->SetOutputEventHandler(outputHandler);
214 
215  // --- Include analysis macro path in search path ----------------
216  gROOT->SetMacroPath(Form("%s:%s:$ALICE_ROOT/ANALYSIS/macros:"
217  "$ALICE_PHYSICS/OADB/macros",
218  cwd.Data(), gROOT->GetMacroPath()));
219 
220  // --- Tender/OCDB -----------------------------------------------
221  if (type == Railway::kESD) {
222  TString supplies = fOptions.Get("tender");
223  if (!supplies.IsNull()) {
224  AddTender(supplies);
225  }
226  else if (fOptions.AsBool("ocdb")) {
227  AddOCDBConnect();
228  }
229  }
230 
231  // --- Physics selction - only for ESD ---------------------------
232  if (type == Railway::kESD) CreatePhysicsSelection(mc, mgr);
233 
234  // --- Create centrality task ------------------------------------
236 
237  // --- Create tasks ----------------------------------------------
238  CreateTasks(mgr);
239 
240  // --- Create monitor objects ------------------------------------
241  CreateMonitors();
242 
243  // --- Post set-up initialization of helper ----------------------
244  if (!fRailway->PostSetup()) return false;
245 
246  // --- Set debug level on defined tasks --------------------------
247  if (verbose > 0) {
248  TIter next(mgr->GetTasks());
249  AliAnalysisTask* sub = 0;
250  while ((sub = static_cast<AliAnalysisTask*>(next()))) {
251  AliAnalysisTaskSE* se = dynamic_cast<AliAnalysisTaskSE*>(sub);
252  if (!se) continue;
253  se->SetDebugLevel(verbose);
254  }
255  }
256 
257  // --- Print this setup ------------------------------------------
258  Print();
259 
260  // --- Initialise the train --------------------------------------
261  if (!mgr->InitAnalysis()) {
262  gSystem->ChangeDirectory(cwd.Data());
263  Error("Init","Failed to initialise train");
264  return false;
265  }
266 
267  // --- Enable progress bar ---------------------------------------
268  if (fRailway->Mode() != Railway::kGrid)
269  mgr->SetUseProgressBar(true, 100);
270 
271  // --- Save setup to disk ----------------------------------------
272  SaveSetup(true);
273 
274  // --- Some information ------------------------------------------
275  mgr->PrintStatus();
276  if (fRailway->Mode() != Railway::kLocal) {
277  TIter next(mgr->GetTasks());
278  AliAnalysisTask* sub = 0;
279  while ((sub = static_cast<AliAnalysisTask*>(next()))) {
280  sub->Print();
281  }
282  }
283  return true;
284  }
291  void PrintTimer(TStopwatch& timer, const char* where)
292  {
293  timer.Stop();
294  Double_t t = timer.RealTime();
295  Int_t h = Int_t(t / 3600); t -= h * 3600;
296  Int_t m = Int_t(t / 60); t -= m * 60;
297  if (t < 0) t = 0;
298  Info(where, "took %4d:%02d:%06.3f", h, m, t);
299  }
306  {
307  TString cwd = gSystem->WorkingDirectory();
308  Bool_t status = false;
309  TStopwatch timer;
310  timer.Start();
311  try {
312  if (!Init()) throw TString("Failed to intialize the train");
313  PrintTimer(timer, "Initialization");
314  timer.Continue();
315 
316  // Check if we're asked to only do the setup
317  if (fOptions.Has("setup")) {
318  status = true;
319  throw TString("Only did setup, no running");
320  }
321 
322  // if (r) SaveSetup(*r, nEvents, asShell);
323 
324  Long64_t nEvents = fOptions.AsLong("events", -1);
325  Long64_t ret = fRailway->Run(nEvents);
326  PrintTimer(timer, "Processing");
327  timer.Continue();
328 
329  // Make sure we go back
330  gSystem->ChangeDirectory(cwd.Data());
331 
332  // Return.
333  if (ret < 0) throw TString("Analysis failed");
334 
335  status = true;
336  }
337  catch (TString& e) {
338  if (status) Warning("Run", "%s", e.Data());
339  else Error("Run", "%s", e.Data());
340  }
341  if (fOptions.Has("date") &&
342  !fOptions.Get("date").EqualTo("none") &&
343  !fOptions.Has("no-link")) {
344  TString tmp = "";
345  TString escaped = EscapeName(fName, tmp);
346  gSystem->Exec(Form("rm -f last_%s", escaped.Data()));
347  gSystem->Exec(Form("ln -sf %s last_%s",
348  fEscapedName.Data(), escaped.Data()));
349  }
350  PrintTimer(timer, "Finish");
351  timer.Continue();
352  return status;
353  }
360  OptionList& Options() { return fOptions; }
365  void Print(Option_t* ="") const
366  {
367  std::cout << "Train: " << fName << " (" << fEscapedName << ")"
368  << std::endl;
369  fOptions.Show(std::cout);
370  if (fRailway) fRailway->Print();
371  }
379  Bool_t Version(std::ostream& o=std::cout)
380  {
381  if (!fOptions.Has("version")) return true;
382 
383  o << "TrainSetup version " << kVersion << std::endl;
384  return false;
385  }
394  Bool_t Help(std::ostream& o=std::cout, bool asProg=false)
395  {
396  if (!fOptions.Has("help")) return true;
397 
398  if (!asProg)
399  o << "Usage: RunTrain(NAME, CLASS, OPTIONS)";
400 
401  o << "\n\nTrain Options:\n";
402  fOptions.Help(o, asProg ? " --" : " ");
403  o << "\n";
404 
405  if (!fRailway && fOptions.Has("url")) {
406  TString url = fOptions.Get("url");
407  fRailway = Railway::Create(url.Data());
408  }
409  if (fRailway) {
410  o << fRailway->Desc() << " URL form:\n\n"
411  << " " << fRailway->UrlHelp() << "\n\n"
412  << "Options:\n";
413  fRailway->Options().Help(o, " ");
414  o << "\n";
415  }
416  else {
417  o << "Possible URL forms:\n\n";
418  Railway::ShowUrlHelp("LocalRailway");
419  Railway::ShowUrlHelp("ProofRailway");
420  Railway::ShowUrlHelp("LiteRailway");
421  Railway::ShowUrlHelp("VAFRailway");
422  Railway::ShowUrlHelp("AAFRailway");
423  Railway::ShowUrlHelp("AAFPluginRailway");
424  Railway::ShowUrlHelp("GridRailway");
425  o << "\n";
426  }
427  return false;
428  }
442  static Bool_t Main(const TString& name, const TString& cls,
443  const TCollection* opts,
444  Bool_t asProg=true,
445  Bool_t spawn=false)
446  {
447  Bool_t ret = false;
448  try {
449  if (cls.IsNull())
450  throw TString("No class name specified");
451  if (name.IsNull())
452  throw TString("No train name specified");
453  TString mkLib = gSystem->GetMakeSharedLib();
454  mkLib.ReplaceAll("-std=c++14", "-std=c++98");
455  // mkLib.Append("-ffpe-trap=invalid,zero,overflow,underflow,inexact");
456  gSystem->SetMakeSharedLib(mkLib);
457 
458  gROOT->ProcessLine("gSystem->RedirectOutput(\"build.log\",\"w\");");
459  Int_t error = 0;
460  Int_t r1 = gROOT->LoadMacro(Form("%s.C+g", cls.Data()), &error);
461  gROOT->ProcessLine("gSystem->RedirectOutput(0);");
462  if (r1 < 0 || error)
463  throw TString::Format("Failed to load setup %s: %d - see build.log",
464  cls.Data(), error);
465 
466  // Make our object using the interpreter
467  TString create = TString::Format("new %s(\"%s\")",
468  cls.Data(), name.Data());
469  gROOT->ProcessLine("gSystem->RedirectOutput(\"build.log\",\"a\");");
470  Long_t retP = gROOT->ProcessLine(create, &error);
471  gROOT->ProcessLine("gSystem->RedirectOutput(0);");
472  if (!retP || error)
473  throw TString::Format("Failed to make object of class %s "
474  "(see build.log): 0x%08lx/%d\n\t%s",
475  cls.Data(), retP, error, create.Data());
476 
477  TrainSetup* train = reinterpret_cast<TrainSetup*>(retP);
478 
479  // Now parse the options
480  if (!train->Options().Parse(opts))
481  throw TString("Failed to parse options");
482 
483  // Info("", "URL=%s", train->Options().Get("url").Data());
484 
485  // Check if we got a help request
486  if (!train->Help(std::cout, asProg)) {
487  ret = true;
488  throw TString("");
489  }
490  // Check if we got a version request
491  if (!train->Version(std::cout)) {
492  ret = true;
493  throw TString("");
494  }
495 
496  // return train->Init();
497  ret = train->Run();
498  }
499  catch (TString& e) {
500  if (!e.IsNull()) Error("Main", "%s", e.Data());
501  }
502  // Info("Main", "End of main loop (app=%p, asProg=%s, spawn=%s)",
503  // gApplication, asProg ? "true" : "false", spawn ? "true" : "false");
504  if (gApplication && asProg) {
505  if (!spawn) {
506  gSystem->Sleep(3);
507  gApplication->Terminate(ret ? 0 : 1);
508  }
509  }
510  return ret;
511  }
512 protected:
513  //__________________________________________________________________
525  virtual AliAnalysisManager* CreateAnalysisManager(const char* name)
526  {
527  return new AliAnalysisManager(name,"Analysis Train");
528  }
538  virtual AliVEventHandler* CreateInputHandler(UShort_t type,
539  Bool_t esdRecPoints=false)
540  {
541  Info("CreateInputHandler", "Making handler for %d (%d)",
542  type, esdRecPoints);
543  AliVEventHandler* ret = 0;
544  switch (type) {
545  case Railway::kESD: {
546  AliESDInputHandler* input = 0;
547  if (!esdRecPoints) input = new AliESDInputHandler();
548  else {
549  Info("CreateInputHandler", "Special handler for rec-points");
550  AliESDInputHandlerRP* esd = new AliESDInputHandlerRP();
551  // esd->ReadFromDirectory();
552  input = esd;
553  }
554  input->SetReadFriends(fOptions.AsBool("friends"));
555  ret = input;
556  }
557  break;
558  case Railway::kAOD: {
559  AliAODInputHandler* input = new AliAODInputHandler();
560  TString fr = fOptions.Get("friends");
561  TObjArray* afr = fr.Tokenize(",+:");
562  TObject* ofr = 0;
563  TIter nfr(afr);
564  while ((ofr = nfr())) input->AddFriend(const_cast<char*>(ofr->GetName()));
565  afr->Delete();
566  ret = input;
567  }
568  break;
569  case Railway::kUser: return 0;
570  }
571  // Info("CreateInput", "Returning input handler %p", ret);
572  return ret;
573  }
581  virtual AliVEventHandler* CreateMCHandler(UShort_t /*type*/, bool mc)
582  {
583  if (!mc) return 0;
584  AliMCEventHandler* mcHandler = new AliMCEventHandler();
585  mcHandler->SetReadTR(true);
586  return mcHandler;
587  }
595  virtual AliVEventHandler* CreateOutputHandler(UShort_t type)
596  {
597  AliAODHandler* ret = new AliAODHandler();
598  switch (type) {
599  case Railway::kESD:
600  ret->SetOutputFileName("AliAOD.root");
601  break;
602  case Railway::kAOD:
603  ret->SetOutputFileName("AliAOD.pass2.root");
604  break;
605  case Railway::kUser:
606  break;
607  }
608 
609  return ret;
610  }
693  {
694  TString opt = fOptions.Get("ps");
695  // opt.ToUpper();
696 
697  if (opt.EqualTo("NONE",TString::kIgnoreCase)) return;
698 
699  // Possibly load as PAR
700  LoadOADB();
701 
702  AliPhysicsSelection* ps = 0;
703  AliInputEventHandler* input =
704  dynamic_cast<AliInputEventHandler*> (mgr->GetInputEventHandler());
705  if (!input) return;
706 
707  // --- Create object, either directory or via task ---------------
708  if (opt.Contains("BARE",TString::kIgnoreCase)) {
709  // --- Just create object and set on input handler -------------
710  ps = new AliPhysicsSelection();
711  if (mc) ps->SetAnalyzeMC();
712 
713  input->SetEventSelection(ps);
714  }
715  else {
716  // --- Create and add the task ---------------------------------
717  CoupleSECar("AddTaskPhysicsSelection.C", Form("%d", mc), AliVEvent::kAny);
718  mgr->RegisterExtraFile("event_stat.root");
719  // mgr->AddStatisticsTask(AliVEvent::kAny);
720 
721  // --- Retrive object from input handler -----------------------
722  ps = dynamic_cast<AliPhysicsSelection*>(input->GetEventSelection());
723  }
724  if (opt.Contains("CUSTOM",TString::kIgnoreCase)) {
725  // --- Load custom trigger definitions -------------------------
726  TString macro("CustomPS.C");
727  Int_t eq = opt.Index("custom=",7,0,TString::kIgnoreCase);
728  if (eq != kNPOS) {
729  Int_t end = opt.Index(".C",2,eq+7,TString::kIgnoreCase);
730  if (end != kNPOS) {
731  macro = opt(eq+7,end+2-eq-7);
732  }
733  }
734  fRailway->LoadAux(macro);
735  TString rmacro = gSystem->Which(gROOT->GetMacroPath(), macro);
736  if (rmacro.IsNull()) {
737  Error("CreatePhysicsSelection", "Custom PS script %s not found",
738  macro.Data());
739  return;
740  }
741  Info("CreatePhysicsSelection", "Loading custom PS from %s",rmacro.Data());
742  TString base(gSystem->BaseName(rmacro.Data()));
743  gROOT->Macro(Form("%s((AliPhysicsSelection*)%p)", base.Data(), ps));
744  }
745 
746  if (opt.Contains("ALL",TString::kIgnoreCase)) {
747  // --- Ignore trigger class when selecting events. This means -
748  // --- that we get offline+(A,C,E) events too ------------------
749  Info("CreatePhysicsSelection", "Skipping trigger selection");
750  ps->SetSkipTriggerClassSelection(true);
751  }
752  }
759  {
760  AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
761  AliVEventHandler* inp = mgr->GetInputEventHandler();
762  if (!inp) return;
763 
764  // Possibly load as PAR
765  LoadOADB();
766 
767  gROOT->SetMacroPath(Form("$ALICE_PHYSICS/OADB/COMMON/MULTIPLICITY/macros"
768  ":%s", gROOT->GetMacroPath()));
769  AliAnalysisTaskSE* task = CoupleSECar("AddTaskMultSelection.C","false");
770  FromOption(task, "AlternateOADBforEstimators", "cent-oadb", "");
771  if (fOptions.Has("cent-oadb")) {
772  TString centOADB = fOptions.AsString("cent-oadb");
773  if (centOADB.EndsWith(".root")) {
774  TString base(gSystem->BaseName(centOADB.Data()));
775  TString per(base);
776  per.ReplaceAll("OADB-","");
777  per.ReplaceAll(".root","");
778  SetOnTask(task, "AlternateOADBforEstimators", per);
779  fRailway->LoadAux(centOADB);
780  if (mc)
781  SetOnTask(task, "AlternateOADBFullManualBypassMC", base);
782  else
783  SetOnTask(task, "AlternateOADBFullManualBypas", base);
784  }
785  }
786  if (!task->HasBranches()) {
787  // Everything except tracks since that slows does things and is
788  // really only needed for reference multiplicities
789  task->SetBranches("ESD:AliESDRun.,AliESDHeader.,AliESDZDC.,"
790  "AliESDVZERO.,AliESDTZERO.,TPCVertex.,"
791  "SPDVertex.,PrimaryVertex.,AliMultiplicity."
792  "SPDPileupVertices,TrkPileupVertices,"
793  "AliESDAD. "
794  "AOD:header,vertices,AliAODTZERO,AliAODVZERO,"
795  "AliAODZDC,AliAODAD");
796  }
797  if (!fOptions.Has("old-cent")) return;
798 
799 
800  // Check if input is AOD
801  Bool_t isAOD = inp->IsA()->InheritsFrom(AliAODInputHandler::Class());
802  if (isAOD) return;
803 
804  task = CoupleSECar("AddTaskCentrality.C",
805  Form("true,%s", isAOD ? "true" : "false"));
806  AliCentralitySelectionTask* ctask =
807  dynamic_cast<AliCentralitySelectionTask*>(task);
808  if (!ctask) return;
809  if (mc) ctask->SetMCInput();
810  }
816  virtual void CreateTasks(AliAnalysisManager* mgr)=0;
817  /* @} */
818  // -----------------------------------------------------------------
831  virtual AliAnalysisTask* CoupleCar(const TString& macro,
832  const TString& args)
833  {
834  TString p = gSystem->Which(gROOT->GetMacroPath(), macro.Data());
835  if (p.IsNull()) {
836  Error("CoupleCar", "Macro %s not found", macro.Data());
837  return 0;
838  }
839  TString cmd(p);
840  if (!args.IsNull())
841  cmd.Append(TString::Format("(%s)", args.Data()));
842  Info("CoupleCar", "Execute %s", cmd.Data());
843  Int_t err;
844  Long_t ret = gROOT->Macro(cmd.Data(), &err, false);
845  if (!ret) {
846  Error("CoupleCar", "Failed to execute %s (%ld)", cmd.Data(), ret);
847  return 0;
848  }
849  return reinterpret_cast<AliAnalysisTask*>(ret);
850  }
858  virtual AliAnalysisTask* CoupleCar(const TString& macro)
859  {
860  TString args;
861  return CoupleCar(macro, args);
862  }
873  virtual AliAnalysisTaskSE* CoupleSECar(const TString& macro,
874  const TString& args,
875  UInt_t mask=0)
876  {
877  AliAnalysisTaskSE* task =
878  dynamic_cast<AliAnalysisTaskSE*>(CoupleCar(macro, args));
879  // Explicitly set mask
880  if (mask > 0) task->SelectCollisionCandidates(mask);
881  return task;
882  }
892  virtual AliAnalysisTaskSE* CoupleSECar(const TString& macro,
893  UInt_t mask=0)
894  {
895  TString args;
896  return CoupleSECar(macro, args, mask);
897  }
906  virtual AliAnalysisTask* FindCar(const TString& name,
907  Bool_t verbose=true) const
908  {
909  AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
910  if (!mgr) {
911  ::Warning("FindCar", "No manager defined");
912  return 0;
913  }
914  AliAnalysisTask* task = mgr->GetTask(name);
915  if (!task && verbose)
916  ::Warning("FindCar", "Task \"%s\" not found in train",
917  name.Data());
918  return task;
919  }
925  void LoadOADB(Bool_t asPar=false)
926  {
927  Bool_t usePar = asPar;
928  fRailway->UsePar(usePar); // Disabled pars temporarily
929  fRailway->LoadLibrary("OADB");
930  fRailway->UsePar(usePar); // Set to old value
931  }
932  /* @} */
937  virtual void AddOCDBConnect()
938  {
939  fRailway->LoadLibrary("PWGPP");
940  Long_t ret = gROOT->ProcessLine("new AliTaskCDBconnect(\"cdb\")");
941  if (!ret) {
942  Fatal("AddOCDBConnect", "Failed to add OCDB connection task");
943  return;
944  }
945  AliAnalysisTask* task = reinterpret_cast<AliAnalysisTask*>(ret);
946  if (!task->HasBranches()) task->SetBranches("ESD:AliESDRun. AOD:header");
947  AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
948 
949  mgr->AddTask(task);
950  mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
951  }
955  enum {
956  kTenderV0 = 0x0001,
957  kTenderTPC = 0x0002,
958  kTenderPtFix = 0x0004,
959  kTenderT0 = 0x0008,
960  kTenderTOF = 0x0010,
961  kTenderTRD = 0x0020,
962  kTenderVTX = 0x0040,
963  kTenderEMCAL = 0x0080,
964  kTenderPID = 0x0100,
965  kTenderHMPID = 0x0200,
966  kTenderPHOS = 0x0400
967  };
977  virtual void* AddTenderSupply(void* tender,
978  UShort_t flag,
979  Int_t debug)
980  {
981  if (flag == 0) return 0;
982 
983  TString c;
984  TString n;
985  switch (flag) {
986  case kTenderV0: n = "VZERO"; c = "VZERO"; break;
987  case kTenderTPC: n = "TPC"; c = "TPC"; break;
988  case kTenderPtFix: n = "TrackFix"; c = "PtInvFix"; break;
989  case kTenderT0: n = "T0"; c = "TZERO"; break;
990  case kTenderTOF: n = "TOF"; c = "TOF"; break;
991  case kTenderTRD: n = "TRD"; c = "TRD"; break;
992  case kTenderVTX: n = "Vtx"; c = "IP"; break;
993  case kTenderEMCAL: n = "EMCAL"; c = "EMCAL"; break;
994  case kTenderPID: n = "PID"; c = "PID"; break;
995  case kTenderHMPID: n = "HMPID"; c = "HMPID"; break;
996  case kTenderPHOS: n = "PHOS"; c = "PHOS"; break;
997  default:
998  Warning("AddTenderSupply", "Unknown tender flag: 0x%08x", flag);
999  return 0;
1000  }
1001  TString m;
1002  switch (flag) {
1003  case kTenderV0: m = Form("s->SetDebug(%d);", debug); break;
1004  case kTenderEMCAL: // Fall through
1005  case kTenderTOF: // Fall through
1006  case kTenderTPC: // Fall through
1007  case kTenderPtFix: // Fall through
1008  case kTenderTRD: m = Form("s->SetDebugLevel(%d);", debug); break;
1009  }
1010 
1011  TString cls(Form("Ali%sTenderSupply", c.Data()));
1012  Long_t ret =
1013  gROOT->ProcessLine(Form("{ %s* s = new %s(\"%s\");"
1014  "((AliTender*)%p)->AddSupply(s);%s"
1015  "} s;",
1016  cls.Data(),
1017  cls.Data(),
1018  n.Data(),
1019  tender,
1020  m.Data()));
1021  void* ptr = reinterpret_cast<void*>(ret);
1022  Info("AddTenderSupply", "Adding supply %s (an %s object): %p",
1023  n.Data(), cls.Data(), ptr);
1024  return ptr;
1025  }
1030  virtual void AddTender(const TString& sup)
1031  {
1032  TString supplies = sup;
1033 
1034  UShort_t which = 0;
1035  supplies.ToUpper();
1036  if (supplies.Contains("V0") ||
1037  supplies.Contains("VZERO")) which |= kTenderV0 ;
1038  if (supplies.Contains("TPC")) which |= kTenderTPC ;
1039  if (supplies.Contains("PTFIX")) which |= kTenderPtFix ;
1040  if (supplies.Contains("T0")) which |= kTenderT0 ;
1041  if (supplies.Contains("TOF")) which |= kTenderTOF ;
1042  if (supplies.Contains("TRD")) which |= kTenderTRD ;
1043  if (supplies.Contains("VTX")) which |= kTenderVTX ;
1044  if (supplies.Contains("EMCAL")) which |= kTenderEMCAL ;
1045  if (supplies.Contains("PID")) which |= kTenderPID ;
1046 
1047  AddTender(which);
1048  }
1054  virtual void AddTender(UShort_t which)
1055  {
1056  if (which == 0) return;
1057 
1058  Int_t vrb = fOptions.AsInt("verbose", 3);
1059 
1060  fRailway->LoadLibrary("Tender");
1061  fRailway->LoadLibrary("TenderSupplies");
1062 
1063  Long_t ret = gROOT->ProcessLine("new AliTender(\"Tender\")");
1064  if (!ret) {
1065  Warning("AddTender", "Failed to make tender");
1066  return;
1067  }
1068  void* tender = reinterpret_cast<void*>(ret);
1069  gROOT->ProcessLine(Form("((AliTender*)%p)->SetCheckEventSelection(%d)",
1070  tender, (which & kTenderV0)));
1071  gROOT->ProcessLine(Form("((AliTender*)%p)->SetDebugLevel(%d)",
1072  tender, vrb));
1073 
1074  // OCDB settings for tender
1075  TString ocdb = fOptions.Get("ocdb");
1076  if (ocdb.IsNull())
1077  ocdb = "raw://";
1078  else if (ocdb.EndsWith(".root")) {
1079  fRailway->LoadLibrary("CDB");
1080  fRailway->LoadAux(ocdb);
1081  gROOT->ProcessLine(Form("AliCDBManager::Instance()->"
1082  "SetSnapshotMode(\"%s\");",
1083  ocdb.Data()));
1084  ocdb = "raw://";
1085  }
1086  gROOT->ProcessLine(Form("((AliTender*)%p)->SetDefaultCDBStorage(\"%s\")",
1087  tender, ocdb.Data()));
1088 
1089  AddTenderSupply(tender, which & kTenderV0, vrb);
1090  AddTenderSupply(tender, which & kTenderTPC, vrb);
1091  AddTenderSupply(tender, which & kTenderPtFix, vrb);
1092  AddTenderSupply(tender, which & kTenderT0, vrb);
1093  AddTenderSupply(tender, which & kTenderTOF, vrb);
1094  AddTenderSupply(tender, which & kTenderTRD, vrb);
1095  AddTenderSupply(tender, which & kTenderVTX, vrb);
1096  AddTenderSupply(tender, which & kTenderEMCAL, vrb);
1097  AddTenderSupply(tender, which & kTenderPID, vrb);
1098 
1099  gROOT->ProcessLine(Form("((AliTender*)%p)->GetSupplies()->Print()",tender));
1100 
1101  AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
1102  AliAnalysisTask* tsk = reinterpret_cast<AliAnalysisTask*>(tender);
1103  mgr->AddTask(tsk);
1104  AliAnalysisDataContainer* cnt =
1105  mgr->CreateContainer("tender_event",
1106  AliESDEvent::Class(),
1107  AliAnalysisManager::kExchangeContainer,
1108  "default_tender");
1109  mgr->ConnectInput (tsk, 0, mgr->GetCommonInputContainer());
1110  mgr->ConnectOutput(tsk, 1, cnt);
1111 
1112  }
1113  /* @} */
1114  //------------------------------------------------------------------
1127  const char* what,
1128  UInt_t val)
1129  {
1130  SetOnTaskGeneric(task, what, Form("%u", val));
1131  }
1140  const char* what,
1141  Int_t val)
1142  {
1143  SetOnTaskGeneric(task, what, Form("%d", val));
1144  }
1153  const char* what,
1154  Long64_t val)
1155  {
1156  SetOnTaskGeneric(task, what, Form("%lld", val));
1157  }
1166  const char* what,
1167  Double_t val)
1168  {
1169  SetOnTaskGeneric(task, what, Form("%lg", val));
1170  }
1179  const char* what,
1180  Bool_t val)
1181  {
1182  SetOnTaskGeneric(task, what, Form("%d", val));
1183  }
1192  const char* what,
1193  const char* val)
1194  {
1195  SetOnTaskGeneric(task, what, Form("\"%s\"", val));
1196  }
1205  const char* what,
1206  const char* val)
1207  {
1208  const char* cls = task->ClassName();
1209  // Info("SetOnTask", "((%s)*%p)->Set%s(%s)", cls, task, what, val);
1210  gROOT->ProcessLine(Form("((%s*)%p)->Set%s(%s)",cls,task,what,val));
1211  }
1212  /* @} */
1213  //------------------------------------------------------------------
1227  const char* what,
1228  const char* opt,
1229  Double_t defval)
1230  {
1231  Double_t val = fOptions.AsDouble(opt,defval);;
1232  // Info("FromOption<D>"," %p, %s, %s, %f", task, what, opt, val);
1233  SetOnTask(task, what, val);
1234  }
1243  const char* what,
1244  const char* opt,
1245  Bool_t /*defval*/)
1246  {
1247  Bool_t val = fOptions.AsBool(opt);;
1248  // Info("FromOption<B>"," %p, %s, %s, %d", task, what, opt, val);
1249  SetOnTask(task, what, val);
1250  }
1260  const char* what,
1261  const char* opt,
1262  const char* defval)
1263  {
1264  TString val = fOptions.AsString(opt,defval);
1265  // Info("FromOption<S>"," %p, %s, %s, %s", task, what, opt, val);
1266  SetOnTask(task, what, val.Data());
1267  }
1277  const char* what,
1278  const char* opt,
1279  Int_t defval)
1280  {
1281  Int_t val = fOptions.AsInt(opt, defval);
1282  // Info("FromOption<I>"," %p, %s, %s, %d", task, what, opt, val);
1283  SetOnTask(task, what, val);
1284  }
1294  const char* what,
1295  const char* opt,
1296  Long64_t defval)
1297  {
1298  Long64_t val = fOptions.AsLong(opt, defval);
1299  // Info("FromOption<L>"," %p, %s, %s, %lld", task, what, opt, val);
1300  SetOnTask(task, what, val);
1301  }
1302  /* @} */
1303 
1304  // -----------------------------------------------------------------
1315  virtual Bool_t HasMCHandler() const
1316  {
1317  AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
1318  if (!mgr) return false;
1319  return mgr->GetMCtruthEventHandler() != 0;
1320  }
1321  /* @} */
1328  virtual const Char_t* ClassName() const = 0;
1329  /* @} */
1330  //__________________________________________________________________
1331  virtual void AddMonitor(const TString& name)
1332  {
1333  if (fRailway->Mode() != Railway::kProof) return;
1334  Warning("CreateMonitors", "Monitoring not supported yet (%s)", name.Data());
1335  }
1336  //__________________________________________________________________
1341  virtual void CreateMonitors()
1342  {
1343  }
1344  //__________________________________________________________________
1357  static TString EscapeName(const char* name, TString& datimeStr)
1358  {
1359  TString escaped = name;
1360  char c[] = { ' ', '/', '@', 0 };
1361  char* p = c;
1362  while (*p) {
1363  char tmp[] = { *p, '\0' };
1364  escaped.ReplaceAll(tmp, "_");
1365  p++;
1366  }
1367  if (!datimeStr.IsNull() &&
1368  !datimeStr.EqualTo("none", TString::kIgnoreCase)) {
1369  TDatime datime;
1370  if (datimeStr.EqualTo("now", TString::kIgnoreCase))
1371  datime.Set();
1372  else {
1373  // Try various formats
1374  struct tm t;
1375  const char* formats[] = { "%Ec", // Locale
1376  "%c", // Locale
1377  "%Ex EX", // Locale
1378  "%x %X", // Locale
1379  "%Y%m%d_%H%M", // YYYYMMDD_HHMM
1380  "%F %R", // ISO standard, no seconds
1381  0 };
1382  const char** f = formats;
1383  Bool_t found = false;
1384  while (*f && !found) {
1385  // Reset needed fields
1386  t.tm_year = 0;
1387  t.tm_mon = 0;
1388  t.tm_mday = 0;
1389  t.tm_hour = 0;
1390  t.tm_min = 0;
1391  // Stop processing on first match
1392  if (strptime(datimeStr.Data(), *f, &t) != 0) found = true;
1393  f++;
1394  }
1395  if (found) {
1396  t.tm_mon += 1; // Return 0-based month
1397  datime.Set(t.tm_year, t.tm_mon, t.tm_mday, t.tm_hour, t.tm_min, 0);
1398  }
1399  }
1400  if (datime.GetYear() <= 1995 ||
1401  datime.GetMonth() == 0 ||
1402  datime.GetDay() == 0) return escaped;
1403  datimeStr = Form("%04d%02d%02d_%02d%02d",
1404  datime.GetYear(),
1405  datime.GetMonth(),
1406  datime.GetDay(),
1407  datime.GetHour(),
1408  datime.GetMinute());
1409  escaped.Append(Form("_%s", datimeStr.Data()));
1410  }
1411  return escaped;
1412  }
1419  {
1420  // Get the name of the target directory
1421  TString& nam = fEscapedName;
1422 
1423  // Check if the directory exists already
1424  Bool_t exists = gSystem->AccessPathName(nam.Data()) == 0;
1425  if (fRailway->Operation() == Railway::kTerminate && !exists) {
1426  Error("SetupWorkingDirectory", "File/directory %s does not exists",
1427  nam.Data());
1428  return false;
1429  }
1430 
1431  Bool_t overwrite = fOptions.Has("overwrite");
1432  // If we're not allowed to overwrite, then complain
1433  if (!overwrite && exists) {
1434  Error("SetupWorkingDirectory", "File/directory %s already exists",
1435  nam.Data());
1436  return false;
1437  }
1438 
1439  // Make the target directory if it doesn't exists
1440  if (!exists) {
1441  if (gSystem->MakeDirectory(nam.Data())) {
1442  Error("SetupWorkingDirectory", "Failed to make directory '%s'",
1443  nam.Data());
1444  return false;
1445  }
1446  }
1447 
1448  // Change directory to target directory
1449  if (!gSystem->ChangeDirectory(nam.Data())) {
1450  Error("SetupWorkingDirectory", "Failed to change directory to %s",
1451  nam.Data());
1452  return false;
1453  }
1454  // Info("SetupWorkingDirectory", "Made subdirectory %s, and cd'ed there",
1455  // nam.Data());
1456  return true;
1457  }
1458  /* @} */
1459  // -----------------------------------------------------------------
1469  virtual void SaveSetup(Bool_t asShellScript)
1470  {
1471  OptionList tmp(fOptions);
1472  const OptionList* uopts = (fRailway ? &fRailway->Options() : 0);
1473  if (tmp.Find("overwrite")) tmp.Set("overwrite");
1474  if (tmp.Find("date") && fEscapedName.Length() > fName.Length()+1) {
1475  Int_t n = fName.Length()+1;
1476  tmp.Set("date", fEscapedName(n, fEscapedName.Length()-n));
1477  }
1478  if (asShellScript)
1479  SaveSetupShell("rerun", ClassName(), fName, tmp, uopts);
1480  SaveSetupROOT("ReRun", ClassName(), fName, tmp, uopts);
1481  if (fRailway) fRailway->AuxSave(fEscapedName, asShellScript);
1483  }
1493  static void SaveSetupShell(const TString& out, const TString& cls,
1494  const TString& name, const OptionList& opts,
1495  const OptionList* uopts)
1496  {
1497  std::ofstream o(Form("%s.sh", out.Data()));
1498  TString url = opts.Get("url");
1499  OptionList tmp(opts);
1500  tmp.Set("url", "${url}");
1501  o << "#!/bin/bash\n\n"
1502  << "class=\"" << cls << "\"\n"
1503  << "name=\"" << name << "\"\n"
1504  << "url=\"" << url << "\"\n\n"
1505  << "# Available options\n"
1506  << "# \n";
1507  tmp.Help(o, "# --");
1508  if (uopts) {
1509  o << "#\n"
1510  << "# Available URI options\n"
1511  << "# \n";
1512  uopts->Help(o, "# ");
1513  }
1514  o << "#\n"
1515  << "opts=(--class=$class \\\n"
1516  << " --name=$name";
1517  tmp.Store(o, " \\\n --", "", true);
1518  o << ")\n\n"
1519  << "echo \"Running runTrain ${opts[@]} $@\"\n"
1520  << "runTrain \"${opts[@]}\" $@\n\n"
1521  << "# EOF" << std::endl;
1522  o.close();
1523  gSystem->Exec(Form("chmod a+x %s.sh", out.Data()));
1524  }
1534  static void SaveSetupROOT(const TString& out, const TString& cls,
1535  const TString& name, const OptionList& opts,
1536  const OptionList* uopts)
1537  {
1538  OptionList tmp(opts);
1539  tmp.Remove("url");
1540 
1541  std::ofstream o(Form("%s.C", out.Data()));
1542  o << "// Available options:\n"
1543  << "// \n";
1544  tmp.Help(o, "// ");
1545  if (uopts) {
1546  o << "// \n"
1547  << "// Available URI options\n";
1548  uopts->Help(o, "// ");
1549  }
1550  o << "//\n"
1551  << "Bool_t " << out << "()\n"
1552  << "{\n"
1553  << " TString name(\"" << name << "\");\n"
1554  << " TString cls(\"" << cls << "\");\n"
1555  << " TUrl uri(\"" << opts.Get("url") << "\");\n"
1556  << " \n"
1557  << " TString opts(";
1558  tmp.Store(o, "\"", ",\"\n ", false);
1559  o << ");\n\n"
1560  << " TString path(";
1561  TString path(gROOT->GetMacroPath());
1562  TObjArray* elements = path.Tokenize(":");
1563  TObjString* element = 0;
1564  TIter next(elements);
1565  while ((element = static_cast<TObjString*>(next()))) {
1566  if (element->String().IsNull()) continue;
1567  o << "\n \"" << element->GetName() << ":\"";
1568  }
1569  elements->Delete();
1570  o << ");\n"
1571  << " path.Append(\"$ALICE_PHYSICS/PWGLF/FORWARD/trains\");\n"
1572  << " gROOT->SetMacroPath(path);\n\n"
1573  << " gROOT->LoadMacro(\"RunTrain.C\");\n\n"
1574  << " return RunTrain(name, cls, uri, opts);\n"
1575  << "}\n"
1576  << "//\n"
1577  << "// EOF\n"
1578  << "//" << std::endl;
1579  o.close();
1580  }
1594  virtual void PostShellCode(std::ostream& o)
1595  {
1596  o << " echo \"Nothing to do for " << ClassName()
1597  << " train\"" << std::endl;
1598  }
1616  {
1617  std::ofstream f("post.sh");
1618  if (!f) {
1619  Error("SavePostAll", "Failed to open post.sh script");
1620  return;
1621  }
1622  f << "#!/bin/bash\n"
1623  << "# Generated by " << ClassName() << "\n"
1624  << "set -e\n"
1625  << "\n"
1626  << "dest=$1\n"
1627  << "prefix=\n"
1628  << "\n"
1629  << "doall() {"
1630  << std::endl;
1631  PostShellCode(f);
1632  f << "}\n"
1633  << "\n"
1634  << "if test ! -f Download.C ;then\n"
1635  << " doall\n"
1636  << " exit\n"
1637  << "fi\n"
1638  << "\n"
1639  << "if test ! -f .download ; then\n"
1640  << " aliroot -l -b -q Download.C\\(1\\)\n"
1641  << " touch .download\n"
1642  << "fi\n"
1643  << "prefix=../\n"
1644  << "\n"
1645  << "for i in root_archive_*.zip ; do\n"
1646  << " d=`basename $i .zip` \n"
1647  << " if test ! -d $d ; then\n"
1648  << " echo \"Directory $d missing\"\n"
1649  << " continue\n"
1650  << " fi\n"
1651  << " \n"
1652  << " (cd $d && doall)\n"
1653  << "done\n"
1654  << "# EOF"
1655  << std::endl;
1656  f.close();
1657  gSystem->Exec("chmod a+x post.sh");
1658  }
1659  /* @} */
1665 };
1666 #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:758
virtual void CreateMonitors()
Definition: TrainSetup.C:1341
void SetOnTaskGeneric(AliAnalysisTaskSE *task, const char *what, const char *val)
Definition: TrainSetup.C:1204
virtual AliVEventHandler * CreateInputHandler(UShort_t type, Bool_t esdRecPoints=false)
Definition: TrainSetup.C:538
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:1615
TString fDatimeString
Definition: TrainSetup.C:1662
Bool_t Run()
Definition: TrainSetup.C:305
const char * url
Railway * fRailway
Definition: TrainSetup.C:1664
void FromOption(AliAnalysisTaskSE *task, const char *what, const char *opt, Bool_t)
Definition: TrainSetup.C:1242
static Railway * Create(const TUrl &url, Int_t verbose=0)
Definition: Railway.C:653
TString fName
Definition: TrainSetup.C:1660
Bool_t Help(std::ostream &o=std::cout, bool asProg=false)
Definition: TrainSetup.C:394
long long Long64_t
Definition: External.C:43
Option * Find(const TString &name) const
Definition: Option.C:401
virtual void AddOCDBConnect()
Definition: TrainSetup.C:937
void FromOption(AliAnalysisTaskSE *task, const char *what, const char *opt, const char *defval)
Definition: TrainSetup.C:1259
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:906
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:1191
virtual const Char_t * UrlHelp() const =0
virtual ~TrainSetup()
Definition: TrainSetup.C:133
void Store(std::ostream &o, const char *prefix="", const char *delim=",", bool quote=true, bool onlySet=false) const
Definition: Option.C:948
virtual void AddTender(UShort_t which)
Definition: TrainSetup.C:1054
TCanvas * c
Definition: TestFitELoss.C:172
virtual AliVEventHandler * CreateMCHandler(UShort_t, bool mc)
Definition: TrainSetup.C:581
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:1493
static TString EscapeName(const char *name, TString &datimeStr)
Definition: TrainSetup.C:1357
virtual const char * Desc() const =0
void SetOnTask(AliAnalysisTaskSE *task, const char *what, Bool_t val)
Definition: TrainSetup.C:1178
virtual AliAnalysisTaskSE * CoupleSECar(const TString &macro, UInt_t mask=0)
Definition: TrainSetup.C:892
void FromOption(AliAnalysisTaskSE *task, const char *what, const char *opt, Int_t defval)
Definition: TrainSetup.C:1276
virtual AliVEventHandler * CreateOutputHandler(UShort_t type)
Definition: TrainSetup.C:595
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:858
OptionList & Options()
Definition: TrainSetup.C:360
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:365
virtual void CreateTasks(AliAnalysisManager *mgr)=0
unsigned int UInt_t
Definition: External.C:33
TrainSetup(const TrainSetup &o)
Definition: TrainSetup.C:105
virtual Bool_t PostSetup()=0
const OptionList & Options() const
Definition: Railway.C:454
virtual AliAnalysisManager * CreateAnalysisManager(const char *name)
Definition: TrainSetup.C:525
void Set(const TString &name, const TString &value)
Definition: Option.C:736
void PrintTimer(TStopwatch &timer, const char *where)
Definition: TrainSetup.C:291
virtual Bool_t IsMC() const
Definition: Railway.C:354
TrainSetup & operator=(const TrainSetup &o)
Definition: TrainSetup.C:119
virtual Short_t InputType() const
Definition: Railway.C:338
void SetOnTask(AliAnalysisTaskSE *task, const char *what, Int_t val)
Definition: TrainSetup.C:1139
void LoadOADB(Bool_t asPar=false)
Definition: TrainSetup.C:925
void FromOption(AliAnalysisTaskSE *task, const char *what, const char *opt, Long64_t defval)
Definition: TrainSetup.C:1293
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:1165
virtual void SaveSetup(Bool_t asShellScript)
Definition: TrainSetup.C:1469
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:1418
Base class for analysis helpers.
void FromOption(AliAnalysisTaskSE *task, const char *what, const char *opt, Double_t defval)
Definition: TrainSetup.C:1226
virtual void * AddTenderSupply(void *tender, UShort_t flag, Int_t debug)
Definition: TrainSetup.C:977
OptionList fOptions
Definition: TrainSetup.C:1663
virtual Bool_t HasMCHandler() const
Definition: TrainSetup.C:1315
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:145
void Show(std::ostream &o, const char *prefix=" ") const
Definition: Option.C:925
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:442
void SetOnTask(AliAnalysisTaskSE *task, const char *what, Long64_t val)
Definition: TrainSetup.C:1152
virtual AliAnalysisTask * CoupleCar(const TString &macro, const TString &args)
Definition: TrainSetup.C:831
virtual void AddMonitor(const TString &name)
Definition: TrainSetup.C:1331
Bool_t Version(std::ostream &o=std::cout)
Definition: TrainSetup.C:379
virtual void AddTender(const TString &sup)
Definition: TrainSetup.C:1030
virtual void PostShellCode(std::ostream &o)
Definition: TrainSetup.C:1594
TString fEscapedName
Definition: TrainSetup.C:1661
virtual void CreatePhysicsSelection(Bool_t mc, AliAnalysisManager *mgr)
Definition: TrainSetup.C:692
virtual AliAnalysisTaskSE * CoupleSECar(const TString &macro, const TString &args, UInt_t mask=0)
Definition: TrainSetup.C:873
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:1534
void SetOnTask(AliAnalysisTaskSE *task, const char *what, UInt_t val)
Definition: TrainSetup.C:1126