15#include "gtranslationTableConventions.h"
16#include "gdataConventions.h"
17#include "gtouchableConventions.h"
34 auto trueInfoData = std::make_unique<GTrueInfoData>(
gopts, ghit);
36 std::vector<GIdentifier> identities = ghit->getGID();
39 for (
auto& identity : identities) { trueInfoData->includeVariable(identity.getName(), identity.getValue()); }
42 ghit->calculateInfosForBit(0);
43 G4ThreeVector avgGlobalPos = ghit->getAvgGlobaPosition();
44 G4ThreeVector avgLocalPos = ghit->getAvgLocalPosition();
46 trueInfoData->includeVariable(
"totalEDeposited", ghit->getTotalEnergyDeposited());
47 trueInfoData->includeVariable(
"avgTime", ghit->getAverageTime());
48 trueInfoData->includeVariable(
"avgx", avgGlobalPos.getX());
49 trueInfoData->includeVariable(
"avgy", avgGlobalPos.getY());
50 trueInfoData->includeVariable(
"avgz", avgGlobalPos.getZ());
51 trueInfoData->includeVariable(
"avglx", avgLocalPos.getX());
52 trueInfoData->includeVariable(
"avgly", avgLocalPos.getY());
53 trueInfoData->includeVariable(
"avglz", avgLocalPos.getZ());
54 trueInfoData->includeVariable(
"hitn",
static_cast<int>(hitn));
57 trueInfoData->includeVariable(
"processName", ghit->getProcessName());
77 log->error(EC__TTNOTFOUNDINTT,
"Translation Table not found");
81 std::vector<int> haddress =
translationTable->getElectronics(ghit->getTTID()).getHAddress();
83 if (haddress.front() == UNINITIALIZEDNUMBERQUANTITY) {
84 log->error(EC__GIDENTITYNOTFOUNDINTT,
"Translation Table found, but haddress was not initialized");
88 gdata.includeVariable(CRATESTRINGID, haddress[0]);
89 gdata.includeVariable(SLOTSTRINGID, haddress[1]);
90 gdata.includeVariable(CHANNELSTRINGID, haddress[2]);
91 gdata.includeVariable(TIMEATELECTRONICS, time);
92 gdata.includeVariable(CHARGEATELECTRONICS, q);
114 modifierWeightsMap[touchableName].push_back(idValue);
115 modifierWeightsMap[touchableName].push_back(weight);
127 modifierWeightsAndTimesMap[touchableName].push_back(idValue);
128 modifierWeightsAndTimesMap[touchableName].push_back(weight);
129 modifierWeightsAndTimesMap[touchableName].push_back(time);
143 size_t countWeights = modifierWeightsMap[tname].size() / 2;
144 for (
size_t h = 0; h < countWeights; h++) { modifierWeightsMap[tname][h * 2 + 1] = modifierWeightsMap[tname][h * 2 + 1] / totalWeight; }
145 size_t countWeightsAndTimes = modifierWeightsAndTimesMap[tname].size() / 3;
146 for (
size_t h = 0; h < countWeightsAndTimes; h++) {
148 modifierWeightsAndTimesMap[tname][h * 3 + 1] = modifierWeightsAndTimesMap[tname][h * 3 + 1] / totalWeight;
162 return thisStep->GetPostStepPoint()->GetGlobalTime();
181 std::vector<std::shared_ptr<GTouchable>> result;
183 if (stepTimeAtElectronicsIndex == gtouchable->getStepTimeAtElectronicsIndex() ||
184 gtouchable->getStepTimeAtElectronicsIndex() == GTOUCHABLEUNSETTIMEINDEX) {
185 gtouchable->assignStepTimeAtElectronicsIndex(stepTimeAtElectronicsIndex);
187 result.emplace_back(gtouchable);
191 auto cloned = std::make_shared<GTouchable>(gtouchable, stepTimeAtElectronicsIndex);
195 result.emplace_back(gtouchable);
196 result.emplace_back(cloned);
214 std::vector<std::shared_ptr<GTouchable>> touchables;
std::shared_ptr< GOptions > gopts
Optional pointer to GOptions.
virtual std::unique_ptr< GTrueInfoData > collectTrueInformationImpl(GHit *ghit, size_t hitn)
Collects true hit information from a GHit.
double processStepTime(const std::shared_ptr< GTouchable > &gTouchID, G4Step *thisStep)
Processes the step time.
virtual std::vector< std::shared_ptr< GTouchable > > processGTouchableModifiersImpl(const std::shared_ptr< GTouchable > &gTouchID, const GTouchableModifiers &gmods)
Default implementation for processing touchable modifiers.
void check_if_log_defined() const
Checks that all required loggers and options are defined.
virtual double processStepTimeImpl(const std::shared_ptr< GTouchable > &gTouchID, G4Step *thisStep)
Default implementation of processStepTime.
std::shared_ptr< const GTranslationTable > translationTable
virtual std::vector< std::shared_ptr< GTouchable > > processTouchableImpl(std::shared_ptr< GTouchable > gtouchable, G4Step *thisStep)
Processes a GTouchable based on the current G4Step.
std::shared_ptr< const GReadoutSpecs > readoutSpecs
After init, we never mutate these:
void chargeAndTimeAtHardware(int time, int q, const GHit *ghit, GDigitizedData &gdata)
Sets hardware-level charge and time information in the digitized data.
int timeCellIndex(double time) const
Computes the time cell index for a given time.
Class to manage modifications to a GTouchable using defined modifier weights.
void insertIdAndWeight(const std::string &touchableName, int idValue, double weight)
Inserts a new (id, weight) pair for given touchable.
void insertIdWeightAndTime(const std::string &touchableName, int idValue, double weight, double time)
Inserts a new (id, weight, time) triplet for given touchable.
void assignOverallWeight(const std::string &touchableName, double totalWeight)
Normalizes the modifier weights using a total weight.
GTouchableModifiers(const std::vector< std::string > &touchableNames)
Constructs GTouchableModifiers with a list of touchable names.