CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ParametrisedEMPhysics.cc
Go to the documentation of this file.
1 //
2 // Joanna Weng 08.2005
3 // Physics process for Gflash parameterisation
4 // modified by Soon Yung Jun, Dongwook Jang
5 // V.Ivanchenko rename the class, cleanup, and move
6 // to SimG4Core/Application - 2012/08/14
7 
11 
12 #include "G4FastSimulationManagerProcess.hh"
13 #include "G4ProcessManager.hh"
14 
15 #include "G4LeptonConstructor.hh"
16 #include "G4MesonConstructor.hh"
17 #include "G4BaryonConstructor.hh"
18 #include "G4ShortLivedConstructor.hh"
19 #include "G4IonConstructor.hh"
20 #include "G4RegionStore.hh"
21 
22 #include "G4EmProcessOptions.hh"
23 
25  : G4VPhysicsConstructor(name), theParSet(p)
26 {
27  theEMShowerModel = 0;
29 }
30 
32  delete theEMShowerModel;
33  delete theHadShowerModel;
34 }
35 
37 {
38  G4LeptonConstructor pLeptonConstructor;
39  pLeptonConstructor.ConstructParticle();
40 
41  G4MesonConstructor pMesonConstructor;
42  pMesonConstructor.ConstructParticle();
43 
44  G4BaryonConstructor pBaryonConstructor;
45  pBaryonConstructor.ConstructParticle();
46 
47  G4ShortLivedConstructor pShortLivedConstructor;
48  pShortLivedConstructor.ConstructParticle();
49 
50  G4IonConstructor pConstructor;
51  pConstructor.ConstructParticle();
52 }
53 
55 
56  // GFlash part
57  bool gem = theParSet.getParameter<bool>("GflashEcal");
58  bool ghad = theParSet.getParameter<bool>("GflashHcal");
59 
60  if(gem || ghad) {
61  edm::LogInfo("SimG4CoreApplication")
62  << "ParametrisedEMPhysics: GFlash Construct: "
63  << gem << " " << ghad;
64  G4FastSimulationManagerProcess * theFastSimulationManagerProcess =
65  new G4FastSimulationManagerProcess();
66  theParticleIterator->reset();
67  while ((*theParticleIterator)()) {
68  G4ParticleDefinition * particle = theParticleIterator->value();
69  G4ProcessManager * pmanager = particle->GetProcessManager();
70  G4String pname = particle->GetParticleName();
71  if(pname == "e-" || pname == "e+") {
72  pmanager->AddProcess(theFastSimulationManagerProcess, -1, -1, 1);
73  }
74  }
75 
76  if(gem) {
77  G4Region* aRegion = G4RegionStore::GetInstance()->GetRegion("EcalRegion");
78 
79  if(!aRegion){
80  edm::LogInfo("SimG4CoreApplication")
81  << "ParametrisedEMPhysics::ConstructProcess: "
82  << "EcalRegion is not defined, GFlash will not be enabled for ECAL!";
83 
84  } else {
85 
86  //Electromagnetic Shower Model for ECAL
88  new GFlashEMShowerModel("GflashEMShowerModel",aRegion,theParSet);
89  //std::cout << "GFlash is defined for EcalRegion" << std::endl;
90  }
91  }
92  if(ghad) {
93  G4Region* aRegion = G4RegionStore::GetInstance()->GetRegion("HcalRegion");
94  if(!aRegion) {
95  edm::LogInfo("SimG4CoreApplication")
96  << "ParametrisedEMPhysics::ConstructProcess: "
97  << "HcalRegion is not defined, GFlash will not be enabled for HCAL!";
98 
99  } else {
100 
101  //Electromagnetic Shower Model for HCAL
103  new GFlashEMShowerModel("GflashHadShowerModel",aRegion,theParSet);
104  //std::cout << "GFlash is defined for HcalRegion" << std::endl;
105  }
106  }
107  }
108  // Russian Roulette part
109  G4EmProcessOptions opt;
110  const G4String rname[8] = {"EcalRegion", "HcalRegion", "QuadRegion", "MuonIron",
111  "PreshowerRegion","CastorRegion","BeamPipeOutsideRegion",
112  "DefaultRegionForTheWorld"};
113  G4double rrfact[8] = { 1.0 };
114 
115  // Russian roulette for gamma
116  G4double energyLim = theParSet.getParameter<double>("RusRoGammaEnergyLimit")*MeV;
117  if(energyLim > 0.0) {
118  rrfact[0] = theParSet.getParameter<double>("RusRoEcalGamma");
119  rrfact[1] = theParSet.getParameter<double>("RusRoHcalGamma");
120  rrfact[2] = theParSet.getParameter<double>("RusRoQuadGamma");
121  rrfact[3] = theParSet.getParameter<double>("RusRoMuonIronGamma");
122  rrfact[4] = theParSet.getParameter<double>("RusRoPreShowerGamma");
123  rrfact[5] = theParSet.getParameter<double>("RusRoCastorGamma");
124  rrfact[6] = theParSet.getParameter<double>("RusRoBeamPipeOutGamma");
125  rrfact[7] = theParSet.getParameter<double>("RusRoWorldGamma");
126  for(int i=0; i<8; ++i) {
127  if(rrfact[i] < 1.0) {
128  opt.ActivateSecondaryBiasing("eBrem",rname[i],rrfact[i],energyLim);
129  edm::LogInfo("SimG4CoreApplication")
130  << "ParametrisedEMPhysics: Russian Roulette"
131  << " for gamma Prob= " << rrfact[i]
132  << " Elimit(MeV)= " << energyLim/CLHEP::MeV
133  << " inside " << rname[i];
134  }
135  }
136  }
137  // Russian roulette for e-
138  energyLim = theParSet.getParameter<double>("RusRoElectronEnergyLimit")*MeV;
139  if(energyLim > 0.0) {
140  rrfact[0] = theParSet.getParameter<double>("RusRoEcalElectron");
141  rrfact[1] = theParSet.getParameter<double>("RusRoHcalElectron");
142  rrfact[2] = theParSet.getParameter<double>("RusRoQuadElectron");
143  rrfact[3] = theParSet.getParameter<double>("RusRoMuonIronElectron");
144  rrfact[4] = theParSet.getParameter<double>("RusRoPreShowerElectron");
145  rrfact[5] = theParSet.getParameter<double>("RusRoCastorElectron");
146  rrfact[6] = theParSet.getParameter<double>("RusRoBeamPipeOutElectron");
147  rrfact[7] = theParSet.getParameter<double>("RusRoWorldElectron");
148  for(int i=0; i<8; ++i) {
149  if(rrfact[i] < 1.0) {
150  opt.ActivateSecondaryBiasing("eIoni",rname[i],rrfact[i],energyLim);
151  opt.ActivateSecondaryBiasing("hIoni",rname[i],rrfact[i],energyLim);
152  opt.ActivateSecondaryBiasing("muIoni",rname[i],rrfact[i],energyLim);
153  opt.ActivateSecondaryBiasing("ionIoni",rname[i],rrfact[i],energyLim);
154  opt.ActivateSecondaryBiasingForGamma("phot",rname[i],rrfact[i],energyLim);
155  opt.ActivateSecondaryBiasingForGamma("compt",rname[i],rrfact[i],energyLim);
156  opt.ActivateSecondaryBiasingForGamma("conv",rname[i],rrfact[i],energyLim);
157  edm::LogInfo("SimG4CoreApplication")
158  << "ParametrisedEMPhysics: Russian Roulette"
159  << " for e- Prob= " << rrfact[i]
160  << " Elimit(MeV)= " << energyLim/CLHEP::MeV
161  << " inside " << rname[i];
162  }
163  }
164  }
165 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
edm::ParameterSet theParSet
GFlashEMShowerModel * theHadShowerModel
ParametrisedEMPhysics(std::string name, const edm::ParameterSet &p)
GFlashEMShowerModel * theEMShowerModel