]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGLF/FORWARD/trains/trainMain.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / trains / trainMain.cxx
index 89ae12ad267a9758116a3b783330b44ff167f48c..b6b6b6b4d2265e99f62a7e79abd10fac286ad20b 100644 (file)
 #include "ParUtilities.C"
 #include "OutputUtilities.C" 
 #include "Option.C"
-#include "Helper.C" 
-#include "LocalHelper.C" 
-#include "ProofHelper.C" 
-#include "LiteHelper.C"
-#include "AAFHelper.C" 
-#include "PluginHelper.C"
-#include "AAFPluginHelper.C" 
-#include "GridHelper.C"
+#include "Railway.C" 
+#include "LocalRailway.C" 
+#include "ProofRailway.C" 
+#include "LiteRailway.C"
+#include "AAFRailway.C" 
+#include "PluginRailway.C"
+#include "AAFPluginRailway.C" 
+#include "GridRailway.C"
 #include "TrainSetup.C"
 
 #include <TGApplication.h>
@@ -114,6 +114,7 @@ void ProgramUsage(const char* progname, std::ostream& o)
   PrintFakeOption(o, "class=CLASS",       "Train class");
   PrintFakeOption(o, "name=NAME",         "Name of train");
   PrintFakeOption(o, "include=DIRECTORY", "Append dir to macro/header path");
+  PrintFakeOption(o, "define=DEFINE",     "Set a preprocessor macro");
   PrintFakeOption(o, "batch",             "Batch mode");
   PrintFakeOption(o, "spawn",             "Spawn interactive ROOT shell");
 }
@@ -122,7 +123,6 @@ void ProgramUsage(const char* progname, std::ostream& o)
  * 
  * @param progname Program name 
  * @param o        Output stream
- * @param r        Optional runner. 
  * 
  * @ingroup pwglf_forward_trains_run
  */
@@ -142,6 +142,8 @@ int
 main(int argc, char** argv)
 {
   TList optList;
+  TList paths;
+  TList defines;
   TString name;
   TString cls;
   TString where;
@@ -162,7 +164,8 @@ main(int argc, char** argv)
       if (eq != kNPOS) val = arg(eq+1, arg.Length()-eq-1);
       if      (arg.BeginsWith("--class"))   cls  = val;
       else if (arg.BeginsWith("--name"))    name = val;
-      else if (arg.BeginsWith("--include")) AppendPath(val);
+      else if (arg.BeginsWith("--include")) paths.Add(new TObjString(val)); 
+      else if (arg.BeginsWith("--define"))  defines.Add(new TObjString(val));
       else if (arg.BeginsWith("--batch"))   batch  = true;
       else if (arg.BeginsWith("--help"))    help   = true;
       else if (arg.BeginsWith("--where"))   where  = val;
@@ -176,6 +179,20 @@ main(int argc, char** argv)
       }
     }
   }
+  // --- Set batch mode early ----------------------------------------
+  // Info("main", "Batch mode is set to %d", batch);
+  gROOT->SetBatch(batch);
+
+  // --- Add to load paths -------------------------------------------
+  // Info("main", "Adding load paths");
+  TIter nextP(&paths);
+  TObject* path = 0;
+  while ((path = nextP())) AppendPath(path->GetName());
+  TIter nextD(&defines);
+  TObject* def = 0;
+  while ((def = nextD())) 
+    gSystem->AddIncludePath(Form("-D%s", def->GetName()));
+
   // --- Initial check or URI/WHERE ----------------------------------
   if (!where.IsNull()) {
     if (urlSeen) {
@@ -211,7 +228,7 @@ main(int argc, char** argv)
 
   // --- Setup script path -------------------------------------------
   const char* aliPath  = gSystem->ExpandPathName("$ALICE_ROOT");
-  const char* fwdPath  = gSystem->ExpandPathName("$ALICE_ROOT/PWGLF/FORWARD/");
+  const char* fwdPath  = gSystem->ExpandPathName("$ALICE_ROOT/PWGLF/FORWARD");
   AppendPath(aliPath);
   AppendPath(Form("%s/include",          aliPath));
   AppendPath(Form("%s/trains",           fwdPath));
@@ -220,7 +237,6 @@ main(int argc, char** argv)
 
   // --- Set-up Application ------------------------------------------
   TApplication* app = 0;
-  gROOT->SetBatch(batch);
   if (spawn) {
     // Info("main", "Creating interpreter application");
     TRint* rint = new TRint("runTrain", 0, 0, 0, 0, true);
@@ -229,10 +245,10 @@ main(int argc, char** argv)
   }
   else if (!batch) {
     // Info("main", "Creating GUI application");
-    app = new TGApplication("runTrain", 0, 0);
+    app = new TApplication("runTrain", 0, 0);
   }
   if (app && !batch) app->InitializeGraphics();
-  
+
   // --- run, possibly in a timer ------------------------------------
   Bool_t ret = true;
   if (!app)