gtouchable
Loading...
Searching...
No Matches
GTouchable Class Reference

Represents a touchable sensitive detector element used as a hit-collection discriminator. More...

#include <gtouchable.h>

Public Member Functions

 GTouchable (const GTouchable &)=default
 
GTouchableoperator= (const GTouchable &)=default
 
 GTouchable (const std::shared_ptr< GOptions > &gopt, const std::string &digitization, const std::string &gidentityString, const std::vector< double > &dimensions)
 Constructs a GTouchable using module options.
 
 GTouchable (const std::shared_ptr< GLogger > &logger, const std::string &digitization, const std::string &gidentityString, const std::vector< double > &dimensions)
 Constructs a GTouchable using an existing logger.
 
 GTouchable (const std::shared_ptr< GTouchable > &base, int newTimeIndex)
 Copy constructor that preserves identity but updates the electronics time-cell index.
 
 ~GTouchable ()
 Destructor with debug trace.
 
bool operator== (const GTouchable &gtouchable) const
 Compares two GTouchable instances using the module comparison semantics.
 
void assignTrackId (int tid)
 Assigns the track id used by flux and dosimeter discrimination.
 
double getEnergyMultiplier () const
 Returns the energy multiplier used for energy sharing.
 
void assignStepTimeAtElectronicsIndex (int timeIndex)
 Assigns the electronics time-cell index used by readout discrimination.
 
int getStepTimeAtElectronicsIndex () const
 Returns the electronics time-cell index.
 
std::vector< GIdentifiergetIdentity () const
 Returns a copy of the identity vector.
 
std::string getIdentityString () const
 Builds a human-readable identity string from the stored identifiers.
 
std::vector< double > getDetectorDimensions () const
 Returns the detector dimensions stored at construction time.
 
bool exists_in_vector (const std::vector< GTouchable > &v) const
 Checks whether this touchable exists in a vector using operator== semantics.
 
- Public Member Functions inherited from GBase< GTouchable >
 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 std::shared_ptr< GTouchablecreate (const std::shared_ptr< GOptions > &gopt)
 Creates a synthetic readout touchable for testing (options-based).
 
static std::shared_ptr< GTouchablecreate (const std::shared_ptr< GLogger > &logger)
 Creates a synthetic readout touchable for testing (logger-based).
 

Friends

std::ostream & operator<< (std::ostream &stream, const GTouchable &gtouchable)
 Stream output helper used in logs and diagnostics.
 

Additional Inherited Members

- Protected Attributes inherited from GBase< GTouchable >
std::shared_ptr< GLoggerlog
 

Detailed Description

A GTouchable acts as a compact “address” for sensitive detector elements during hit processing and digitization. It is commonly used as a key when deciding whether a newly produced hit should:

  • merge into an existing hit collection entry, or
  • create a new entry.

Comparison semantics

The equality operator implements a two-stage comparison:

  1. Compare the identity vector values positionally (same size and same identifier values).
  2. If identities match, apply a type-specific discriminator:
    • readout compares stepTimeAtElectronicsIndex
    • flux compares trackId
    • dosimeter compares trackId
    • particleCounter always matches once identities match

The identity vector size mismatch is considered an exceptional situation and is logged at debug level.

Definition at line 139 of file gtouchable.h.

Constructor & Destructor Documentation

◆ GTouchable() [1/4]

GTouchable::GTouchable ( const GTouchable & )
default

◆ GTouchable() [2/4]

GTouchable::GTouchable ( const std::shared_ptr< GOptions > & gopt,
const std::string & digitization,
const std::string & gidentityString,
const std::vector< double > & dimensions )

This constructor is used when a module options object is available and a module-scoped logger should be created/used by the base class.

Called from detector construction code when building the sensitive detector registry.

Parameters
goptOptions container used to configure logging and module behavior.
digitizationDigitization type string (e.g. "readout", FLUXNAME, COUNTERNAME).
gidentityStringIdentity specification string, e.g. "sector: 2, layer: 4, wire: 33".
dimensionsPhysical dimensions of the detector element (module-defined convention).

Definition at line 16 of file gtouchable.cc.

◆ GTouchable() [3/4]

GTouchable::GTouchable ( const std::shared_ptr< GLogger > & logger,
const std::string & digitization,
const std::string & gidentityString,
const std::vector< double > & dimensions )

This constructor is useful when a caller already owns a configured logger instance (for example in tests or in code that wants to share a logger across multiple objects).

Parameters
loggerLogger instance used for diagnostics.
digitizationDigitization type string (e.g. "readout", FLUXNAME, COUNTERNAME).
gidentityStringIdentity specification string, e.g. "sector: 2, layer: 4, wire: 33".
dimensionsPhysical dimensions of the detector element (module-defined convention).

Definition at line 52 of file gtouchable.cc.

◆ GTouchable() [4/4]

GTouchable::GTouchable ( const std::shared_ptr< GTouchable > & base,
int newTimeIndex )
inline

This is used to create a new hit key when the identity matches but the time-cell differs, i.e. when a hit must be split by electronics time window.

The copy uses the base class copy constructor and then copies the data members from base, replacing only stepTimeAtElectronicsIndex with newTimeIndex.

Parameters
baseExisting touchable to copy from.
newTimeIndexThe updated electronics time-cell index.

Definition at line 191 of file gtouchable.h.

◆ ~GTouchable()

GTouchable::~GTouchable ( )
inline

The destructor logs the type and getIdentityString() at debug level, which can be useful when diagnosing object lifetimes.

Definition at line 207 of file gtouchable.h.

Member Function Documentation

◆ assignStepTimeAtElectronicsIndex()

void GTouchable::assignStepTimeAtElectronicsIndex ( int timeIndex)
inline
Parameters
timeIndexElectronics time-cell index that represents the readout time window.

Definition at line 241 of file gtouchable.h.

◆ assignTrackId()

void GTouchable::assignTrackId ( int tid)
inline

This value is typically set during hit processing when the simulation step is known.

Parameters
tidTrack id to store in the touchable.

Definition at line 224 of file gtouchable.h.

◆ create() [1/2]

static std::shared_ptr< GTouchable > GTouchable::create ( const std::shared_ptr< GLogger > & logger)
inlinestatic

The generated identity uses a deterministic pattern based on a process-wide atomic counter:

  • sector cycles in [1..6]
  • paddle cycles in [1..20]
Parameters
loggerLogger instance used for diagnostics.
Returns
A newly created test touchable.

Definition at line 331 of file gtouchable.h.

◆ create() [2/2]

static std::shared_ptr< GTouchable > GTouchable::create ( const std::shared_ptr< GOptions > & gopt)
inlinestatic

The generated identity uses a deterministic pattern based on a process-wide atomic counter:

  • sector cycles in [1..6]
  • paddle cycles in [1..20]
Parameters
goptOptions container used to configure logging and module behavior.
Returns
A newly created test touchable.

Definition at line 311 of file gtouchable.h.

◆ exists_in_vector()

bool GTouchable::exists_in_vector ( const std::vector< GTouchable > & v) const
inline

This is a convenience helper mainly used for diagnostics and validation logic. It logs level-2 informational messages indicating whether the touchable was found.

Parameters
vVector of touchables to scan.
Returns
True if a matching touchable is found, false otherwise.

Definition at line 289 of file gtouchable.h.

◆ getDetectorDimensions()

std::vector< double > GTouchable::getDetectorDimensions ( ) const
inline

Dimensions are stored verbatim and interpreted by module-specific digitization logic.

Returns
A vector containing the dimensions.

Definition at line 278 of file gtouchable.h.

◆ getEnergyMultiplier()

double GTouchable::getEnergyMultiplier ( ) const
inline

The multiplier is typically set by digitization logic (for example when distributing energy across multiple readout cells). The default is 1.

Returns
The energy multiplier.

Definition at line 234 of file gtouchable.h.

◆ getIdentity()

std::vector< GIdentifier > GTouchable::getIdentity ( ) const
inline
Returns
The identity vector as a std::vector of GIdentifier.

Definition at line 255 of file gtouchable.h.

◆ getIdentityString()

std::string GTouchable::getIdentityString ( ) const
inline

The returned string is constructed by concatenating each identifier as: "<name>: <value> " (note the trailing space).

Returns
A human-readable identity string.

Definition at line 265 of file gtouchable.h.

◆ getStepTimeAtElectronicsIndex()

int GTouchable::getStepTimeAtElectronicsIndex ( ) const
inline
Returns
The stored time-cell index, or GTOUCHABLEUNSETTIMEINDEX if not assigned yet.

Definition at line 248 of file gtouchable.h.

◆ operator=()

GTouchable & GTouchable::operator= ( const GTouchable & )
default

◆ operator==()

bool GTouchable::operator== ( const GTouchable & gtouchable) const
Parameters
gtouchableThe touchable to compare with.
Returns
True if the objects are considered equal (same identity and same type-specific discriminator).

Definition at line 87 of file gtouchable.cc.

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & stream,
const GTouchable & gtouchable )
friend

Definition at line 138 of file gtouchable.cc.


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