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

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

◆ ~ParametrisedEMPhysics()

ParametrisedEMPhysics::~ParametrisedEMPhysics ( )
override

Definition at line 121 of file ParametrisedEMPhysics.cc.

121  {
122  if (m_tpmod) {
123  delete m_tpmod;
124  m_tpmod = nullptr;
125  }
126 }

References m_tpmod.

Member Function Documentation

◆ ConstructParticle()

void ParametrisedEMPhysics::ConstructParticle ( )
override

Definition at line 128 of file ParametrisedEMPhysics.cc.

128  {
129  G4LeptonConstructor pLeptonConstructor;
130  pLeptonConstructor.ConstructParticle();
131 
132  G4BaryonConstructor pBaryonConstructor;
133  pBaryonConstructor.ConstructParticle();
134 }

◆ ConstructProcess()

void ParametrisedEMPhysics::ConstructProcess ( )
override

Definition at line 136 of file ParametrisedEMPhysics.cc.

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

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 325 of file ParametrisedEMPhysics.cc.

325  {
326  G4ProcessManager* man = part->GetProcessManager();
327  G4Transportation* trans = (G4Transportation*)((*(man->GetProcessList()))[0]);
328  if (trans) {
329  trans->SetThresholdWarningEnergy(th1);
330  trans->SetThresholdImportantEnergy(th2);
331  trans->SetThresholdTrials(ntry);
332  edm::LogVerbatim("SimG4CoreApplication")
333  << "ParametrisedEMPhysics: printout level changed for " << part->GetParticleName();
334  }
335 }

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
EgammaValidation_cff.genp
genp
produce generated paricles in acceptance #
Definition: EgammaValidation_cff.py:115
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:325
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