CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
ParametrisedEMPhysics Class Reference

#include <ParametrisedEMPhysics.h>

Inheritance diagram for ParametrisedEMPhysics:

Classes

struct  TLSmod
 

Public Member Functions

void ConstructParticle () override
 
void ConstructProcess () override
 
 ParametrisedEMPhysics (const std::string &name, const edm::ParameterSet &p)
 
 ~ParametrisedEMPhysics () override
 

Private Member Functions

void ModifyTransportation (const G4ParticleDefinition *, int ntry, double th1, double th2)
 

Private Attributes

edm::ParameterSet theParSet
 

Static Private Attributes

static G4ThreadLocal TLSmodm_tpmod = nullptr
 

Detailed Description

Definition at line 16 of file ParametrisedEMPhysics.h.

Constructor & Destructor Documentation

◆ ParametrisedEMPhysics()

ParametrisedEMPhysics::ParametrisedEMPhysics ( const std::string &  name,
const edm::ParameterSet p 
)

Definition at line 67 of file ParametrisedEMPhysics.cc.

68  : G4VPhysicsConstructor(name), theParSet(p) {
69  // bremsstrahlung threshold and EM verbosity
70  G4EmParameters* param = G4EmParameters::Instance();
71  G4int verb = theParSet.getUntrackedParameter<int>("Verbosity", 0);
72  param->SetVerbose(verb);
73 
74  G4double bremth = theParSet.getParameter<double>("G4BremsstrahlungThreshold") * GeV;
75  param->SetBremsstrahlungTh(bremth);
76 
77  bool fluo = theParSet.getParameter<bool>("FlagFluo");
78  param->SetFluo(fluo);
79 
80  bool modifyT = theParSet.getParameter<bool>("ModifyTransportation");
81  double th1 = theParSet.getUntrackedParameter<double>("ThresholdWarningEnergy") * MeV;
82  double th2 = theParSet.getUntrackedParameter<double>("ThresholdImportantEnergy") * MeV;
83  int nt = theParSet.getUntrackedParameter<int>("ThresholdTrials");
84 
85  edm::LogVerbatim("SimG4CoreApplication")
86  << "ParametrisedEMPhysics::ConstructProcess: bremsstrahlung threshold Eth= " << bremth / GeV << " GeV"
87  << "\n verbosity= " << verb << " fluoFlag: " << fluo
88  << " modifyTransport: " << modifyT << " Ntrials= " << nt
89  << "\n ThWarning(MeV)= " << th1 << " ThException(MeV)= " << th2;
90 
91  // Russian roulette and tracking cut for e+-
92  double energyLim = theParSet.getParameter<double>("RusRoElectronEnergyLimit") * MeV;
93  if (energyLim > 0.0) {
94  G4double rrfact[NREG] = {1.0};
95 
96  rrfact[0] = theParSet.getParameter<double>("RusRoEcalElectron");
97  rrfact[1] = theParSet.getParameter<double>("RusRoHcalElectron");
98  rrfact[2] = theParSet.getParameter<double>("RusRoMuonIronElectron");
99  rrfact[3] = theParSet.getParameter<double>("RusRoPreShowerElectron");
100  rrfact[4] = theParSet.getParameter<double>("RusRoCastorElectron");
101  rrfact[5] = theParSet.getParameter<double>("RusRoWorldElectron");
102  for (int i = 0; i < NREG; ++i) {
103  if (rrfact[i] < 1.0) {
104  param->ActivateSecondaryBiasing("eIoni", rname[i], rrfact[i], energyLim);
105  param->ActivateSecondaryBiasing("hIoni", rname[i], rrfact[i], energyLim);
106  edm::LogVerbatim("SimG4CoreApplication")
107  << "ParametrisedEMPhysics: Russian Roulette"
108  << " for e- Prob= " << rrfact[i] << " Elimit(MeV)= " << energyLim / CLHEP::MeV << " inside " << rname[i];
109  }
110  }
111  }
112 }

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), GeV, mps_fire::i, MeV, NREG, nt, rname, and theParSet.

◆ ~ParametrisedEMPhysics()

ParametrisedEMPhysics::~ParametrisedEMPhysics ( )
override

Definition at line 114 of file ParametrisedEMPhysics.cc.

114  {
115  if (m_tpmod) {
116  delete m_tpmod;
117  m_tpmod = nullptr;
118  }
119 }

References m_tpmod.

Member Function Documentation

◆ ConstructParticle()

void ParametrisedEMPhysics::ConstructParticle ( )
override

Definition at line 121 of file ParametrisedEMPhysics.cc.

121  {
122  G4LeptonConstructor pLeptonConstructor;
123  pLeptonConstructor.ConstructParticle();
124 
125  G4BaryonConstructor pBaryonConstructor;
126  pBaryonConstructor.ConstructParticle();
127 }

◆ ConstructProcess()

void ParametrisedEMPhysics::ConstructProcess ( )
override

Definition at line 129 of file ParametrisedEMPhysics.cc.

129  {
130  edm::LogVerbatim("SimG4CoreApplication") << "ParametrisedEMPhysics::ConstructProcess() started";
131 
132  // GFlash part
133  bool gem = theParSet.getParameter<bool>("GflashEcal");
134  bool lowEnergyGem = theParSet.getParameter<bool>("LowEnergyGflashEcal");
135  bool ghad = theParSet.getParameter<bool>("GflashHcal");
136  bool gemHad = theParSet.getParameter<bool>("GflashEcalHad");
137  bool ghadHad = theParSet.getParameter<bool>("GflashHcalHad");
138 
139  if (gem || ghad || lowEnergyGem || gemHad || ghadHad) {
140  if (!m_tpmod) {
141  m_tpmod = new TLSmod;
142  }
143  edm::LogVerbatim("SimG4CoreApplication")
144  << "ParametrisedEMPhysics: GFlash Construct for e+-: " << gem << " " << ghad << " " << lowEnergyGem
145  << " for hadrons: " << gemHad << " " << ghadHad;
146 
147  m_tpmod->theFastSimulationManagerProcess = std::make_unique<G4FastSimulationManagerProcess>();
148 
149  if (gem || ghad) {
150  G4Electron::Electron()->GetProcessManager()->AddDiscreteProcess(m_tpmod->theFastSimulationManagerProcess.get());
151  G4Positron::Positron()->GetProcessManager()->AddDiscreteProcess(m_tpmod->theFastSimulationManagerProcess.get());
152  } else if (lowEnergyGem) {
153  G4Electron::Electron()->GetProcessManager()->AddDiscreteProcess(m_tpmod->theFastSimulationManagerProcess.get());
154  G4Positron::Positron()->GetProcessManager()->AddDiscreteProcess(m_tpmod->theFastSimulationManagerProcess.get());
155  }
156 
157  if (gemHad || ghadHad) {
158  G4Proton::Proton()->GetProcessManager()->AddDiscreteProcess(m_tpmod->theFastSimulationManagerProcess.get());
159  G4AntiProton::AntiProton()->GetProcessManager()->AddDiscreteProcess(
161  G4PionPlus::PionPlus()->GetProcessManager()->AddDiscreteProcess(m_tpmod->theFastSimulationManagerProcess.get());
162  G4PionMinus::PionMinus()->GetProcessManager()->AddDiscreteProcess(m_tpmod->theFastSimulationManagerProcess.get());
163  G4KaonPlus::KaonPlus()->GetProcessManager()->AddDiscreteProcess(m_tpmod->theFastSimulationManagerProcess.get());
164  G4KaonMinus::KaonMinus()->GetProcessManager()->AddDiscreteProcess(m_tpmod->theFastSimulationManagerProcess.get());
165  }
166 
167  if (gem || gemHad || lowEnergyGem) {
168  G4Region* aRegion = G4RegionStore::GetInstance()->GetRegion("EcalRegion", false);
169 
170  if (!aRegion) {
171  edm::LogWarning("SimG4CoreApplication") << "ParametrisedEMPhysics::ConstructProcess: "
172  << "EcalRegion is not defined, GFlash will not be enabled for ECAL!";
173 
174  } else {
175  if (gem) {
176  //Electromagnetic Shower Model for ECAL
178  std::make_unique<GFlashEMShowerModel>("GflashEcalEMShowerModel", aRegion, theParSet);
179  } else if (lowEnergyGem) {
180  //Low energy electromagnetic Shower Model for ECAL
182  std::make_unique<LowEnergyFastSimModel>("LowEnergyFastSimModel", aRegion, theParSet);
183  }
184 
185  if (gemHad) {
186  //Electromagnetic Shower Model for ECAL
188  std::make_unique<GFlashHadronShowerModel>("GflashEcalHadShowerModel", aRegion, theParSet);
189  }
190  }
191  }
192  if (ghad || ghadHad) {
193  G4Region* aRegion = G4RegionStore::GetInstance()->GetRegion("HcalRegion", false);
194  if (!aRegion) {
195  edm::LogWarning("SimG4CoreApplication") << "ParametrisedEMPhysics::ConstructProcess: "
196  << "HcalRegion is not defined, GFlash will not be enabled for HCAL!";
197 
198  } else {
199  if (ghad) {
200  //Electromagnetic Shower Model for HCAL
202  std::make_unique<GFlashEMShowerModel>("GflashHcalEMShowerModel", aRegion, theParSet);
203  }
204  if (ghadHad) {
205  //Electromagnetic Shower Model for ECAL
207  std::make_unique<GFlashHadronShowerModel>("GflashHcalHadShowerModel", aRegion, theParSet);
208  }
209  }
210  }
211  }
212 
213  G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
214 
215  // Step limiters for e+-
216  bool eLimiter = theParSet.getParameter<bool>("ElectronStepLimit");
217  bool rLimiter = theParSet.getParameter<bool>("ElectronRangeTest");
218  bool pLimiter = theParSet.getParameter<bool>("PositronStepLimit");
219  // Step limiters for hadrons
220  bool pTCut = theParSet.getParameter<bool>("ProtonRegionLimit");
221  bool piTCut = theParSet.getParameter<bool>("PionRegionLimit");
222 
223  std::vector<std::string> regnames = theParSet.getParameter<std::vector<std::string> >("LimitsPerRegion");
224  std::vector<double> limitsE = theParSet.getParameter<std::vector<double> >("EnergyLimitsE");
225  std::vector<double> limitsH = theParSet.getParameter<std::vector<double> >("EnergyLimitsH");
226  std::vector<double> facE = theParSet.getParameter<std::vector<double> >("EnergyFactorsE");
227  std::vector<double> rmsE = theParSet.getParameter<std::vector<double> >("EnergyRMSE");
228  int nlimits = regnames.size();
229  int nlimitsH = 0;
230  std::vector<const G4Region*> reg;
231  std::vector<G4double> rlimE;
232  std::vector<G4double> rlimH;
233  std::vector<G4double> factE;
234  std::vector<G4double> rmsvE;
235  if (0 < nlimits) {
236  G4RegionStore* store = G4RegionStore::GetInstance();
237  for (int i = 0; i < nlimits; ++i) {
238  // apply limiter for whole CMS
239  if (regnames[i] == "all") {
240  reg.clear();
241  rlimE.clear();
242  rlimH.clear();
243  factE.clear();
244  rmsvE.clear();
245  reg.emplace_back(nullptr);
246  rlimE.emplace_back(limitsE[i] * CLHEP::MeV);
247  rlimH.emplace_back(limitsH[i] * CLHEP::MeV);
248  factE.emplace_back(facE[i]);
249  rmsvE.emplace_back(rmsE[i]);
250  nlimitsH = (limitsH[i] > 0) ? 1 : 0;
251  break;
252  }
253  const G4Region* r = store->GetRegion(regnames[i], false);
254  // apply for concrete G4Region
255  if (r && (limitsE[i] > 0.0 || limitsH[i] > 0.0)) {
256  reg.emplace_back(r);
257  rlimE.emplace_back(limitsE[i] * CLHEP::MeV);
258  rlimH.emplace_back(limitsH[i] * CLHEP::MeV);
259  factE.emplace_back(facE[i]);
260  rmsvE.emplace_back(rmsE[i]);
261  if (limitsH[i] > 0) {
262  ++nlimitsH;
263  }
264  }
265  }
266  nlimits = reg.size();
267  }
268 
269  if (eLimiter || rLimiter || 0 < nlimits) {
271  elim->SetRangeCheckFlag(rLimiter);
272  elim->SetFieldCheckFlag(eLimiter);
273  elim->SetTrackingCutPerRegion(reg, rlimE, factE, rmsvE);
274  ph->RegisterProcess(elim, G4Electron::Electron());
275  }
276 
277  if (pLimiter || 0 < nlimits) {
278  ElectronLimiter* plim = new ElectronLimiter(theParSet, G4Positron::Positron());
279  plim->SetFieldCheckFlag(pLimiter);
280  plim->SetTrackingCutPerRegion(reg, rlimE, factE, rmsvE);
281  ph->RegisterProcess(plim, G4Positron::Positron());
282  }
283  if (0 < nlimits && 0 < nlimitsH) {
284  if (pTCut) {
285  ElectronLimiter* plim = new ElectronLimiter(theParSet, G4Proton::Proton());
286  plim->SetFieldCheckFlag(pLimiter);
287  plim->SetTrackingCutPerRegion(reg, rlimH, factE, rmsvE);
288  ph->RegisterProcess(plim, G4Proton::Proton());
289  }
290  if (piTCut) {
291  ElectronLimiter* plim = new ElectronLimiter(theParSet, G4PionPlus::PionPlus());
292  plim->SetFieldCheckFlag(pLimiter);
293  plim->SetTrackingCutPerRegion(reg, rlimH, factE, rmsvE);
294  ph->RegisterProcess(plim, G4PionPlus::PionPlus());
295  plim = new ElectronLimiter(theParSet, G4PionMinus::PionMinus());
296  plim->SetFieldCheckFlag(pLimiter);
297  plim->SetTrackingCutPerRegion(reg, rlimH, factE, rmsvE);
298  ph->RegisterProcess(plim, G4PionMinus::PionMinus());
299  }
300  }
301  // enable fluorescence
302  bool fluo = theParSet.getParameter<bool>("FlagFluo");
303  if (fluo && !G4LossTableManager::Instance()->AtomDeexcitation()) {
304  G4VAtomDeexcitation* de = new G4UAtomicDeexcitation();
305  G4LossTableManager::Instance()->SetAtomDeexcitation(de);
306  }
307  // change parameters of transportation
308  bool modifyT = theParSet.getParameter<bool>("ModifyTransportation");
309  if (modifyT) {
310  double th1 = theParSet.getUntrackedParameter<double>("ThresholdWarningEnergy") * MeV;
311  double th2 = theParSet.getUntrackedParameter<double>("ThresholdImportantEnergy") * MeV;
312  int nt = theParSet.getUntrackedParameter<int>("ThresholdTrials");
314  }
315  edm::LogVerbatim("SimG4CoreApplication") << "ParametrisedEMPhysics::ConstructProcess() is done";
316 }

References nanoDQM_cff::Electron, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), mps_fire::i, m_tpmod, MeV, ModifyTransportation(), nt, alignCSCRings::r, ElectronLimiter::SetFieldCheckFlag(), ElectronLimiter::SetRangeCheckFlag(), ElectronLimiter::SetTrackingCutPerRegion(), ParametrisedEMPhysics::TLSmod::theEcalEMShowerModel, ParametrisedEMPhysics::TLSmod::theEcalHadShowerModel, ParametrisedEMPhysics::TLSmod::theFastSimulationManagerProcess, ParametrisedEMPhysics::TLSmod::theHcalEMShowerModel, ParametrisedEMPhysics::TLSmod::theHcalHadShowerModel, ParametrisedEMPhysics::TLSmod::theLowEnergyFastSimModel, and theParSet.

◆ ModifyTransportation()

void ParametrisedEMPhysics::ModifyTransportation ( const G4ParticleDefinition *  part,
int  ntry,
double  th1,
double  th2 
)
private

Definition at line 318 of file ParametrisedEMPhysics.cc.

318  {
319  G4ProcessManager* man = part->GetProcessManager();
320  G4Transportation* trans = (G4Transportation*)((*(man->GetProcessList()))[0]);
321  if (trans) {
322  trans->SetThresholdWarningEnergy(th1);
323  trans->SetThresholdImportantEnergy(th2);
324  trans->SetThresholdTrials(ntry);
325  edm::LogVerbatim("SimG4CoreApplication")
326  << "ParametrisedEMPhysics: printout level changed for " << part->GetParticleName();
327  }
328 }

Referenced by ConstructProcess().

Member Data Documentation

◆ m_tpmod

G4ThreadLocal ParametrisedEMPhysics::TLSmod * ParametrisedEMPhysics::m_tpmod = nullptr
staticprivate

Definition at line 29 of file ParametrisedEMPhysics.h.

Referenced by ConstructProcess(), and ~ParametrisedEMPhysics().

◆ theParSet

edm::ParameterSet ParametrisedEMPhysics::theParSet
private

Definition at line 27 of file ParametrisedEMPhysics.h.

Referenced by ConstructProcess(), and ParametrisedEMPhysics().

ParametrisedEMPhysics::TLSmod::theFastSimulationManagerProcess
std::unique_ptr< G4FastSimulationManagerProcess > theFastSimulationManagerProcess
Definition: ParametrisedEMPhysics.cc:62
ElectronLimiter
Definition: ElectronLimiter.h:23
mps_fire.i
i
Definition: mps_fire.py:428
ParametrisedEMPhysics::TLSmod::theEcalEMShowerModel
std::unique_ptr< GFlashEMShowerModel > theEcalEMShowerModel
Definition: ParametrisedEMPhysics.cc:57
nt
int nt
Definition: AMPTWrapper.h:42
ElectronLimiter::SetTrackingCutPerRegion
void SetTrackingCutPerRegion(std::vector< const G4Region * > &, std::vector< G4double > &, std::vector< G4double > &, std::vector< G4double > &)
Definition: ElectronLimiter.cc:111
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
ParametrisedEMPhysics::TLSmod::theHcalEMShowerModel
std::unique_ptr< GFlashEMShowerModel > theHcalEMShowerModel
Definition: ParametrisedEMPhysics.cc:59
ParametrisedEMPhysics::TLSmod::theLowEnergyFastSimModel
std::unique_ptr< LowEnergyFastSimModel > theLowEnergyFastSimModel
Definition: ParametrisedEMPhysics.cc:58
MeV
const double MeV
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
ParametrisedEMPhysics::TLSmod::theHcalHadShowerModel
std::unique_ptr< GFlashHadronShowerModel > theHcalHadShowerModel
Definition: ParametrisedEMPhysics.cc:61
ParametrisedEMPhysics::ModifyTransportation
void ModifyTransportation(const G4ParticleDefinition *, int ntry, double th1, double th2)
Definition: ParametrisedEMPhysics.cc:318
part
part
Definition: HCALResponse.h:20
ParametrisedEMPhysics::TLSmod::theEcalHadShowerModel
std::unique_ptr< GFlashHadronShowerModel > theEcalHadShowerModel
Definition: ParametrisedEMPhysics.cc:60
ElectronLimiter::SetFieldCheckFlag
void SetFieldCheckFlag(G4bool)
Definition: ElectronLimiter.h:70
rname
const G4String rname[NREG]
Definition: ParametrisedEMPhysics.cc:48
GeV
const double GeV
Definition: MathUtil.h:16
ParametrisedEMPhysics::theParSet
edm::ParameterSet theParSet
Definition: ParametrisedEMPhysics.h:27
gem
Definition: AMC13Event.h:6
NREG
const G4int NREG
Definition: ParametrisedEMPhysics.cc:47
alignCSCRings.r
r
Definition: alignCSCRings.py:93
ElectronLimiter::SetRangeCheckFlag
void SetRangeCheckFlag(G4bool)
Definition: ElectronLimiter.h:68
nanoDQM_cff.Electron
Electron
Definition: nanoDQM_cff.py:62
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
ParametrisedEMPhysics::m_tpmod
static G4ThreadLocal TLSmod * m_tpmod
Definition: ParametrisedEMPhysics.h:29