7 #include "../gdataConventions.h"
13 log->debug(CONSTRUCTOR,
"GDigitizedData");
14 gidentity = ghit->getGID();
18 std::map<std::string, int> filteredIntObservablesMap;
19 for (
const auto& [varName, value] : intObservablesMap) {
20 if (validVarName(varName, which)) {
21 filteredIntObservablesMap[varName] = value;
24 log->debug(NORMAL,
" getting ", which,
" from intObservablesMap.");
25 return filteredIntObservablesMap;
29 std::map<std::string, float> filteredFltObservablesMap;
30 for (
const auto& [varName, value] : doubleObservablesMap) {
31 if (validVarName(varName, which)) {
32 filteredFltObservablesMap[varName] = value;
35 log->debug(NORMAL,
" getting ", which,
" from doubleObservablesMap.");
36 return filteredFltObservablesMap;
39 bool GDigitizedData::validVarName(
const std::string& varName,
int which)
const {
46 }
else if (which == 1) {
55 log->debug(NORMAL,
"Including int variable ", vname,
" with value ", value);
56 intObservablesMap[vname] = value;
60 log->debug(NORMAL,
"Including float variable ", vname,
" with value ", value);
61 doubleObservablesMap[vname] = value;
68 log->debug(NORMAL,
"Getting TIMEATELECTRONICS from intObservablesMap.");
73 if (intObservablesMap.find(varName) == intObservablesMap.end()) {
74 log->error(
EC__VARIABLENOTFOUND,
"variable name <" + varName +
"> not found in GDigitizedData::intObservablesMap");
76 return intObservablesMap[varName];
80 if (doubleObservablesMap.find(varName) == doubleObservablesMap.end()) {
81 log->error(
EC__VARIABLENOTFOUND,
"variable name <" + varName +
"> not found in GDigitizedData::doubleObservablesMap");
83 return doubleObservablesMap[varName];
87 std::string identifierString =
"";
88 for (
size_t i = 0; i < gidentity.size() - 1; i++) {
89 identifierString += gidentity[i].getName() +
"->" + std::to_string(gidentity[i].getValue()) +
", ";
91 identifierString += gidentity.back().getName() +
"->" + std::to_string(gidentity.back().getValue());
92 return identifierString;
GDigitizedData(GHit *ghit, const std::shared_ptr< GLogger > &logger)
Constructs a GDigitizedData object from a GHit.
std::map< std::string, float > getFltObservablesMap(int which) const
Returns the filtered map of float observables.
std::map< std::string, int > getIntObservablesMap(int which) const
Returns the filtered map of integer observables.
int getTimeAtElectronics()
Gets the time at electronics.
void includeVariable(const std::string &vname, int value)
float getFltObservable(std::string varName)
int getIntObservable(std::string varName)
std::string getIdentityString()
Returns a string representation of the hit identity.
constexpr const char * TIMEATELECTRONICS
Identifier for time at electronics.
constexpr const char * CRATESTRINGID
Identifier for crate.
constexpr const char * CHANNELSTRINGID
Identifier for channel.
constexpr const char * SLOTSTRINGID
Identifier for slot.
constexpr int TIMEATELECTRONICSNOTDEFINED
Default value for undefined time at electronics.
constexpr int EC__VARIABLENOTFOUND
Exit code when a variable is not found.
constexpr const char * CHARGEATELECTRONICS
Identifier for charge at electronics.