15 #include "G4FastSimulationManagerProcess.hh" 16 #include "G4ProcessManager.hh" 17 #include "G4HadronicParameters.hh" 18 #include "G4EmBuilder.hh" 20 #include "G4RegionStore.hh" 21 #include "G4Electron.hh" 22 #include "G4Positron.hh" 23 #include "G4MuonMinus.hh" 24 #include "G4MuonPlus.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" 32 #include "G4EmParameters.hh" 33 #include "G4LossTableManager.hh" 34 #include "G4PhysicsListHelper.hh" 35 #include "G4ProcessManager.hh" 36 #include "G4SystemOfUnits.hh" 37 #include "G4Transportation.hh" 38 #include "G4UAtomicDeexcitation.hh" 39 #include "G4Version.hh" 52 "DefaultRegionForTheWorld"};
66 : G4VPhysicsConstructor(
name), theParSet(
p) {
67 G4EmParameters* param = G4EmParameters::Instance();
69 param->SetVerbose(verb);
72 param->SetBremsstrahlungTh(bremth);
74 param->SetMuHadBremsstrahlungTh(mubrth);
77 param->SetGeneralProcessActive(
genp);
79 #if G4VERSION_NUMBER >= 1110 81 G4HadronicParameters::Instance()->SetEnableNeutronGeneralProcess(genn);
84 param->SetTransportationWithMsc(G4TransportationWithMscType::fEnabled);
88 param->SetRetrieveMuDataFromFile(mudat);
99 <<
"ParametrisedEMPhysics::ConstructProcess: bremsstrahlung threshold Eth= " << bremth / GeV <<
" GeV" 100 <<
"\n verbosity= " << verb <<
" fluoFlag: " << fluo
101 <<
" modifyTransport: " << modifyT <<
" Ntrials= " <<
nt 102 <<
"\n ThWarning(MeV)= " << th1 <<
" ThException(MeV)= " << th2;
106 if (energyLim > 0.0) {
107 G4double rrfact[
NREG] = {1.0};
115 for (
int i = 0;
i <
NREG; ++
i) {
116 if (rrfact[
i] < 1.0) {
117 param->ActivateSecondaryBiasing(
"eIoni",
rname[
i], rrfact[
i], energyLim);
118 param->ActivateSecondaryBiasing(
"hIoni",
rname[
i], rrfact[
i], energyLim);
120 <<
"ParametrisedEMPhysics: Russian Roulette" 121 <<
" for e- Prob= " << rrfact[
i] <<
" Elimit(MeV)= " << energyLim / CLHEP::MeV <<
" inside " <<
rname[
i];
134 G4EmBuilder::ConstructMinimalEmSet();
138 edm::LogVerbatim(
"SimG4CoreApplication") <<
"ParametrisedEMPhysics::ConstructProcess() started";
147 if (
gem || ghad || lowEnergyGem || gemHad || ghadHad) {
152 <<
"ParametrisedEMPhysics: GFlash Construct for e+-: " <<
gem <<
" " << ghad <<
" " << lowEnergyGem
153 <<
" for hadrons: " << gemHad <<
" " << ghadHad;
160 }
else if (lowEnergyGem) {
165 if (gemHad || ghadHad) {
167 G4AntiProton::AntiProton()->GetProcessManager()->AddDiscreteProcess(
175 if (
gem || gemHad || lowEnergyGem) {
176 G4Region* aRegion = G4RegionStore::GetInstance()->GetRegion(
"EcalRegion",
false);
179 edm::LogWarning(
"SimG4CoreApplication") <<
"ParametrisedEMPhysics::ConstructProcess: " 180 <<
"EcalRegion is not defined, GFlash will not be enabled for ECAL!";
186 std::make_unique<GFlashEMShowerModel>(
"GflashEcalEMShowerModel", aRegion,
theParSet);
187 }
else if (lowEnergyGem) {
190 std::make_unique<LowEnergyFastSimModel>(
"LowEnergyFastSimModel", aRegion,
theParSet);
196 std::make_unique<GFlashHadronShowerModel>(
"GflashEcalHadShowerModel", aRegion,
theParSet);
200 if (ghad || ghadHad) {
201 G4Region* aRegion = G4RegionStore::GetInstance()->GetRegion(
"HcalRegion",
false);
203 edm::LogWarning(
"SimG4CoreApplication") <<
"ParametrisedEMPhysics::ConstructProcess: " 204 <<
"HcalRegion is not defined, GFlash will not be enabled for HCAL!";
210 std::make_unique<GFlashEMShowerModel>(
"GflashHcalEMShowerModel", aRegion,
theParSet);
215 std::make_unique<GFlashHadronShowerModel>(
"GflashHcalHadShowerModel", aRegion,
theParSet);
221 G4PhysicsListHelper*
ph = G4PhysicsListHelper::GetPhysicsListHelper();
231 std::vector<std::string> regnames =
theParSet.
getParameter<std::vector<std::string> >(
"LimitsPerRegion");
236 int nlimits = regnames.size();
238 std::vector<const G4Region*> reg;
239 std::vector<G4double> rlimE;
240 std::vector<G4double> rlimH;
241 std::vector<G4double> factE;
242 std::vector<G4double> rmsvE;
244 G4RegionStore* store = G4RegionStore::GetInstance();
245 for (
int i = 0;
i < nlimits; ++
i) {
247 if (regnames[
i] ==
"all") {
253 reg.emplace_back(
nullptr);
254 rlimE.emplace_back(limitsE[
i] * CLHEP::MeV);
255 rlimH.emplace_back(limitsH[
i] * CLHEP::MeV);
256 factE.emplace_back(facE[
i]);
257 rmsvE.emplace_back(rmsE[
i]);
258 nlimitsH = (limitsH[
i] > 0) ? 1 : 0;
261 const G4Region*
r = store->GetRegion(regnames[
i],
false);
263 if (
r && (limitsE[
i] > 0.0 || limitsH[
i] > 0.0)) {
265 rlimE.emplace_back(limitsE[
i] * CLHEP::MeV);
266 rlimH.emplace_back(limitsH[
i] * CLHEP::MeV);
267 factE.emplace_back(facE[
i]);
268 rmsvE.emplace_back(rmsE[
i]);
269 if (limitsH[
i] > 0) {
274 nlimits = reg.size();
277 if (eLimiter || rLimiter || 0 < nlimits) {
285 if (pLimiter || 0 < nlimits) {
289 ph->RegisterProcess(plim, G4Positron::Positron());
291 if (0 < nlimits && 0 < nlimitsH) {
296 ph->RegisterProcess(plim, G4Proton::Proton());
302 ph->RegisterProcess(plim, G4PionPlus::PionPlus());
306 ph->RegisterProcess(plim, G4PionMinus::PionMinus());
311 if (fluo && !G4LossTableManager::Instance()->AtomDeexcitation()) {
312 G4VAtomDeexcitation* de =
new G4UAtomicDeexcitation();
313 G4LossTableManager::Instance()->SetAtomDeexcitation(de);
323 edm::LogVerbatim(
"SimG4CoreApplication") <<
"ParametrisedEMPhysics::ConstructProcess() is done";
327 G4ProcessManager* man =
part->GetProcessManager();
328 G4Transportation* trans = (G4Transportation*)((*(man->GetProcessList()))[0]);
330 trans->SetThresholdWarningEnergy(th1);
331 trans->SetThresholdImportantEnergy(th2);
332 trans->SetThresholdTrials(ntry);
334 <<
"ParametrisedEMPhysics: printout level changed for " <<
part->GetParticleName();
void ConstructParticle() override
Log< level::Info, true > LogVerbatim
T getParameter(std::string const &) const
genp
produce generated paricles in acceptance #
void SetRangeCheckFlag(G4bool)
edm::ParameterSet theParSet
void SetTrackingCutPerRegion(std::vector< const G4Region *> &, std::vector< G4double > &, std::vector< G4double > &, std::vector< G4double > &)
static G4ThreadLocal TLSmod * m_tpmod
void ModifyTransportation(const G4ParticleDefinition *, int ntry, double th1, double th2)
T getUntrackedParameter(std::string const &, T const &) const
std::unique_ptr< G4FastSimulationManagerProcess > theFastSimulationManagerProcess
std::unique_ptr< GFlashEMShowerModel > theEcalEMShowerModel
void SetFieldCheckFlag(G4bool)
std::unique_ptr< LowEnergyFastSimModel > theLowEnergyFastSimModel
std::unique_ptr< GFlashEMShowerModel > theHcalEMShowerModel
std::unique_ptr< GFlashHadronShowerModel > theHcalHadShowerModel
ParametrisedEMPhysics(const std::string &name, const edm::ParameterSet &p)
const G4String rname[NREG]
std::unique_ptr< GFlashHadronShowerModel > theEcalHadShowerModel
Log< level::Warning, false > LogWarning
~ParametrisedEMPhysics() override
void ConstructProcess() override