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

Abstract base class for dynamically loaded digitization plugins. More...

#include <gdynamicdigitization.h>

Public Member Functions

 GDynamicDigitization (const std::shared_ptr< GOptions > &g)
 Constructs the digitization base object.
 
virtual ~GDynamicDigitization ()=default
 Virtual destructor.
 
double processStepTime (const std::shared_ptr< GTouchable > &gTouchID, G4Step *thisStep)
 Computes the time associated with a simulation step for electronics binning.
 
virtual double processStepTimeImpl (const std::shared_ptr< GTouchable > &gTouchID, G4Step *thisStep)
 Implementation hook for step time computation.
 
std::vector< std::shared_ptr< GTouchable > > processTouchable (std::shared_ptr< GTouchable > gtouchable, G4Step *thisStep)
 Processes a touchable based on the current step and readout specs.
 
virtual std::vector< std::shared_ptr< GTouchable > > processTouchableImpl (std::shared_ptr< GTouchable > gtouchable, G4Step *thisStep)
 Implementation hook for touchable processing.
 
std::vector< std::shared_ptr< GTouchable > > processGTouchableModifiers (const std::shared_ptr< GTouchable > &gTouchID, const GTouchableModifiers &gmods)
 Applies touchable modifiers.
 
virtual std::vector< std::shared_ptr< GTouchable > > processGTouchableModifiersImpl (const std::shared_ptr< GTouchable > &gTouchID, const GTouchableModifiers &gmods)
 Implementation hook for touchable modifier application.
 
std::unique_ptr< GTrueInfoDatacollectTrueInformation (GHit *ghit, size_t hitn)
 Collects standardized “true hit information” into a GTrueInfoData record.
 
virtual std::unique_ptr< GTrueInfoDatacollectTrueInformationImpl (GHit *ghit, size_t hitn)
 Implementation hook for true-information collection.
 
std::unique_ptr< GDigitizedDatadigitizeHit (GHit *ghit, size_t hitn)
 Digitizes a hit into a GDigitizedData record.
 
virtual std::unique_ptr< GDigitizedDatadigitizeHitImpl (GHit *ghit, size_t hitn)
 Implementation hook for hit digitization.
 
bool loadConstants (int runno, std::string const &variation)
 Loads digitization constants (calibration/configuration).
 
virtual bool loadConstantsImpl (int runno, std::string const &variation)
 Implementation hook for constant loading.
 
bool loadTT (int runno, std::string const &variation)
 Loads the translation table (identity -> electronics address).
 
virtual bool loadTTImpl (int runno, std::string const &variation)
 Implementation hook for translation table loading.
 
void chargeAndTimeAtHardware (int time, int q, const GHit *ghit, GDigitizedData &gdata)
 Adds hardware-level time/charge and address fields to a digitized record.
 
bool defineReadoutSpecs ()
 Initializes readout specifications.
 
virtual bool defineReadoutSpecsImpl ()=0
 Implementation hook to define readout specs.
 
virtual bool decisionToSkipHit (double energy)
 Decides whether a hit should be skipped based on deposited energy.
 
void set_loggers (const std::shared_ptr< GOptions > &g)
 Sets the options pointer required by the digitization base.
 
- Public Member Functions inherited from GBase< GDynamicDigitization >
 GBase (const std::shared_ptr< GOptions > &gopt, std::string logger_name="")
 
 GBase (const std::shared_ptr< GLogger > &logger)
 
 GBase (const GBase &)=default
 
 GBase (GBase &&) noexcept=default
 
virtual ~GBase ()
 
GBaseoperator= (const GBase &)=default
 
GBaseoperator= (GBase &&) noexcept=default
 

Static Public Member Functions

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

Data Fields

std::shared_ptr< const GReadoutSpecsreadoutSpecs
 Readout specs are created during initialization and treated as immutable.
 
std::shared_ptr< const GTranslationTabletranslationTable
 Translation table is typically loaded during initialization and treated as immutable.
 

Protected Member Functions

void check_if_log_defined () const
 Ensures options/logging are configured before plugin methods run.
 

Protected Attributes

std::shared_ptr< GOptionsgopts
 Options used by the digitization plugin instance.
 
- Protected Attributes inherited from GBase< GDynamicDigitization >
std::shared_ptr< GLoggerlog
 

Detailed Description

Plugins typically implement:

They may additionally override:

Definition at line 159 of file gdynamicdigitization.h.

Constructor & Destructor Documentation

◆ GDynamicDigitization()

GDynamicDigitization::GDynamicDigitization ( const std::shared_ptr< GOptions > & g)
inlineexplicit
Parameters
gOptions used by this plugin instance.

Definition at line 167 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 )

This routine inserts:

  • crate/slot/channel from the translation table
  • TIMEATELECTRONICS and CHARGEATELECTRONICS
Parameters
timeTime value (time unit follows project conventions; often ns).
qCharge value (ADC-like integer).
ghitInput hit providing the translation-table id.
gdataDigitized record to augment (caller retains ownership).

Definition at line 58 of file gdynamicdigitization.cc.

◆ check_if_log_defined()

void GDynamicDigitization::check_if_log_defined ( ) const
inlineprotected

If options are not set, prints an error message and exits.

Definition at line 468 of file gdynamicdigitization.h.

◆ collectTrueInformation()

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

Wrapper that logs/checks and delegates to collectTrueInformationImpl().

Parameters
ghitInput hit from the sensitive detector.
hitnSequential hit index.
Returns
Newly created true-information record.

Definition at line 268 of file gdynamicdigitization.h.

◆ collectTrueInformationImpl()

std::unique_ptr< GTrueInfoData > GDynamicDigitization::collectTrueInformationImpl ( GHit * ghit,
size_t hitn )
virtual
Parameters
ghitInput hit.
hitnSequential hit index.
Returns
Newly created true-information record.

Definition at line 24 of file gdynamicdigitization.cc.

◆ decisionToSkipHit()

virtual bool GDynamicDigitization::decisionToSkipHit ( double energy)
inlinevirtual

Default behavior skips hits with exactly zero energy if the recordZeroEdep option is disabled.

Parameters
energyTotal deposited energy for the hit.
Returns
true if the hit should be skipped.

Definition at line 437 of file gdynamicdigitization.h.

◆ defineReadoutSpecs()

bool GDynamicDigitization::defineReadoutSpecs ( )
inline

Wrapper that logs/checks and delegates to defineReadoutSpecsImpl().

Returns
true on success.

Definition at line 387 of file gdynamicdigitization.h.

◆ defineReadoutSpecsImpl()

virtual bool GDynamicDigitization::defineReadoutSpecsImpl ( )
pure virtual

Must be implemented by derived classes.

Returns
true on success.

Implemented in GPlugin_test_example, GFluxDigitization, GParticleCounterDigitization, and GDosimeterDigitization.

◆ digitizeHit()

std::unique_ptr< GDigitizedData > GDynamicDigitization::digitizeHit ( GHit * ghit,
size_t hitn )
inline

Wrapper that logs/checks and delegates to digitizeHitImpl().

Parameters
ghitInput hit from the sensitive detector.
hitnSequential hit index.
Returns
Newly created digitized record (or nullptr if not implemented).

Definition at line 293 of file gdynamicdigitization.h.

◆ digitizeHitImpl()

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

Default implementation returns nullptr to indicate "not implemented".

Parameters
ghitInput hit.
hitnSequential hit index.
Returns
Newly created digitized record, or nullptr.

Reimplemented in GPlugin_test_example, GFluxDigitization, GParticleCounterDigitization, and GDosimeterDigitization.

Definition at line 308 of file gdynamicdigitization.h.

◆ instantiate()

static GDynamicDigitization * GDynamicDigitization::instantiate ( const dlhandle h,
std::shared_ptr< GOptions > g )
inlinestatic

This function looks up the GDynamicDigitizationFactory symbol and calls it.

Parameters
hDynamic library handle.
gOptions to pass to the plugin instance.
Returns
Newly created plugin instance, or nullptr on failure.

Definition at line 417 of file gdynamicdigitization.h.

◆ loadConstants()

bool GDynamicDigitization::loadConstants ( int runno,
std::string const & variation )
inline

Wrapper that logs/checks and delegates to loadConstantsImpl().

Parameters
runnoRun number.
variationVariation string.
Returns
true on success.

Definition at line 320 of file gdynamicdigitization.h.

◆ loadConstantsImpl()

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

Default implementation does nothing and returns true.

Parameters
runnoRun number.
variationVariation string.
Returns
true on success.

Reimplemented in GPlugin_test_example, and GDosimeterDigitization.

Definition at line 335 of file gdynamicdigitization.h.

◆ loadTT()

bool GDynamicDigitization::loadTT ( int runno,
std::string const & variation )
inline

Wrapper that logs/checks and delegates to loadTTImpl().

Parameters
runnoRun number.
variationVariation string.
Returns
true on success.

Definition at line 348 of file gdynamicdigitization.h.

◆ loadTTImpl()

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

Default implementation does nothing and returns true.

Parameters
runnoRun number.
variationVariation string.
Returns
true on success.

Reimplemented in GPlugin_test_example.

Definition at line 364 of file gdynamicdigitization.h.

◆ processGTouchableModifiers()

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

Wrapper that logs/checks and delegates to processGTouchableModifiersImpl().

Parameters
gTouchIDInput touchable to modify.
gmodsModifier container describing how to modify touchables.
Returns
A vector of modified touchables (possibly empty).

Definition at line 239 of file gdynamicdigitization.h.

◆ processGTouchableModifiersImpl()

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

Default implementation returns an empty vector (no modifiers applied).

Parameters
gTouchIDInput touchable.
gmodsModifier container.
Returns
Modified touchables (default: empty).

Definition at line 156 of file gdynamicdigitization.cc.

◆ processStepTime()

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

This wrapper logs, checks that options are configured, and delegates to processStepTimeImpl().

Parameters
gTouchIDTouchable associated with the current step.
thisStepPointer to the current G4Step.
Returns
Time value used for electronics time binning (unit follows project conventions).

Definition at line 183 of file gdynamicdigitization.h.

◆ processStepTimeImpl()

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

Default behavior returns the post-step global time from G4Step.

Parameters
gTouchIDTouchable associated with the current step.
thisStepPointer to the current G4Step.
Returns
Time value used for electronics time binning.

Definition at line 122 of file gdynamicdigitization.cc.

◆ processTouchable()

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

The default behavior bins the step time into an electronics time-cell index using readoutSpecs->timeCellIndex(). If the index changes relative to the current touchable, a second touchable instance is created.

Parameters
gtouchableInput touchable for this step.
thisStepPointer to the current G4Step.
Returns
One or more touchables representing the time-binned view of the input.

Definition at line 213 of file gdynamicdigitization.h.

◆ processTouchableImpl()

std::vector< std::shared_ptr< GTouchable > > GDynamicDigitization::processTouchableImpl ( std::shared_ptr< GTouchable > gtouchable,
G4Step * thisStep )
virtual
Parameters
gtouchableInput touchable for this step.
thisStepPointer to the current G4Step.
Returns
One or more touchables representing the time-binned view of the input.

Definition at line 129 of file gdynamicdigitization.cc.

◆ set_loggers()

void GDynamicDigitization::set_loggers ( const std::shared_ptr< GOptions > & g)
inline
Parameters
gOptions object to store for later use.
Warning
A future refactor may remove this pattern; currently it is required for legacy flows.

Definition at line 453 of file gdynamicdigitization.h.

Field Documentation

◆ gopts

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

Definition at line 461 of file gdynamicdigitization.h.

◆ readoutSpecs

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

Definition at line 403 of file gdynamicdigitization.h.

◆ translationTable

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

Definition at line 406 of file gdynamicdigitization.h.


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