43 default:
return "unknown‑gtouchable";
61 GIdentifier(
const std::string& n,
int v) : idName{n}, idValue{v} {
75 [[nodiscard]]
inline std::string
getName()
const {
return idName; }
81 [[nodiscard]]
inline int getValue()
const {
return idValue; }
120 GTouchable(
const std::shared_ptr<GOptions>& gopt,
121 const std::string& digitization,
122 const std::string& gidentityString,
123 const std::vector<double>& dimensions);
126 GTouchable(
const std::shared_ptr<GLogger>& logger,
127 const std::string& digitization,
128 const std::string& gidentityString,
129 const std::vector<double>& dimensions);
141 GTouchable(
const std::shared_ptr<GTouchable>& base,
int newTimeIndex)
144 gidentity(base->gidentity),
145 trackId(base->trackId),
146 eMultiplier(base->eMultiplier),
190 [[nodiscard]]
inline std::vector<GIdentifier>
getIdentity()
const {
return gidentity; }
197 std::string idString;
198 for (
const auto&
id : gidentity) { idString +=
id.getName() +
": " + std::to_string(
id.getValue()) +
" "; }
215 for (
const auto& gt : v) {
217 log->info(2,
"GTouchable",
this,
" exists in vector.");
221 log->info(2,
"GTouchable",
this,
" does not exist in vector.");
227 static std::shared_ptr<GTouchable>
create(
const std::shared_ptr<GOptions>& gopt) {
228 int touchableNumber = globalGTouchableCounter.fetch_add(1, std::memory_order_relaxed);
229 int sector = (touchableNumber % 6) + 1;
230 int paddle = (touchableNumber % 20) + 1;
231 std::string identity =
"sector: " + std::to_string(sector) +
", paddle: " + std::to_string(paddle);
232 const auto& dimensions = {10.0, 20.0, 30.0};
234 return std::make_shared<GTouchable>(gopt,
"readout", identity, dimensions);
238 static std::shared_ptr<GTouchable>
create(
const std::shared_ptr<GLogger>& logger) {
239 int touchableNumber = globalGTouchableCounter.fetch_add(1, std::memory_order_relaxed);
240 int sector = (touchableNumber % 6) + 1;
241 int paddle = (touchableNumber % 20) + 1;
242 std::string identity =
"sector: " + std::to_string(sector) +
", paddle: " + std::to_string(paddle);
243 const auto& dimensions = {10.0, 20.0, 30.0};
245 return std::make_shared<GTouchable>(logger,
"readout", identity, dimensions);
250 std::vector<GIdentifier> gidentity;
253 int stepTimeAtElectronicsIndex;
255 std::vector<double> detectorDimensions;
262 static std::atomic<int> globalGTouchableCounter;
Represents a touchable sensitive detector element.
GTouchable(const GTouchable &)=default
static std::shared_ptr< GTouchable > create(const std::shared_ptr< GOptions > &gopt)
std::vector< GIdentifier > getIdentity() const
Returns the identifier vector.
bool operator==(const GTouchable >ouchable) const
Equality operator comparing two GTouchable objects.
void assignTrackId(int tid)
Assigns a track identifier.
void assignStepTimeAtElectronicsIndex(int timeIndex)
Assigns the step time index used in electronics.
friend std::ostream & operator<<(std::ostream &stream, const GTouchable >ouchable)
Overloaded output operator for GTouchable.
double getEnergyMultiplier() const
Gets the energy multiplier.
static std::shared_ptr< GTouchable > create(const std::shared_ptr< GLogger > &logger)
GTouchable & operator=(const GTouchable &)=default
int getStepTimeAtElectronicsIndex() const
Gets the electronics time index.
bool exists_in_vector(const std::vector< GTouchable > &v) const
Checks if the GTouchable is found in a vector of GTouchable objects.
std::string getIdentityString() const
Returns a string formed by all identifiers.
std::vector< double > getDetectorDimensions() const
Returns the detector dimensions.
GTouchable(const std::shared_ptr< GTouchable > &base, int newTimeIndex)
Copy constructor for updating the electronic time index. Used to create a new hit,...
GTouchableType
Enumeration representing the type of GTouchable element.
@ flux
Track-based discrimination.
@ particleCounter
No additional discriminating factors.
@ readout
Electronic readout with time window discrimination.
@ dosimeter
Radiation digitization using track id.
const char * to_string(GTouchableType t)
Represents a unique identifier for a sensitive detector element.
GIdentifier(const std::string &n, int v)
Constructs a GIdentifier.
friend std::ostream & operator<<(std::ostream &stream, const GIdentifier &gidentifier)
Overloaded output operator for GIdentifier.
std::string getName() const
Gets the identifier name.
bool operator==(const GIdentifier &gid) const
Equality operator comparing only the identifier value.
int getValue() const
Gets the identifier value.