CMS 3D CMS Logo

LowEnergyFastSimModel.cc
Go to the documentation of this file.
3 
5 
6 #include "G4VFastSimulationModel.hh"
7 #include "G4Electron.hh"
8 #include "GFlashHitMaker.hh"
9 #include "G4Region.hh"
10 #include "G4PhysicalConstants.hh"
11 
12 constexpr double twomass = 2 * CLHEP::electron_mass_c2;
13 
15  : G4VFastSimulationModel(name, region),
16  fEmax(parSet.getParameter<double>("LowEnergyGflashEcalEmax")),
17  fRegion(region) {}
18 
19 G4bool LowEnergyFastSimModel::IsApplicable(const G4ParticleDefinition& particle) {
20  return (11 == std::abs(particle.GetPDGEncoding()));
21 }
22 
23 G4bool LowEnergyFastSimModel::ModelTrigger(const G4FastTrack& fastTrack) {
24  G4double energy = fastTrack.GetPrimaryTrack()->GetKineticEnergy();
25  return energy < fEmax && fRegion == fastTrack.GetEnvelope();
26 }
27 
28 void LowEnergyFastSimModel::DoIt(const G4FastTrack& fastTrack, G4FastStep& fastStep) {
29  fastStep.KillPrimaryTrack();
30  fastStep.SetPrimaryTrackPathLength(0.0);
31  double energy = fastTrack.GetPrimaryTrack()->GetKineticEnergy();
32 
33  const G4ThreeVector& pos = fastTrack.GetPrimaryTrack()->GetPosition();
34 
35  G4double inPointEnergy = param.GetInPointEnergyFraction(energy) * energy;
36 
37  // take into account positron annihilation (not included in in-point)
38  if (-11 == fastTrack.GetPrimaryTrack()->GetDefinition()->GetPDGEncoding())
39  energy += twomass;
40 
41  const G4ThreeVector& momDir = fastTrack.GetPrimaryTrack()->GetMomentumDirection();
42  const G4ThreeVector& ortho = momDir.orthogonal();
43  const G4ThreeVector& cross = momDir.cross(ortho);
44 
45  // in point energy deposition
46  GFlashEnergySpot spot;
47  spot.SetEnergy(inPointEnergy);
48  spot.SetPosition(pos);
49  fHitMaker.make(&spot, &fastTrack);
50 
51  // tail energy deposition
52  G4double etail = energy - inPointEnergy;
53  const G4int nspots = int(etail) + 1;
54  const G4double tailEnergy = etail / (G4double)nspots;
55  for (G4int i = 0; i < nspots; ++i) {
56  const G4double radius = param.GetRadius(energy);
57  const G4double z = param.GetZ();
58 
59  const G4double phi = CLHEP::twopi * G4UniformRand();
60  const G4ThreeVector tailPos = pos + z * momDir + radius * std::cos(phi) * ortho + radius * std::sin(phi) * cross;
61 
62  spot.SetEnergy(tailEnergy);
63  spot.SetPosition(tailPos);
64  fHitMaker.make(&spot, &fastTrack);
65  }
66 }
mps_fire.i
i
Definition: mps_fire.py:428
twomass
constexpr double twomass
Definition: LowEnergyFastSimModel.cc:12
MessageLogger.h
pos
Definition: PixelAliasList.h:18
LowEnergyFastSimModel.h
LowEnergyFastSimParam::GetInPointEnergyFraction
G4double GetInPointEnergyFraction(G4double energy) const
Definition: LowEnergyFastSimParam.h:9
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Basic3DVector::cross
Basic3DVector cross(const Basic3DVector &lh) const
Vector product, or "cross" product, with a vector of same type.
Definition: extBasic3DVector.h:203
DDAxes::z
LowEnergyFastSimParam::GetRadius
G4double GetRadius(G4double energy) const
Definition: LowEnergyFastSimParam.h:15
LowEnergyFastSimModel::fEmax
const G4double fEmax
Definition: LowEnergyFastSimModel.h:22
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
cross
Basic3DVector cross(const Basic3DVector &v) const
Vector product, or "cross" product, with a vector of same type.
Definition: Basic3DVectorLD.h:225
LowEnergyFastSimModel::DoIt
void DoIt(const G4FastTrack &fastTrack, G4FastStep &fastStep) override
Definition: LowEnergyFastSimModel.cc:28
edm::ParameterSet
Definition: ParameterSet.h:47
LowEnergyFastSimModel::param
LowEnergyFastSimParam param
Definition: LowEnergyFastSimModel.h:25
HLT_FULL_cff.region
region
Definition: HLT_FULL_cff.py:88338
createfilelist.int
int
Definition: createfilelist.py:10
LowEnergyFastSimParam::GetZ
G4double GetZ() const
Definition: LowEnergyFastSimParam.h:24
DDAxes::phi
LowEnergyFastSimModel::fHitMaker
GFlashHitMaker fHitMaker
Definition: LowEnergyFastSimModel.h:24
LowEnergyFastSimModel::fRegion
const G4Envelope *const fRegion
Definition: LowEnergyFastSimModel.h:23
CosmicsPD_Skims.radius
radius
Definition: CosmicsPD_Skims.py:135
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
LowEnergyFastSimModel::ModelTrigger
G4bool ModelTrigger(const G4FastTrack &fastTrack) override
Definition: LowEnergyFastSimModel.cc:23
LowEnergyFastSimModel::IsApplicable
G4bool IsApplicable(const G4ParticleDefinition &particle) override
Definition: LowEnergyFastSimModel.cc:19
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ParameterSet.h
LowEnergyFastSimModel::LowEnergyFastSimModel
LowEnergyFastSimModel(const G4String &name, G4Region *region, const edm::ParameterSet &parSet)
Definition: LowEnergyFastSimModel.cc:14