gdynamicDigitization
Loading...
Searching...
No Matches
GTouchableModifiers Class Reference

Helper container for representing touchable “modifier” information. More...

#include <gdynamicdigitization.h>

Public Member Functions

 GTouchableModifiers (const std::vector< std::string > &touchableNames)
 Constructs the container and declares supported touchable names.
 
void insertIdAndWeight (const std::string &touchableName, int idValue, double weight)
 Inserts a new (id, weight) pair for the specified touchable.
 
void insertIdWeightAndTime (const std::string &touchableName, int idValue, double weight, double time)
 Inserts a new (id, weight, time) triplet for the specified touchable.
 
void assignOverallWeight (const std::string &touchableName, double totalWeight)
 Normalizes modifier weights by dividing by a provided total.
 
bool isWeightsOnly () const
 Returns whether the container currently reports weights-only modifiers.
 
std::vector< double > getModifierWeightsVector (const std::string &touchableName)
 Returns the weights vector for a touchable.
 
std::vector< double > getModifierWeightsAndTimeVector (const std::string &touchableName)
 Returns the weights-and-times vector for a touchable.
 

Detailed Description

Some digitization routines need to create one or more derived touchables from a single touchable, weighted by occupancy, energy, time, or similar criteria.

This helper stores modifier payloads in one of two mutually exclusive representations:

  • weights-only : flat pairs (id, weight)
  • weights-and-times : flat triplets (id, weight, time)
Note
Only one representation is expected to be filled for a given instance.

Definition at line 40 of file gdynamicdigitization.h.

Constructor & Destructor Documentation

◆ GTouchableModifiers()

GTouchableModifiers::GTouchableModifiers ( const std::vector< std::string > & touchableNames)
explicit

Declaring touchable names up-front ensures the internal maps contain keys for all expected touchables.

Parameters
touchableNamesList of touchable names for which modifiers may be recorded.

Definition at line 83 of file gdynamicdigitization.cc.

Member Function Documentation

◆ assignOverallWeight()

void GTouchableModifiers::assignOverallWeight ( const std::string & touchableName,
double totalWeight )
  • For weights-only vectors, normalizes every second element.
  • For weights-and-times vectors, normalizes the weight element of each triplet.
Parameters
touchableNameName of the touchable whose modifiers are to be normalized.
totalWeightDenominator for normalization (must be non-zero).

Definition at line 107 of file gdynamicdigitization.cc.

◆ getModifierWeightsAndTimeVector()

std::vector< double > GTouchableModifiers::getModifierWeightsAndTimeVector ( const std::string & touchableName)
inline
Parameters
touchableNameTouchable name key.
Returns
A copy of the internal flat vector containing (id, weight, time) triplets.
Warning
This function will crash if the key was not declared in the constructor.

Definition at line 138 of file gdynamicdigitization.h.

◆ getModifierWeightsVector()

std::vector< double > GTouchableModifiers::getModifierWeightsVector ( const std::string & touchableName)
inline
Parameters
touchableNameTouchable name key.
Returns
A copy of the internal flat vector containing (id, weight) pairs.
Warning
This function will crash if the key was not declared in the constructor.

Definition at line 125 of file gdynamicdigitization.h.

◆ insertIdAndWeight()

void GTouchableModifiers::insertIdAndWeight ( const std::string & touchableName,
int idValue,
double weight )
Parameters
touchableNameName of the touchable to modify.
idValueIdentifier value associated with the modifier entry.
weightUnnormalized weight (caller may later normalize with assignOverallWeight()).

Definition at line 91 of file gdynamicdigitization.cc.

◆ insertIdWeightAndTime()

void GTouchableModifiers::insertIdWeightAndTime ( const std::string & touchableName,
int idValue,
double weight,
double time )
Parameters
touchableNameName of the touchable to modify.
idValueIdentifier value associated with the modifier entry.
weightUnnormalized weight (caller may later normalize with assignOverallWeight()).
timeTime associated with this modifier entry (time unit follows project conventions).

Definition at line 98 of file gdynamicdigitization.cc.

◆ isWeightsOnly()

bool GTouchableModifiers::isWeightsOnly ( ) const
inline
Returns
true if modifierWeightsMap is non-empty.
Note
This is a coarse check: it reports whether the map is non-empty, not whether a specific touchable has entries.

Definition at line 114 of file gdynamicdigitization.h.


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