]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGLF/FORWARD/analysis2/sim/BaseConfig.C
Various updates:
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / sim / BaseConfig.C
index 4837bd479539eedb86922d09c8a6ec30281a091b..ea577d2d5693c738b9c496eff6000864b114ff84 100644 (file)
@@ -167,7 +167,164 @@ struct VirtualOCDBCfg
 /** Global variable */
 VirtualOCDBCfg* ocdbCfg = 0;
 
-// 
+struct VirtualEGCfg 
+{
+  TString runType;
+  VirtualEGCfg() : runType("") {}
+  virtual ~VirtualEGCfg() {}
+  /**
+   * Load the general libraries needed
+   *
+   */
+  static void LoadGen(const TString& runType) {
+    if (!gROOT->GetClass("AliStructFuncType"))
+      gSystem->Load("liblhapdf");      // Parton density functions
+    if (!gROOT->GetClass("TPythia6"))
+      gSystem->Load("libEGPythia6");   // TGenerator interface
+    if (!runType.EqualTo("hydjet", TString::kIgnoreCase))
+      LoadPythia(false);
+  }
+
+  /**
+   * Load the pythia libraries
+   *
+   * @param vers Optional version post-fix
+   */
+  static void LoadPythia(Bool_t gen=true, const char* vers="6.4.21")
+  {
+    if (gen) LoadGen("");
+    char m = vers[0];
+    if (gROOT->GetClass(Form("AliPythia6%c", m))) return;
+    gSystem->Load(Form("libpythia%s", vers));
+    gSystem->Load(Form("libAliPythia%c", m));
+  }
+  /**
+   * Load HIJING libraries
+   */
+  static void LoadHijing()
+  {
+    LoadPythia();
+    if (gROOT->GetClass("THijing")) return;
+    gSystem->Load("libhijing");
+    gSystem->Load("libTHijing");
+    AliPDG::AddParticlesToPdgDataBase();
+  }
+  /**
+   * Load HydJet libraries
+   */
+  static void LoadHydjet()
+  {
+    if (gROOT->GetClass("TUHKMgen")) return;
+    gSystem->Load("libTUHKMgen");
+  }
+  /**
+   * Load DPMJet libraries
+   */
+  static void LoadDpmjet()
+  {
+    LoadPythia();
+    if (gROOT->GetClass("TDPMjet")) return;
+    gSystem->Load("libdpmjet");
+    gSystem->Load("libTDPMjet");
+  }
+  /**
+   * Load AMPT libraries
+   */
+  static void LoadAmpt()
+  {
+    LoadPythia();
+    if (gROOT->GetClass("TAmpt")) return;
+    gSystem->Load("libampt");
+    gSystem->Load("libTAmpt");
+  }
+  /**
+   * Make the generator
+   *
+   * @param rt    Event generator identifier 
+   * @param b1    Least impact parameter 
+   * @param b2    Largest impact parameter 
+   * @param smear If true, smear interaction per event 
+   *
+   * @return Point to newly allocated generator or null
+   * 
+   */
+  AliGenerator* MakeGenerator(const TString& rt, 
+                             Float_t b1, 
+                             Float_t b2, 
+                             Bool_t smear=true)
+  {
+    if (rt.IsNull()) { 
+      ::Fatal("MakeGenerator", "No EG spec given");
+      return 0;
+    }
+
+    TString runType = rt;
+    runType.ToLower();
+
+    AliGenerator* g = CreateGenerator(runType,b1,b2);
+    if (g && smear) g->SetVertexSmear(AliGenerator::kPerEvent);
+
+    return g;
+  }
+  /**
+   * Make our decayer
+   *
+   * @param rt The EG to use 
+   *
+   * @return Newly allocated decayer or null
+   */
+  TVirtualMCDecayer* MakeDecayer(const TString& rt)
+  {
+    if (rt.IsNull()) { 
+      ::Fatal("MakeGenerator", "No EG spec given");
+      return 0;
+    }
+
+    TString runType = rt;
+    rt.ToLower();
+
+    TVirtualMCDecayer* decayer = CreateDecayer(runType);
+
+    if (decayer) decayer->Init();
+    return decayer;
+  }
+protected:
+  /** 
+   * Create the generator.  This function must be defined in a derived class. 
+   * 
+   * @param runType The generator ID (all lower case)
+   * @param b1      Least impact parameter 
+   * @param b2      Largest impact parameter 
+   * 
+   * @return Must return a pointer to a new AliGenerator or null
+   */
+  virtual AliGenerator* CreateGenerator(const TString& runType, 
+                                       Float_t b1, 
+                                       Float_t b2) = 0;
+  /** 
+   * Create the decayer.  This function must be defined in a derived class. 
+   * 
+   * @param runType The generator ID (all lower case)
+   * 
+   * @return Must return a pointer to a new TVirtualMCDecayer or null
+   */
+  virtual TVirtualMCDecayer* CreateDecayer(const TString& runType) = 0;
+
+};
+/** Global variable */
+VirtualEGCfg* egCfg = 0;
+
+
+
+/**
+ * A function so that we can do TROOT::Macro.  Does nothing but print a message.
+ *
+ */
+void BaseConfig()
+{
+  Info("", "Defined base classes for configuration");
+}
+//
 // EOF
 //