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) {
68 G4EmParameters* param = G4EmParameters::Instance();
70 param->SetVerbose(verb);
73 param->SetBremsstrahlungTh(bremth);
75 param->SetMuHadBremsstrahlungTh(mubrth);
78 param->SetGeneralProcessActive(
genp);
80 bool pe =
p.getParameter<
bool>(
"PhotoeffectBelowKShell");
81 int type =
p.getParameter<
int>(
"G4TransportWithMSC");
83 #if G4VERSION_NUMBER >= 1110 84 param->SetPhotoeffectBelowKShell(pe);
85 G4TransportationWithMscType trtype = G4TransportationWithMscType::fDisabled;
87 trtype = G4TransportationWithMscType::fEnabled;
88 }
else if (
type == 2) {
89 trtype = G4TransportationWithMscType::fMultipleSteps;
91 param->SetTransportationWithMsc(trtype);
95 param->SetRetrieveMuDataFromFile(mudat);
106 <<
"### ParametrisedEMPhysics parameters:" 107 <<
"\n verbosity= " << verb <<
"\n fluoFlag: " << fluo <<
"\n fluo below K-shell: " << pe
108 <<
"\n transportation with msc: " <<
type <<
"\n modifyTransport: " << modifyT <<
" Ntrials= " <<
nt 109 <<
"\n ThWarning(MeV)= " << th1 / CLHEP::MeV <<
"\n ThException(MeV)= " << th2 / CLHEP::MeV
110 <<
"\n read muon data: " << mudat <<
"\n bremsstrahlung threshold Eth(GeV)= " << bremth / CLHEP::GeV;
114 if (energyLim > 0.0) {
115 G4double rrfact[
NREG] = {1.0};
123 for (
int i = 0;
i <
NREG; ++
i) {
124 if (rrfact[
i] < 1.0) {
125 param->ActivateSecondaryBiasing(
"eIoni",
rname[
i], rrfact[
i], energyLim);
126 param->ActivateSecondaryBiasing(
"hIoni",
rname[
i], rrfact[
i], energyLim);
128 <<
"ParametrisedEMPhysics: Russian Roulette" 129 <<
" for e- Prob= " << rrfact[
i] <<
" Elimit(MeV)= " << energyLim / CLHEP::MeV <<
" inside " <<
rname[
i];
142 G4EmBuilder::ConstructMinimalEmSet();
146 edm::LogVerbatim(
"SimG4CoreApplication") <<
"ParametrisedEMPhysics::ConstructProcess() started";
155 if (
gem || ghad || lowEnergyGem || gemHad || ghadHad) {
160 <<
"ParametrisedEMPhysics: GFlash Construct for e+-: " <<
gem <<
" " << ghad <<
" " << lowEnergyGem
161 <<
" for hadrons: " << gemHad <<
" " << ghadHad;
168 }
else if (lowEnergyGem) {
173 if (gemHad || ghadHad) {
175 G4AntiProton::AntiProton()->GetProcessManager()->AddDiscreteProcess(
183 if (
gem || gemHad || lowEnergyGem) {
184 G4Region* aRegion = G4RegionStore::GetInstance()->GetRegion(
"EcalRegion",
false);
187 edm::LogWarning(
"SimG4CoreApplication") <<
"ParametrisedEMPhysics::ConstructProcess: " 188 <<
"EcalRegion is not defined, GFlash will not be enabled for ECAL!";
194 std::make_unique<GFlashEMShowerModel>(
"GflashEcalEMShowerModel", aRegion,
theParSet);
195 }
else if (lowEnergyGem) {
198 std::make_unique<LowEnergyFastSimModel>(
"LowEnergyFastSimModel", aRegion,
theParSet);
204 std::make_unique<GFlashHadronShowerModel>(
"GflashEcalHadShowerModel", aRegion,
theParSet);
208 if (ghad || ghadHad) {
209 G4Region* aRegion = G4RegionStore::GetInstance()->GetRegion(
"HcalRegion",
false);
211 edm::LogWarning(
"SimG4CoreApplication") <<
"ParametrisedEMPhysics::ConstructProcess: " 212 <<
"HcalRegion is not defined, GFlash will not be enabled for HCAL!";
218 std::make_unique<GFlashEMShowerModel>(
"GflashHcalEMShowerModel", aRegion,
theParSet);
223 std::make_unique<GFlashHadronShowerModel>(
"GflashHcalHadShowerModel", aRegion,
theParSet);
229 G4PhysicsListHelper*
ph = G4PhysicsListHelper::GetPhysicsListHelper();
239 std::vector<std::string> regnames =
theParSet.
getParameter<std::vector<std::string> >(
"LimitsPerRegion");
244 int nlimits = regnames.size();
246 std::vector<const G4Region*> reg;
247 std::vector<G4double> rlimE;
248 std::vector<G4double> rlimH;
249 std::vector<G4double> factE;
250 std::vector<G4double> rmsvE;
252 G4RegionStore* store = G4RegionStore::GetInstance();
253 for (
int i = 0;
i < nlimits; ++
i) {
255 if (regnames[
i] ==
"all") {
261 reg.emplace_back(
nullptr);
262 rlimE.emplace_back(limitsE[
i] * CLHEP::MeV);
263 rlimH.emplace_back(limitsH[
i] * CLHEP::MeV);
264 factE.emplace_back(facE[
i]);
265 rmsvE.emplace_back(rmsE[
i]);
266 nlimitsH = (limitsH[
i] > 0) ? 1 : 0;
269 const G4Region*
r = store->GetRegion(regnames[
i],
false);
271 if (
r && (limitsE[
i] > 0.0 || limitsH[
i] > 0.0)) {
273 rlimE.emplace_back(limitsE[
i] * CLHEP::MeV);
274 rlimH.emplace_back(limitsH[
i] * CLHEP::MeV);
275 factE.emplace_back(facE[
i]);
276 rmsvE.emplace_back(rmsE[
i]);
277 if (limitsH[
i] > 0) {
282 nlimits = reg.size();
285 if (eLimiter || rLimiter || 0 < nlimits) {
293 if (pLimiter || 0 < nlimits) {
297 ph->RegisterProcess(plim, G4Positron::Positron());
299 if (0 < nlimits && 0 < nlimitsH) {
304 ph->RegisterProcess(plim, G4Proton::Proton());
310 ph->RegisterProcess(plim, G4PionPlus::PionPlus());
314 ph->RegisterProcess(plim, G4PionMinus::PionMinus());
319 if (fluo && !G4LossTableManager::Instance()->AtomDeexcitation()) {
320 G4VAtomDeexcitation* de =
new G4UAtomicDeexcitation();
321 G4LossTableManager::Instance()->SetAtomDeexcitation(de);
331 edm::LogVerbatim(
"SimG4CoreApplication") <<
"ParametrisedEMPhysics::ConstructProcess() is done";
335 G4ProcessManager* man =
part->GetProcessManager();
336 G4Transportation* trans = (G4Transportation*)((*(man->GetProcessList()))[0]);
338 trans->SetThresholdWarningEnergy(th1);
339 trans->SetThresholdImportantEnergy(th2);
340 trans->SetThresholdTrials(ntry);
342 <<
"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