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" 51 "DefaultRegionForTheWorld"};
65 : 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 bool pe =
p.getParameter<
bool>(
"PhotoeffectBelowKShell");
80 param->SetPhotoeffectBelowKShell(pe);
82 int type =
p.getParameter<
int>(
"G4TransportWithMSC");
83 G4TransportationWithMscType trtype = G4TransportationWithMscType::fDisabled;
85 trtype = G4TransportationWithMscType::fEnabled;
86 }
else if (
type == 2) {
87 trtype = G4TransportationWithMscType::fMultipleSteps;
89 param->SetTransportationWithMsc(trtype);
92 param->SetRetrieveMuDataFromFile(mudat);
103 <<
"### ParametrisedEMPhysics parameters:" 104 <<
"\n verbosity= " << verb <<
"\n fluoFlag: " << fluo <<
"\n fluo below K-shell: " << pe
105 <<
"\n transportation with msc: " <<
type <<
"\n modifyTransport: " << modifyT <<
" Ntrials= " <<
nt 106 <<
"\n ThWarning(MeV)= " << th1 / CLHEP::MeV <<
"\n ThException(MeV)= " << th2 / CLHEP::MeV
107 <<
"\n read muon data: " << mudat <<
"\n bremsstrahlung threshold Eth(GeV)= " << bremth / CLHEP::GeV;
111 if (energyLim > 0.0) {
112 G4double rrfact[
NREG] = {1.0};
120 for (
int i = 0;
i <
NREG; ++
i) {
121 if (rrfact[
i] < 1.0) {
122 param->ActivateSecondaryBiasing(
"eIoni",
rname[
i], rrfact[
i], energyLim);
123 param->ActivateSecondaryBiasing(
"hIoni",
rname[
i], rrfact[
i], energyLim);
125 <<
"ParametrisedEMPhysics: Russian Roulette" 126 <<
" for e- Prob= " << rrfact[
i] <<
" Elimit(MeV)= " << energyLim / CLHEP::MeV <<
" inside " <<
rname[
i];
139 G4EmBuilder::ConstructMinimalEmSet();
143 edm::LogVerbatim(
"SimG4CoreApplication") <<
"ParametrisedEMPhysics::ConstructProcess() started";
152 if (
gem || ghad || lowEnergyGem || gemHad || ghadHad) {
157 <<
"ParametrisedEMPhysics: GFlash Construct for e+-: " <<
gem <<
" " << ghad <<
" " << lowEnergyGem
158 <<
" for hadrons: " << gemHad <<
" " << ghadHad;
165 }
else if (lowEnergyGem) {
170 if (gemHad || ghadHad) {
172 G4AntiProton::AntiProton()->GetProcessManager()->AddDiscreteProcess(
180 if (
gem || gemHad || lowEnergyGem) {
181 G4Region* aRegion = G4RegionStore::GetInstance()->GetRegion(
"EcalRegion",
false);
184 edm::LogWarning(
"SimG4CoreApplication") <<
"ParametrisedEMPhysics::ConstructProcess: " 185 <<
"EcalRegion is not defined, GFlash will not be enabled for ECAL!";
191 std::make_unique<GFlashEMShowerModel>(
"GflashEcalEMShowerModel", aRegion,
theParSet);
192 }
else if (lowEnergyGem) {
195 std::make_unique<LowEnergyFastSimModel>(
"LowEnergyFastSimModel", aRegion,
theParSet);
201 std::make_unique<GFlashHadronShowerModel>(
"GflashEcalHadShowerModel", aRegion,
theParSet);
205 if (ghad || ghadHad) {
206 G4Region* aRegion = G4RegionStore::GetInstance()->GetRegion(
"HcalRegion",
false);
208 edm::LogWarning(
"SimG4CoreApplication") <<
"ParametrisedEMPhysics::ConstructProcess: " 209 <<
"HcalRegion is not defined, GFlash will not be enabled for HCAL!";
215 std::make_unique<GFlashEMShowerModel>(
"GflashHcalEMShowerModel", aRegion,
theParSet);
220 std::make_unique<GFlashHadronShowerModel>(
"GflashHcalHadShowerModel", aRegion,
theParSet);
226 G4PhysicsListHelper*
ph = G4PhysicsListHelper::GetPhysicsListHelper();
236 std::vector<std::string> regnames =
theParSet.
getParameter<std::vector<std::string> >(
"LimitsPerRegion");
241 int nlimits = regnames.size();
243 std::vector<const G4Region*> reg;
244 std::vector<G4double> rlimE;
245 std::vector<G4double> rlimH;
246 std::vector<G4double> factE;
247 std::vector<G4double> rmsvE;
249 G4RegionStore* store = G4RegionStore::GetInstance();
250 for (
int i = 0;
i < nlimits; ++
i) {
252 if (regnames[
i] ==
"all") {
258 reg.emplace_back(
nullptr);
259 rlimE.emplace_back(limitsE[
i] * CLHEP::MeV);
260 rlimH.emplace_back(limitsH[
i] * CLHEP::MeV);
261 factE.emplace_back(facE[
i]);
262 rmsvE.emplace_back(rmsE[
i]);
263 nlimitsH = (limitsH[
i] > 0) ? 1 : 0;
266 const G4Region*
r = store->GetRegion(regnames[
i],
false);
268 if (
r && (limitsE[
i] > 0.0 || limitsH[
i] > 0.0)) {
270 rlimE.emplace_back(limitsE[
i] * CLHEP::MeV);
271 rlimH.emplace_back(limitsH[
i] * CLHEP::MeV);
272 factE.emplace_back(facE[
i]);
273 rmsvE.emplace_back(rmsE[
i]);
274 if (limitsH[
i] > 0) {
279 nlimits = reg.size();
282 if (eLimiter || rLimiter || 0 < nlimits) {
290 if (pLimiter || 0 < nlimits) {
294 ph->RegisterProcess(plim, G4Positron::Positron());
296 if (0 < nlimits && 0 < nlimitsH) {
301 ph->RegisterProcess(plim, G4Proton::Proton());
307 ph->RegisterProcess(plim, G4PionPlus::PionPlus());
311 ph->RegisterProcess(plim, G4PionMinus::PionMinus());
316 if (fluo && !G4LossTableManager::Instance()->AtomDeexcitation()) {
317 G4VAtomDeexcitation* de =
new G4UAtomicDeexcitation();
318 G4LossTableManager::Instance()->SetAtomDeexcitation(de);
328 edm::LogVerbatim(
"SimG4CoreApplication") <<
"ParametrisedEMPhysics::ConstructProcess() is done";
332 G4ProcessManager* man =
part->GetProcessManager();
333 G4Transportation* trans = (G4Transportation*)((*(man->GetProcessList()))[0]);
335 trans->SetThresholdWarningEnergy(th1);
336 trans->SetThresholdImportantEnergy(th2);
337 trans->SetThresholdTrials(ntry);
339 <<
"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