CMS 3D CMS Logo

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

#include <ElectronLimiter.h>

Inheritance diagram for ElectronLimiter:

Public Member Functions

 ElectronLimiter (const edm::ParameterSet &, const G4ParticleDefinition *)
 
void InitialiseProcess (const G4ParticleDefinition *) override
 
G4bool IsApplicable (const G4ParticleDefinition &) override
 
G4VParticleChange * PostStepDoIt (const G4Track &, const G4Step &) override
 
G4double PostStepGetPhysicalInteractionLength (const G4Track &track, G4double previousStepSize, G4ForceCondition *condition) override
 
void SetFieldCheckFlag (G4bool)
 
void SetRangeCheckFlag (G4bool)
 
void SetTrackingCutPerRegion (std::vector< const G4Region *> &, std::vector< G4double > &, std::vector< G4double > &, std::vector< G4double > &)
 
void StartTracking (G4Track *) override
 
 ~ElectronLimiter () override
 

Private Attributes

std::vector< G4double > energyLimits_
 
std::vector< G4double > factors_
 
G4bool fieldCheckFlag_
 
G4VEnergyLossProcess * ionisation_
 
G4bool killTrack_
 
G4double minStepLimit_
 
G4int nRegions_
 
const G4ParticleDefinition * particle_
 
G4bool rangeCheckFlag_
 
std::vector< const G4Region * > regions_
 
std::vector< G4double > rms_
 
CMSTrackingCutModeltrcut_
 

Detailed Description

Definition at line 23 of file ElectronLimiter.h.

Constructor & Destructor Documentation

◆ ElectronLimiter()

ElectronLimiter::ElectronLimiter ( const edm::ParameterSet p,
const G4ParticleDefinition *  part 
)
explicit

Definition at line 19 of file ElectronLimiter.cc.

References minStepLimit_, AlCaHLTBitMon_ParallelJobs::p, and trcut_.

20  : G4VEmProcess("eLimiter", fGeneral),
21  ionisation_(nullptr),
22  particle_(part),
23  nRegions_(0),
24  rangeCheckFlag_(false),
25  fieldCheckFlag_(false),
26  killTrack_(false) {
27  // set Process Sub Type
28  SetProcessSubType(static_cast<int>(STEP_LIMITER));
29  minStepLimit_ = p.getParameter<double>("MinStepLimit") * CLHEP::mm;
31 }
const G4ParticleDefinition * particle_
CMSTrackingCutModel * trcut_
G4double minStepLimit_
G4VEnergyLossProcess * ionisation_
part
Definition: HCALResponse.h:20

◆ ~ElectronLimiter()

ElectronLimiter::~ElectronLimiter ( )
override

Definition at line 33 of file ElectronLimiter.cc.

References trcut_.

33 { delete trcut_; }
CMSTrackingCutModel * trcut_

Member Function Documentation

◆ InitialiseProcess()

void ElectronLimiter::InitialiseProcess ( const G4ParticleDefinition *  )
override

Definition at line 35 of file ElectronLimiter.cc.

References fieldCheckFlag_, ionisation_, nRegions_, particle_, and rangeCheckFlag_.

35  {
36  G4LossTableManager *lManager = G4LossTableManager::Instance();
37  if (rangeCheckFlag_) {
38  ionisation_ = lManager->GetEnergyLossProcess(particle_);
39  if (!ionisation_) {
40  rangeCheckFlag_ = false;
41  }
42  }
43  AddEmModel(0, new G4DummyModel());
44 
45  if (lManager->IsMaster()) {
46  edm::LogVerbatim("SimG4CoreApplication")
47  << "ElectronLimiter::BuildPhysicsTable for " << particle_->GetParticleName() << " ioni: " << ionisation_
48  << " rangeCheckFlag: " << rangeCheckFlag_ << " fieldCheckFlag: " << fieldCheckFlag_ << " " << nRegions_
49  << " regions for tracking cuts\n";
50  }
51 }
Log< level::Info, true > LogVerbatim
const G4ParticleDefinition * particle_
G4VEnergyLossProcess * ionisation_

◆ IsApplicable()

G4bool ElectronLimiter::IsApplicable ( const G4ParticleDefinition &  )
override

Definition at line 107 of file ElectronLimiter.cc.

107 { return true; }

◆ PostStepDoIt()

G4VParticleChange * ElectronLimiter::PostStepDoIt ( const G4Track &  aTrack,
const G4Step &   
)
override

Definition at line 96 of file ElectronLimiter.cc.

References killTrack_, CMSTrackingCutModel::SampleEnergyDepositEcal(), and trcut_.

96  {
97  fParticleChange.Initialize(aTrack);
98  if (killTrack_) {
99  fParticleChange.ProposeTrackStatus(fStopAndKill);
100  G4double edep = trcut_->SampleEnergyDepositEcal(aTrack.GetKineticEnergy());
101  fParticleChange.ProposeLocalEnergyDeposit(edep);
102  fParticleChange.SetProposedKineticEnergy(0.0);
103  }
104  return &fParticleChange;
105 }
CMSTrackingCutModel * trcut_
virtual G4double SampleEnergyDepositEcal(G4double kinEnergy)

◆ PostStepGetPhysicalInteractionLength()

G4double ElectronLimiter::PostStepGetPhysicalInteractionLength ( const G4Track &  track,
G4double  previousStepSize,
G4ForceCondition *  condition 
)
override

Definition at line 53 of file ElectronLimiter.cc.

References energyLimits_, factors_, fieldCheckFlag_, mps_fire::i, CMSTrackingCutModel::InitialiseForStep(), ionisation_, killTrack_, lut2db_cfg::limit, SiStripPI::min, minStepLimit_, nRegions_, isotrackApplyRegressor::range, rangeCheckFlag_, regions_, rms_, and trcut_.

55  {
56  *condition = NotForced;
57  G4double limit = DBL_MAX;
58  killTrack_ = false;
59 
60  G4double kinEnergy = aTrack.GetKineticEnergy();
61  if (0 < nRegions_) {
62  if (regions_[0] == nullptr) {
63  if (kinEnergy < energyLimits_[0]) {
64  killTrack_ = true;
66  limit = 0.0;
67  }
68  } else {
69  const G4Region *reg = aTrack.GetVolume()->GetLogicalVolume()->GetRegion();
70  for (G4int i = 0; i < nRegions_; ++i) {
71  if (reg == regions_[i] && kinEnergy < energyLimits_[i]) {
72  killTrack_ = true;
74  limit = 0.0;
75  break;
76  }
77  }
78  }
79  }
80  if (!killTrack_ && rangeCheckFlag_) {
81  G4double safety = aTrack.GetStep()->GetPreStepPoint()->GetSafety();
82  if (safety > std::min(minStepLimit_, previousLimit)) {
83  G4double range = ionisation_->GetRange(kinEnergy, aTrack.GetMaterialCutsCouple());
84  if (safety >= range) {
85  killTrack_ = true;
86  limit = 0.0;
87  }
88  }
89  }
90  if (!killTrack_ && fieldCheckFlag_) {
92  }
93  return limit;
94 }
CMSTrackingCutModel * trcut_
std::vector< G4double > rms_
G4double minStepLimit_
void InitialiseForStep(G4double fac, G4double rms)
G4VEnergyLossProcess * ionisation_
std::vector< const G4Region * > regions_
std::vector< G4double > energyLimits_
std::vector< G4double > factors_

◆ SetFieldCheckFlag()

void ElectronLimiter::SetFieldCheckFlag ( G4bool  val)
inline

◆ SetRangeCheckFlag()

void ElectronLimiter::SetRangeCheckFlag ( G4bool  val)
inline

◆ SetTrackingCutPerRegion()

void ElectronLimiter::SetTrackingCutPerRegion ( std::vector< const G4Region *> &  reg,
std::vector< G4double > &  cut,
std::vector< G4double > &  fac,
std::vector< G4double > &  rms 
)

Definition at line 111 of file ElectronLimiter.cc.

References DMR_cfg::cut, energyLimits_, factors_, nRegions_, regions_, SiStripPI::rms, and rms_.

Referenced by ParametrisedEMPhysics::ConstructProcess().

114  {
115  nRegions_ = reg.size();
116  if (nRegions_ > 0) {
117  regions_ = reg;
118  energyLimits_ = cut;
119  factors_ = fac;
120  rms_ = rms;
121  }
122 }
std::vector< G4double > rms_
std::vector< const G4Region * > regions_
std::vector< G4double > energyLimits_
std::vector< G4double > factors_

◆ StartTracking()

void ElectronLimiter::StartTracking ( G4Track *  )
override

Definition at line 109 of file ElectronLimiter.cc.

109 {}

Member Data Documentation

◆ energyLimits_

std::vector<G4double> ElectronLimiter::energyLimits_
private

◆ factors_

std::vector<G4double> ElectronLimiter::factors_
private

◆ fieldCheckFlag_

G4bool ElectronLimiter::fieldCheckFlag_
private

◆ ionisation_

G4VEnergyLossProcess* ElectronLimiter::ionisation_
private

Definition at line 51 of file ElectronLimiter.h.

Referenced by InitialiseProcess(), and PostStepGetPhysicalInteractionLength().

◆ killTrack_

G4bool ElectronLimiter::killTrack_
private

Definition at line 65 of file ElectronLimiter.h.

Referenced by PostStepDoIt(), and PostStepGetPhysicalInteractionLength().

◆ minStepLimit_

G4double ElectronLimiter::minStepLimit_
private

Definition at line 60 of file ElectronLimiter.h.

Referenced by ElectronLimiter(), and PostStepGetPhysicalInteractionLength().

◆ nRegions_

G4int ElectronLimiter::nRegions_
private

◆ particle_

const G4ParticleDefinition* ElectronLimiter::particle_
private

Definition at line 53 of file ElectronLimiter.h.

Referenced by InitialiseProcess().

◆ rangeCheckFlag_

G4bool ElectronLimiter::rangeCheckFlag_
private

◆ regions_

std::vector<const G4Region *> ElectronLimiter::regions_
private

◆ rms_

std::vector<G4double> ElectronLimiter::rms_
private

◆ trcut_

CMSTrackingCutModel* ElectronLimiter::trcut_
private