CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
LowEnergyFastSimModel Class Reference

#include <LowEnergyFastSimModel.h>

Inheritance diagram for LowEnergyFastSimModel:

Public Member Functions

void DoIt (const G4FastTrack &fastTrack, G4FastStep &fastStep) override
 
G4bool IsApplicable (const G4ParticleDefinition &particle) override
 
 LowEnergyFastSimModel (const G4String &name, G4Region *region, const edm::ParameterSet &parSet)
 
G4bool ModelTrigger (const G4FastTrack &fastTrack) override
 

Private Attributes

G4bool fCheck
 
G4double fEmax
 
GFlashHitMaker fHitMaker
 
LowEnergyFastSimParam fParam
 
const G4Envelope * fRegion
 
G4ThreeVector fTailPos
 
const TrackingActionfTrackingAction
 

Detailed Description

Definition at line 16 of file LowEnergyFastSimModel.h.

Constructor & Destructor Documentation

◆ LowEnergyFastSimModel()

LowEnergyFastSimModel::LowEnergyFastSimModel ( const G4String &  name,
G4Region *  region,
const edm::ParameterSet parSet 
)

Definition at line 16 of file LowEnergyFastSimModel.cc.

17  : G4VFastSimulationModel(name, region),
18  fRegion(region),
19  fTrackingAction(nullptr),
20  fCheck(false),
21  fTailPos(0., 0., 0.) {
22  fEmax = parSet.getParameter<double>("LowEnergyGflashEcalEmax") * CLHEP::GeV;
23 }

References fEmax, edm::ParameterSet::getParameter(), and GeV.

Member Function Documentation

◆ DoIt()

void LowEnergyFastSimModel::DoIt ( const G4FastTrack &  fastTrack,
G4FastStep &  fastStep 
)
override

Definition at line 43 of file LowEnergyFastSimModel.cc.

43  {
44  fastStep.KillPrimaryTrack();
45  fastStep.SetPrimaryTrackPathLength(0.0);
46  G4double energy = fastTrack.GetPrimaryTrack()->GetKineticEnergy();
47 
48  const G4ThreeVector& pos = fastTrack.GetPrimaryTrack()->GetPosition();
49 
50  G4double inPointEnergy = fParam.GetInPointEnergyFraction(energy) * energy;
51 
52  // take into account positron annihilation (not included in in-point)
53  if (-11 == fastTrack.GetPrimaryTrack()->GetDefinition()->GetPDGEncoding())
54  energy += twomass;
55 
56  const G4ThreeVector& momDir = fastTrack.GetPrimaryTrack()->GetMomentumDirection();
57 
58  // in point energy deposition
59  GFlashEnergySpot spot;
60  spot.SetEnergy(inPointEnergy);
61  spot.SetPosition(pos);
62  fHitMaker.make(&spot, &fastTrack);
63 
64  // tail energy deposition
65  G4double etail = energy - inPointEnergy;
66  const G4int nspots = (G4int)(etail) + 1;
67  const G4double tailEnergy = etail / (G4double)nspots;
68  for (G4int i = 0; i < nspots; ++i) {
69  const G4double r = fParam.GetRadius(energy);
70  const G4double z = fParam.GetZ();
71 
72  const G4double phi = CLHEP::twopi * G4UniformRand();
73  fTailPos.set(r * std::cos(phi), r * std::sin(phi), z);
74  fTailPos.rotateUz(momDir);
75  fTailPos += pos;
76 
77  spot.SetEnergy(tailEnergy);
78  spot.SetPosition(fTailPos);
79  fHitMaker.make(&spot, &fastTrack);
80  }
81 }

References funct::cos(), HCALHighEnergyHPDFilter_cfi::energy, fHitMaker, fParam, fTailPos, LowEnergyFastSimParam::GetInPointEnergyFraction(), LowEnergyFastSimParam::GetRadius(), LowEnergyFastSimParam::GetZ(), mps_fire::i, phi, alignCSCRings::r, funct::sin(), twomass, and z.

◆ IsApplicable()

G4bool LowEnergyFastSimModel::IsApplicable ( const G4ParticleDefinition &  particle)
override

Definition at line 25 of file LowEnergyFastSimModel.cc.

25  {
26  return (11 == std::abs(particle.GetPDGEncoding()));
27 }

References funct::abs().

◆ ModelTrigger()

G4bool LowEnergyFastSimModel::ModelTrigger ( const G4FastTrack &  fastTrack)
override

Definition at line 29 of file LowEnergyFastSimModel.cc.

29  {
30  const G4Track* track = fastTrack.GetPrimaryTrack();
31  if (fCheck) {
32  if (nullptr == fTrackingAction) {
33  fTrackingAction = static_cast<const TrackingAction*>(G4EventManager::GetEventManager()->GetUserTrackingAction());
34  }
35  int pdgMother = std::abs(fTrackingAction->geant4Track()->GetDefinition()->GetPDGEncoding());
36  if (pdgMother == 11 || pdgMother == 22)
37  return false;
38  }
39  G4double energy = track->GetKineticEnergy();
40  return (energy < fEmax && fRegion == fastTrack.GetEnvelope());
41 }

References funct::abs(), HCALHighEnergyHPDFilter_cfi::energy, fCheck, fEmax, fRegion, fTrackingAction, TrackingAction::geant4Track(), and HLT_FULL_cff::track.

Member Data Documentation

◆ fCheck

G4bool LowEnergyFastSimModel::fCheck
private

Definition at line 28 of file LowEnergyFastSimModel.h.

Referenced by ModelTrigger().

◆ fEmax

G4double LowEnergyFastSimModel::fEmax
private

Definition at line 25 of file LowEnergyFastSimModel.h.

Referenced by LowEnergyFastSimModel(), and ModelTrigger().

◆ fHitMaker

GFlashHitMaker LowEnergyFastSimModel::fHitMaker
private

Definition at line 30 of file LowEnergyFastSimModel.h.

Referenced by DoIt().

◆ fParam

LowEnergyFastSimParam LowEnergyFastSimModel::fParam
private

Definition at line 31 of file LowEnergyFastSimModel.h.

Referenced by DoIt().

◆ fRegion

const G4Envelope* LowEnergyFastSimModel::fRegion
private

Definition at line 26 of file LowEnergyFastSimModel.h.

Referenced by ModelTrigger().

◆ fTailPos

G4ThreeVector LowEnergyFastSimModel::fTailPos
private

Definition at line 29 of file LowEnergyFastSimModel.h.

Referenced by DoIt().

◆ fTrackingAction

const TrackingAction* LowEnergyFastSimModel::fTrackingAction
private

Definition at line 27 of file LowEnergyFastSimModel.h.

Referenced by ModelTrigger().

mps_fire.i
i
Definition: mps_fire.py:428
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11724
twomass
constexpr G4double twomass
Definition: LowEnergyFastSimModel.cc:14
pos
Definition: PixelAliasList.h:18
LowEnergyFastSimModel::fCheck
G4bool fCheck
Definition: LowEnergyFastSimModel.h:28
TrackingAction::geant4Track
const G4Track * geant4Track() const
Definition: TrackingAction.h:25
LowEnergyFastSimParam::GetInPointEnergyFraction
G4double GetInPointEnergyFraction(G4double energy) const
Definition: LowEnergyFastSimParam.h:9
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
LowEnergyFastSimModel::fParam
LowEnergyFastSimParam fParam
Definition: LowEnergyFastSimModel.h:31
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
DDAxes::z
LowEnergyFastSimParam::GetRadius
G4double GetRadius(G4double energy) const
Definition: LowEnergyFastSimParam.h:15
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
LowEnergyFastSimModel::fEmax
G4double fEmax
Definition: LowEnergyFastSimModel.h:25
GeV
const double GeV
Definition: MathUtil.h:16
HLT_FULL_cff.region
region
Definition: HLT_FULL_cff.py:88286
LowEnergyFastSimParam::GetZ
G4double GetZ() const
Definition: LowEnergyFastSimParam.h:24
LowEnergyFastSimModel::fRegion
const G4Envelope * fRegion
Definition: LowEnergyFastSimModel.h:26
alignCSCRings.r
r
Definition: alignCSCRings.py:93
DDAxes::phi
LowEnergyFastSimModel::fHitMaker
GFlashHitMaker fHitMaker
Definition: LowEnergyFastSimModel.h:30
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
LowEnergyFastSimModel::fTrackingAction
const TrackingAction * fTrackingAction
Definition: LowEnergyFastSimModel.h:27
LowEnergyFastSimModel::fTailPos
G4ThreeVector fTailPos
Definition: LowEnergyFastSimModel.h:29