51#include <gemc/gbase/gbase.h>
52#include <gemc/ghit/ghit.h>
290 return arrayIntObservablesMap;
303 return arrayDoubleObservablesMap;
312 [[nodiscard]]
inline const std::vector<GIdentifier>&
getIdentity()
const {
return gidentity; }
330 static std::unique_ptr<GDigitizedData>
create(
const std::shared_ptr<GOptions>& gopts) {
332 auto digi_data = std::make_unique<GDigitizedData>(gopts, hit);
333 auto counter = globalDigitizedDataCounter.fetch_add(1, std::memory_order_relaxed);
339 digi_data->includeVariable(
"adc", counter * 0.1);
345 std::map<std::string, int> intObservablesMap;
348 std::map<std::string, double> doubleObservablesMap;
351 std::map<std::string, double> transientVariablesMap;
354 std::map<std::string, std::vector<int>> arrayIntObservablesMap;
357 std::map<std::string, std::vector<double>> arrayDoubleObservablesMap;
360 std::vector<GIdentifier> gidentity;
376 [[nodiscard]]
static bool validVarName(
const std::string& varName,
int which);
384 static std::atomic<int> globalDigitizedDataCounter;
Stores digitized, electronics-level observables for one hit.
void accumulateVariable(const std::string &vname, int value)
Accumulates one integer observable into the current object.
static std::unique_ptr< GDigitizedData > create(const std::shared_ptr< GOptions > &gopts)
Creates deterministic example data for tests and examples.
bool hasTransientVariable(const std::string &vname) const
Returns whether a transient floating-point value is present.
int getIntObservable(const std::string &varName)
Returns one integer observable by key.
const std::vector< GIdentifier > & getIdentity() const
Returns the identifier vectory.
std::map< std::string, int > getIntObservablesMap(int which) const
Returns a filtered copy of the integer observables map.
int getTimeAtElectronics()
Returns the conventional timeAtElectronics integer observable when present.
void includeVariable(const std::string &vname, int value)
Stores or overwrites one integer observable for this hit.
friend std::ostream & operator<<(std::ostream &os, const GDigitizedData &data)
std::map< std::string, double > getDblObservablesMap(int which) const
Returns a filtered copy of the floating-point observables map.
double getTransientVariable(const std::string &vname) const
Returns a transient floating-point value by key.
GDigitizedData(const std::shared_ptr< GOptions > &gopts, const GHit *ghit)
Constructs the object and copies the hit identity from the source hit.
double getDblObservable(const std::string &varName)
Returns one floating-point observable by key.
void includeTransientVariable(const std::string &vname, double value)
Stores a non-published floating-point value for post-digitization decisions.
std::map< std::string, std::vector< int > > getArrayIntObservablesMap() const
Returns a copy of the array-valued integer observables.
std::map< std::string, std::vector< double > > getArrayDblObservablesMap() const
Returns a copy of the array-valued floating-point observables.
static GHit * create(const std::shared_ptr< GOptions > &gopts)
constexpr const char * GDIGITIZED_DATA_LOGGER
Logger domain name used by GDigitizedData.
Shared constants, schema keys, and error codes for the GData module.
constexpr const char * TIMEATELECTRONICS
Electronics-stage time or TDC proxy.
constexpr const char * CRATESTRINGID
Electronics crate identifier.
constexpr const char * CHANNELSTRINGID
Channel index within the slot or module.
constexpr const char * SLOTSTRINGID
Slot index within the crate.
GOptions defineOptions()
Defines the options subtree used by the digitized-data logger domain.