10std::atomic<int> GTouchable::globalGTouchableCounter{0};
17 const std::string& digitization,
18 const std::string& gidentityString,
19 const std::vector<double>& dimensions,
25 detectorDimensions(dimensions),
40 for (
auto& gid : identity) {
45 const std::string& idName = identifier[0];
46 int idValue = std::stoi(identifier[1]);
48 gidentity.emplace_back(idName, idValue);
56 const std::string& digitization,
57 const std::string& gidentityString,
58 const std::vector<double>& dimensions,
64 detectorDimensions(dimensions),
79 for (
auto& gid : identity) {
84 const std::string& idName = identifier[0];
85 int idValue = std::stoi(identifier[1]);
87 gidentity.emplace_back(idName, idValue);
96 if (this->gidentity.size() != that.gidentity.size()) {
104 for (
size_t i = 0; i < this->gidentity.size(); ++i) {
105 bool equal = ( this->gidentity[i].getValue() == that.gidentity[i].getValue() );
106 std::string comparisonResult = equal ?
" ✅" :
" ❌";
107 log->
debug(
NORMAL,
" ← ", this->gidentity[i],
" → ", that.gidentity[i], comparisonResult);
108 if (!equal) {
return false; }
111 bool typeComparison =
false;
115 switch (this->gType) {
117 typeComparison = this->stepTimeAtElectronicsIndex == that.stepTimeAtElectronicsIndex;
118 result = typeComparison ?
" ✅" :
" ❌";
119 log->
debug(
NORMAL,
" Touchable type is readout. Time cell comparison: ",
120 this->stepTimeAtElectronicsIndex,
121 " ", that.stepTimeAtElectronicsIndex,
125 typeComparison = this->trackId == that.trackId;
126 result = typeComparison ?
" ✅" :
" ❌";
127 log->
debug(
NORMAL,
" Touchable type is flux. Track id comparison: ", this->trackId,
" ", that.trackId,
131 typeComparison = this->trackId == that.trackId;
132 result = typeComparison ?
" ✅" :
" ❌";
133 log->
debug(
NORMAL,
" Touchable type is gPhotonDetector. Track id comparison: ",
134 this->trackId,
" ", that.trackId,
" result:", result);
137 typeComparison =
true;
138 log->
debug(
NORMAL,
" Touchable type is dosimeter. No additional comparison needed, returning true ✅");
142 typeComparison = this->pid == that.pid;
143 result = typeComparison ?
" ✅" :
" ❌";
144 log->
debug(
NORMAL,
" Touchable type is flux. Track id comparison: ", this->trackId,
" ", that.trackId,
149 typeComparison =
true;
151 " Touchable type is integral_counter. No additional comparison needed, returning true ✅");
154 return typeComparison;
159 stream <<
" GTouchable: ";
161 stream <<
KRED << gid;
162 if (gid.getName() !=
gtouchable.gidentity.back().getName()) { stream <<
", "; }
163 else { stream <<
RST; }
168 stream <<
KGRN <<
" (readout), " <<
RST <<
" multiplier: " <<
gtouchable.eMultiplier <<
169 ", time cell index: " <<
176 stream <<
KGRN <<
" (gPhotonDetector), " <<
RST <<
" g4 track id: " <<
gtouchable.trackId;
179 stream <<
KGRN <<
" (dosimeter), " <<
RST;
182 stream <<
KGRN <<
" (particle_counter), " <<
RST <<
" particle id: " <<
gtouchable.pid;
185 stream <<
KGRN <<
" (integral_counter), " <<
RST;
194 stream << gidentifier.idName <<
": " << gidentifier.idValue;
std::shared_ptr< GLogger > log
void debug(debug_type type, Args &&... args) const
Represents a touchable sensitive detector element used as a hit-collection discriminator.
GTouchable(const GTouchable &)=default
bool operator==(const GTouchable >ouchable) const
Compares two GTouchable instances using the module comparison semantics.
std::string getIdentityString() const
Builds a human-readable identity string from the stored identifiers.
Conventions and constants used by the gtouchable module.
#define GTOUCHABLEUNSETTIMEINDEX
Sentinel value for an unset electronics time-cell index.
#define FLUXNAME
Digitization type name for flux-like detectors.
#define DOSIMETERNAME
Digitization type name for dosimeters.
#define COUNTERNAME
Digitization type name for simple particle counters.
#define GPHOTON_DETECTORNAME
Digitization type name for optical-photon flux detectors.
std::ostream & operator<<(std::ostream &stream, const GTouchable >ouchable)
constexpr const char * TOUCHABLE_LOGGER
Logger name used by the gtouchable module.
const char * to_string(GTouchableType t)
Converts a GTouchableType value to a stable string for logging.
vector< string > getStringVectorFromStringWithDelimiter(const string &input, const string &x)
A single (name,value) identifier element used to build a touchable identity vector.