]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Modifications for G4 simulation:
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 5 Oct 2009 15:47:50 +0000 (15:47 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 5 Oct 2009 15:47:50 +0000 (15:47 +0000)
- Move call to detector->CreateMaterials() from AliMC::Init()
    in AliMC::ConstructOpGeometry(); as materials have to be defined
    when we set optical properties
- In EMCAL, HMPID:
    Move definition of cuts and process controls per tracking media
    in Init()
- In AliStack:
    Set fCurrentTrack in functions called by Geant4:
    PopPrimaryForTracking(), SetCurrentTrack()
Updated G4 macros:
- Extended g4menu.C with buttons for running in batch
    and running G3 simulation
- Updated magnetic field
- Changed the default physics list selection to QGSP_BERT_EMV+optical;
    removed specialControls from selection
- Set default range cut value to 0.01 mm
- Added commented line with Geant4 VMC commands useful for
    debugging

(I. Hrivnacova)

EMCAL/AliEMCAL.cxx
EMCAL/AliEMCAL.h
HMPID/AliHMPIDv3.cxx
STEER/AliMC.cxx
STEER/AliStack.cxx
STEER/AliStack.h
macros/g4Config.C
macros/g4ConfigCommon1.C [new file with mode: 0644]
macros/g4ConfigCommon2.C [new file with mode: 0644]
macros/g4ConfigGeometry.C
macros/g4menu.C

index 21623f8f4641cd8dc2d9b9673c25bd52f718771f..8b912b90ecde94ea17b1bd017bcb8aa9f01f9451 100644 (file)
@@ -125,6 +125,7 @@ void AliEMCAL::InitConstants()
   fBirkC2 = 9.6e-6/(1.032 * 1.032);
   }
 
+
 //____________________________________________________________________________
 void AliEMCAL::DefineMediumParameters()
 {
@@ -276,8 +277,21 @@ void AliEMCAL::CreateMaterials()
   fBirkC1 =  0.013/dP;
   fBirkC2 =  9.6e-6/(dP * dP);
 
-  DefineMediumParameters(); // Feb 20, 2007
+  // Call just in case of Geant3; What to do in case of Geant4 ?
+  // if(gMC->InheritsFrom("TGeant3")) DefineMediumParameters(); // Feb 20, 2007
+  // Just do the same but in Init() function
+  // DefineMediumParameters(); 
 }
+
+//____________________________________________________________________________
+void  AliEMCAL::Init()
+{
+  // Call just in case of Geant3; What to do in case of Geant4 ?
+  // if(gMC->InheritsFrom("TGeant3")) DefineMediumParameters(); // Feb 20, 2007
+  // Just do the same
+  DefineMediumParameters(); 
+}     
+
 //____________________________________________________________________________
 void AliEMCAL::Digits2Raw() {
 
index 8b6c89cae97a72db960c123d5ebb2f7617182287..25a8e4b1c32c3c40f34ea6fe6899a6c9438d121e 100644 (file)
@@ -56,6 +56,7 @@ class AliEMCAL : public AliDetector {
   }
   virtual AliDigitizer* CreateDigitizer(AliRunDigitizer* manager) const;
   virtual void  CreateMaterials() ;   
+  virtual void  Init() ;   
   virtual void  Digits2Raw();
   
   virtual void  FinishRun() {}                  
index 0f49fefdc9edf13a50a9fee90365fb33f4f576c1..889fcf8987b326592c73bb13f1166ac23d212c5f 100644 (file)
@@ -132,8 +132,6 @@ void AliHMPIDv3::CreateMaterials()
     AliMaterial(++matId,"W"   ,aW   ,zW   ,dW   ,radW   ,absW   );  AliMedium(kW   ,"W"   , matId, unsens, itgfld, maxfld, tmaxfd, stemax, deemax, epsil, stmin);
     AliMaterial(++matId,"Al"  ,aAl  ,zAl  ,dAl  ,radAl  ,absAl  );  AliMedium(kAl  ,"Al"  , matId, unsens, itgfld, maxfld, tmaxfd, stemax, deemax, epsil, stmin);
     AliMaterial(++matId,"Ar"  ,aAr  ,zAr  ,dAr  ,radAr  ,absAr  );  AliMedium(kAr  ,"Ar"  , matId, unsens, itgfld, maxfld, tmaxfd, stemax, deemax, epsil, stmin);
-
-    InitProperties();
         
 }//void AliHMPID::CreateMaterials()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -509,11 +507,14 @@ void AliHMPIDv3::Init()
 // Arguments: none
 //   Returns: none      
   AliDebug(1,"Start v2 HMPID.");    
+  InitProperties();
   AliDebug(1,"Stop v2 HMPID.");    
 }
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void AliHMPIDv3::DefineOpticalProperties() 
 {
+  AliDebug(1,"");    
+
 // Optical properties definition.
   const Int_t kNbins=30;       //number of photon energy points
   Float_t emin=5.5,emax=8.5;         //Photon energy range,[eV]
index 12dd60c4b4e1c939ae41b14bede5b6a3a6df2de6..956e133a96b0a7aa7015d3b5822ef621144b9e9e 100644 (file)
@@ -192,6 +192,8 @@ void  AliMC::ConstructOpGeometry()
   AliModule *detector;
   AliInfo("Optical properties definition");
   while((detector = dynamic_cast<AliModule*>(next()))) {
+    // Initialise detector geometry
+    if(gAlice->IsRootGeometry()) detector->CreateMaterials();
     // Initialise detector optical properties
     detector->DefineOpticalProperties();
   }  
@@ -210,8 +212,6 @@ void  AliMC::InitGeometry()
   AliModule *detector;
   while((detector = dynamic_cast<AliModule*>(next()))) {
     stw.Start();
-    // Initialise detector geometry
-    if(gAlice->IsRootGeometry()) detector->CreateMaterials();
     detector->Init();
     AliInfo(Form("%10s R:%.2fs C:%.2fs",
                 detector->GetName(),stw.RealTime(),stw.CpuTime()));
@@ -300,13 +300,13 @@ void AliMC::BeginPrimary()
 void AliMC::PreTrack()
 {
   // Actions before the track's transport
+
      TObjArray &dets = *gAlice->Modules();
      AliModule *module;
 
      for(Int_t i=0; i<=gAlice->GetNdets(); i++)
        if((module = dynamic_cast<AliModule*>(dets[i])))
         module->PreTrack();
-
 }
 
 //_______________________________________________________________________
@@ -546,6 +546,7 @@ void AliMC::ResetSDigits()
 void AliMC::PostTrack()
 {
   // Posts tracks for each module
+
   TObjArray &dets = *gAlice->Modules();
   AliModule *module;
   
@@ -560,6 +561,7 @@ void AliMC::FinishPrimary()
   //
   // Called  at the end of each primary track
   //
+
   AliRunLoader *runloader=AliRunLoader::Instance();
   //  static Int_t count=0;
   //  const Int_t times=10;
@@ -628,8 +630,6 @@ void AliMC::FinishEvent()
   //
   // Called at the end of the event.
   //
-  
-  //
     
   if(AliSimulation::Instance()->Lego()) AliSimulation::Instance()->Lego()->FinishEvent();
 
@@ -1091,6 +1091,7 @@ void AliMC::ResetTrackReferences()
     fTmpTrackReferences.Clear();
 }
 
+//_______________________________________________________________________
 void AliMC::RemapTrackReferencesIDs(Int_t *map)
 {
   // 
@@ -1113,6 +1114,7 @@ void AliMC::RemapTrackReferencesIDs(Int_t *map)
   fTmpTrackReferences.Compress();
 }
 
+//_______________________________________________________________________
 void AliMC::FixParticleDecaytime()
 {
     //
@@ -1170,6 +1172,7 @@ void AliMC::MakeTmpTrackRefsTree()
     fTmpTreeTR->Branch("TrackReferences", "TClonesArray", &pRef, 4000);
 }
 
+//_______________________________________________________________________
 void AliMC::ReorderAndExpandTreeTR()
 {
 //
index 2bc35641a34fc832dadfce073288fa61f36dda92..c86db151e8f227ba132b89f87a8c55d3b2cdaa22 100644 (file)
@@ -207,7 +207,7 @@ void AliStack::PushTrack(Int_t done, Int_t parent, Int_t pdg,
     = new(fParticles[fLoadPoint++]) 
       TParticle(pdg, is, parent, -1, kFirstDaughter, kLastDaughter,
                px, py, pz, e, vx, vy, vz, tof);
-   
+                
   particle->SetPolarisation(polx, poly, polz);
   particle->SetWeight(weight);
   particle->SetUniqueID(mech);
@@ -226,7 +226,6 @@ void AliStack::PushTrack(Int_t done, Int_t parent, Int_t pdg,
   particle->SetBit(kDaughtersBit);
   //  Add the particle to the stack
   
-  
   fParticleMap.AddAtAndExpand(particle, fNtrack);//CHECK!!
 
   if(parent>=0) {
@@ -281,8 +280,10 @@ TParticle*  AliStack::PopPrimaryForTracking(Int_t i)
   
   TParticle* particle = Particle(i);
   
-  if (!particle->TestBit(kDoneBit))
+  if (!particle->TestBit(kDoneBit)) {
+    fCurrentTrack = particle;
     return particle;
+  }
   else
     return 0;
 }      
@@ -807,6 +808,15 @@ void AliStack::DumpLoadedStack() const
         "\n=======================================================================\n\n");
 }
 
+//_____________________________________________________________________________
+void  AliStack::SetCurrentTrack(Int_t track)
+{ 
+  fCurrent = track; 
+  if (fCurrent < fNprimary) fCurrentTrack = Particle(track);
+}
+
+
+//_____________________________________________________________________________
 //
 // protected methods
 //
@@ -974,6 +984,7 @@ Bool_t AliStack::IsStable(Int_t pdg) const
   return isStable;
 }
 
+//_____________________________________________________________________________
 Bool_t AliStack::IsPhysicalPrimary(Int_t index)
 {
     //
index 521a1366e3f298ab5d5d991de6eaa10adc888280..2c72b9dd6e16a5411e1f58b640d1c92c9d98a1e5 100644 (file)
@@ -117,9 +117,6 @@ class AliStack : public TVirtualMCStack
 inline void  AliStack::SetNtrack(Int_t ntrack)
 { fNtrack = ntrack; }
 
-inline void  AliStack::SetCurrentTrack(Int_t track)
-{ fCurrent = track; }
-
 inline Int_t AliStack::GetNtrack() const
 { return fNtrack; }
 
index 70836eb3736cc83735693ab891e634de702b633e..731546bde9e7eaf2388d060fe4e23a2807516ae3 100644 (file)
@@ -7,8 +7,9 @@
 // AliRun with this g4Config.C
 //
 // aliroot
-// root [0] gAlice->Init("g4Config.C");               
-// root [1] gAlice->Run();     
+// root [0] AliSimulation sim("$ALICE_ROOT/macros/g4Config.C");               
+// root [1] .... customize your simulation setting here               
+// root [1] sim.Run(10);
 //
 // You can also start from a mini GUI - g4menu.C.
 // See description in this macro.
@@ -22,8 +23,8 @@ void Config()
 
   // AliRoot setup
   //
-  gROOT->LoadMacro("$ALICE_ROOT/macros/g4ConfigCommon.C");
-  ConfigCommon();
+  gROOT->LoadMacro("$ALICE_ROOT/macros/g4ConfigCommon1.C");
+  ConfigCommon1();
 
   // Load Geant4 + Geant4 VMC libraries
   //
@@ -38,75 +39,62 @@ void Config()
   // Create Geant4 VMC
   //  
   TGeant4 *geant4 = 0;
-  if (!gMC) {
+  if ( ! gMC ) {
     TG4RunConfiguration* runConfiguration 
       = new TG4RunConfiguration("geomRoot", 
-                                "emStandard+optical", 
-                                "specialCuts+specialControls+stackPopper",
+                                "QGSP_BERT_EMV+optical", 
+                                "specialCuts+stackPopper+stepLimiter",
                                  true);
 //      = new TG4RunConfiguration("geomRootToGeant4",
 //                                "emStandard+optical", 
-//                                "specialCuts+specialControls+stackPopper",
+//                                "specialCuts+specialControls+stackPopper+stepLimiter",
 //                                 true);
       
 
     geant4 = new TGeant4("TGeant4", "The Geant4 Monte Carlo", runConfiguration);
     cout << "Geant4 has been created." << endl;
-  } else {
+  } 
+  else {
     cout << "Monte Carlo has been already created." << endl;
   }  
-    
-  //
-  // Set External decayer
-  TVirtualMCDecayer *decayer = new AliDecayerPythia();
-
-  decayer->SetForceDecay(kAll);
-  decayer->Init();
-  gMC->SetExternalDecayer(decayer);
-  
-  //=======================================================================
-  // ************* STEERING parameters FOR ALICE SIMULATION **************
-  // --- Specify event type to be tracked through the ALICE setup
-  // --- All positions are in cm, angles in degrees, and P and E in GeV
 
-  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);
+  // Customization of Geant4 VMC
+  //
 
-  Float_t cut = 1.e-3;        // 1MeV cut by default
-  Float_t tofmax = 1.e10;
+  geant4->ProcessGeantCommand("/mcPhysics/rangeCuts 0.01 mm"); 
+  geant4->ProcessGeantCommand("/mcVerbose/all 1");  
 
-  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); 
+  // 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");  
 
-  // Set apply cuts 
-  geant4->ProcessGeantCommand("/run/particle/applyCuts");  
-  // geant4->ProcessGeantCommand("/mcVerbose/geometryManager 2");  
-  geant4->ProcessGeantCommand("/mcVerbose/composedPhysicsList 2");  
-  geant4->ProcessGeantCommand("/mcDet/volNameSeparator !");
-  geant4->ProcessGeantCommand("/mcControl/g3Defaults");
-  geant4->ProcessGeantCommand("/mcPhysics/setStackPopperSelection e+ e- pi+ pi- kaon+ kaon- gamma");
-  // geant4->ProcessGeantCommand("/tracking/verbose 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"); 
+    
+  // AliRoot event generator
+  // (it has to be created after MC, as it may use decayer via VMC)
+  //
+  gROOT->LoadMacro("$ALICE_ROOT/macros/g4ConfigCommon2.C");
+  ConfigCommon2();
 
   cout << "Running g4Config.C finished ... " << endl;
 }
diff --git a/macros/g4ConfigCommon1.C b/macros/g4ConfigCommon1.C
new file mode 100644 (file)
index 0000000..ea0df78
--- /dev/null
@@ -0,0 +1,284 @@
+// $Id: g4ConfigCommon.C 30849 2009-02-01 11:42:22Z fca $
+//
+// AliRoot Configuration for running aliroot with Monte Carlo.
+// ConfigCommon1() includes the common setting for all MCs
+// which has to be called before MC is instantiated.
+// Called from g4Config.C
+//
+// By I. Hrivnacova, IPN Orsay
+
+// Options 
+static AliMagF::BMap_t smag = AliMagF::k5kG;
+static TString comment;
+
+// Functions
+void  LoadPythia();
+
+void ConfigCommon1(Bool_t setRootGeometry = kTRUE)
+{
+  cout << "Running ConfigCommon1.C ... " << endl;
+
+  //=======================================================================
+  // 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("Pb-Pb");
+  cout<<"Trigger configuration is set to  Pb-Pb"<<endl;
+
+  // ============================= 
+  // Magnetic field
+  // ============================= 
+
+  // Field (L3 0.4 T)
+  if (smag == AliMagF::k2kG) {
+      comment = comment.Append(" | L3 field 0.2 T");
+  } 
+  else if (smag == AliMagF::k5kG) {
+      comment = comment.Append(" | L3 field 0.5 T");
+  }
+  // OK
+  AliMagF* field = new AliMagF("Maps","Maps", 2, -1., -1., 10., smag);
+  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 ConfigCommon1.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/macros/g4ConfigCommon2.C b/macros/g4ConfigCommon2.C
new file mode 100644 (file)
index 0000000..c281ff8
--- /dev/null
@@ -0,0 +1,135 @@
+// $Id: g4ConfigCommon.C 30849 2009-02-01 11:42:22Z fca $
+//
+// 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 g4Config.C
+//
+// By I. Hrivnacova, IPN Orsay
+
+// Functions
+Float_t EtaToTheta(Float_t arg);
+AliGenerator* GeneratorFactory();
+
+void ConfigCommon2()
+{
+  cout << "Running ConfigCommon2.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
+  //=======================================================================
+
+  // 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__);
+
+  int nParticles = 100;
+  if (gSystem->Getenv("CONFIG_NPARTICLES")) {
+    nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES"));
+  }
+
+  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
+
+  AliGenHIJINGpara *hijingparam = new AliGenHIJINGpara(nParticles);
+  hijingparam->SetMomentumRange(0.2, 999);
+  gener->AddGenerator(hijingparam,"HIJING PARAM",1);
+  gener->Init();
+
+  // Activate this line if you want the vertex smearing to happen
+  // track by track
+  //
+  //gener->SetVertexSmear(perTrack); 
+
+/*
+  // 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 ConfigCommon2.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; 
+}
+
index 79505274350199a40ee7c4ff65fcf1cd0c3188a2..e3830a8cc7e3531fffc4dfce10b2c5ffe03a26a8 100644 (file)
@@ -27,8 +27,8 @@ void Config()
   
   // AliRoot setup
   //
-  gROOT->LoadMacro("$ALICE_ROOT/macros/g4ConfigCommon.C");
-  ConfigCommon(kFALSE);
+  gROOT->LoadMacro("$ALICE_ROOT/macros/g4ConfigCommon1.C");
+  ConfigCommon1(kFALSE);
 
   cout << "Running g4ConfigGometry.C finished ... " << endl;
 
index b7e27a4d651a193fdc317f776eb89f61e5701ecf..5e55d13b89d63d813c8fcf03841886c8fd1df581 100644 (file)
@@ -30,12 +30,20 @@ void g4menu()
     gROOT->LoadMacro("$ALICE/geant4_vmc/examples/macro/g4libs.C");
   gInterpreter->ProcessLine("g4libs()");
 
+  // Load ALICE Geant4 library
+  //cout << "Loading g4alice library ..." << endl;
+  //gSystem->Load("libg4alice");
+
   // Menu
   TControlBar* menu = new TControlBar("vertical","Alice Geant4 menu");
   
   menu->AddButton("Geometry", "MakeGeometry()",  "Generate Root geometry file");
-  menu->AddButton("Run",      "RunSimulation()",  "Process Alice run");
-  menu->AddButton("Init",     "Init()",  "Initialize Alice for simulation");
+  menu->AddButton("Run G4",   "RunG4Simulation()",  "Process Alice run");
+  menu->AddButton("Run G4 batch",   "RunG4Simulation(); >& g4.out",  "Process Alice run");
+  menu->AddButton("Run G3",   "RunG3Simulation()",  "Process Alice run");
+  menu->AddButton("Run G3 batch",   "RunG3Simulation(); >& g3.out",  "Process Alice run");
+  menu->AddButton("Init",     "Init();",  "Initialize Alice for G4 simulation");
+  menu->AddButton("Init batch","Init(); >& g4init.out",  "Initialize Alice for G4 simulation");
   menu->AddButton("Geant4UI", "StartGeant4UI()","Go to Geant4 Interactive session");
   menu->AddButton("AGDD",     "GenerateAGDD()","Generate XML (AGDD) file with geometry description");
   //menu->AddButton("GDML",     "GenerateGDML()","Generate XML (GDML) file with geometry description");
@@ -98,19 +106,41 @@ void Init()
   gInterpreter->ProcessLine(gAlice->GetConfigFunction());
   gAlice->GetMCApp()->Init();
 
+  ((TGeant4*)gMC)->ProcessGeantCommand("/mcDet/printMedia");
+
   cout << endl
        << "Only MonteCarlo initialization has been performed. " << endl
        << "To run simulation you have to re-run aliroot and choose Run in g4menu." << endl;
 }    
 
 
-void RunSimulation()
+void RunG4Simulation()
 {  
   AliSimulation sim("$ALICE_ROOT/macros/g4Config.C");
+  sim.SetMakeSDigits("");
   sim.SetMakeDigits("");
+  //sim.SetMakeDigitsFromHits("ITS TPC");
+  //sim.SetMakeDigitsFromHits("ITS");
+  sim.SetMakeDigitsFromHits("");
+  sim.SetRunHLT("");
+  sim.SetNumberOfEvents(1000);
+  TStopwatch timer;
+  timer.Start();
+  sim.Run(1);
+  timer.Stop();
+  timer.Print();
+}    
+
+void RunG3Simulation()
+{  
+  AliSimulation sim("$ALICE_ROOT/macros/g3Config.C");
   sim.SetMakeSDigits("");
+  sim.SetMakeDigits("");
+  //sim.SetMakeDigitsFromHits("ITS TPC");
+  //sim.SetMakeDigitsFromHits("ITS");
+  sim.SetMakeDigitsFromHits("");
   sim.SetRunHLT("");
-  sim.SetNumberOfEvents(1);
+  sim.SetNumberOfEvents(1000);
   TStopwatch timer;
   timer.Start();
   sim.Run(1);