|
| 1 | +#include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysicsA.h" |
| 2 | +#include "SimG4Core/Physics/interface/CMSG4TrackInterface.h" |
| 3 | +#include "SimG4Core/Notification/interface/CurrentG4Track.h" |
| 4 | +#include "FWCore/MessageLogger/interface/MessageLogger.h" |
| 5 | + |
| 6 | +#include <CLHEP/Units/SystemOfUnits.h> |
| 7 | +#include "G4ParticleDefinition.hh" |
| 8 | +#include "G4LossTableManager.hh" |
| 9 | +#include "G4EmParameters.hh" |
| 10 | +#include "G4EmBuilder.hh" |
| 11 | + |
| 12 | +#include "G4ComptonScattering.hh" |
| 13 | +#include "G4GammaConversion.hh" |
| 14 | +#include "G4PhotoElectricEffect.hh" |
| 15 | + |
| 16 | +#include "G4MscStepLimitType.hh" |
| 17 | + |
| 18 | +#include "G4eMultipleScattering.hh" |
| 19 | +#include "G4hMultipleScattering.hh" |
| 20 | +#include "G4eCoulombScatteringModel.hh" |
| 21 | +#include "G4CoulombScattering.hh" |
| 22 | +#include "G4WentzelVIModel.hh" |
| 23 | +#include "G4UrbanMscModel.hh" |
| 24 | + |
| 25 | +#include "G4eIonisation.hh" |
| 26 | +#include "G4eBremsstrahlung.hh" |
| 27 | +#include "G4eplusAnnihilation.hh" |
| 28 | + |
| 29 | +#include "G4hIonisation.hh" |
| 30 | +#include "G4ionIonisation.hh" |
| 31 | + |
| 32 | +#include "G4ParticleTable.hh" |
| 33 | +#include "G4Gamma.hh" |
| 34 | +#include "G4Electron.hh" |
| 35 | +#include "G4Positron.hh" |
| 36 | +#include "G4GenericIon.hh" |
| 37 | + |
| 38 | +#include "G4PhysicsListHelper.hh" |
| 39 | +#include "G4BuilderType.hh" |
| 40 | +#include "G4GammaGeneralProcess.hh" |
| 41 | + |
| 42 | +#include "G4ProcessManager.hh" |
| 43 | +#include "G4TransportationWithMsc.hh" |
| 44 | + |
| 45 | +#include "G4RegionStore.hh" |
| 46 | +#include "G4Region.hh" |
| 47 | + |
| 48 | +#include <AdePT/core/AdePTConfiguration.hh> |
| 49 | +#include <AdePT/integration/AdePTTrackingManager.hh> |
| 50 | + |
| 51 | +#include "G4HepEmConfig.hh" |
| 52 | + |
| 53 | +CMSEmStandardPhysicsA::CMSEmStandardPhysicsA(G4int ver, const edm::ParameterSet& p) |
| 54 | + : G4VPhysicsConstructor("CMSEmStandard_ema") { |
| 55 | + fAdePTConfiguration = new AdePTConfiguration(); |
| 56 | + SetVerboseLevel(ver); |
| 57 | + // EM parameters specific for this EM physics configuration |
| 58 | + G4EmParameters* param = G4EmParameters::Instance(); |
| 59 | + param->SetDefaults(); |
| 60 | + param->SetVerbose(ver); |
| 61 | + param->SetApplyCuts(true); |
| 62 | + param->SetStepFunction(0.8, 1 * CLHEP::mm); |
| 63 | + param->SetMscRangeFactor(0.2); |
| 64 | + param->SetMscStepLimitType(fMinimal); |
| 65 | + param->SetFluo(false); |
| 66 | + SetPhysicsType(bElectromagnetic); |
| 67 | + fRangeFactor = p.getParameter<double>("G4MscRangeFactor"); |
| 68 | + fGeomFactor = p.getParameter<double>("G4MscGeomFactor"); |
| 69 | + fSafetyFactor = p.getParameter<double>("G4MscSafetyFactor"); |
| 70 | + fLambdaLimit = p.getParameter<double>("G4MscLambdaLimit") * CLHEP::mm; |
| 71 | + std::string msc = p.getParameter<std::string>("G4MscStepLimit"); |
| 72 | + fStepLimitType = fUseSafety; |
| 73 | + if (msc == "UseSafetyPlus") { |
| 74 | + fStepLimitType = fUseSafetyPlus; |
| 75 | + } |
| 76 | + if (msc == "Minimal") { |
| 77 | + fStepLimitType = fMinimal; |
| 78 | + } |
| 79 | + double tcut = p.getParameter<double>("G4TrackingCut") * CLHEP::MeV; |
| 80 | + param->SetLowestElectronEnergy(tcut); |
| 81 | + param->SetLowestMuHadEnergy(tcut); |
| 82 | +} |
| 83 | + |
| 84 | +void CMSEmStandardPhysicsA::ConstructParticle() { |
| 85 | + // minimal set of particles for EM physics |
| 86 | + G4EmBuilder::ConstructMinimalEmSet(); |
| 87 | +} |
| 88 | + |
| 89 | +void CMSEmStandardPhysicsA::ConstructProcess() { |
| 90 | + if (verboseLevel > 0) { |
| 91 | + int id = CMSG4TrackInterface::instance()->getThreadID(); |
| 92 | + edm::LogVerbatim("PhysicsList") << "### " << GetPhysicsName() << " Construct EM Processes; EMA threadID=" << id; |
| 93 | + } |
| 94 | + |
| 95 | + // This EM builder takes default models of Geant4 10 EMV. |
| 96 | + // Multiple scattering by WentzelVI for all particles except: |
| 97 | + // a) e+e- below 100 MeV for which the Urban model is used |
| 98 | + // b) ions for which Urban model is used |
| 99 | + G4EmBuilder::PrepareEMPhysics(); |
| 100 | + |
| 101 | + G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper(); |
| 102 | + // processes used by several particles |
| 103 | + G4hMultipleScattering* hmsc = new G4hMultipleScattering("ionmsc"); |
| 104 | + G4NuclearStopping* pnuc(nullptr); |
| 105 | + |
| 106 | + const G4Region* aRegion = G4RegionStore::GetInstance()->GetRegion("HcalRegion", false); |
| 107 | + const G4Region* bRegion = G4RegionStore::GetInstance()->GetRegion("HGCalRegion", false); |
| 108 | + |
| 109 | + // G4HepEm is Active |
| 110 | + if (verboseLevel > 0) { |
| 111 | + edm::LogVerbatim("PhysicsList") << "AdePT is active, registering AdePTTrackingManager"; |
| 112 | + } |
| 113 | + |
| 114 | + // number of worker threads must be passed to AdePT |
| 115 | + fAdePTConfiguration->SetNumThreads(CurrentG4Track::numberOfWorkers()); |
| 116 | + |
| 117 | + // Construct the AdePT tracking manager |
| 118 | + auto* hepEmTM = new AdePTTrackingManager( fAdePTConfiguration, verboseLevel); |
| 119 | + |
| 120 | + // now configure the G4HepEm config in the AdePT TM, as it will be used to define the physics |
| 121 | + G4HepEmConfig* config = hepEmTM->GetG4HepEmConfig(); |
| 122 | + // First set global configuration parameters: |
| 123 | + // ------------------------------------------ |
| 124 | + // The default MSC `RangeFactor`, `SafetyFactor`, `StepLimitType` parameters |
| 125 | + // as well as `SetApplyCuts` and `SetLowestElectronEnergy` are taken from |
| 126 | + // `G4EmParameters` so we set only the step function parameters here. |
| 127 | + |
| 128 | + config->SetEnergyLossStepLimitFunctionParameters(0.8, 1.0 * CLHEP::mm); |
| 129 | + |
| 130 | + // Then set special configuration for some regions: |
| 131 | + // ------------------------------------------------ |
| 132 | + if (nullptr != aRegion) { |
| 133 | + // HCal region |
| 134 | + const G4String& rname = aRegion->GetName(); |
| 135 | + config->SetMinimalMSCStepLimit(fStepLimitType == fMinimal, rname); |
| 136 | + config->SetMSCRangeFactor(fRangeFactor, rname); |
| 137 | + config->SetMSCSafetyFactor(fSafetyFactor, rname); |
| 138 | + } |
| 139 | + |
| 140 | + if (nullptr != bRegion) { |
| 141 | + // HGCal region |
| 142 | + const G4String& rname = bRegion->GetName(); |
| 143 | + config->SetMinimalMSCStepLimit(fStepLimitType == fMinimal, rname); |
| 144 | + config->SetMSCRangeFactor(fRangeFactor, rname); |
| 145 | + config->SetMSCSafetyFactor(fSafetyFactor, rname); |
| 146 | + |
| 147 | + config->SetWoodcockTrackingRegion(rname); |
| 148 | + config->SetWDTEnergyLimit(0.5 * CLHEP::MeV); |
| 149 | + } |
| 150 | + |
| 151 | + G4Electron::Electron()->SetTrackingManager(hepEmTM); |
| 152 | + G4Positron::Positron()->SetTrackingManager(hepEmTM); |
| 153 | + G4Gamma::Gamma()->SetTrackingManager(hepEmTM); |
| 154 | + |
| 155 | + // generic ion |
| 156 | + G4ParticleDefinition* particle = G4GenericIon::GenericIon(); |
| 157 | + G4ionIonisation* ionIoni = new G4ionIonisation(); |
| 158 | + ph->RegisterProcess(hmsc, particle); |
| 159 | + ph->RegisterProcess(ionIoni, particle); |
| 160 | + |
| 161 | + // muons, hadrons ions |
| 162 | + G4EmBuilder::ConstructCharged(hmsc, pnuc); |
| 163 | +} |
0 commit comments