17std::atomic<int> GTrueInfoData::globalTrueInfoDataCounter{0};
22 gidentity = ghit->
getGID();
27 doubleObservablesMap[varName] = value;
29 2,
"%1 including %2 in trueInfoDoublesVariablesMap with value: %3",
FUNCTION_NAME, varName, value);
34 log->info(2,
"%1 including %2 in trueInfoStringVariablesMap with value:%3",
FUNCTION_NAME, varName, value);
35 stringVariablesMap[varName] = std::move(value);
40 if (!doubleObservablesMap.contains(vname)) {
41 doubleObservablesMap[vname] = value;
43 2,
"%1Creating double variable %2 with value %3, sum is now:%4",
FUNCTION_NAME, vname, value,
44 doubleObservablesMap[vname]);
47 doubleObservablesMap[vname] += value;
49 2,
"%1Accumulating double variable %2 with value %3, sum is now:%4",
FUNCTION_NAME, vname, value,
50 doubleObservablesMap[vname]);
58 os <<
"GTrueInfoData{identity=\"" << idString <<
"\"";
60 if (!data.doubleObservablesMap.empty()) {
61 os <<
", doubleObservables={";
63 for (
const auto& [name, value] : data.doubleObservablesMap) {
67 os << name <<
": " << value;
73 if (!data.stringVariablesMap.empty()) {
74 os <<
", stringObservables={";
76 for (
const auto& [name, value] : data.stringVariablesMap) {
80 os << name <<
": \"" << value <<
"\"";
GBase(const std::shared_ptr< GOptions > &gopt, std::string logger_name="")
std::shared_ptr< GLogger > log
std::vector< GIdentifier > getGID() const
void includeVariable(const std::string &varName, double var)
Stores or overwrites one numeric truth observable.
void accumulateVariable(const std::string &vname, double value)
Accumulates a numeric observable into the current object.
GTrueInfoData(const std::shared_ptr< GOptions > &gopts, const GHit *ghit)
Constructs the object and copies the hit identity from the source hit.
std::ostream & operator<<(std::ostream &os, const GTrueInfoData &data)
Container for simulation-level observables associated with a single hit.
constexpr const char * GTRUEDATA_LOGGER
Logger domain name used by GTrueInfoData.
std::string getIdentityString(std::vector< GIdentifier > gidentity)