23 auto trueInfoData = std::make_unique<GTrueInfoData>(
gopts, ghit);
25 std::vector<GIdentifier> identities = ghit->
getGID();
36 trueInfoData->includeVariable(
"pid", ghit->
getPid());
37 trueInfoData->includeVariable(
"tid", ghit->
getTid());
40 trueInfoData->includeVariable(
"avgx", avgGlobalPos.getX());
41 trueInfoData->includeVariable(
"avgy", avgGlobalPos.getY());
42 trueInfoData->includeVariable(
"avgz", avgGlobalPos.getZ());
43 trueInfoData->includeVariable(
"avglx", avgLocalPos.getX());
44 trueInfoData->includeVariable(
"avgly", avgLocalPos.getY());
45 trueInfoData->includeVariable(
"avglz", avgLocalPos.getZ());
46 trueInfoData->includeVariable(
"hitn",
static_cast<int>(hitn));
49 trueInfoData->includeVariable(
"processName", ghit->
getProcessName());
80 for (
const auto& tname : touchableNames) {
81 modifierWeightsMap[tname] = {};
88 modifierWeightsMap[touchableName].push_back(idValue);
89 modifierWeightsMap[touchableName].push_back(weight);
96 modifierWeightsAndTimesMap[touchableName].push_back(idValue);
97 modifierWeightsAndTimesMap[touchableName].push_back(weight);
98 modifierWeightsAndTimesMap[touchableName].push_back(time);
104 size_t countWeights = modifierWeightsMap[tname].size() / 2;
105 for (
size_t h = 0; h < countWeights; h++) {
106 modifierWeightsMap[tname][h * 2 + 1] = modifierWeightsMap[tname][h * 2 + 1] / totalWeight;
110 size_t countWeightsAndTimes = modifierWeightsAndTimesMap[tname].size() / 3;
111 for (
size_t h = 0; h < countWeightsAndTimes; h++) {
112 modifierWeightsAndTimesMap[tname][h * 3 + 1] = modifierWeightsAndTimesMap[tname][h * 3 + 1] / totalWeight;
118 [[maybe_unused]] G4Step* thisStep) {
120 return thisStep->GetPostStepPoint()->GetGlobalTime();
125 std::shared_ptr<GTouchable>
gtouchable, G4Step* thisStep) {
129 std::vector<std::shared_ptr<GTouchable>> result;
133 if (stepTimeAtElectronicsIndex ==
gtouchable->getStepTimeAtElectronicsIndex() ||
135 gtouchable->assignStepTimeAtElectronicsIndex(stepTimeAtElectronicsIndex);
140 auto cloned = std::make_shared<GTouchable>(
gtouchable, stepTimeAtElectronicsIndex);
144 result.emplace_back(cloned);
152 [[maybe_unused]]
const std::shared_ptr<GTouchable>& gTouchID,
155 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()