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),
39 for (
auto& gid : identity) {
44 const std::string& idName = identifier[0];
45 int idValue = std::stoi(identifier[1]);
47 gidentity.emplace_back(idName, idValue);
55 const std::string& digitization,
56 const std::string& gidentityString,
57 const std::vector<double>& dimensions,
63 detectorDimensions(dimensions),
77 for (
auto& gid : identity) {
82 const std::string& idName = identifier[0];
83 int idValue = std::stoi(identifier[1]);
85 gidentity.emplace_back(idName, idValue);
94 if (this->gidentity.size() != that.gidentity.size()) {
102 for (
size_t i = 0; i < this->gidentity.size(); ++i) {
103 bool equal = ( this->gidentity[i].getValue() == that.gidentity[i].getValue() );
104 std::string comparisonResult = equal ?
" ✅" :
" ❌";
105 log->
debug(
NORMAL,
" ← ", this->gidentity[i],
" → ", that.gidentity[i], comparisonResult);
106 if (!equal) {
return false; }
109 bool typeComparison =
false;
113 switch (this->gType) {
115 typeComparison = this->stepTimeAtElectronicsIndex == that.stepTimeAtElectronicsIndex;
116 result = typeComparison ?
" ✅" :
" ❌";
117 log->
debug(
NORMAL,
" Touchable type is readout. Time cell comparison: ",
118 this->stepTimeAtElectronicsIndex,
119 " ", that.stepTimeAtElectronicsIndex,
123 typeComparison = this->trackId == that.trackId;
124 result = typeComparison ?
" ✅" :
" ❌";
125 log->
debug(
NORMAL,
" Touchable type is flux. Track id comparison: ", this->trackId,
" ", that.trackId,
129 typeComparison =
true;
130 log->
debug(
NORMAL,
" Touchable type is dosimeter. No additional comparison needed, returning true ✅");
134 typeComparison = this->pid == that.pid;
135 result = typeComparison ?
" ✅" :
" ❌";
136 log->
debug(
NORMAL,
" Touchable type is flux. Track id comparison: ", this->trackId,
" ", that.trackId,
141 typeComparison =
true;
143 " Touchable type is integral_counter. No additional comparison needed, returning true ✅");
146 return typeComparison;
151 stream <<
" GTouchable: ";
153 stream <<
KRED << gid;
154 if (gid.getName() !=
gtouchable.gidentity.back().getName()) { stream <<
", "; }
155 else { stream <<
RST; }
160 stream <<
KGRN <<
" (readout), " <<
RST <<
" multiplier: " <<
gtouchable.eMultiplier <<
161 ", time cell index: " <<
168 stream <<
KGRN <<
" (dosimeter), " <<
RST;
171 stream <<
KGRN <<
" (particle_counter), " <<
RST <<
" particle id: " <<
gtouchable.pid;
174 stream <<
KGRN <<
" (integral_counter), " <<
RST;
183 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.
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.