CMS 3D CMS Logo

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 
13 
14 #include "G4FastSimulationManagerProcess.hh"
15 #include "G4ProcessManager.hh"
16 
17 #include "G4LeptonConstructor.hh"
18 #include "G4MesonConstructor.hh"
19 #include "G4BaryonConstructor.hh"
20 #include "G4ShortLivedConstructor.hh"
21 #include "G4IonConstructor.hh"
22 #include "G4RegionStore.hh"
23 #include "G4Electron.hh"
24 #include "G4Positron.hh"
25 #include "G4MuonMinus.hh"
26 #include "G4MuonPlus.hh"
27 #include "G4PionMinus.hh"
28 #include "G4PionPlus.hh"
29 #include "G4KaonMinus.hh"
30 #include "G4KaonPlus.hh"
31 #include "G4Proton.hh"
32 #include "G4AntiProton.hh"
33 
34 #include "G4EmParameters.hh"
35 #include "G4EmProcessOptions.hh"
36 #include "G4PhysicsListHelper.hh"
37 #include "G4SystemOfUnits.hh"
38 #include "G4UAtomicDeexcitation.hh"
39 #include "G4LossTableManager.hh"
40 
42  const edm::ParameterSet & p)
43  : G4VPhysicsConstructor(name), theParSet(p)
44 {
45  theEcalEMShowerModel = nullptr;
46  theEcalHadShowerModel = nullptr;
47  theHcalEMShowerModel = nullptr;
48  theHcalHadShowerModel = nullptr;
49 
50  // bremsstrahlung threshold and EM verbosity
51  G4EmParameters* param = G4EmParameters::Instance();
52  G4int verb = theParSet.getUntrackedParameter<int>("Verbosity",0);
53  param->SetVerbose(verb);
54 
55  G4double bremth = theParSet.getParameter<double>("G4BremsstrahlungThreshold")*GeV;
56  param->SetBremsstrahlungTh(bremth);
57 
58  bool fluo = theParSet.getParameter<bool>("FlagFluo");
59  param->SetFluo(fluo);
60 
61  edm::LogInfo("SimG4CoreApplication")
62  << "ParametrisedEMPhysics::ConstructProcess: bremsstrahlung threshold Eth= "
63  << bremth/GeV << " GeV"
64  << "\n verbosity= " << verb
65  << " fluoFlag: " << fluo;
66 }
67 
69  delete theEcalEMShowerModel;
70  delete theEcalHadShowerModel;
71  delete theHcalEMShowerModel;
72  delete theHcalHadShowerModel;
73 }
74 
76 {
77  G4LeptonConstructor pLeptonConstructor;
78  pLeptonConstructor.ConstructParticle();
79 
80  G4MesonConstructor pMesonConstructor;
81  pMesonConstructor.ConstructParticle();
82 
83  G4BaryonConstructor pBaryonConstructor;
84  pBaryonConstructor.ConstructParticle();
85 
86  G4ShortLivedConstructor pShortLivedConstructor;
87  pShortLivedConstructor.ConstructParticle();
88 
89  G4IonConstructor pConstructor;
90  pConstructor.ConstructParticle();
91 }
92 
94 
95  // GFlash part
96  bool gem = theParSet.getParameter<bool>("GflashEcal");
97  bool ghad = theParSet.getParameter<bool>("GflashHcal");
98  bool gemHad = theParSet.getParameter<bool>("GflashEcalHad");
99  bool ghadHad = theParSet.getParameter<bool>("GflashHcalHad");
100 
101  G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
102  if(gem || ghad || gemHad || ghadHad) {
103  edm::LogInfo("SimG4CoreApplication")
104  << "ParametrisedEMPhysics: GFlash Construct for e+-: "
105  << gem << " " << ghad << " for hadrons: " << gemHad << " " << ghadHad;
106 
107  G4FastSimulationManagerProcess * theFastSimulationManagerProcess =
108  new G4FastSimulationManagerProcess();
109 
110  if(gem || ghad) {
111  ph->RegisterProcess(theFastSimulationManagerProcess, G4Electron::Electron());
112  ph->RegisterProcess(theFastSimulationManagerProcess, G4Positron::Positron());
113  }
114  if(gemHad || ghadHad) {
115  ph->RegisterProcess(theFastSimulationManagerProcess, G4Proton::Proton());
116  ph->RegisterProcess(theFastSimulationManagerProcess, G4AntiProton::AntiProton());
117  ph->RegisterProcess(theFastSimulationManagerProcess, G4PionPlus::PionPlus());
118  ph->RegisterProcess(theFastSimulationManagerProcess, G4PionMinus::PionMinus());
119  ph->RegisterProcess(theFastSimulationManagerProcess, G4KaonPlus::KaonPlus());
120  ph->RegisterProcess(theFastSimulationManagerProcess, G4KaonMinus::KaonMinus());
121  }
122 
123  if(gem || gemHad) {
124  G4Region* aRegion =
125  G4RegionStore::GetInstance()->GetRegion("EcalRegion");
126 
127  if(!aRegion){
128  edm::LogInfo("SimG4CoreApplication")
129  << "ParametrisedEMPhysics::ConstructProcess: "
130  << "EcalRegion is not defined, GFlash will not be enabled for ECAL!";
131 
132  } else {
133  if(gem) {
134 
135  //Electromagnetic Shower Model for ECAL
137  new GFlashEMShowerModel("GflashEcalEMShowerModel",aRegion,theParSet);
138  //std::cout << "GFlash is defined for EcalRegion" << std::endl;
139  }
140  if(gemHad) {
141 
142  //Electromagnetic Shower Model for ECAL
144  new GFlashHadronShowerModel("GflashEcalHadShowerModel",aRegion,theParSet);
145  //std::cout << "GFlash is defined for EcalRegion" << std::endl;
146  }
147  }
148  }
149  if(ghad || ghadHad) {
150  G4Region* aRegion =
151  G4RegionStore::GetInstance()->GetRegion("HcalRegion");
152  if(!aRegion) {
153  edm::LogInfo("SimG4CoreApplication")
154  << "ParametrisedEMPhysics::ConstructProcess: "
155  << "HcalRegion is not defined, GFlash will not be enabled for HCAL!";
156 
157  } else {
158  if(ghad) {
159 
160  //Electromagnetic Shower Model for HCAL
162  new GFlashEMShowerModel("GflashHcalEMShowerModel",aRegion,theParSet);
163  //std::cout << "GFlash is defined for HcalRegion" << std::endl;
164  }
165  if(ghadHad) {
166 
167  //Electromagnetic Shower Model for ECAL
169  new GFlashHadronShowerModel("GflashHcalHadShowerModel",aRegion,theParSet);
170  //std::cout << "GFlash is defined for EcalRegion" << std::endl;
171  }
172  }
173  }
174  }
175  // Russian roulette and tracking cut for e+-
176  const G4int NREG = 6;
177  const G4String rname[NREG] = {"EcalRegion", "HcalRegion", "MuonIron",
178  "PreshowerRegion","CastorRegion",
179  "DefaultRegionForTheWorld"};
180  G4double rrfact[NREG] = { 1.0 };
181 
182  double energyLim =
183  theParSet.getParameter<double>("RusRoElectronEnergyLimit")*MeV;
184  if(energyLim > 0.0) {
185  G4EmProcessOptions opt;
186  rrfact[0] = theParSet.getParameter<double>("RusRoEcalElectron");
187  rrfact[1] = theParSet.getParameter<double>("RusRoHcalElectron");
188  rrfact[2] = theParSet.getParameter<double>("RusRoMuonIronElectron");
189  rrfact[3] = theParSet.getParameter<double>("RusRoPreShowerElectron");
190  rrfact[4] = theParSet.getParameter<double>("RusRoCastorElectron");
191  rrfact[5] = theParSet.getParameter<double>("RusRoWorldElectron");
192  for(int i=0; i<NREG; ++i) {
193  if(rrfact[i] < 1.0) {
194  opt.ActivateSecondaryBiasing("eIoni",rname[i],rrfact[i],energyLim);
195  opt.ActivateSecondaryBiasing("hIoni",rname[i],rrfact[i],energyLim);
196  edm::LogInfo("SimG4CoreApplication")
197  << "ParametrisedEMPhysics: Russian Roulette"
198  << " for e- Prob= " << rrfact[i]
199  << " Elimit(MeV)= " << energyLim/CLHEP::MeV
200  << " inside " << rname[i];
201  }
202  }
203  }
204 
205  // Step limiters for e+-
206  bool eLimiter = theParSet.getParameter<bool>("ElectronStepLimit");
207  bool rLimiter = theParSet.getParameter<bool>("ElectronRangeTest");
208  bool pLimiter = theParSet.getParameter<bool>("PositronStepLimit");
209 
210  if(eLimiter || rLimiter) {
214  ph->RegisterProcess(theElectronLimiter, G4Electron::Electron());
215  }
216 
217  if(pLimiter){
220  ph->RegisterProcess(theElectronLimiter, G4Positron::Positron());
221  }
222  // enable fluorescence
223  bool fluo = theParSet.getParameter<bool>("FlagFluo");
224  if(fluo) {
225  G4VAtomDeexcitation* de = new G4UAtomicDeexcitation();
226  G4LossTableManager::Instance()->SetAtomDeexcitation(de);
227  de->SetFluo(true);
228  }
229 }
ElectronLimiter * theElectronLimiter
void ConstructParticle() override
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const double GeV
Definition: MathUtil.h:16
void SetRangeCheckFlag(G4bool)
edm::ParameterSet theParSet
ElectronLimiter * thePositronLimiter
GFlashHadronShowerModel * theEcalHadShowerModel
const double MeV
void SetFieldCheckFlag(G4bool)
GFlashHadronShowerModel * theHcalHadShowerModel
ParametrisedEMPhysics(std::string name, const edm::ParameterSet &p)
GFlashEMShowerModel * theHcalEMShowerModel
GFlashEMShowerModel * theEcalEMShowerModel
void ConstructProcess() override