gdynamicDigitization
Loading...
Searching...
No Matches
GDynamicDigitization Class Referenceabstract

Abstract base class for dynamic digitization functionality. More...

#include <gdynamicdigitization.h>

Inheritance diagram for GDynamicDigitization:
Inheritance graph
Collaboration diagram for GDynamicDigitization:
Collaboration graph

Public Member Functions

 GDynamicDigitization (const std::shared_ptr< GOptions > &g)
 
virtual ~GDynamicDigitization ()=default
 Virtual destructor.
 
double processStepTime (const std::shared_ptr< GTouchable > &gTouchID, G4Step *thisStep)
 Processes the step time.
 
virtual double processStepTimeImpl (const std::shared_ptr< GTouchable > &gTouchID, G4Step *thisStep)
 Default implementation of processStepTime.
 
std::vector< std::shared_ptr< GTouchable > > processTouchable (std::shared_ptr< GTouchable > gtouchable, G4Step *thisStep)
 Processes a GTouchable based on a G4Step.
 
virtual std::vector< std::shared_ptr< GTouchable > > processTouchableImpl (std::shared_ptr< GTouchable > gtouchable, G4Step *thisStep)
 Processes a GTouchable based on the current G4Step.
 
std::vector< std::shared_ptr< GTouchable > > processGTouchableModifiers (const std::shared_ptr< GTouchable > &gTouchID, const GTouchableModifiers &gmods)
 Processes touchable modifiers.
 
virtual std::vector< std::shared_ptr< GTouchable > > processGTouchableModifiersImpl (const std::shared_ptr< GTouchable > &gTouchID, const GTouchableModifiers &gmods)
 Default implementation for processing touchable modifiers.
 
std::unique_ptr< GTrueInfoData > collectTrueInformation (GHit *ghit, size_t hitn)
 Collects true hit information into a GTrueInfoData object.
 
virtual std::unique_ptr< GTrueInfoData > collectTrueInformationImpl (GHit *ghit, size_t hitn)
 Collects true hit information from a GHit.
 
std::unique_ptr< GDigitizedData > digitizeHit (GHit *ghit, size_t hitn)
 Digitizes hit information into a GDigitizedData object.
 
virtual std::unique_ptr< GDigitizedData > digitizeHitImpl (GHit *ghit, size_t hitn)
 
bool loadConstants (int runno, std::string const &variation)
 Loads digitization constants.
 
virtual bool loadConstantsImpl (int runno, std::string const &variation)
 
bool loadTT (int runno, std::string const &variation)
 Loads the translation table.
 
virtual bool loadTTImpl (int runno, std::string const &variation)
 
void chargeAndTimeAtHardware (int time, int q, const GHit *ghit, GDigitizedData &gdata)
 Sets hardware-level charge and time information in the digitized data.
 
bool defineReadoutSpecs ()
 Pure virtual function to initialize readout specifications.
 
virtual bool defineReadoutSpecsImpl ()=0
 
virtual bool decisionToSkipHit (double energy)
 
void set_loggers (const std::shared_ptr< GOptions > &g)
 Sets the loggers for the digitization process.
 

Static Public Member Functions

static GDynamicDigitizationinstantiate (const dlhandle h, std::shared_ptr< GOptions > g)
 Dynamically instantiates a GDynamicDigitization object from a dynamic library.
 

Data Fields

std::shared_ptr< const GReadoutSpecsreadoutSpecs
 After init, we never mutate these:
 
std::shared_ptr< const GTranslationTable > translationTable
 

Protected Member Functions

void check_if_log_defined () const
 Checks that all required loggers and options are defined.
 

Protected Attributes

std::shared_ptr< GOptions > gopts
 Optional pointer to GOptions.
 

Detailed Description

Definition at line 104 of file gdynamicdigitization.h.

Constructor & Destructor Documentation

◆ GDynamicDigitization()

GDynamicDigitization::GDynamicDigitization ( const std::shared_ptr< GOptions > & g)
inlineexplicit

Definition at line 106 of file gdynamicdigitization.h.

◆ ~GDynamicDigitization()

virtual GDynamicDigitization::~GDynamicDigitization ( )
virtualdefault

Member Function Documentation

◆ chargeAndTimeAtHardware()

void GDynamicDigitization::chargeAndTimeAtHardware ( int time,
int q,
const GHit * ghit,
GDigitizedData & gdata )

Sets charge and time information at the hardware level in a GDigitizedData object.

Sets the gdata variable TIMEATELECTRONICS (used by RunAction to identify eventFrameIndex) and includes the translation table (hardware address: crate/slot/channel) in the digitized data. Exits with an error if the translation table is not defined.

Parameters
timeTime value (ns).
qCharge value.
ghitPointer to the GHit.
gdataPointer to the GDigitizedData - caller keeps ownership.

Checks that the translation table is defined and that the hardware address (from the GHit's TTID) is initialized. Then, it includes the crate, slot, channel, time, and charge in the digitized data.

Parameters
timeTime value (assumed unit: ns).
qCharge value.
ghitPointer to the GHit.
gdataPointer to the GDigitizedData.

Definition at line 73 of file gdynamicdigitization.cc.

◆ check_if_log_defined()

void GDynamicDigitization::check_if_log_defined ( ) const
inlineprotected

If any required logger is missing, prints an error message and exits.

Definition at line 320 of file gdynamicdigitization.h.

◆ collectTrueInformation()

std::unique_ptr< GTrueInfoData > GDynamicDigitization::collectTrueInformation ( GHit * ghit,
size_t hitn )
inline

Integrates all information built in GHit::addHitInfosForBitset.

Parameters
ghitPointer to a GHit.
hitnHit index.
Returns
A pointer to a newly created GTrueInfoData object.

Definition at line 176 of file gdynamicdigitization.h.

◆ collectTrueInformationImpl()

std::unique_ptr< GTrueInfoData > GDynamicDigitization::collectTrueInformationImpl ( GHit * ghit,
size_t hitn )
virtual

Integrates all available information built in GHit::addHitInfosForBitset (such as energy, time, and positions) into a new GTrueInfoData object.

Parameters
ghitPointer to the GHit.
hitnHit index.
Returns
Pointer to a newly allocated GTrueInfoData object.

Definition at line 33 of file gdynamicdigitization.cc.

◆ decisionToSkipHit()

virtual bool GDynamicDigitization::decisionToSkipHit ( double energy)
inlinevirtual

Definition at line 292 of file gdynamicdigitization.h.

◆ defineReadoutSpecs()

bool GDynamicDigitization::defineReadoutSpecs ( )
inline

Must be implemented by derived classes.

Returns
True if initialization is successful, false otherwise.

Definition at line 250 of file gdynamicdigitization.h.

◆ defineReadoutSpecsImpl()

virtual bool GDynamicDigitization::defineReadoutSpecsImpl ( )
pure virtual

◆ digitizeHit()

std::unique_ptr< GDigitizedData > GDynamicDigitization::digitizeHit ( GHit * ghit,
size_t hitn )
inline
Parameters
ghitPointer to a GHit.
hitnHit index.
Returns
A pointer to a GDigitizedData object, or nullptr if not implemented.

Definition at line 191 of file gdynamicdigitization.h.

◆ digitizeHitImpl()

virtual std::unique_ptr< GDigitizedData > GDynamicDigitization::digitizeHitImpl ( GHit * ghit,
size_t hitn )
inlinevirtual

◆ instantiate()

static GDynamicDigitization * GDynamicDigitization::instantiate ( const dlhandle h,
std::shared_ptr< GOptions > g )
inlinestatic
Parameters
hHandle to the dynamic library.
Returns
A pointer to a GDynamicDigitization instance, or nullptr if instantiation fails.

Definition at line 278 of file gdynamicdigitization.h.

◆ loadConstants()

bool GDynamicDigitization::loadConstants ( int runno,
std::string const & variation )
inline
Parameters
runnoRun number.
variationVariation string.
Returns
True if successful, false otherwise.

Definition at line 206 of file gdynamicdigitization.h.

◆ loadConstantsImpl()

virtual bool GDynamicDigitization::loadConstantsImpl ( int runno,
std::string const & variation )
inlinevirtual

Reimplemented in GPlugin_test_example, and GDosimeterDigitization.

Definition at line 212 of file gdynamicdigitization.h.

◆ loadTT()

bool GDynamicDigitization::loadTT ( int runno,
std::string const & variation )
inline
Parameters
runnoRun number.
variationVariation string.
Returns
True if successful, false otherwise.

Definition at line 221 of file gdynamicdigitization.h.

◆ loadTTImpl()

virtual bool GDynamicDigitization::loadTTImpl ( int runno,
std::string const & variation )
inlinevirtual

Reimplemented in GPlugin_test_example.

Definition at line 227 of file gdynamicdigitization.h.

◆ processGTouchableModifiers()

std::vector< std::shared_ptr< GTouchable > > GDynamicDigitization::processGTouchableModifiers ( const std::shared_ptr< GTouchable > & gTouchID,
const GTouchableModifiers & gmods )
inline

This function applies modifiers from a GTouchableModifiers object.

Parameters
gTouchIDPointer to the original GTouchable.
gmodsA GTouchableModifiers object.
Returns
A vector of modified GTouchable pointers.

Definition at line 158 of file gdynamicdigitization.h.

◆ processGTouchableModifiersImpl()

std::vector< std::shared_ptr< GTouchable > > GDynamicDigitization::processGTouchableModifiersImpl ( const std::shared_ptr< GTouchable > & gTouchID,
const GTouchableModifiers & gmods )
virtual

Returns an empty vector; derived classes may override to apply actual modifications.

Parameters
gTouchIDPointer to the original GTouchable.
gmodsA GTouchableModifiers object.
Returns
An empty vector of GTouchable pointers.

Definition at line 212 of file gdynamicdigitization.cc.

◆ processStepTime()

double GDynamicDigitization::processStepTime ( const std::shared_ptr< GTouchable > & gTouchID,
G4Step * thisStep )
inline

Returns the global time from the post-step point of the current G4Step.

Parameters
gTouchIDPointer to the GTouchable.
thisStepPointer to the current G4Step.
Returns
The global time.

Definition at line 122 of file gdynamicdigitization.h.

◆ processStepTimeImpl()

double GDynamicDigitization::processStepTimeImpl ( const std::shared_ptr< GTouchable > & gTouchID,
G4Step * thisStep )
virtual

Returns the global time from the post-step point of the current G4Step.

Parameters
gTouchIDPointer to the GTouchable (unused in this default implementation).
thisStepPointer to the current G4Step.
Returns
The global time.

Definition at line 161 of file gdynamicdigitization.cc.

◆ processTouchable()

std::vector< std::shared_ptr< GTouchable > > GDynamicDigitization::processTouchable ( std::shared_ptr< GTouchable > gtouchable,
G4Step * thisStep )
inline

If the computed time cell index matches the current one (or if it was unset), the original touchable is returned; otherwise, a new touchable is created.

Parameters
gtouchablePointer to the original GTouchable.
thisStepPointer to the current G4Step.
Returns
A vector of GTouchable pointers.

Definition at line 141 of file gdynamicdigitization.h.

◆ processTouchableImpl()

std::vector< std::shared_ptr< GTouchable > > GDynamicDigitization::processTouchableImpl ( std::shared_ptr< GTouchable > gtouchable,
G4Step * thisStep )
virtual

Computes the time cell index using the readout specifications. If the computed index is equal to the current touchable's index (or if not set), assigns it and returns the original touchable. Otherwise, returns a vector with the original touchable and a new one with the updated index.

Parameters
gtouchablePointer to the original GTouchable.
thisStepPointer to the current G4Step.
Returns
A vector of GTouchable pointers.

Definition at line 176 of file gdynamicdigitization.cc.

◆ set_loggers()

void GDynamicDigitization::set_loggers ( const std::shared_ptr< GOptions > & g)
inline
Parameters
gPointer to GOptions.

Definition at line 306 of file gdynamicdigitization.h.

Field Documentation

◆ gopts

std::shared_ptr<GOptions> GDynamicDigitization::gopts
protected

Definition at line 313 of file gdynamicdigitization.h.

◆ readoutSpecs

std::shared_ptr<const GReadoutSpecs> GDynamicDigitization::readoutSpecs

Definition at line 258 of file gdynamicdigitization.h.

◆ translationTable

std::shared_ptr<const GTranslationTable> GDynamicDigitization::translationTable

Definition at line 259 of file gdynamicdigitization.h.


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