]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - macros/Config_PDC06.C
Truncate Z vertex at 3 sigma (was at one sigma)
[u/mrichter/AliRoot.git] / macros / Config_PDC06.C
index b103191475a4734d083b583ea3bdbfd6b0fb1300..16cd0ccf624febde672793b74a3a6751cc8ee340 100644 (file)
@@ -2,13 +2,22 @@
 // Configuration for the Physics Data Challenge 2006
 //
 
+// One can use the configuration macro in compiled mode by
+// root [0] gSystem->Load("libgeant321");
+// root [0] gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include\
+//                   -I$ALICE_ROOT -I$ALICE/geant3/TGeant3");
+// root [0] .x grun.C(1,"Config_PDC06.C++")
+
 #if !defined(__CINT__) || defined(__MAKECINT__)
 #include <Riostream.h>
 #include <TRandom.h>
 #include <TDatime.h>
 #include <TSystem.h>
 #include <TVirtualMC.h>
-#include <TGeant3.h>
+#include <TGeant3TGeo.h>
+#include "EVGEN/AliGenCocktail.h"
+#include "EVGEN/AliGenParam.h"
+#include "EVGEN/AliGenMUONlib.h"
 #include "STEER/AliRunLoader.h"
 #include "STEER/AliRun.h"
 #include "STEER/AliConfig.h"
 #include "STRUCT/AliFRAMEv2.h"
 #include "STRUCT/AliSHILv2.h"
 #include "STRUCT/AliPIPEv0.h"
+#include "ITS/AliITSgeom.h"
 #include "ITS/AliITSvPPRasymmFMD.h"
 #include "TPC/AliTPCv2.h"
-#include "TOF/AliTOFv4T0.h"
+#include "TOF/AliTOFv5T0.h"
 #include "RICH/AliRICHv1.h"
-#include "ZDC/AliZDCv1.h"
+#include "ZDC/AliZDCv2.h"
 #include "TRD/AliTRDv1.h"
-#include "FMD/AliFMDv0.h"
+#include "FMD/AliFMDv1.h"
 #include "MUON/AliMUONv1.h"
 #include "PHOS/AliPHOSv1.h"
 #include "PMD/AliPMDv1.h"
 #include "START/AliSTARTv1.h"
-#include "CRT/AliCRTv1.h"
+#include "EMCAL/AliEMCALv2.h"
+#include "CRT/AliCRTv0.h"
+#include "VZERO/AliVZEROv7.h"
 #endif
 
 
@@ -46,7 +58,15 @@ enum PDC06Proc_t
   kDPlusPbPb5500,  kDPluspPb8800,  kDPluspp14000,
   kBeautyPbPb5500, kBeautypPb8800, kBeautypp14000, kBeautypp14000wmi, 
 // -- Pythia Mb
-  kPyMbNoHvq, kPyOmegaPlus, kPyOmegaMinus
+  kPyMbNoHvq, kPyOmegaPlus, kPyOmegaMinus, kRunMax
+};
+
+const char * pprRunName[] = {
+  "kCharmPbPb5500",  "kCharmpPb8800",  "kCharmpp14000",  "kCharmpp14000wmi",
+  "kD0PbPb5500",     "kD0pPb8800",     "kD0pp14000",
+  "kDPlusPbPb5500",  "kDPluspPb8800",  "kDPluspp14000",
+  "kBeautyPbPb5500", "kBeautypPb8800", "kBeautypp14000", "kBeautypp14000wmi", 
+  "kPyMbNoHvq", "kPyOmegaPlus", "kPyOmegaMinus"
 };
 
 
@@ -69,12 +89,19 @@ enum Mag_t
 AliGenPythia *PythiaHVQ(PDC06Proc_t proc);
 AliGenerator *MbCocktail();
 AliGenerator *PyMbTriggered(Int_t pdg);
+void ProcessEnvironmentVars();
 
 // This part for configuration
 static PDC06Proc_t   proc     = kPyOmegaPlus;
 static DecayHvFl_t   decHvFl  = kNature; 
 static YCut_t        ycut     = kFull;
 static Mag_t         mag      = k5kG; 
+//========================//
+// Set Random Number seed //
+//========================//
+TDatime dt;
+static UInt_t seed    = dt.Get();
+
 // nEvts = -1  : you get 1 QQbar pair and all the fragmentation and 
 //               decay chain
 // nEvts = N>0 : you get N charm / beauty Hadrons 
@@ -109,18 +136,12 @@ static TString comment;
 void Config()
 {
  
-  //========================//
-  // Set Random Number seed //
-  //========================//
-  TDatime dt;
-  UInt_t curtime = dt.Get();
-  UInt_t procid  = gSystem->GetPid();
-  UInt_t seed    = curtime-procid;
-
-  //  gRandom->SetSeed(seed);
-  //  cerr<<"Seed for random number generation= "<<seed<<endl; 
-  gRandom->SetSeed(12345);
-  
+
+  // Get settings from environment variables
+  ProcessEnvironmentVars();
+
+  gRandom->SetSeed(seed);
+  cerr<<"Seed for random number generation= "<<seed<<endl; 
 
   // libraries required by geant321
 #if defined(__CINT__)
@@ -213,7 +234,7 @@ void Config()
   //=========================//
   // Generator Configuration //
   //=========================//
-  AliGenerator* gener;
+  AliGenerator* gener = 0x0;
   
   if (proc <=   kBeautypp14000wmi) {
       AliGenPythia *pythia = PythiaHVQ(proc);
@@ -285,14 +306,9 @@ void Config()
   printf("\n \n Diamond size x-y: %10.3e z: %10.3e\n \n", sigmaxy, sigmaz);
     
   gener->SetSigma(sigmaxy, sigmaxy, sigmaz);      // Sigma in (X,Y,Z) (cm) on IP position
-  gener->SetCutVertexZ(1.);        // Truncate at 1 sigma
+  gener->SetCutVertexZ(3.);        // Truncate at 3 sigma
   gener->SetVertexSmear(kPerEvent);
 
-  gener->SetTrackingFlag(0);
-  // Specify GEANT tracking limits (Rmax, Zmax)
-  //gAlice->GetMCApp()->TrackingLimits(90.,1.0e10);
-
-
   gener->Init();
 
   // FIELD
@@ -314,78 +330,87 @@ void Config()
 
 
   Int_t iABSO  = 1;
-  Int_t iCRT   = 1;
+  Int_t iCRT   = 0;
   Int_t iDIPO  = 1;
+  Int_t iEMCAL = 1;
   Int_t iFMD   = 1;
   Int_t iFRAME = 1;
   Int_t iHALL  = 1;
   Int_t iITS   = 1;
   Int_t iMAG   = 1;
   Int_t iMUON  = 1;
-  Int_t iPHOS  = 0;
+  Int_t iPHOS  = 1;
   Int_t iPIPE  = 1;
   Int_t iPMD   = 1;
   Int_t iRICH  = 1;
   Int_t iSHIL  = 1;
   Int_t iSTART = 1;
-  Int_t iTOF   = 0;
+  Int_t iTOF   = 1;
   Int_t iTPC   = 1;
   Int_t iTRD   = 1;
+  Int_t iVZERO = 1;
   Int_t iZDC   = 1;
+  
 
-  //=================== Alice BODY parameters =============================
-  AliBODY *BODY = new AliBODY("BODY","Alice envelop");
-
-  if(iMAG) {
-    //=================== MAG parameters ============================
-    // --- Start with Magnet since detector layouts may be depending ---
-    // --- on the selected Magnet dimensions ---
-    AliMAG *MAG  = new AliMAG("MAG","Magnet");
-  }
-
+    //=================== Alice BODY parameters =============================
+    AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
 
-  if(iABSO) {
-    //=================== ABSO parameters ============================
-    AliABSO *ABSO  = new AliABSOv0("ABSO","Muon Absorber");
-  }
 
-  if(iDIPO) {
-    //=================== DIPO parameters ============================
+    if (iMAG)
+    {
+        //=================== MAG parameters ============================
+        // --- Start with Magnet since detector layouts may be depending ---
+        // --- on the selected Magnet dimensions ---
+        AliMAG *MAG = new AliMAG("MAG", "Magnet");
+    }
 
-    AliDIPO *DIPO  = new AliDIPOv2("DIPO","Dipole version 2");
-  }
 
-  if(iHALL) {
-    //=================== HALL parameters ============================
+    if (iABSO)
+    {
+        //=================== ABSO parameters ============================
+        AliABSO *ABSO = new AliABSOv0("ABSO", "Muon Absorber");
+    }
 
-    AliHALL *HALL  = new AliHALL("HALL","Alice Hall");
-  }
+    if (iDIPO)
+    {
+        //=================== DIPO parameters ============================
 
+        AliDIPO *DIPO = new AliDIPOv2("DIPO", "Dipole version 2");
+    }
 
-  if(iFRAME) {
-    //=================== FRAME parameters ============================
+    if (iHALL)
+    {
+        //=================== HALL parameters ============================
 
-    AliFRAME *FRAME  = new AliFRAMEv2("FRAME","Space Frame");
+        AliHALL *HALL = new AliHALL("HALL", "Alice Hall");
+    }
 
-  }
 
-  if(iSHIL) {
-    //=================== SHIL parameters ============================
+    if (iFRAME)
+    {
+        //=================== FRAME parameters ============================
 
-    AliSHIL *SHIL  = new AliSHILv2("SHIL","Shielding");
-  }
+        AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
+    }
 
+    if (iSHIL)
+    {
+        //=================== SHIL parameters ============================
 
-  if(iPIPE) {
-    //=================== PIPE parameters ============================
+        AliSHIL *SHIL = new AliSHILv2("SHIL", "Shielding Version 2");
+    }
 
-    AliPIPE *PIPE  = new AliPIPEv0("PIPE","Beam Pipe");
-  }
 
+    if (iPIPE)
+    {
+        //=================== PIPE parameters ============================
 
-  if(iITS) {
+        AliPIPE *PIPE = new AliPIPEv0("PIPE", "Beam Pipe");
+    }
+    if(iITS) {
 
-//=================== ITS parameters ============================
+    //=================== ITS parameters ============================
     //
     // As the innermost detector in ALICE, the Inner Tracking System "impacts" on
     // almost all other detectors. This involves the fact that the ITS geometry
@@ -403,39 +428,27 @@ void Config()
     //
     //AliITS *ITS  = new AliITSv5asymm("ITS","Updates ITS TDR detailed version with asymmetric services");
     //
-    AliITSvPPRasymmFMD *ITS  = new AliITSvPPRasymmFMD("ITS","New ITS PPR detailed version with asymmetric services");
-    ITS->SetMinorVersion(2);                                         // don't touch this parameter if you're not an ITS developer
-    ITS->SetReadDet(kFALSE);                                         // don't touch this parameter if you're not an ITS developer
-    ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det");  // don't touch this parameter if you're not an ITS developer
-    ITS->SetThicknessDet1(200.);   // detector thickness on layer 1 must be in the range [150,300]
-    ITS->SetThicknessDet2(200.);   // detector thickness on layer 2 must be in the range [150,300]
-    ITS->SetThicknessChip1(200.);  // chip thickness on layer 1 must be in the range [100,300]
-    ITS->SetThicknessChip2(200.);  // chip thickness on layer 2 must be in the range [100,300]
-    ITS->SetRails(1);             // 1 --> rails in ; 0 --> rails out
-    ITS->SetCoolingFluid(1);       // 1 --> water ; 0 --> freon
-    //
-    //AliITSvPPRsymm *ITS  = new AliITSvPPRsymm("ITS","New ITS PPR detailed version with symmetric services");
-    //ITS->SetMinorVersion(2);                                       // don't touch this parameter if you're not an ITS developer
-    //ITS->SetReadDet(kFALSE);                                       // don't touch this parameter if you're not an ITS developer
-    //ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRsymm2.det"); // don't touch this parameter if you're not an ITS developer
-    //ITS->SetThicknessDet1(300.);   // detector thickness on layer 1 must be in the range [150,300]
-    //ITS->SetThicknessDet2(300.);   // detector thickness on layer 2 must be in the range [150,300]
-    //ITS->SetThicknessChip1(300.);  // chip thickness on layer 1 must be in the range [100,300]
-    //ITS->SetThicknessChip2(300.);  // chip thickness on layer 2 must be in the range [100,300]
-    //ITS->SetRails(1);              // 1 --> rails in ; 0 --> rails out
-    //ITS->SetCoolingFluid(1);       // 1 --> water ; 0 --> freon
-    //
-    //
+       AliITSvPPRasymmFMD *ITS  = new AliITSvPPRasymmFMD("ITS","New ITS PPR detailed version with asymmetric services");
+       ITS->SetMinorVersion(2);  // don't touch this parameter if you're not an ITS developer
+       ITS->SetReadDet(kTRUE);   // don't touch this parameter if you're not an ITS developer
+    //    ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det");  // don't touch this parameter if you're not an ITS developer
+       ITS->SetThicknessDet1(200.);   // detector thickness on layer 1 must be in the range [100,300]
+       ITS->SetThicknessDet2(200.);   // detector thickness on layer 2 must be in the range [100,300]
+       ITS->SetThicknessChip1(200.);  // chip thickness on layer 1 must be in the range [150,300]
+       ITS->SetThicknessChip2(200.);  // chip thickness on layer 2 must be in the range [150,300]
+       ITS->SetRails(0);            // 1 --> rails in ; 0 --> rails out
+       ITS->SetCoolingFluid(1);   // 1 --> water ; 0 --> freon
+
     // Coarse geometries (warning: no hits are produced with these coarse geometries and they unuseful 
     // for reconstruction !):
     //                                                     
     //
     //AliITSvPPRcoarseasymm *ITS  = new AliITSvPPRcoarseasymm("ITS","New ITS PPR coarse version with asymmetric services");
-    //ITS->SetRails(1);                // 1 --> rails in ; 0 --> rails out
+    //ITS->SetRails(0);                // 1 --> rails in ; 0 --> rails out
     //ITS->SetSupportMaterial(0);      // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
     //
     //AliITS *ITS  = new AliITSvPPRcoarsesymm("ITS","New ITS PPR coarse version with symmetric services");
-    //ITS->SetRails(1);                // 1 --> rails in ; 0 --> rails out
+    //ITS->SetRails(0);                // 1 --> rails in ; 0 --> rails out
     //ITS->SetSupportMaterial(0);      // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
     //                      
     //
@@ -448,98 +461,98 @@ void Config()
     // ITSgeometry.tme) in a format understandable to the CAD system EUCLID.
     // The default (=0) means that you dont want to use this facility.
     //
-    ITS->SetEUCLID(0);  
-  }
-  
-
-  if(iTPC) {
-    //============================ TPC parameters ===================
-    AliTPC *TPC  = new AliTPCv2("TPC","Default");
-  }
-
-
-  if(iTOF) {
-    //=================== TOF parameters ============================
-    AliTOF *TOF  = new AliTOFv4T0("TOF","normal TOF");
-  }
+       ITS->SetEUCLID(0);  
+    }
 
-  if(iRICH) {
-    //=================== RICH parameters ===========================
-    AliRICH *RICH  = new AliRICHv1("RICH","normal RICH");    
+    if (iTPC)
+    {
+      //============================ TPC parameters =====================
+        AliTPC *TPC = new AliTPCv2("TPC", "Default");
+    }
 
-  }
 
+    if (iTOF) {
+        //=================== TOF parameters ============================
+       AliTOF *TOF = new AliTOFv5T0("TOF", "normal TOF");
+    }
 
-  if(iZDC) {
-    //=================== ZDC parameters ============================
 
-    AliZDC *ZDC  = new AliZDCv1("ZDC","normal ZDC");
-  }
+    if (iRICH)
+    {
+        //=================== RICH parameters ===========================
+        AliRICH *RICH = new AliRICHv1("RICH", "normal RICH");
 
-  if(iCRT) {
-    //=================== CRT parameters ============================
+    }
 
-    AliCRT *CRT  = new AliCRTv1("CRT","normal CRT");
-  }
 
-  if(iTRD) {
-    //=================== TRD parameters ============================
-  
-    AliTRD *TRD  = new AliTRDv1("TRD","TRD slow simulator");
-  
-    // Select the gas mixture (0: 97% Xe + 3% isobutane, 1: 90% Xe + 10% CO2)
-    TRD->SetGasMix(1);
-  
-    // With hole in front of PHOS
-    TRD->SetPHOShole();
-    // With hole in front of RICH
-    TRD->SetRICHhole();
-    // Switch on TR
-    AliTRDsim *TRDsim = TRD->CreateTR();
-  }
+    if (iZDC)
+    {
+        //=================== ZDC parameters ============================
 
-  if(iFMD) {
-    //=================== FMD parameters ============================
+        AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC");
+    }
 
-    AliFMD *FMD  = new AliFMDv0("FMD","normal FMD");
-  }
+    if (iTRD)
+    {
+        //=================== TRD parameters ============================
 
-  if(iMUON) {
-    //=================== MUON parameters ===========================
-    AliMUON *MUON  = new AliMUONv1("MUON","default");
-  }
-  //=================== PHOS parameters ===========================
+        AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
 
-  if(iPHOS) {
-    AliPHOS *PHOS  = new AliPHOSv1("PHOS","GPS2");
-  }
+        // Select the gas mixture (0: 97% Xe + 3% isobutane, 1: 90% Xe + 10% CO2)
+        TRD->SetGasMix(1);
+       // Switch on TR
+       AliTRDsim *TRDsim = TRD->CreateTR();
+    }
 
+    if (iFMD)
+    {
+        //=================== FMD parameters ============================
+       AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
+   }
 
-  //=================== CRT parameters ===========================
+    if (iMUON)
+    {
+        //=================== MUON parameters ===========================
+        // New MUONv1 version (geometry defined via builders)
+        AliMUON *MUON = new AliMUONv1("MUON", "default");
+    }
+    //=================== PHOS parameters ===========================
 
-  if(iCRT) {
-    AliCRT *CRT  = new AliCRTv1("CRT","Normal CRTGPS2");
-  }
+    if (iPHOS)
+    {
+        AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
+    }
 
 
-  if(iPMD) {
-    //=================== PMD parameters ============================
+    if (iPMD)
+    {
+        //=================== PMD parameters ============================
+        AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
+    }
 
-    AliPMD *PMD  = new AliPMDv1("PMD","normal PMD");
-    PMD->SetPAR(1., 1., 0.8, 0.02);
-    PMD->SetIN(6., 18., -580., 27., 27.);
-    PMD->SetGEO(0.0, 0.2, 4.);
-    PMD->SetPadSize(0.8, 1.0, 1.0, 1.5);
+    if (iSTART)
+    {
+        //=================== START parameters ============================
+        AliSTART *START = new AliSTARTv1("START", "START Detector");
+    }
 
-  }
+    if (iEMCAL)
+    {
+        //=================== EMCAL parameters ============================
+        AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "SHISH_77_TRD1_2X2_FINAL_110DEG");
+    }
 
-  if(iSTART) {
-    //=================== START parameters ============================
-    AliSTART *START  = new AliSTARTv1("START","START Detector");
-  }
+     if (iCRT)
+    {
+        //=================== CRT parameters ============================
+        AliCRT *CRT = new AliCRTv0("CRT", "normal ACORDE");
+    }
 
-         
+     if (iVZERO)
+    {
+        //=================== CRT parameters ============================
+        AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
+    }
 }
 //
 //           PYTHIA
@@ -693,10 +706,8 @@ AliGenPythia *PythiaHVQ(PDC06Proc_t proc) {
 AliGenerator* MbCocktail()
 {
       comment = comment.Append(" pp at 14 TeV: Pythia low-pt, no heavy quarks + J/Psi from parameterisation");
-      gener = new AliGenCocktail();
+      AliGenCocktail * gener = new AliGenCocktail();
       gener->UsePerEventRates();
-      gener->SetTrackingFlag(0);
-      
  
 //
 //    Pythia
@@ -738,6 +749,23 @@ AliGenerator* PyMbTriggered(Int_t pdg)
     return pythia;
 }
 
+void ProcessEnvironmentVars()
+{
+    // Run type
+    if (gSystem->Getenv("CONFIG_RUN_TYPE")) {
+      for (Int_t iRun = 0; iRun < kRunMax; iRun++) {
+       if (strcmp(gSystem->Getenv("CONFIG_RUN_TYPE"), pprRunName[iRun])==0) {
+         proc = (PDC06Proc_t)iRun;
+         cout<<"Run type set to "<<pprRunName[iRun]<<endl;
+       }
+      }
+    }
+
+    // Random Number seed
+    if (gSystem->Getenv("CONFIG_SEED")) {
+      seed = atoi(gSystem->Getenv("CONFIG_SEED"));
+    }
+}