test
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 
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 "G4MuonNuclearProcess.hh"
35 #include "G4MuonVDNuclearModel.hh"
36 
37 //#include "G4EmParameters.hh"
38 #include "G4EmProcessOptions.hh"
39 #include "G4PhysicsListHelper.hh"
40 #include "G4SystemOfUnits.hh"
41 #include "G4UAtomicDeexcitation.hh"
42 #include "G4LossTableManager.hh"
43 
45  const edm::ParameterSet & p)
46  : G4VPhysicsConstructor(name), theParSet(p)
47 {
48  theEcalEMShowerModel = nullptr;
49  theEcalHadShowerModel = nullptr;
50  theHcalEMShowerModel = nullptr;
51  theHcalHadShowerModel = nullptr;
52 
53  // will be uncommented for Geant4 10.1
54  // bremsstrahlung threshold and EM verbosity
55  /*
56  G4EmParameters* param = G4EmParameters::Instance();
57  G4int verb = theParSet.getUntrackedParameter<int>("Verbosity",0);
58  param->SetVerbose(verb);
59 
60  G4double bremth = theParSet.getParameter<double>("G4BremsstrahlungThreshold")*GeV;
61  param->SetBremsstrahlungTh(bremth);
62 
63  bool fluo = theParSet.getParameter<bool>("FlagFluo");
64  param->SetFluo(fluo);
65 
66  edm::LogInfo("SimG4CoreApplication")
67  << "ParametrisedEMPhysics::ConstructProcess: bremsstrahlung threshold Eth= "
68  << bremth/GeV << " GeV"
69  << "\n verbosity= " << verb
70  << " fluoFlag: " << fluo;
71  */
72 }
73 
75  delete theEcalEMShowerModel;
76  delete theEcalHadShowerModel;
77  delete theHcalEMShowerModel;
78  delete theHcalHadShowerModel;
79 }
80 
82 {
83  G4LeptonConstructor pLeptonConstructor;
84  pLeptonConstructor.ConstructParticle();
85 
86  G4MesonConstructor pMesonConstructor;
87  pMesonConstructor.ConstructParticle();
88 
89  G4BaryonConstructor pBaryonConstructor;
90  pBaryonConstructor.ConstructParticle();
91 
92  G4ShortLivedConstructor pShortLivedConstructor;
93  pShortLivedConstructor.ConstructParticle();
94 
95  G4IonConstructor pConstructor;
96  pConstructor.ConstructParticle();
97 }
98 
100 
101  // GFlash part
102  bool gem = theParSet.getParameter<bool>("GflashEcal");
103  bool ghad = theParSet.getParameter<bool>("GflashHcal");
104  bool gemHad = theParSet.getParameter<bool>("GflashEcalHad");
105  bool ghadHad = theParSet.getParameter<bool>("GflashHcalHad");
106 
107  G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
108  if(gem || ghad || gemHad || ghadHad) {
109  edm::LogInfo("SimG4CoreApplication")
110  << "ParametrisedEMPhysics: GFlash Construct for e+-: "
111  << gem << " " << ghad << " for hadrons: " << gemHad << " " << ghadHad;
112 
113  G4FastSimulationManagerProcess * theFastSimulationManagerProcess =
114  new G4FastSimulationManagerProcess();
115 
116  if(gem || ghad) {
117  ph->RegisterProcess(theFastSimulationManagerProcess, G4Electron::Electron());
118  ph->RegisterProcess(theFastSimulationManagerProcess, G4Positron::Positron());
119  }
120  if(gemHad || ghadHad) {
121  ph->RegisterProcess(theFastSimulationManagerProcess, G4Proton::Proton());
122  ph->RegisterProcess(theFastSimulationManagerProcess, G4AntiProton::AntiProton());
123  ph->RegisterProcess(theFastSimulationManagerProcess, G4PionPlus::PionPlus());
124  ph->RegisterProcess(theFastSimulationManagerProcess, G4PionMinus::PionMinus());
125  ph->RegisterProcess(theFastSimulationManagerProcess, G4KaonPlus::KaonPlus());
126  ph->RegisterProcess(theFastSimulationManagerProcess, G4KaonMinus::KaonMinus());
127  }
128 
129  if(gem || gemHad) {
130  G4Region* aRegion =
131  G4RegionStore::GetInstance()->GetRegion("EcalRegion");
132 
133  if(!aRegion){
134  edm::LogInfo("SimG4CoreApplication")
135  << "ParametrisedEMPhysics::ConstructProcess: "
136  << "EcalRegion is not defined, GFlash will not be enabled for ECAL!";
137 
138  } else {
139  if(gem) {
140 
141  //Electromagnetic Shower Model for ECAL
143  new GFlashEMShowerModel("GflashEcalEMShowerModel",aRegion,theParSet);
144  //std::cout << "GFlash is defined for EcalRegion" << std::endl;
145  }
146  if(gemHad) {
147 
148  //Electromagnetic Shower Model for ECAL
150  new GFlashHadronShowerModel("GflashEcalHadShowerModel",aRegion,theParSet);
151  //std::cout << "GFlash is defined for EcalRegion" << std::endl;
152  }
153  }
154  }
155  if(ghad || ghadHad) {
156  G4Region* aRegion =
157  G4RegionStore::GetInstance()->GetRegion("HcalRegion");
158  if(!aRegion) {
159  edm::LogInfo("SimG4CoreApplication")
160  << "ParametrisedEMPhysics::ConstructProcess: "
161  << "HcalRegion is not defined, GFlash will not be enabled for HCAL!";
162 
163  } else {
164  if(ghad) {
165 
166  //Electromagnetic Shower Model for HCAL
168  new GFlashEMShowerModel("GflashHcalEMShowerModel",aRegion,theParSet);
169  //std::cout << "GFlash is defined for HcalRegion" << std::endl;
170  }
171  if(ghadHad) {
172 
173  //Electromagnetic Shower Model for ECAL
175  new GFlashHadronShowerModel("GflashHcalHadShowerModel",aRegion,theParSet);
176  //std::cout << "GFlash is defined for EcalRegion" << std::endl;
177  }
178  }
179  }
180  }
181  // bremsstrahlung threshold and EM verbosity
182  G4EmProcessOptions opt;
183  G4int verb = theParSet.getUntrackedParameter<int>("Verbosity",0);
184  opt.SetVerbose(verb - 1);
185 
186  G4double bremth = theParSet.getParameter<double>("G4BremsstrahlungThreshold")*GeV;
187  edm::LogInfo("SimG4CoreApplication")
188  << "ParametrisedEMPhysics::ConstructProcess: bremsstrahlung threshold Eth= "
189  << bremth/GeV << " GeV";
190  opt.SetBremsstrahlungTh(bremth);
191 
192  // Russian roulette and tracking cut for e+-
193  const G4int NREG = 6;
194  const G4String rname[NREG] = {"EcalRegion", "HcalRegion", "MuonIron",
195  "PreshowerRegion","CastorRegion",
196  "DefaultRegionForTheWorld"};
197  G4double rrfact[NREG] = { 1.0 };
198 
199  double energyLim =
200  theParSet.getParameter<double>("RusRoElectronEnergyLimit")*MeV;
201  if(energyLim > 0.0) {
202  rrfact[0] = theParSet.getParameter<double>("RusRoEcalElectron");
203  rrfact[1] = theParSet.getParameter<double>("RusRoHcalElectron");
204  rrfact[2] = theParSet.getParameter<double>("RusRoMuonIronElectron");
205  rrfact[3] = theParSet.getParameter<double>("RusRoPreShowerElectron");
206  rrfact[4] = theParSet.getParameter<double>("RusRoCastorElectron");
207  rrfact[5] = theParSet.getParameter<double>("RusRoWorldElectron");
208  for(int i=0; i<NREG; ++i) {
209  if(rrfact[i] < 1.0) {
210  opt.ActivateSecondaryBiasing("eIoni",rname[i],rrfact[i],energyLim);
211  opt.ActivateSecondaryBiasing("hIoni",rname[i],rrfact[i],energyLim);
212  edm::LogInfo("SimG4CoreApplication")
213  << "ParametrisedEMPhysics: Russian Roulette"
214  << " for e- Prob= " << rrfact[i]
215  << " Elimit(MeV)= " << energyLim/CLHEP::MeV
216  << " inside " << rname[i];
217  }
218  }
219  }
220 
221  // Step limiters for e+-
222  bool eLimiter = theParSet.getParameter<bool>("ElectronStepLimit");
223  bool rLimiter = theParSet.getParameter<bool>("ElectronRangeTest");
224  bool pLimiter = theParSet.getParameter<bool>("PositronStepLimit");
225 
226  if(eLimiter || rLimiter) {
230  ph->RegisterProcess(theElectronLimiter, G4Electron::Electron());
231  }
232 
233  if(pLimiter){
236  ph->RegisterProcess(theElectronLimiter, G4Positron::Positron());
237  }
238  // enable fluorescence
239  bool fluo = theParSet.getParameter<bool>("FlagFluo");
240  if(fluo) {
241  G4VAtomDeexcitation* de = new G4UAtomicDeexcitation();
242  G4LossTableManager::Instance()->SetAtomDeexcitation(de);
243  de->SetFluo(true);
244  }
245  // enable muon nuclear (valid option for Geant4 10.0pX only)
246  bool munuc = theParSet.getParameter<bool>("FlagMuNucl");
247  //bool munuc = false;
248  if(munuc) {
249  G4MuonNuclearProcess* muNucProcess = new G4MuonNuclearProcess();
250  muNucProcess->RegisterMe(new G4MuonVDNuclearModel());
251  ph->RegisterProcess(muNucProcess, G4MuonPlus::MuonPlus());
252  ph->RegisterProcess(muNucProcess, G4MuonMinus::MuonMinus());
253  }
254 
255 }
ElectronLimiter * theElectronLimiter
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
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