]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - macros/g4Config.C
Small corrections to the TENDER code, which will support AliTenderInputHander(current...
[u/mrichter/AliRoot.git] / macros / g4Config.C
index d69b24c73a8f70b2be793ddb7f7faf2647943491..731546bde9e7eaf2388d060fe4e23a2807516ae3 100644 (file)
@@ -7,19 +7,24 @@
 // 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.
+//
+// By I. Hrivnacova, IPN Orsay
        
 
 void Config()
 {
+  cout << "Running g4Config.C ... " << endl;
+
   // AliRoot setup
   //
-  gROOT->LoadMacro("g4ConfigCommon.C");
-  ConfigCommon();
+  gROOT->LoadMacro("$ALICE_ROOT/macros/g4ConfigCommon1.C");
+  ConfigCommon1();
 
   // Load Geant4 + Geant4 VMC libraries
   //
@@ -28,83 +33,68 @@ 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) {
+  if ( ! gMC ) {
     TG4RunConfiguration* runConfiguration 
-      = new TG4RunConfiguration("geomVMCtoRoot", true);
-//      = new TG4RunConfiguration("geomRootToGeant4");
+      = new TG4RunConfiguration("geomRoot", 
+                                "QGSP_BERT_EMV+optical", 
+                                "specialCuts+stackPopper+stepLimiter",
+                                 true);
+//      = new TG4RunConfiguration("geomRootToGeant4",
+//                                "emStandard+optical", 
+//                                "specialCuts+specialControls+stackPopper+stepLimiter",
+//                                 true);
       
-    // 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;
   }  
-    
-  //
-  // 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
+  // Customization of Geant4 VMC
+  //
 
-  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);
+  geant4->ProcessGeantCommand("/mcPhysics/rangeCuts 0.01 mm"); 
+  geant4->ProcessGeantCommand("/mcVerbose/all 1");  
 
-  Float_t cut = 1.e-3;        // 1MeV cut by default
-  Float_t tofmax = 1.e10;
+  // 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");  
 
-  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); 
+  // 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();
 
-  // 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");  
+  cout << "Running g4Config.C finished ... " << endl;
 }