25 auto trueInfoData = std::make_unique<GTrueInfoData>(
gopts, ghit);
27 std::vector<GIdentifier> identities = ghit->
getGID();
30 for (
auto& identity : identities) {
31 trueInfoData->includeVariable(identity.getName(), identity.getValue());
43 trueInfoData->includeVariable(
"avgx", avgGlobalPos.getX());
44 trueInfoData->includeVariable(
"avgy", avgGlobalPos.getY());
45 trueInfoData->includeVariable(
"avgz", avgGlobalPos.getZ());
46 trueInfoData->includeVariable(
"avglx", avgLocalPos.getX());
47 trueInfoData->includeVariable(
"avgly", avgLocalPos.getY());
48 trueInfoData->includeVariable(
"avglz", avgLocalPos.getZ());
49 trueInfoData->includeVariable(
"hitn",
static_cast<int>(hitn));
52 trueInfoData->includeVariable(
"processName", ghit->
getProcessName());
85 for (
const auto& tname : touchableNames) {
86 modifierWeightsMap[tname] = {};
93 modifierWeightsMap[touchableName].push_back(idValue);
94 modifierWeightsMap[touchableName].push_back(weight);
101 modifierWeightsAndTimesMap[touchableName].push_back(idValue);
102 modifierWeightsAndTimesMap[touchableName].push_back(weight);
103 modifierWeightsAndTimesMap[touchableName].push_back(time);
109 size_t countWeights = modifierWeightsMap[tname].size() / 2;
110 for (
size_t h = 0; h < countWeights; h++) {
111 modifierWeightsMap[tname][h * 2 + 1] = modifierWeightsMap[tname][h * 2 + 1] / totalWeight;
115 size_t countWeightsAndTimes = modifierWeightsAndTimesMap[tname].size() / 3;
116 for (
size_t h = 0; h < countWeightsAndTimes; h++) {
117 modifierWeightsAndTimesMap[tname][h * 3 + 1] = modifierWeightsAndTimesMap[tname][h * 3 + 1] / totalWeight;
123 [[maybe_unused]] G4Step* thisStep) {
125 return thisStep->GetPostStepPoint()->GetGlobalTime();
130 std::shared_ptr<GTouchable>
gtouchable, G4Step* thisStep) {
134 std::vector<std::shared_ptr<GTouchable>> result;
138 if (stepTimeAtElectronicsIndex ==
gtouchable->getStepTimeAtElectronicsIndex() ||
140 gtouchable->assignStepTimeAtElectronicsIndex(stepTimeAtElectronicsIndex);
145 auto cloned = std::make_shared<GTouchable>(
gtouchable, stepTimeAtElectronicsIndex);
149 result.emplace_back(cloned);
157 [[maybe_unused]]
const std::shared_ptr<GTouchable>& gTouchID,
160 std::vector<std::shared_ptr<GTouchable>> touchables;
std::shared_ptr< GLogger > log
void includeVariable(const std::string &vname, int value)
std::shared_ptr< GOptions > gopts
Options used by the digitization plugin instance.
virtual std::unique_ptr< GTrueInfoData > collectTrueInformationImpl(GHit *ghit, size_t hitn)
Implementation hook for true-information collection.
double processStepTime(const std::shared_ptr< GTouchable > &gTouchID, G4Step *thisStep)
Computes the time associated with a simulation step for electronics binning.
virtual std::vector< std::shared_ptr< GTouchable > > processGTouchableModifiersImpl(const std::shared_ptr< GTouchable > &gTouchID, const GTouchableModifiers &gmods)
Implementation hook for touchable modifier application.
void check_if_log_defined() const
Ensures options/logging are configured before plugin methods run.
virtual double processStepTimeImpl(const std::shared_ptr< GTouchable > &gTouchID, G4Step *thisStep)
Implementation hook for step time computation.
std::shared_ptr< const GTranslationTable > translationTable
Translation table is typically loaded during initialization and treated as immutable.
virtual std::vector< std::shared_ptr< GTouchable > > processTouchableImpl(std::shared_ptr< GTouchable > gtouchable, G4Step *thisStep)
Implementation hook for touchable processing.
std::shared_ptr< const GReadoutSpecs > readoutSpecs
Readout specs are created during initialization and treated as immutable.
void chargeAndTimeAtHardware(int time, int q, const GHit *ghit, GDigitizedData &gdata)
Adds hardware-level time/charge and address fields to a digitized record.
std::vector< GIdentifier > getGID() const
std::vector< int > getTTID() const
void calculateInfosForBit(int bit)
G4ThreeVector getAvgGlobaPosition()
double getTotalEnergyDeposited()
G4ThreeVector getAvgLocalPosition()
std::string getProcessName() const
void error(int exit_code, Args &&... args) const
int timeCellIndex(double time) const
Computes the 1-based electronics time-cell index for a given time.
Helper container for representing touchable “modifier” information.
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.
GTouchableModifiers(const std::vector< std::string > &touchableNames)
Constructs the container and declares supported touchable names.
GElectronic getElectronics(const std::vector< int > &identity) const
constexpr const char * TIMEATELECTRONICS
constexpr const char * CRATESTRINGID
constexpr const char * CHANNELSTRINGID
constexpr const char * SLOTSTRINGID
constexpr const char * CHARGEATELECTRONICS
#define GTOUCHABLEUNSETTIMEINDEX
#define EC__TTNOTFOUNDINTT
#define EC__GIDENTITYNOTFOUNDINTT
#define UNINITIALIZEDNUMBERQUANTITY
std::vector< int > getHAddress()