]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - macros/g4Config.C
Updated version of the Geant4 configuration (Andrei)
[u/mrichter/AliRoot.git] / macros / g4Config.C
index fa3662fb9fdd6598e2435df08fe8a5967cb26034..d69b24c73a8f70b2be793ddb7f7faf2647943491 100644 (file)
 
 void Config()
 {
-  // ============================= 
-  // Geant4
-  // ============================= 
+  // AliRoot setup
+  //
+  gROOT->LoadMacro("g4ConfigCommon.C");
+  ConfigCommon();
 
   // Load Geant4 + Geant4 VMC libraries
   //
@@ -27,35 +28,83 @@ void Config()
     if (!gInterpreter->IsLoaded("$ALICE/geant4_vmc/examples/macro/g4libs.C")) {
       gROOT->LoadMacro("$ALICE/geant4_vmc/examples/macro/g4libs.C");
       gInterpreter->ProcessLine("g4libs()");
+      // Load G4root library (for G4 navigation with TGeo)
+      gSystem->Load("libG4root");
     }
   }    
 
   // Create Geant4 VMC
   //  
+  TGeant4 *geant4 = 0;
   if (!gMC) {
-
     TG4RunConfiguration* runConfiguration 
-      = new TG4RunConfiguration(true);
-        
-    TGeant4* geant4
-       = new TGeant4("TGeant4", "The Geant4 Monte Carlo", runConfiguration);
+      = new TG4RunConfiguration("geomVMCtoRoot", true);
+//      = new TG4RunConfiguration("geomRootToGeant4");
+      
+    // Switch on hadron & optical physics, + special cuts
+    // Switch on optical physics (not activated by default)
+    TG4PhysicsListOptions options;
+    options.SetStackPopperPhysics(true);
+    options.SetHadronPhysics(true);
+    options.SetOpticalPhysics(true);
+    options.SetSpecialCutsPhysics(true);
+    options.SetSpecialControlsPhysics(true);
+    runConfiguration->SetPhysicsListOptions(options);
 
+    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;
+  }  
     
-  // Switch on hadron physics
-  geant4->ProcessGeantCommand("/mcPhysics/setHadron true");  
+  //
+  // Set External decayer
+  TVirtualMCDecayer *decayer = new AliDecayerPythia();
 
-  // Switch on special cuts process
-  geant4->ProcessGeantCommand("/mcPhysics/setSpecialCuts true");  
-  geant4->ProcessGeantCommand("/run/particle/applyCuts");  
+  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
 
-  // ============================= 
-  // AliRoot setup
-  // ============================= 
+  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);
 
-  gROOT->LoadMacro("g4ConfigCommon.C");
-  ConfigCommon(false);
+  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); 
+
+  // Set apply cuts 
+  geant4->ProcessGeantCommand("/run/particle/applyCuts");  
+  geant4->ProcessGeantCommand("/mcVerbose/geometryManager 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");  
 }