15 #include "G4FastSimulationManagerProcess.hh"
16 #include "G4ProcessManager.hh"
17 #include "G4EmBuilder.hh"
19 #include "G4RegionStore.hh"
20 #include "G4Electron.hh"
21 #include "G4Positron.hh"
22 #include "G4MuonMinus.hh"
23 #include "G4MuonPlus.hh"
24 #include "G4PionMinus.hh"
25 #include "G4PionPlus.hh"
26 #include "G4KaonMinus.hh"
27 #include "G4KaonPlus.hh"
28 #include "G4Proton.hh"
29 #include "G4AntiProton.hh"
31 #include "G4EmParameters.hh"
32 #include "G4LossTableManager.hh"
33 #include "G4PhysicsListHelper.hh"
34 #include "G4ProcessManager.hh"
35 #include "G4SystemOfUnits.hh"
36 #include "G4Transportation.hh"
37 #include "G4UAtomicDeexcitation.hh"
50 "DefaultRegionForTheWorld"};
64 : G4VPhysicsConstructor(name), theParSet(p) {
65 G4EmParameters* param = G4EmParameters::Instance();
67 param->SetVerbose(verb);
70 param->SetBremsstrahlungTh(bremth);
72 param->SetMuHadBremsstrahlungTh(mubrth);
75 param->SetGeneralProcessActive(genp);
78 param->SetRetrieveMuDataFromFile(mudat);
89 <<
"ParametrisedEMPhysics::ConstructProcess: bremsstrahlung threshold Eth= " << bremth /
GeV <<
" GeV"
90 <<
"\n verbosity= " << verb <<
" fluoFlag: " << fluo
91 <<
" modifyTransport: " << modifyT <<
" Ntrials= " << nt
92 <<
"\n ThWarning(MeV)= " << th1 <<
" ThException(MeV)= " << th2;
96 if (energyLim > 0.0) {
97 G4double rrfact[
NREG] = {1.0};
105 for (
int i = 0;
i <
NREG; ++
i) {
106 if (rrfact[
i] < 1.0) {
107 param->ActivateSecondaryBiasing(
"eIoni",
rname[
i], rrfact[i], energyLim);
108 param->ActivateSecondaryBiasing(
"hIoni",
rname[i], rrfact[i], energyLim);
110 <<
"ParametrisedEMPhysics: Russian Roulette"
111 <<
" for e- Prob= " << rrfact[
i] <<
" Elimit(MeV)= " << energyLim /
CLHEP::MeV <<
" inside " <<
rname[
i];
124 G4EmBuilder::ConstructMinimalEmSet();
128 edm::LogVerbatim(
"SimG4CoreApplication") <<
"ParametrisedEMPhysics::ConstructProcess() started";
137 if (gem || ghad || lowEnergyGem || gemHad || ghadHad) {
142 <<
"ParametrisedEMPhysics: GFlash Construct for e+-: " << gem <<
" " << ghad <<
" " << lowEnergyGem
143 <<
" for hadrons: " << gemHad <<
" " << ghadHad;
150 }
else if (lowEnergyGem) {
155 if (gemHad || ghadHad) {
157 G4AntiProton::AntiProton()->GetProcessManager()->AddDiscreteProcess(
165 if (gem || gemHad || lowEnergyGem) {
166 G4Region* aRegion = G4RegionStore::GetInstance()->GetRegion(
"EcalRegion",
false);
169 edm::LogWarning(
"SimG4CoreApplication") <<
"ParametrisedEMPhysics::ConstructProcess: "
170 <<
"EcalRegion is not defined, GFlash will not be enabled for ECAL!";
176 std::make_unique<GFlashEMShowerModel>(
"GflashEcalEMShowerModel", aRegion,
theParSet);
177 }
else if (lowEnergyGem) {
180 std::make_unique<LowEnergyFastSimModel>(
"LowEnergyFastSimModel", aRegion,
theParSet);
186 std::make_unique<GFlashHadronShowerModel>(
"GflashEcalHadShowerModel", aRegion,
theParSet);
190 if (ghad || ghadHad) {
191 G4Region* aRegion = G4RegionStore::GetInstance()->GetRegion(
"HcalRegion",
false);
193 edm::LogWarning(
"SimG4CoreApplication") <<
"ParametrisedEMPhysics::ConstructProcess: "
194 <<
"HcalRegion is not defined, GFlash will not be enabled for HCAL!";
200 std::make_unique<GFlashEMShowerModel>(
"GflashHcalEMShowerModel", aRegion,
theParSet);
205 std::make_unique<GFlashHadronShowerModel>(
"GflashHcalHadShowerModel", aRegion,
theParSet);
211 G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
221 std::vector<std::string> regnames =
theParSet.
getParameter<std::vector<std::string> >(
"LimitsPerRegion");
226 int nlimits = regnames.size();
228 std::vector<const G4Region*> reg;
229 std::vector<G4double> rlimE;
230 std::vector<G4double> rlimH;
231 std::vector<G4double> factE;
232 std::vector<G4double> rmsvE;
234 G4RegionStore* store = G4RegionStore::GetInstance();
235 for (
int i = 0;
i < nlimits; ++
i) {
237 if (regnames[
i] ==
"all") {
243 reg.emplace_back(
nullptr);
245 rlimH.emplace_back(limitsH[
i] * CLHEP::MeV);
246 factE.emplace_back(facE[
i]);
247 rmsvE.emplace_back(rmsE[i]);
248 nlimitsH = (limitsH[
i] > 0) ? 1 : 0;
251 const G4Region*
r = store->GetRegion(regnames[
i],
false);
253 if (r && (limitsE[i] > 0.0 || limitsH[i] > 0.0)) {
256 rlimH.emplace_back(limitsH[i] * CLHEP::MeV);
257 factE.emplace_back(facE[i]);
258 rmsvE.emplace_back(rmsE[i]);
259 if (limitsH[i] > 0) {
264 nlimits = reg.size();
267 if (eLimiter || rLimiter || 0 < nlimits) {
275 if (pLimiter || 0 < nlimits) {
279 ph->RegisterProcess(plim, G4Positron::Positron());
281 if (0 < nlimits && 0 < nlimitsH) {
286 ph->RegisterProcess(plim, G4Proton::Proton());
292 ph->RegisterProcess(plim, G4PionPlus::PionPlus());
296 ph->RegisterProcess(plim, G4PionMinus::PionMinus());
301 if (fluo && !G4LossTableManager::Instance()->AtomDeexcitation()) {
302 G4VAtomDeexcitation* de =
new G4UAtomicDeexcitation();
303 G4LossTableManager::Instance()->SetAtomDeexcitation(de);
313 edm::LogVerbatim(
"SimG4CoreApplication") <<
"ParametrisedEMPhysics::ConstructProcess() is done";
317 G4ProcessManager* man = part->GetProcessManager();
318 G4Transportation* trans = (G4Transportation*)((*(man->GetProcessList()))[0]);
320 trans->SetThresholdWarningEnergy(th1);
321 trans->SetThresholdImportantEnergy(th2);
322 trans->SetThresholdTrials(ntry);
324 <<
"ParametrisedEMPhysics: printout level changed for " << part->GetParticleName();
void ConstructParticle() override
Log< level::Info, true > LogVerbatim
T getUntrackedParameter(std::string const &, T const &) const
void SetRangeCheckFlag(G4bool)
edm::ParameterSet theParSet
static G4ThreadLocal TLSmod * m_tpmod
void ModifyTransportation(const G4ParticleDefinition *, int ntry, double th1, double th2)
std::unique_ptr< G4FastSimulationManagerProcess > theFastSimulationManagerProcess
std::unique_ptr< GFlashEMShowerModel > theEcalEMShowerModel
void SetFieldCheckFlag(G4bool)
tuple genp
produce generated paricles in acceptance #
std::unique_ptr< LowEnergyFastSimModel > theLowEnergyFastSimModel
std::unique_ptr< GFlashEMShowerModel > theHcalEMShowerModel
std::unique_ptr< GFlashHadronShowerModel > theHcalHadShowerModel
T getParameter(std::string const &) const
ParametrisedEMPhysics(const std::string &name, const edm::ParameterSet &p)
const G4String rname[NREG]
std::unique_ptr< GFlashHadronShowerModel > theEcalHadShowerModel
constexpr char Electron[]
Log< level::Warning, false > LogWarning
void SetTrackingCutPerRegion(std::vector< const G4Region * > &, std::vector< G4double > &, std::vector< G4double > &, std::vector< G4double > &)
~ParametrisedEMPhysics() override
void ConstructProcess() override