ATLAS Offline Software
Public Member Functions | Protected Attributes | List of all members
StoppedParticleFastSim Class Reference

#include <StoppedParticleFastSim.h>

Inheritance diagram for StoppedParticleFastSim:
Collaboration diagram for StoppedParticleFastSim:

Public Member Functions

 StoppedParticleFastSim (const std::string &name, G4Region *region, const std::string &fsSDname)
 
 ~StoppedParticleFastSim ()
 
G4bool IsApplicable (const G4ParticleDefinition &) override final
 
virtual G4bool ModelTrigger (const G4FastTrack &) override final
 
void DoIt (const G4FastTrack &, G4FastStep &) override final
 

Protected Attributes

TrackFastSimSDm_fsSD {}
 
bool m_init {false}
 
std::string m_fsSDname {""}
 

Detailed Description

Definition at line 17 of file StoppedParticleFastSim.h.

Constructor & Destructor Documentation

◆ StoppedParticleFastSim()

StoppedParticleFastSim::StoppedParticleFastSim ( const std::string &  name,
G4Region *  region,
const std::string &  fsSDname 
)

Definition at line 24 of file StoppedParticleFastSim.cxx.

25  : G4VFastSimulationModel(name, region)
26  , m_fsSDname(fsSDname)
27 {
28 }

◆ ~StoppedParticleFastSim()

StoppedParticleFastSim::~StoppedParticleFastSim ( )
inline

Definition at line 22 of file StoppedParticleFastSim.h.

22 {}

Member Function Documentation

◆ DoIt()

void StoppedParticleFastSim::DoIt ( const G4FastTrack &  fastTrack,
G4FastStep &  fastStep 
)
finaloverride

Definition at line 57 of file StoppedParticleFastSim.cxx.

58 {
59  if (!m_init){
60  m_init = true;
61 
62  G4SDManager *sdm = G4SDManager::GetSDMpointer();
63  G4VSensitiveDetector * vsd = sdm->FindSensitiveDetector( m_fsSDname );
64  if (vsd) {
65  m_fsSD = dynamic_cast<TrackFastSimSD*>(vsd);
66  if (!m_fsSD) {
67  G4ExceptionDescription description;
68  description << "DoIt: Could not cast the SD into an instance of TrackFasSimSD.";
69  G4Exception("StoppedParticleFastSim", "MissingTrackFastSimSD", FatalException, description);
70  abort();
71  }
72  }
73  else {
74  G4cout << "StoppedParticleFastSim::DoIt INFO Could not get TrackFastSimSD sensitive detector. If you are not writing track records this is expected." << G4endl;
75  }
76  // found the SD
77  } // End of lazy init
78  const int id = fastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetDefinition()->GetPDGEncoding();
79  if (m_fsSD &&
80  (MC::isSquarkLH(id) ||
81  id == 1000021 || // gluino
82  MC::isRHadron(id))) {
83  m_fsSD->WriteTrack( fastTrack.GetPrimaryTrack() , false , true );
84  }
85  fastStep.KillPrimaryTrack();
86 }

◆ IsApplicable()

G4bool StoppedParticleFastSim::IsApplicable ( const G4ParticleDefinition &  )
finaloverride

Definition at line 30 of file StoppedParticleFastSim.cxx.

31 {
32  return true;
33 }

◆ ModelTrigger()

G4bool StoppedParticleFastSim::ModelTrigger ( const G4FastTrack &  fastTrack)
finaloverridevirtual

Definition at line 35 of file StoppedParticleFastSim.cxx.

36 {
37  // Trigger if the energy is below our threshold or if the time is over 150 ns
38  int id = fastTrack.GetPrimaryTrack()->GetDynamicParticle()->GetDefinition()->GetPDGEncoding();
39  if (id<1000000 || id>1100000) return true; // skip SM particles and super-partners of RH-fermions
40  if (MC::isSquarkLH(id) ||
41  id == 1000021 || // gluino
42  MC::isRHadron(id)) {
43  G4Material * mat = fastTrack.GetPrimaryTrack()->GetMaterial();
44  double minA=1500000.;
45  for (unsigned int i=0;i<mat->GetNumberOfElements();++i){
46  if (mat->GetElement(i) &&
47  minA>mat->GetElement(i)->GetN()){
48  minA=mat->GetElement(i)->GetN();
49  }
50  }
51  if (fastTrack.GetPrimaryTrack()->GetVelocity()<0.15*std::pow(minA,-2./3.)*CLHEP::c_light) return true;
52  return false;
53  }
54  return true;
55 }

Member Data Documentation

◆ m_fsSD

TrackFastSimSD* StoppedParticleFastSim::m_fsSD {}
protected

Definition at line 31 of file StoppedParticleFastSim.h.

◆ m_fsSDname

std::string StoppedParticleFastSim::m_fsSDname {""}
protected

Definition at line 33 of file StoppedParticleFastSim.h.

◆ m_init

bool StoppedParticleFastSim::m_init {false}
protected

Definition at line 32 of file StoppedParticleFastSim.h.


The documentation for this class was generated from the following files:
StoppedParticleFastSim::m_fsSD
TrackFastSimSD * m_fsSD
Definition: StoppedParticleFastSim.h:31
TrackFastSimSD
Definition: TrackFastSimSD.h:24
mat
GeoMaterial * mat
Definition: LArDetectorConstructionTBEC.cxx:55
StoppedParticleFastSim::m_fsSDname
std::string m_fsSDname
Definition: StoppedParticleFastSim.h:33
StoppedParticleFastSim::m_init
bool m_init
Definition: StoppedParticleFastSim.h:32
lumiFormat.i
int i
Definition: lumiFormat.py:85
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
python.PhysicalConstants.c_light
float c_light
Definition: PhysicalConstants.py:73
TrackFastSimSD::WriteTrack
void WriteTrack(const G4Track *, const bool, const bool)
Definition: TrackFastSimSD.cxx:97
isSquarkLH
bool isSquarkLH(const T &p)
Definition: AtlasPID.h:463
isRHadron
bool isRHadron(const T &p)
Definition: AtlasPID.h:600
pow
constexpr int pow(int base, int exp) noexcept
Definition: ap_fixedTest.cxx:15
description
std::string description
glabal timer - how long have I taken so far?
Definition: hcg.cxx:88