17std::atomic<int> GTrueInfoData::globalTrueInfoDataCounter{0};
22 gidentity = ghit->
getGID();
27 doubleObservablesMap[varName] = value;
28 log->
info(2,
FUNCTION_NAME,
" including ", varName,
" in trueInfoDoublesVariablesMap with value: ", value);
33 log->
info(2,
FUNCTION_NAME,
" including ", varName,
" in trueInfoStringVariablesMap with value:", value);
34 stringVariablesMap[varName] = std::move(value);
39 if (doubleObservablesMap.find(vname) == doubleObservablesMap.end()) {
40 doubleObservablesMap[vname] = value;
41 log->
info(2,
FUNCTION_NAME,
"Creating double variable ", vname,
" with value ", value,
", sum is now:",
42 doubleObservablesMap[vname]);
45 doubleObservablesMap[vname] += value;
46 log->
info(2,
FUNCTION_NAME,
"Accumulating double variable ", vname,
" with value ", value,
", sum is now:",
47 doubleObservablesMap[vname]);
53 std::string identifierString;
54 for (
size_t i = 0; i < gidentity.size() - 1; i++) {
55 identifierString += gidentity[i].getName() +
"->" + std::to_string(gidentity[i].getValue()) +
", ";
57 identifierString += gidentity.back().getName() +
"->" + std::to_string(gidentity.back().getValue());
58 return identifierString;
64 if (!data.doubleObservablesMap.empty()) {
65 os <<
", doubleObservables={";
67 for (
const auto& [name, value] : data.doubleObservablesMap) {
71 os << name <<
": " << value;
77 if (!data.stringVariablesMap.empty()) {
78 os <<
", stringObservables={";
80 for (
const auto& [name, value] : data.stringVariablesMap) {
84 os << name <<
": \"" << value <<
"\"";
std::shared_ptr< GLogger > log
std::vector< GIdentifier > getGID() const
void info(int level, Args &&... args) const
Stores simulation-level observables for one hit.
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::string getIdentityString() const
Builds a readable identity string from the stored hit identifiers.
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.