g4Config.C 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // Configuration macro for Geant4 VirtualMC
  2. void Config()
  3. {
  4. /// Create the run configuration
  5. /// In constructor user has to specify the geometry input
  6. /// and select geometry navigation via the following options:
  7. /// - geomVMCtoGeant4 - geometry defined via VMC, G4 native navigation
  8. /// - geomVMCtoRoot - geometry defined via VMC, Root navigation
  9. /// - geomRoot - geometry defined via Root, Root navigation
  10. /// - geomRootToGeant4 - geometry defined via Root, G4 native navigation
  11. /// - geomGeant4 - geometry defined via Geant4, G4 native navigation
  12. ///
  13. /// The second argument in the constructor selects physics list:
  14. /// - emStandard - standard em physics (default)
  15. /// - emStandard+optical - standard em physics + optical physics
  16. /// - XYZ - selected hadron physics list ( XYZ = LHEP, QGSP, ...)
  17. /// - XYZ+optical - selected hadron physics list + optical physics
  18. ///
  19. /// The third argument activates the special processes in the TG4SpecialPhysicsList,
  20. /// which implement VMC features:
  21. /// - stepLimiter - step limiter (default)
  22. /// - specialCuts - VMC cuts
  23. /// - specialControls - VMC controls for activation/inactivation selected processes
  24. /// - stackPopper - stackPopper process
  25. /// When more than one options are selected, they should be separated with '+'
  26. /// character: eg. stepLimit+specialCuts.
  27. //TG4RunConfiguration* runConfiguration
  28. //= new TG4RunConfiguration("geomRoot", "FTFP_BERT", "stepLimiter+specialCuts");
  29. TG4RunConfiguration* runConfiguration
  30. = new TG4RunConfiguration("geomRoot", "FTFP_BERT+optical");
  31. /// Create the G4 VMC
  32. TGeant4* geant4 = new TGeant4("TGeant4", "The Geant4 Monte Carlo", runConfiguration);
  33. cout << "Geant4 has been created." << endl;
  34. /// create Fair Specific stack
  35. MpdStack *stack = new MpdStack(1000);
  36. stack->StoreSecondaries(kTRUE);
  37. // stack->SetMinPoints(0);
  38. geant4->SetStack(stack);
  39. //AZ if(FairRunSim::Instance()->IsExtDecayer()){
  40. if(FairRunSim::Instance()->IsExtDecayer() && !geant4->GetDecayer()){ //AZ
  41. TVirtualMCDecayer* decayer = TPythia6Decayer::Instance();
  42. geant4->SetExternalDecayer(decayer);
  43. }
  44. /// Customise Geant4 setting
  45. /// (verbose level, global range cut, ..)
  46. TString configm(gSystem->Getenv("VMCWORKDIR"));
  47. TString configm1 = configm + "/gconfig/g4config.in";
  48. cout << " -I g4Config() using g4conf macro: " << configm1 << endl;
  49. // set the common cuts
  50. TString cuts = configm + "/gconfig/SetCuts.C";
  51. cout << "Physics cuts with script \n "<< cuts.Data() << endl;
  52. Int_t cut=gROOT->LoadMacro(cuts.Data());
  53. if(cut==0)gInterpreter->ProcessLine("SetCuts()");
  54. //set geant4 specific stuff
  55. geant4->SetMaxNStep(10000); // default is 30000
  56. geant4->ProcessGeantMacro(configm1.Data());
  57. // Activate the parameters defined in tracking media
  58. // (DEEMAX, STMIN, STEMAX), which are, be default, ignored.
  59. // In Geant4 case, only STEMAX is taken into account.
  60. geant4->SetUserParameters(kTRUE);
  61. }