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