Belle II Software development
|
Sensitive Detector implementation of PXD and SVD. More...
#include <SensitiveDetector.h>
Public Member Functions | |
SensitiveDetector (VXD::SensorInfoBase *sensorInfo) | |
Construct instance and take over ownership of the sensorInfo pointer. | |
void | setOptions (bool seeNeutrons, bool onlyPrimaryTrueHits, float distanceTolerance, float electronTolerance, float minimumElectrons) |
Set all common options. | |
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 | |
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 | |
int | saveTrueHit (const SensorTraversal &traversal) override |
Save the actual TrueHit for a given sensor traversal information. | |
int | saveSimHit (const SensorTraversal &traversal, const SensorTraversal::range &points) override |
Save a SimHit for a track along the given points. | |
void | saveRelations (const SensorTraversal &traversal, int trueHitIndex, std::vector< std::pair< unsigned int, float > > simHitIndices) override |
Save the relations between MCParticle, TrueHit and SimHits. | |
std::array< float, 3 > | vecToFloat (const G4ThreeVector &vec) |
Convert G4ThreeVector (aka Hep3Vector) to float array to store in TrueHit/SimHit classes. | |
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 | |
StoreArray< SimHitClass > | m_simhits |
StoreArray for the SimHits. | |
StoreArray< TrueHitClass > | m_truehits |
StoreArray for the TrueHits. | |
StoreArray< MCParticle > | m_mcparticles |
StoreArray for the MCParticles, needed by relations. | |
RelationArray | m_relMCSimHits {m_mcparticles, m_simhits} |
Relation between MCParticle and SimHits. | |
RelationArray | m_relMCTrueHits {m_mcparticles, m_truehits} |
Relation between MCParticle and TrueHits. | |
RelationArray | m_relTrueSimHits {m_truehits, m_simhits} |
Relation between TrueHits and SimHits. | |
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. | |
Sensitive Detector implementation of PXD and SVD.
This class provides the actual implementation of the hit generation for PXD and SVD. It is templated to be able to create the corresponding output collection.
It generates two different kinds of Hits:
SimHitClass | Class to use when generating SimHits |
TrueHitClass | Class to use when generating TrueHits |
Definition at line 64 of file SensitiveDetector.h.
|
explicit |
Construct instance and take over ownership of the sensorInfo pointer.
Definition at line 122 of file SensitiveDetector.h.
|
privateinherited |
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.
|
protectedinherited |
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.
|
privateinherited |
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.
|
inlineinherited |
Return the VxdID belonging to this sensitive detector.
Definition at line 80 of file SensitiveDetectorBase.h.
|
inlineinherited |
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.
|
overrideprivatevirtual |
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 |
Implements SensitiveDetectorBase.
Definition at line 185 of file SensitiveDetector.h.
|
overrideprivatevirtual |
Save a SimHit for a track along the given points.
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 |
Implements SensitiveDetectorBase.
Definition at line 163 of file SensitiveDetector.h.
|
overrideprivatevirtual |
Save the actual TrueHit for a given sensor traversal information.
traversal | information on the particle traversal to be used when creating the TrueHit |
Implements SensitiveDetectorBase.
Definition at line 137 of file SensitiveDetector.h.
|
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.
|
inlineinherited |
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.
|
protectedinherited |
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.
|
overrideprivatevirtualinherited |
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.
|
inlineprivate |
Convert G4ThreeVector (aka Hep3Vector) to float array to store in TrueHit/SimHit classes.
vec | vector to convert |
Definition at line 102 of file SensitiveDetector.h.
|
privateinherited |
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.
|
privateinherited |
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.
|
privateinherited |
Pointer to the SensorInfo associated with this instance.
Definition at line 163 of file SensitiveDetectorBase.h.
|
private |
StoreArray for the MCParticles, needed by relations.
Definition at line 112 of file SensitiveDetector.h.
|
privateinherited |
minimum number of electrons a track must deposit for SimHit/TrueHits to be created
Definition at line 174 of file SensitiveDetectorBase.h.
|
privateinherited |
only create TrueHits for primary particles
Definition at line 179 of file SensitiveDetectorBase.h.
|
private |
Relation between MCParticle and SimHits.
Definition at line 114 of file SensitiveDetector.h.
|
private |
Relation between MCParticle and TrueHits.
Definition at line 116 of file SensitiveDetector.h.
|
private |
Relation between TrueHits and SimHits.
Definition at line 118 of file SensitiveDetector.h.
|
privateinherited |
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.
|
private |
StoreArray for the SimHits.
Definition at line 108 of file SensitiveDetector.h.
|
privateinherited |
Subdetector the class belongs to.
Definition at line 91 of file SensitiveDetectorBase.h.
|
privateinherited |
stack of SensorTraversal information for all tracks not finished so far
Definition at line 165 of file SensitiveDetectorBase.h.
|
private |
StoreArray for the TrueHits.
Definition at line 110 of file SensitiveDetector.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.