]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
In vmctest:
authorivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 2 Dec 2009 16:01:38 +0000 (16:01 +0000)
committerivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 2 Dec 2009 16:01:38 +0000 (16:01 +0000)
Adding gun test which can be run with G3, G4.

22 files changed:
test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s0.root [new file with mode: 0644]
test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s1.root [new file with mode: 0644]
test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s2.root [new file with mode: 0644]
test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s3.root [new file with mode: 0644]
test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s4.root [new file with mode: 0644]
test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s5.root [new file with mode: 0644]
test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s6.root [new file with mode: 0644]
test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s7.root [new file with mode: 0644]
test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s8.root [new file with mode: 0644]
test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s9.root [new file with mode: 0644]
test/vmctest/gun/README [new file with mode: 0644]
test/vmctest/gun/commonConfig.C [new file with mode: 0644]
test/vmctest/gun/g3Config.C [new file with mode: 0644]
test/vmctest/gun/g4Config.C [new file with mode: 0644]
test/vmctest/gun/gen.C [new file with mode: 0644]
test/vmctest/gun/genConfig.C [new file with mode: 0644]
test/vmctest/gun/genExtFileConfig.C [new file with mode: 0644]
test/vmctest/gun/genGunConfig.C [new file with mode: 0644]
test/vmctest/gun/rec.C [new file with mode: 0644]
test/vmctest/gun/rungen.sh [new file with mode: 0755]
test/vmctest/gun/runsim.sh [new file with mode: 0755]
test/vmctest/gun/sim.C [new file with mode: 0644]

diff --git a/test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s0.root b/test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s0.root
new file mode 100644 (file)
index 0000000..3efa627
Binary files /dev/null and b/test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s0.root differ
diff --git a/test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s1.root b/test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s1.root
new file mode 100644 (file)
index 0000000..79d181f
Binary files /dev/null and b/test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s1.root differ
diff --git a/test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s2.root b/test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s2.root
new file mode 100644 (file)
index 0000000..44f1b4e
Binary files /dev/null and b/test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s2.root differ
diff --git a/test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s3.root b/test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s3.root
new file mode 100644 (file)
index 0000000..83a0f0c
Binary files /dev/null and b/test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s3.root differ
diff --git a/test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s4.root b/test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s4.root
new file mode 100644 (file)
index 0000000..dd8af46
Binary files /dev/null and b/test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s4.root differ
diff --git a/test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s5.root b/test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s5.root
new file mode 100644 (file)
index 0000000..092e63a
Binary files /dev/null and b/test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s5.root differ
diff --git a/test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s6.root b/test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s6.root
new file mode 100644 (file)
index 0000000..e1fd73c
Binary files /dev/null and b/test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s6.root differ
diff --git a/test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s7.root b/test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s7.root
new file mode 100644 (file)
index 0000000..1cf616a
Binary files /dev/null and b/test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s7.root differ
diff --git a/test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s8.root b/test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s8.root
new file mode 100644 (file)
index 0000000..90e10c5
Binary files /dev/null and b/test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s8.root differ
diff --git a/test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s9.root b/test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s9.root
new file mode 100644 (file)
index 0000000..2263ec9
Binary files /dev/null and b/test/vmctest/gun/GRP/GRP/Data/Run0_0_v1_s9.root differ
diff --git a/test/vmctest/gun/README b/test/vmctest/gun/README
new file mode 100644 (file)
index 0000000..5248ff6
--- /dev/null
@@ -0,0 +1,48 @@
+$Id$
+
+How to run gun test with both G3 and G4
+=======================================
+
+1. event generation
+
+cd $ALICE_ROOT/test/vmctest/gun
+./rungen.sh
+   --> will generate primary events in an external file
+
+2. simulation
+
+./runsim.sh
+   --> will run simulation with both G3 and G4;
+       if you want to re-process with one MC only, you can just
+       edit the lines with
+       RUNG3=1
+       RUNG4=1
+       
+       The output files are moved in g3, g4 directories.
+       When repeating test with a different configuration,
+       you shoul rename the existing output directory 
+
+3. extract digits
+
+cd g3
+../../scripts/digits.sh
+cd ../g4
+../../scripts/digits.sh
+
+4. plot digits
+
+First select directories to be processed in ../scripts/plotDigits.C
+by modifying lines
+  label[0] = "g3";    
+  label[1] = "g4";
+  label[2] = "g4";
+
+cd $ALICE_ROOT/test/vmctest/gun
+aliroot ../scripts/plotDigits.C
+
+
+
+
+
+
+
diff --git a/test/vmctest/gun/commonConfig.C b/test/vmctest/gun/commonConfig.C
new file mode 100644 (file)
index 0000000..95ff720
--- /dev/null
@@ -0,0 +1,292 @@
+// $Id$
+//
+// AliRoot Configuration for running aliroot with Monte Carlo.
+// commonConfig() includes the common setting for all MCs
+// which has to be called before MC is instantiated.
+// Called from MC specific configs (g3Config.C, g4Config.C).
+//
+// Extracted from G3 specific Config.C 
+// by I. Hrivnacova, IPN Orsay
+
+enum PprTrigConf_t {
+    kDefaultPPTrig, kDefaultPbPbTrig
+};
+
+const char * pprTrigConfName[] = {
+    "p-p","Pb-Pb"
+};
+
+// Options 
+static AliMagF::BMap_t smag = AliMagF::k5kG;
+static PprTrigConf_t strig = kDefaultPPTrig; // default PP trigger configuration
+static TString comment;
+
+// Functions
+void  LoadPythia();
+
+void commonConfig(Bool_t setRootGeometry = kFALSE)
+{
+  cout << "Running commonConfig.C ... " << endl;
+
+    // Set Random Number seed
+  gRandom->SetSeed(123456); // Set 0 to use the currecnt time
+  AliLog::Message(AliLog::kInfo, Form("Seed for random number generation = %d",gRandom->GetSeed()), "Config.C", "Config.C", "Config()","Config.C", __LINE__);
+
+
+  //=======================================================================
+  // Load Pythia libraries
+  //=======================================================================
+
+  LoadPythia();
+
+  //=======================================================================
+  // ALICE steering object (AliRunLoader)
+  //=======================================================================
+
+  // Set Root geometry file
+  if ( setRootGeometry ) {
+    gAlice->SetRootGeometry();
+    gAlice->SetGeometryFromFile("geometry.root");
+  }
+
+  AliRunLoader* rl 
+    = AliRunLoader::Open("galice.root",
+                         AliConfig::GetDefaultEventFolderName(),
+                         "recreate");
+  if ( ! rl ) {
+    gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
+    return;
+  }
+  rl->SetCompressionLevel(2);
+  rl->SetNumberOfEventsPerFile(3);
+  gAlice->SetRunLoader(rl);
+  
+  //======================================================================
+  // Trigger configuration
+  //=======================================================================
+
+  gAlice->SetTriggerDescriptor(pprTrigConfName[strig]);
+  cout << "Trigger configuration is set to  " << pprTrigConfName[strig] << endl;
+
+  // ============================= 
+  // Magnetic field
+  // ============================= 
+
+  // Field (L3 0.5 T)
+  AliMagF* field = new AliMagF("Maps","Maps", -1., -1., AliMagF::k5kG);
+  TGeoGlobalMagField::Instance()->SetField(field);
+
+  printf("\n \n Comment: %s \n \n", comment.Data());
+
+  // ============================= 
+  // Modules
+  // ============================= 
+
+  rl->CdGAFile();
+
+  Int_t   iABSO  =  1;
+  Int_t   iDIPO  =  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  =  1;
+  Int_t   iPIPE  =  1;
+  Int_t   iPMD   =  1;
+  Int_t   iHMPID =  1;
+  Int_t   iSHIL  =  1;
+  Int_t   iT0    =  1;
+  Int_t   iTOF   =  1;
+  Int_t   iTPC   =  1;
+  Int_t   iTRD   =  1;
+  Int_t   iZDC   =  1;
+  Int_t   iEMCAL =  1;
+  Int_t   iACORDE = 0;
+  Int_t   iVZERO =  1;
+/*
+  Int_t   iABSO  =  0;
+  Int_t   iDIPO  =  0;
+  Int_t   iFMD   =  0;
+  Int_t   iFRAME =  0;
+  Int_t   iHALL  =  0;
+  Int_t   iITS   =  0;
+  Int_t   iMAG   =  0;
+  Int_t   iMUON  =  0;
+  Int_t   iPHOS  =  0;
+  Int_t   iPIPE  =  0;
+  Int_t   iPMD   =  0;
+  Int_t   iHMPID =  0;
+  Int_t   iSHIL  =  0;
+  Int_t   iT0    =  0;
+  Int_t   iTOF   =  0;
+  Int_t   iTPC   =  1;
+  Int_t   iTRD   =  0;
+  Int_t   iZDC   =  0;
+  Int_t   iEMCAL =  0;
+  Int_t   iACORDE = 0;
+  Int_t   iVZERO =  0;
+*/
+  rl->CdGAFile();
+  //=================== 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");
+  }
+
+
+  if (iABSO)
+  {
+      //=================== ABSO parameters ============================
+      AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
+  }
+
+  if (iDIPO)
+  {
+      //=================== DIPO parameters ============================
+
+      AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
+  }
+
+  if (iHALL)
+  {
+      //=================== HALL parameters ============================
+
+      AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
+  }
+
+
+  if (iFRAME)
+  {
+      //=================== FRAME parameters ============================
+
+      AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
+      FRAME->SetHoles(1);
+  }
+
+  if (iSHIL)
+  {
+      //=================== SHIL parameters ============================
+
+      AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
+  }
+
+
+  if (iPIPE)
+  {
+      //=================== PIPE parameters ============================
+
+      AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
+  }
+  if (iITS)
+  {
+      //=================== ITS parameters ============================
+
+      AliITS *ITS  = new AliITSv11Hybrid("ITS","ITS v11Hybrid");
+  }
+
+  if (iTPC)
+  {
+      //============================ TPC parameters ===================
+      AliTPC *TPC = new AliTPCv2("TPC", "Default");
+  }
+
+
+  if (iTOF) {
+      //=================== TOF parameters ============================
+      AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
+  }
+
+
+  if (iHMPID)
+  {
+      //=================== HMPID parameters ===========================
+      AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
+
+  }
+
+
+  if (iZDC)
+  {
+      //=================== ZDC parameters ============================
+
+      AliZDC *ZDC = new AliZDCv3("ZDC", "normal ZDC");
+  }
+
+  if (iTRD)
+  {
+      //=================== TRD parameters ============================
+
+      AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
+  }
+
+  if (iFMD)
+  {
+      //=================== FMD parameters ============================
+      AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
+  }
+
+  if (iMUON)
+  {
+      //=================== MUON parameters ===========================
+      // New MUONv1 version (geometry defined via builders)
+      AliMUON *MUON = new AliMUONv1("MUON", "default");
+  }
+  //=================== PHOS parameters ===========================
+
+  if (iPHOS)
+  {
+      AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
+  }
+
+
+  if (iPMD)
+  {
+      //=================== PMD parameters ============================
+      AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
+  }
+
+  if (iT0)
+  {
+      //=================== T0 parameters ============================
+      AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
+  }
+
+  if (iEMCAL)
+  {
+      //=================== EMCAL parameters ============================
+      AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETE");
+  }
+
+   if (iACORDE)
+  {
+      //=================== ACORDE parameters ============================
+      AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
+  }
+
+   if (iVZERO)
+  {
+      //=================== ACORDE parameters ============================
+      AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
+  }
+
+  AliLog::Message(AliLog::kInfo, "End of Config", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
+
+  cout << "Running commonConfig.C finished ... " << endl;
+}
+
+void LoadPythia()
+{
+  // Load Pythia related libraries
+  gSystem->Load("liblhapdf.so");      // Parton density functions
+  gSystem->Load("libEGPythia6.so");   // TGenerator interface
+  gSystem->Load("libpythia6.so");     // Pythia
+  gSystem->Load("libAliPythia6.so");  // ALICE specific implementations
+}
diff --git a/test/vmctest/gun/g3Config.C b/test/vmctest/gun/g3Config.C
new file mode 100644 (file)
index 0000000..00e5eeb
--- /dev/null
@@ -0,0 +1,34 @@
+// $Id$
+//
+// Configuration macro for running aliroot with Geant3
+// with primary events read from external file.
+//
+// By I. Hrivnacova, IPN Orsay
+
+void Config()
+{
+  cout << "Running g3Config.C ... " << endl;
+
+  // AliRoot setup
+  //
+  gROOT->LoadMacro("$ALICE_ROOT/test/vmctest/gun/commonConfig.C");
+  commonConfig(kFALSE);
+
+  // Load Geant3 + Geant3 VMC libraries
+  //
+#if defined(__CINT__)
+    gSystem->Load("libgeant321");
+#endif
+
+  // Create TGeant3
+  //  
+  new  TGeant3TGeo("C++ Interface to Geant3");
+
+  // AliRoot event generator
+  // (it has to be created after MC, as it may use decayer via VMC)
+  //
+  gROOT->LoadMacro("$ALICE_ROOT/test/vmctest/gun/genExtFileConfig.C");
+  genExtFileConfig();
+
+  cout << "Running g3Config.C finished ... " << endl;
+}  
diff --git a/test/vmctest/gun/g4Config.C b/test/vmctest/gun/g4Config.C
new file mode 100644 (file)
index 0000000..7d780e7
--- /dev/null
@@ -0,0 +1,119 @@
+// $Id$
+//
+// Configuration macro for running aliroot with Geant4
+// with primary events read from external file.
+//
+// By I. Hrivnacova, IPN Orsay
+       
+
+void Config()
+{
+  cout << "Running g4Config.C ... " << endl;
+
+  // AliRoot setup
+  //
+  gROOT->LoadMacro("$ALICE_ROOT/test/vmctest/gun/commonConfig.C");
+  commonConfig(kTRUE);
+
+  // Load Geant4 + Geant4 VMC libraries
+  //
+  if (gClassTable->GetID("TGeant4") == -1) {
+    // Load Geant4 libraries 
+    if (!gInterpreter->IsLoaded("$ALICE/geant4_vmc/examples/macro/g4libs.C")) {
+      gROOT->LoadMacro("$ALICE/geant4_vmc/examples/macro/g4libs.C");
+      gInterpreter->ProcessLine("g4libs()");
+    }
+  }    
+
+  // Create Geant4 VMC
+  //  
+  TGeant4 *geant4 = 0;
+  if ( ! gMC ) {
+    TG4RunConfiguration* runConfiguration 
+      = new TG4RunConfiguration("geomRoot", 
+                                "QGSP_BERT_EMV+optical", 
+                                "specialCuts+stackPopper+stepLimiter",
+                                 true);
+//      = new TG4RunConfiguration("geomRootToGeant4",
+//                                "emStandard+optical", 
+//                                "specialCuts+specialControls+stackPopper+stepLimiter",
+//                                 true);
+      
+
+    geant4 = new TGeant4("TGeant4", "The Geant4 Monte Carlo", runConfiguration);
+    cout << "Geant4 has been created." << endl;
+  } 
+  else {
+    cout << "Monte Carlo has been already created." << endl;
+  }  
+
+  // Customization of Geant4 VMC
+  //
+
+  //geant4->ProcessGeantCommand("/mcPhysics/rangeCuts 0.01 mm"); 
+    geant4->ProcessGeantCommand("/mcVerbose/all 1");  
+    geant4->ProcessGeantCommand("/mcVerbose/geometryManager 2");  
+    geant4->ProcessGeantCommand("/mcVerbose/opGeometryManager 1");  
+    geant4->ProcessGeantCommand("/mcTracking/loopVerbose 0");     
+    geant4->ProcessGeantCommand("/mcPhysics/rangeCuts 0.01 mm"); 
+    //geant4->ProcessGeantCommand("/mcPhysics/rangeCuts 1 mm"); 
+    geant4->ProcessGeantCommand("/mcPhysics/selectOpProcess Scintillation");
+    geant4->ProcessGeantCommand("/mcPhysics/setOpProcessActivation false");
+    geant4->ProcessGeantCommand("/mcTracking/skipNeutrino true");
+
+  // Uncomment this line to get a detail info from each step 
+  // geant4->ProcessGeantCommand("/tracking/verbose 1");  
+  
+  // More info from the physics list
+  // the verbosity level is passed to all contained physics lists and their
+  // physics builders
+  //geant4->ProcessGeantCommand("/mcVerbose/composedPhysicsList 2");  
+  
+  // More info from optical processes
+  //geant4->ProcessGeantCommand("/mcVerbose/opticalPhysicsList 3");  
+  
+  // More info from geometry building
+  //geant4->ProcessGeantCommand("/mcVerbose/geometryManager 1");  
+
+  // More info from setting geometry properties (in materials and surfaces)
+  // for optical physics
+  //geant4->ProcessGeantCommand("/mcVerbose/opGeometryManager 1");  
+  
+  // More info about regions construction 
+  // and conversion of VMC cuts in cuts in range per regions 
+  // geant4->ProcessGeantCommand("/mcVerbose/regionsManager 2");
+  
+  // Suppress verbose info from tracks which reached maximum number of steps
+  // (default value is 30000)  
+  //geant4->ProcessGeantCommand("/mcTracking/loopVerbose 0"); 
+    
+  //
+  // Set apply cuts 
+/*
+  geant4->ProcessGeantCommand("/run/particle/applyCuts");  
+  // geant4->ProcessGeantCommand("/mcVerbose/geometryManager 2");  
+
+  geant4->ProcessGeantCommand("/mcVerbose/composedPhysicsList 2");  
+  geant4->ProcessGeantCommand("/mcDet/volNameSeparator !");
+  geant4->ProcessGeantCommand("/mcPhysics/setStackPopperSelection e+ e- pi+ pi- kaon+ kaon- gamma");
+  //geant4->ProcessGeantCommand("/tracking/verbose 1");  
+
+  geant4->ProcessGeantCommand("/mcControl/g3Defaults");
+!!!!n Generates warnings:
+>>> Event 0
+G4ProcessTable::Insert : arguments are 0 pointer 
+G4ProcessTable::Insert : arguments are 0 pointer 
+G4ProcessTable::Insert : arguments are 0 pointer 
+G4ProcessTable::Insert : arguments are 0 pointer 
+G4ProcessTable::Insert : arguments are 0 pointer 
+
+*/
+
+  // AliRoot event generator
+  // (it has to be created after MC, as it may use decayer via VMC)
+  //
+  gROOT->LoadMacro("$ALICE_ROOT/test/vmctest/gun/genExtFileConfig.C");
+  genExtFileConfig();
+
+  cout << "Running g4Config.C finished ... " << endl;
+}
diff --git a/test/vmctest/gun/gen.C b/test/vmctest/gun/gen.C
new file mode 100644 (file)
index 0000000..2ad5d98
--- /dev/null
@@ -0,0 +1,111 @@
+// $Id$
+//
+// Generation of kinematics tree which can be then used as an extrenal
+// event generator.
+// According to: $ALICE_ROOT/test/genkine/gen/fastGen.C
+//
+// By I. Hrivnacova, IPN Orsay
+
+#if !defined(__CINT__) || defined(__MAKECINT__)
+#include <Riostream.h>
+#include <TH1F.h>
+#include <TStopwatch.h>
+#include <TDatime.h>
+#include <TRandom.h>
+#include <TDatabasePDG.h>
+#include <TParticle.h>
+#include <TArrayI.h>
+
+#include "AliGenerator.h"
+#include "AliPDG.h"
+#include "AliRunLoader.h"
+#include "AliRun.h"
+#include "AliStack.h"
+#include "AliHeader.h"
+#include "PYTHIA6/AliGenPythia.h"
+#include "PYTHIA6/AliPythia.h"
+#endif
+
+void gen(Int_t nev = 1, char* filename = "galice.root")
+{
+  // Load libraries
+  // gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include -I$ALICE_ROOT");
+  gSystem->Load("liblhapdf.so");      // Parton density functions
+  gSystem->Load("libEGPythia6.so");   // TGenerator interface
+  gSystem->Load("libpythia6.so");     // Pythia
+  gSystem->Load("libAliPythia6.so");  // ALICE specific implementations
+
+  AliPDG::AddParticlesToPdgDataBase();
+  TDatabasePDG::Instance();
+
+  // Run loader
+  AliRunLoader* rl = AliRunLoader::Open("galice.root","FASTRUN","recreate");
+  
+  rl->SetCompressionLevel(2);
+  rl->SetNumberOfEventsPerFile(nev);
+  rl->LoadKinematics("RECREATE");
+  rl->MakeTree("E");
+  gAlice->SetRunLoader(rl);
+  
+  //  Create stack
+  rl->MakeStack();
+  AliStack* stack = rl->Stack();
+  
+  //  Header
+  AliHeader* header = rl->GetHeader();
+  
+  //  Create and Initialize Generator
+  gROOT->LoadMacro("$ALICE_ROOT/test/vmctest/gun/genGunConfig.C");
+  AliGenerator* gener = genGunConfig();
+
+  // Go to galice.root
+  rl->CdGAFile();
+
+  // Forbid some decays. Do it after gener->Init(0, because
+  // the initialization of the generator includes reading of the decay table.
+  // ...
+
+  //
+  // Event Loop
+  //
+  
+  TStopwatch timer;
+  timer.Start();
+  for (Int_t iev = 0; iev < nev; iev++) {
+    
+    cout <<"Event number "<< iev << endl;
+    
+    // Initialize event
+    header->Reset(0,iev);
+    rl->SetEventNumber(iev);
+    stack->Reset();
+    rl->MakeTree("K");
+    
+    // Generate event
+    stack->Reset();
+    stack->ConnectTree(rl->TreeK());
+    gener->Generate();
+    cout << "Number of particles " << stack->GetNprimary() << endl;
+    
+    // Finish event
+    header->SetNprimary(stack->GetNprimary());
+    header->SetNtrack(stack->GetNtrack());  
+    
+    // I/O
+    stack->FinishEvent();
+    header->SetStack(stack);
+    rl->TreeE()->Fill();
+    rl->WriteKinematics("OVERWRITE");
+    
+  } // event loop
+  timer.Stop();
+  timer.Print();
+  
+  //                         Termination
+  //  Generator
+  gener->FinishRun();
+  //  Write file
+  rl->WriteHeader("OVERWRITE");
+  gener->Write();
+  rl->Write();
+}
diff --git a/test/vmctest/gun/genConfig.C b/test/vmctest/gun/genConfig.C
new file mode 100644 (file)
index 0000000..e3fbf61
--- /dev/null
@@ -0,0 +1,33 @@
+// $Id$
+//
+// Configuration macro for primary event generation for gun test (in vmctest).
+//
+// By I. Hrivnacova, IPN Orsay
+
+void Config()
+{
+  cout << "Running genConfig.C ... " << endl;
+
+  // AliRoot setup
+  //
+  gROOT->LoadMacro("$ALICE_ROOT/test/vmctest/gun/commonConfig.C");
+  commonConfig(kFALSE);
+
+  // Load Geant3 + Geant3 VMC libraries
+  //
+#if defined(__CINT__)
+    gSystem->Load("libgeant321");
+#endif
+
+  // Create TGeant3
+  //  
+  new  TGeant3TGeo("C++ Interface to Geant3");
+
+  // AliRoot event generator
+  // (it has to be created after MC, as it may use decayer via VMC)
+  //
+  gROOT->LoadMacro("$ALICE_ROOT/test/vmctest/gun/genGunConfig.C");
+  genGunConfig();
+
+  cout << "Running genConfig.C finished ... " << endl;
+}  
diff --git a/test/vmctest/gun/genExtFileConfig.C b/test/vmctest/gun/genExtFileConfig.C
new file mode 100644 (file)
index 0000000..8d732e6
--- /dev/null
@@ -0,0 +1,107 @@
+// $Id$
+//
+// AliRoot Configuration for running aliroot with Monte Carlo.
+// ConfigCommon2() includes the common setting for all MCs
+// which has to be called after MC is instantiated.
+// Called from MC specific configs (g3Config.C, g4Config.C).
+//
+// Extracted from G3 specific Config.C 
+// by I. Hrivnacova, IPN Orsay
+
+// Functions
+Float_t EtaToTheta(Float_t arg);
+AliGenerator* GeneratorFactory();
+
+void genExtFileConfig()
+{
+  cout << "Running genExtFileConfig.C ... " << endl;
+
+  //=======================================================================
+  // Steering parameters for ALICE simulation
+  //=======================================================================
+
+  gMC->SetProcess("DCAY",1);
+  gMC->SetProcess("PAIR",1);
+  gMC->SetProcess("COMP",1);
+  gMC->SetProcess("PHOT",1);
+  gMC->SetProcess("PFIS",0);
+  gMC->SetProcess("DRAY",0);
+  gMC->SetProcess("ANNI",1);
+  gMC->SetProcess("BREM",1);
+  gMC->SetProcess("MUNU",1);
+  gMC->SetProcess("CKOV",1);
+  gMC->SetProcess("HADR",1);
+  gMC->SetProcess("LOSS",2);
+  gMC->SetProcess("MULS",1);
+  //gMC->SetProcess("RAYL",1);
+
+  Float_t cut = 1.e-3;        // 1MeV cut by default
+  Float_t tofmax = 1.e10;
+
+  gMC->SetCut("CUTGAM", cut);
+  gMC->SetCut("CUTELE", cut);
+  gMC->SetCut("CUTNEU", cut);
+  gMC->SetCut("CUTHAD", cut);
+  gMC->SetCut("CUTMUO", cut);
+  gMC->SetCut("BCUTE",  cut); 
+  gMC->SetCut("BCUTM",  cut); 
+  gMC->SetCut("DCUTE",  cut); 
+  gMC->SetCut("DCUTM",  cut); 
+  gMC->SetCut("PPCUTM", cut);
+  gMC->SetCut("TOFMAX", tofmax); 
+
+  //=======================================================================
+  // External decayer
+  //=======================================================================
+
+  TVirtualMCDecayer *decayer = new AliDecayerPythia();
+  decayer->SetForceDecay(kAll);
+  decayer->Init();
+/*
+  //forbid some decays
+  AliPythia * py= AliPythia::Instance();
+  py->SetMDME(737,1,0); //forbid D*+->D+ + pi0
+  py->SetMDME(738,1,0);//forbid D*+->D+ + gamma
+
+  for(Int_t d=747; d<=762; d++){ 
+    py->SetMDME(d,1,0);
+  }
+
+  for(Int_t d=764; d<=807; d++){ 
+    py->SetMDME(d,1,0);
+  }
+*/
+  gMC->SetExternalDecayer(decayer);
+  
+  //=======================================================================
+  // Event generator
+  //=======================================================================
+
+  // External generator configuration
+  AliGenerator* gener = GeneratorFactory();
+  gener->SetOrigin(0, 0, 0);    // vertex position
+  //gener->SetSigma(0, 0, 5.3);   // Sigma in (X,Y,Z) (cm) on IP position
+  //gener->SetCutVertexZ(1.);     // Truncate at 1 sigma
+  //gener->SetVertexSmear(kPerEvent); 
+  gener->SetTrackingFlag(1);
+  gener->Init();
+    
+  cout << "Running genExtFileConfig.C finished ... " << endl;
+}
+
+Float_t EtaToTheta(Float_t arg){
+  return (180./TMath::Pi())*2.*atan(exp(-arg));
+}
+
+AliGenerator* GeneratorFactory() {
+
+  AliGenExtFile *gener = new AliGenExtFile(-1);
+  AliGenReaderTreeK * reader = new AliGenReaderTreeK();
+
+  reader->SetFileName("galice.root");
+  reader->AddDir("gen");
+  gener->SetReader(reader);
+     
+  return gener; 
+}
+
diff --git a/test/vmctest/gun/genGunConfig.C b/test/vmctest/gun/genGunConfig.C
new file mode 100644 (file)
index 0000000..1e18e32
--- /dev/null
@@ -0,0 +1,187 @@
+/// $Id$
+//
+// AliRoot Configuration for gun vmctest
+//
+// Extracted from G3 specific Config.C in test/gun.
+// by I. Hrivnacova, IPN Orsay
+
+Float_t EtaToTheta(Float_t arg);
+
+AliGenerator* genGunConfig()
+{
+  cout << "Running genGunConfig.C ... " << endl;
+
+  //=======================================================================
+  // Event generator
+  //=======================================================================
+
+  // The cocktail iitself
+
+  AliGenCocktail *gener = new AliGenCocktail();
+  gener->SetPhiRange(0, 360);
+  // Set pseudorapidity range from -8 to 8.
+  Float_t thmin = EtaToTheta(8);   // theta min. <---> eta max
+  Float_t thmax = EtaToTheta(-8);  // theta max. <---> eta min 
+  gener->SetThetaRange(thmin,thmax);
+  gener->SetOrigin(0, 0, 0);  //vertex position
+  gener->SetSigma(0, 0, 0);   //Sigma in (X,Y,Z) (cm) on IP position
+
+
+  // Particle guns for the barrel part (taken from RichConfig)
+
+  AliGenFixed *pG1=new AliGenFixed(1);
+  pG1->SetPart(kProton);
+  pG1->SetMomentum(2.5);
+  pG1->SetTheta(109.5-3);
+  pG1->SetPhi(10);
+  gener->AddGenerator(pG1,"g1",1);
+  
+  AliGenFixed *pG2=new AliGenFixed(1);
+  pG2->SetPart(kPiPlus);
+  pG2->SetMomentum(1.0);
+  pG2->SetTheta( 90.0-3);
+  pG2->SetPhi(10);
+  gener->AddGenerator(pG2,"g2",1);
+
+  AliGenFixed *pG3=new AliGenFixed(1);
+  pG3->SetPart(kPiMinus);
+  pG3->SetMomentum(1.5);
+  pG3->SetTheta(109.5-3);
+  pG3->SetPhi(30);
+  gener->AddGenerator(pG3,"g3",1);
+  
+  AliGenFixed *pG4=new AliGenFixed(1);
+  pG4->SetPart(kKPlus);
+  pG4->SetMomentum(0.7);
+  pG4->SetTheta( 90.0-3);
+  pG4->SetPhi(30);
+  gener->AddGenerator(pG4,"g4",1);
+  
+  AliGenFixed *pG5=new AliGenFixed(1);
+  pG5->SetPart(kKMinus);
+  pG5->SetMomentum(1.0);
+  pG5->SetTheta( 70.0-3);
+  pG5->SetPhi(30);
+  gener->AddGenerator(pG5,"g5",1);
+  
+  AliGenFixed *pG6=new AliGenFixed(1);
+  pG6->SetPart(kProtonBar);
+  pG6->SetMomentum(2.5);
+  pG6->SetTheta( 90.0-3);
+  pG6->SetPhi(50);
+  gener->AddGenerator(pG6,"g6",1);
+  
+  AliGenFixed *pG7=new AliGenFixed(1);
+  pG7->SetPart(kPiMinus);
+  pG7->SetMomentum(0.7);
+  pG7->SetTheta( 70.0-3);
+  pG7->SetPhi(50);
+  gener->AddGenerator(pG7,"g7",1);
+
+  // Electrons for TRD
+
+  AliGenFixed *pG8=new AliGenFixed(1);
+  pG8->SetPart(kElectron);
+  pG8->SetMomentum(1.2);
+  pG8->SetTheta( 95.0);
+  pG8->SetPhi(190);
+  gener->AddGenerator(pG8,"g8",1);
+
+  AliGenFixed *pG9=new AliGenFixed(1);
+  pG9->SetPart(kPositron);
+  pG9->SetMomentum(1.2);
+  pG9->SetTheta( 85.0);
+  pG9->SetPhi(190);
+  gener->AddGenerator(pG9,"g9",1);
+
+  // PHOS
+
+  AliGenBox *gphos = new AliGenBox(1);
+  gphos->SetMomentumRange(10,11.);
+  gphos->SetPhiRange(270.5,270.7);
+  gphos->SetThetaRange(90.5,90.7);
+  gphos->SetPart(kGamma);
+  gener->AddGenerator(gphos,"GENBOX GAMMA for PHOS",1);
+
+  // EMCAL
+
+  AliGenBox *gemcal = new AliGenBox(1);
+  gemcal->SetMomentumRange(10,11.);
+  gemcal->SetPhiRange(90.5,199.5);
+  gemcal->SetThetaRange(90.5,90.7);
+  gemcal->SetPart(kGamma);
+  gener->AddGenerator(gemcal,"GENBOX GAMMA for EMCAL",1);
+
+  // MUON
+  AliGenBox * gmuon1 = new AliGenBox(1);
+  gmuon1->SetMomentumRange(20.,20.1);
+  gmuon1->SetPhiRange(0., 360.);         
+  gmuon1->SetThetaRange(171.000,178.001);
+  gmuon1->SetPart(kMuonMinus);           // Muons
+  gener->AddGenerator(gmuon1,"GENBOX MUON1",1);
+
+  AliGenBox * gmuon2 = new AliGenBox(1);
+  gmuon2->SetMomentumRange(20.,20.1);
+  gmuon2->SetPhiRange(0., 360.);         
+  gmuon2->SetThetaRange(171.000,178.001);
+  gmuon2->SetPart(kMuonPlus);           // Muons
+  gener->AddGenerator(gmuon2,"GENBOX MUON1",1);
+
+  //TOF
+  AliGenFixed *gtof=new AliGenFixed(1);
+  gtof->SetPart(kProton);
+  gtof->SetMomentum(2.5);
+  gtof->SetTheta(95);
+  gtof->SetPhi(340);
+  gener->AddGenerator(gtof,"Proton for TOF",1);
+
+  //FMD1
+  AliGenFixed *gfmd1=new AliGenFixed(1);
+  gfmd1->SetPart(kGamma);
+  gfmd1->SetMomentum(25);
+  gfmd1->SetTheta(1.8);
+  gfmd1->SetPhi(10);
+  gener->AddGenerator(gfmd1,"Gamma for FMD1",1);
+  
+  //FMD2i
+  AliGenFixed *gfmd2i=new AliGenFixed(1);
+  gfmd2i->SetPart(kPiPlus);
+  gfmd2i->SetMomentum(1.5);
+  gfmd2i->SetTheta(7.3);
+  gfmd2i->SetPhi(20);
+  gener->AddGenerator(gfmd2i,"Pi+ for FMD2i",1);
+  
+  //FMD2o
+  AliGenFixed *gfmd2o=new AliGenFixed(1);
+  gfmd2o->SetPart(kPiMinus);
+  gfmd2o->SetMomentum(1.5);
+  gfmd2o->SetTheta(16.1);
+  gfmd2o->SetPhi(30);
+  gener->AddGenerator(gfmd2o,"Pi- for FMD2o",1);
+  
+  //FMD3o
+  AliGenFixed *gfmd3o=new AliGenFixed(1);
+  gfmd3o->SetPart(kPiPlus);
+  gfmd3o->SetMomentum(1.5);
+  gfmd3o->SetTheta(163.9);
+  gfmd3o->SetPhi(40);
+  gener->AddGenerator(gfmd3o,"Pi+ for FMD3o",1);
+  
+  //FMD3i
+  AliGenFixed *gfmd3i=new AliGenFixed(1);
+  gfmd3i->SetPart(kPiMinus);
+  gfmd3i->SetMomentum(1.5);
+  gfmd3i->SetTheta(170.5);
+  gfmd3i->SetPhi(50);
+  gener->AddGenerator(gfmd3i,"Pi- for FMD3i",1);
+  
+  gener->Init();
+  
+  return gener;
+  
+  cout << "Running genGunConfig.C finished ... " << endl;
+}
+
+Float_t EtaToTheta(Float_t arg){
+  return (180./TMath::Pi())*2.*atan(exp(-arg));
+}
diff --git a/test/vmctest/gun/rec.C b/test/vmctest/gun/rec.C
new file mode 100644 (file)
index 0000000..918fef3
--- /dev/null
@@ -0,0 +1,21 @@
+// $Id$
+//
+// Macro for running reconstruction in test/vmctest/gun.
+// From test/gun. 
+
+void rec() {
+  AliReconstruction reco;
+
+  reco.SetWriteESDfriend();
+  reco.SetWriteAlignmentData();
+
+  reco.SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+  reco.SetSpecificStorage("GRP/GRP/Data",
+                         Form("local://%s",gSystem->pwd()));
+
+  TStopwatch timer;
+  timer.Start();
+  reco.Run();
+  timer.Stop();
+  timer.Print();
+}
diff --git a/test/vmctest/gun/rungen.sh b/test/vmctest/gun/rungen.sh
new file mode 100755 (executable)
index 0000000..eaebe39
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh
+# $Id$
+
+NEVENTS=100
+GENCONFIG="$ALICE_ROOT/test/vmctest/gun/genConfig.C" 
+OUTDIR=gen
+
+rm -rf *.root *.dat *.log fort* hlt hough raw* recraw/*.root recraw/*.log
+aliroot -b -q gen.C\($NEVENTS,\""$GENCONFIG"\"\)      2>&1 | tee gen.log
+rm -fr $OUTDIR
+mkdir $OUTDIR
+mv galice.root Kinematics*.root gen.log $OUTDIR
+
+rm -rf *.root *.dat *.log fort* hlt hough raw* recraw/*.root recraw/*.log
diff --git a/test/vmctest/gun/runsim.sh b/test/vmctest/gun/runsim.sh
new file mode 100755 (executable)
index 0000000..127fe96
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/sh
+# $Id$
+
+# Before running this script, you should run rungen.sh first.
+
+NEVENTS=20
+G3CONFIG="$ALICE_ROOT/test/vmctest/gun/g3Config.C" 
+G4CONFIG="$ALICE_ROOT/test/vmctest/gun/g4Config.C" 
+G3OUTDIR=g3
+G4OUTDIR=g4
+
+RUNG3=0
+RUNG4=1
+
+if [ "$RUNG3" = "1" ]; then 
+  rm -rf *.root *.dat *.log fort* hlt hough raw* recraw/*.root recraw/*.log
+  aliroot -b -q  sim.C\($NEVENTS,\""$G3CONFIG"\"\)  2>&1 | tee sim.log
+  #aliroot -b -q rec.C      2>&1 | tee rec.log
+  rm -fr $G3OUTDIR
+  mkdir $G3OUTDIR
+  mv *.root *.log $G3OUTDIR
+  cp g3Config.C $G3OUTDIR
+fi
+
+if [ "$RUNG4" = "1" ]; then 
+  rm -rf *.root *.dat *.log fort* hlt hough raw* recraw/*.root recraw/*.log
+  cp g3/geometry.root .
+  aliroot -b -q  sim.C\($NEVENTS,\""$G4CONFIG"\"\)  2>&1 | tee sim.log
+  #aliroot -b -q rec.C      2>&1 | tee rec.log
+  rm -fr $G4OUTDIR
+  mkdir $G4OUTDIR
+  mv *.root *.log $G4OUTDIR
+  cp g4Config.C $G3OUTDIR
+fi
diff --git a/test/vmctest/gun/sim.C b/test/vmctest/gun/sim.C
new file mode 100644 (file)
index 0000000..5adf59c
--- /dev/null
@@ -0,0 +1,22 @@
+// $Id$
+//
+// Macro for running simulation in test/vmctest/gun.
+// From test/gun. 
+
+void sim(Int_t nev=4, const TString& config) {
+
+  AliSimulation simulator(config);
+  simulator.SetMakeSDigits("TRD TOF PHOS HMPID EMCAL MUON FMD ZDC PMD T0 VZERO");
+  simulator.SetMakeDigitsFromHits("ITS TPC");
+  simulator.SetWriteRawData("","raw.root",kTRUE);
+
+  simulator.SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+  simulator.SetSpecificStorage("GRP/GRP/Data",
+                              Form("local://%s",gSystem->pwd()));
+
+  TStopwatch timer;
+  timer.Start();
+  simulator.Run(nev);
+  timer.Stop();
+  timer.Print();
+}