AliPhysics  fceccc5 (fceccc5)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RunTrain.C
Go to the documentation of this file.
1 
22 Bool_t
23 BuildScript(const char* name, Bool_t verbose, Bool_t force, Bool_t debug)
24 {
25  const char opt[] = { (force ? '+' : debug ? 'g' : '\0'),
26  (force && debug ? 'g' : '\0'), '\0' };
27  if (verbose) Printf("Building %s ...",name);
28  Int_t error;
29  Int_t ret = gROOT->LoadMacro(Form("%s.C+%s", name, opt), &error);
30  if (ret < 0 || error) {
31  Error("BuildScript", "Failed to build %s: %d", error);
32  return false;
33  }
34  return true;
35 
36 }
37 
50 Bool_t
51 BuildRailways(Bool_t verbose, Bool_t force, Bool_t debug,
52  Bool_t all=false)
53 {
54  gSystem->AddIncludePath("-I$ALICE_ROOT/include");
55  gSystem->AddIncludePath("-I$ALICE_PHYSICS/include");
56  gSystem->AddIncludePath("-I$ALICE_PHYSICS/PWGLF/FORWARD/trains/");
57  gROOT->SetMacroPath(Form("%s:$ALICE_PHYSICS/PWGLF/FORWARD/trains",
58  gROOT->GetMacroPath()));
59  gSystem->Load("libANALYSIS");
60  gSystem->Load("libANALYSISalice");
61  const char* scripts[] = { "AvailableSoftware",
62  "ChainBuilder",
63  "ParUtilities",
64  "OutputUtilities",
65  "Option",
66  "Railway",
67  "TrainSetup",
68  (all ? "LocalRailway" : 0),
69  "ProofRailway",
70  "LiteRailway",
71  "AAFRailway",
72  "PluginRailway",
73  "AAFPluginRailway",
74  "GridRailway",
75  0 };
76  const char** ptr = scripts;
77  while ((*ptr)) {
78  if (!BuildScript(*ptr, verbose, force, debug)) return false;
79  ptr++;
80  }
81  return true;
82 }
83 
90 void PlainUsage()
91 {
92  std::cout << "Usage: .x RunTrain.C(NAME,CLASS,OPTIONS)\n\n"
93  << " NAME Name of train (free form)\n"
94  << " CLASS Name of class implementing TrainSetup\n"
95  << " OPTIONS Comma separated list of options\n"
96  << std::endl;
97 }
98 
111 Bool_t RunTrain(const TString& name, const TString& cls,
112  const TUrl& uri, const TString& opts)
113 {
114  // Check for help
115  if (name.IsNull() || name.EqualTo("help", TString::kIgnoreCase) ||
116  cls.IsNull() || cls.EqualTo("help", TString::kIgnoreCase) ||
117  !uri.IsValid()) {
118  PlainUsage();
119  return true;
120  }
121 
122  Bool_t verb = opts.Contains("verbose");
123  // Build our helpers
124  if (!BuildRailways(verb, false, true)) return false;
125 
126  // Tokenize options
127  if (!opts.EndsWith(",")) opts.Append(",");
128  opts.Append("url=");
129  opts.Append(uri.GetUrl());
130  TObjArray* optList = opts.Tokenize(",");
131  return TrainSetup::Main(name, cls, optList, false);
132 }
133 /*
134  * EOF
135  */
136 
TSystem * gSystem
Bool_t RunTrain(const TString &name, const TString &cls, const TUrl &uri, const TString &opts)
Definition: RunTrain.C:111
Bool_t BuildRailways(Bool_t verbose, Bool_t force, Bool_t debug, Bool_t all=false)
Definition: RunTrain.C:51
Definition: External.C:92
int Int_t
Definition: External.C:63
void PlainUsage()
Definition: RunTrain.C:90
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
Bool_t BuildScript(const char *name, Bool_t verbose, Bool_t force, Bool_t debug)
Definition: RunTrain.C:23