Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VFastSimSensitiveDetector Class Referenceabstract

Base class for the sensitive detector used within the fast simulation. More...

#include <G4VFastSimSensitiveDetector.hh>

Public Member Functions

G4bool Hit (const G4FastHit *aHit, const G4FastTrack *aTrack, G4TouchableHandle *aTouchable)
 

Detailed Description

Base class for the sensitive detector used within the fast simulation.

Base class for a sensitive detector that allows to store hits created in the fast simulation models. It must me used in addition to inheritance from the usual base class G4VSensitiveDetector for processing of energy deposited in G4Step. ProcessHits(...) method must be implemented and describe how hits should be saved in the hit collections. It is invoked by Hit method which is public and can be called directly in the fast simulation model (if sensitive detector is known to the model), or via the helper class G4FastSimHitMaker that will locate appropriate volume and retrieve its sensitive detector. An extended example extended/parameterisations/Par03 demonstrates how to use G4VFastSimSensitiveDetector to deposit energy from fast simulation and compare it to the detailed simulation.

Definition at line 54 of file G4VFastSimSensitiveDetector.hh.

Member Function Documentation

◆ Hit()

G4bool G4VFastSimSensitiveDetector::Hit ( const G4FastHit aHit,
const G4FastTrack aTrack,
G4TouchableHandle aTouchable 
)
inline

Create a hit.

It checks if G4VSensitiveDetector is also used as a base class, and takes into account the readout geometry, if it is defined. User instruction on how to deposit energy needs to be implemented in ProcessHits method.

Parameters
[in]aHitCreated hit (energy and position)
[in]aTrackFast track with access to particle's track and properties in envelope's local coordinates
[in]aTouchableTouchable with relevant transformations

Definition at line 67 of file G4VFastSimSensitiveDetector.hh.

69 {
70 G4bool result = true;
71 G4VSensitiveDetector* sensDet = dynamic_cast<G4VSensitiveDetector*>(this);
72 if(sensDet == nullptr)
73 {
74 G4Exception("G4VFastSimSensitiveDetector::Hit()", "InvalidSetup",
76 "Sensitive detector needs also to inherit also from "
77 "G4VSensitiveDetector if full "
78 "simulation is used instead!");
79 }
80 if(sensDet->isActive())
81 {
82 G4VReadOutGeometry* ROgeometry = sensDet->GetROgeometry();
83 G4TouchableHistory* ROhistory = 0;
84
85 if(ROgeometry)
86 {
87 // create fake pre-step point updating the touchable from read-out
88 // geometry.
89 G4Step fakeStep;
90 const G4Track* currentTrack = aTrack->GetPrimaryTrack();
91 G4StepPoint* tmpPoint = fakeStep.GetPreStepPoint();
92 tmpPoint->SetTouchableHandle(*aTouchable);
93 tmpPoint->SetPosition(aHit->GetPosition());
94 tmpPoint->SetMomentumDirection(currentTrack->GetMomentumDirection());
95 result = ROgeometry->CheckROVolume(&fakeStep, ROhistory);
96 } else {
97 ROhistory = static_cast<G4TouchableHistory*>((*aTouchable)());
98 }
99 if(result)
100 result = ProcessHits(aHit, aTrack, ROhistory);
101 }
102 else
103 {
104 result = false;
105 }
106 return result;
107 }
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
bool G4bool
Definition: G4Types.hh:86
G4ThreeVector GetPosition() const
Get position.
Definition: G4FastHit.hh:65
const G4Track * GetPrimaryTrack() const
Definition: G4FastTrack.hh:206
void SetTouchableHandle(const G4TouchableHandle &apValue)
void SetPosition(const G4ThreeVector &aValue)
void SetMomentumDirection(const G4ThreeVector &aValue)
Definition: G4Step.hh:62
G4StepPoint * GetPreStepPoint() const
const G4ThreeVector & GetMomentumDirection() const
virtual G4bool CheckROVolume(G4Step *, G4TouchableHistory *&)
G4VReadOutGeometry * GetROgeometry() const

Referenced by G4FastSimHitMaker::make().


The documentation for this class was generated from the following file: