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