Belle II Software development
|
Base class for Sensitive Detector implementation of PXD and SVD. More...
#include <SensitiveDetectorBase.h>
Public Member Functions | |
SensitiveDetectorBase (SensorInfoBase *info) | |
Constructor. | |
void | setOptions (bool seeNeutrons, bool onlyPrimaryTrueHits, float distanceTolerance, float electronTolerance, float minimumElectrons) |
Set all common options. | |
virtual | ~SensitiveDetectorBase () override |
Destructor freeing the sensor Info. | |
SensorInfoBase * | getSensorInfo () |
Return a pointer to the SensorInfo associated with this instance. | |
VxdID | getSensorID () const |
Return the VxdID belonging to this sensitive detector. | |
Static Public Member Functions | |
static const std::map< std::string, RelationArray::EConsolidationAction > & | getMCParticleRelations () |
Return a list of all registered Relations with MCParticles. | |
static void | setActive (bool activeStatus) |
Enable/Disable all Sensitive Detectors. | |
static void | registerMCParticleRelation (const std::string &name, RelationArray::EConsolidationAction ignoreAction=RelationArray::c_negativeWeight) |
Register an relation involving MCParticles. | |
static void | registerMCParticleRelation (const RelationArray &relation, RelationArray::EConsolidationAction ignoreAction=RelationArray::c_negativeWeight) |
Overload to make it easer to register MCParticle relations. | |
Protected Member Functions | |
virtual int | saveTrueHit (const SensorTraversal &traversal)=0 |
Save the actual TrueHit for this sensor traversal. | |
virtual int | saveSimHit (const SensorTraversal &traversal, const SensorTraversal::range &points)=0 |
Save a SimHit for this track including the given points. | |
virtual void | saveRelations (const SensorTraversal &traversal, int trueHitIndex, std::vector< std::pair< unsigned int, float > > simHitIndices)=0 |
Save the relations between MCParticle, TrueHit and SimHits. | |
std::vector< unsigned int > | simplifyEnergyDeposit (const SensorTraversal::range &points) |
Simplify the energy deposition profile using Douglas-Peuker-Algorithm We normally force a Geant4 step after 5µm but energy deposition does not necessarily vary much between these short steps. | |
StepInformation | findMidPoint (const SensorTraversal &traversal) |
Find the mid-point of the track traversal. | |
Private Member Functions | |
bool | step (G4Step *step, G4TouchableHistory *) override |
Process a single Geant4 Step. | |
bool | finishTrack () |
Process a track once all steps are known. | |
std::vector< std::pair< unsigned int, float > > | createSimHits () |
Determine which SimHits to create. | |
virtual bool | ProcessHits (G4Step *aStep, G4TouchableHistory *aROhist) |
Check if recording hits is enabled and if so call step() and set the correct MCParticle flag. | |
Private Attributes | |
SensorInfoBase * | m_info {0} |
Pointer to the SensorInfo associated with this instance. | |
std::stack< SensorTraversal > | m_tracks |
stack of SensorTraversal information for all tracks not finished so far | |
float | m_distanceTolerance {0} |
maximum distance between step point and linear interpolation of sensor traversal before a new simhit object is created | |
float | m_electronTolerance {0} |
maximum relative difference between electron density of two steps where they can be considered similar enough to be merged | |
float | m_minimumElectrons {0} |
minimum number of electrons a track must deposit for SimHit/TrueHits to be created | |
bool | m_seeNeutrons {false} |
also create SimHit/TrueHit objects for neutrons (or charged particles which deposit less than m_minimumElectrons electrons | |
bool | m_onlyPrimaryTrueHits {false} |
only create TrueHits for primary particles | |
Const::EDetector | m_subdetector |
Subdetector the class belongs to. | |
Static Private Attributes | |
static std::map< std::string, RelationArray::EConsolidationAction > | s_mcRelations |
Static set holding all relations which have to be updated at the end of the Event. | |
static bool | s_active |
Static bool which indicates wether recording of hits is enabled. | |
Base class for Sensitive Detector implementation of PXD and SVD.
This base class provides common access to sensor information (like transformation) and performs the the collection of energy depositing when particles cross the sensor. Most of the calculations are contained here while the detector dependent hit and relation creation is delegated to the derived VXD::SensitiveDetector<SimHitClass, TrueHitClass>.
Definition at line 37 of file SensitiveDetectorBase.h.
|
inlineexplicit |
Constructor.
info | pointer to a valid SensorInfo instance providing information about the sensor this sensitive detector instance will handle. Ownership of the SensorInfo goes to the sensitive detector instance |
Definition at line 45 of file SensitiveDetectorBase.h.
|
inlineoverridevirtual |
Destructor freeing the sensor Info.
Reimplemented from SensitiveDetectorBase.
Definition at line 71 of file SensitiveDetectorBase.h.
|
private |
Determine which SimHits to create.
A SimHit is a linear approximation of the particle trajectory. As such we try to combine as many Geant4 steps as possible by defining a distance tolerance and using the Douglas-Peucker algortihm to determine the required number of SimHits to keep the maximum distance of all Geant4 steps below that tolerance.
Definition at line 126 of file SensitiveDetectorBase.cc.
|
protected |
Find the mid-point of the track traversal.
This function will return the position and momentum at the center of the track traversal, using cubic spline interpolation between the actual geant4 steps. Center is defined as "half the flight length" in this case.
traversal | information on the particle traversal to be used when finding the midpoint |
Definition at line 274 of file SensitiveDetectorBase.cc.
|
private |
Process a track once all steps are known.
This function decides whether TrueHit/SimHits will be saved
Definition at line 94 of file SensitiveDetectorBase.cc.
|
inlinestaticinherited |
Return a list of all registered Relations with MCParticles.
Definition at line 42 of file SensitiveDetectorBase.h.
|
inline |
Return the VxdID belonging to this sensitive detector.
Definition at line 80 of file SensitiveDetectorBase.h.
|
inline |
Return a pointer to the SensorInfo associated with this instance.
Definition at line 77 of file SensitiveDetectorBase.h.
|
inlineprivatevirtualinherited |
Check if recording hits is enabled and if so call step() and set the correct MCParticle flag.
Called by Geant4 for each step inside the sensitive volumes attached
Definition at line 94 of file SensitiveDetectorBase.h.
|
inlinestaticinherited |
Overload to make it easer to register MCParticle relations.
relation | RelationArray to register |
ignoreAction |
Definition at line 66 of file SensitiveDetectorBase.h.
|
staticinherited |
Register an relation involving MCParticles.
All Relations which point from an MCParticle to something have to be registered with addMCParticleRelation() because the index of the MCParticles might change at the end of the event. During simulation, the TrackID should be used as index of the MCParticle
name | Name of the relation to register |
ignoreAction |
Definition at line 22 of file SensitiveDetectorBase.cc.
|
protectedpure virtual |
Save the relations between MCParticle, TrueHit and SimHits.
traversal | information on the particle traversal to be used when creating the Relations |
trueHitIndex | index of the TrueHit, <0 if no TrueHit was created |
simHitIndices | indices of the SimHits along with the number of electrons deposited in each SimHit |
Implemented in SensitiveDetector< SimHitClass, TrueHitClass >.
|
protectedpure virtual |
Save a SimHit for this track including the given points.
This function depends on the actual SimHit implementation and is implemented in VXD::SensitiveDetector.
traversal | information on the particle traversal to be used when creating the SimHit |
points | pair of iterators to the first and last step position to be used for the SimHit |
Implemented in SensitiveDetector< SimHitClass, TrueHitClass >.
|
protectedpure virtual |
Save the actual TrueHit for this sensor traversal.
This function depends on the actual TrueHit implementation and is implemented in VXD::SensitiveDetector.
traversal | information on the particle traversal to be used when creating the TrueHit |
Implemented in SensitiveDetector< SimHitClass, TrueHitClass >.
|
inlinestaticinherited |
Enable/Disable all Sensitive Detectors.
By default, all sensitive detectors won't create hits to make it possible to use the Geant4 Navigator for non-simulation purposes. Only during simulation the sensitive detectors will be enabled to record hits
activeStatus | bool to indicate wether hits should be recorded |
Definition at line 50 of file SensitiveDetectorBase.h.
|
inline |
Set all common options.
seeNeutrons | if true, simhits are also stored for neutrons |
onlyPrimaryTrueHits | if true, truehits will only be created for primary particles |
distanceTolerance | maximal distance of step position from linear approximation. |
electronTolerance | maximum deviation of energy deposition from linear approximation in electrons |
minimumElectrons | minimum number of electrons to be deposited before SimHits are created. |
Definition at line 60 of file SensitiveDetectorBase.h.
|
protected |
Simplify the energy deposition profile using Douglas-Peuker-Algorithm We normally force a Geant4 step after 5µm but energy deposition does not necessarily vary much between these short steps.
Saving all steps would be a waste of space so we define a tolerance (in electrons) and keep only the points needed so that no point is further away from the profile than this tolerance.
points | pair of iterators to the first and last point of the energy deposition profile |
Definition at line 183 of file SensitiveDetectorBase.cc.
|
overrideprivatevirtual |
Process a single Geant4 Step.
This function stores the necessary information to create the TrueHits and SimHits and will call finishTrack() if a track leaves the volume or is stopped inside the volume.
Implements SensitiveDetectorBase.
Definition at line 28 of file SensitiveDetectorBase.cc.
|
private |
maximum distance between step point and linear interpolation of sensor traversal before a new simhit object is created
Definition at line 168 of file SensitiveDetectorBase.h.
|
private |
maximum relative difference between electron density of two steps where they can be considered similar enough to be merged
Definition at line 171 of file SensitiveDetectorBase.h.
|
private |
Pointer to the SensorInfo associated with this instance.
Definition at line 163 of file SensitiveDetectorBase.h.
|
private |
minimum number of electrons a track must deposit for SimHit/TrueHits to be created
Definition at line 174 of file SensitiveDetectorBase.h.
|
private |
only create TrueHits for primary particles
Definition at line 179 of file SensitiveDetectorBase.h.
|
private |
also create SimHit/TrueHit objects for neutrons (or charged particles which deposit less than m_minimumElectrons electrons
Definition at line 177 of file SensitiveDetectorBase.h.
|
privateinherited |
Subdetector the class belongs to.
Definition at line 91 of file SensitiveDetectorBase.h.
|
private |
stack of SensorTraversal information for all tracks not finished so far
Definition at line 165 of file SensitiveDetectorBase.h.
|
staticprivateinherited |
Static bool which indicates wether recording of hits is enabled.
Definition at line 89 of file SensitiveDetectorBase.h.
|
staticprivateinherited |
Static set holding all relations which have to be updated at the end of the Event.
Definition at line 87 of file SensitiveDetectorBase.h.