gdata
gDigitizedData.h
Go to the documentation of this file.
1 #pragma once
2 
11 #include <string>
12 #include <map>
13 #include <vector>
14 #include "ghit.h"
15 #include "glogger.h"
16 
18 public:
24  GDigitizedData(GHit* ghit, const std::shared_ptr<GLogger>& logger);
25 
29  ~GDigitizedData() { log->debug(DESTRUCTOR, "GDigitizedData"); }
30 
35  std::string getIdentityString();
36 
37  // Public interface to add data to a hit:
38  void includeVariable(const std::string& vname, int value);
39  void includeVariable(const std::string& vname, double value);
40  // void includeVariable(std::string vname, std::vector<int> values);
41 
47  [[nodiscard]] std::map<std::string, int> getIntObservablesMap(int which) const;
48 
54  [[nodiscard]] std::map<std::string, double> getDblObservablesMap(int which) const;
55 
64 
65  int getIntObservable(const std::string& varName);
66  double getDblObservable(const std::string& varName);
67 
72  [[nodiscard]] inline std::map<std::string, std::vector<int>> getArrayIntObservablesMap() const { return arrayIntObservablesMap; }
73 
78  [[nodiscard]] inline std::map<std::string, std::vector<double>> getArrayDblObservablesMap() const { return arrayDoubleObservablesMap; }
79 
80 private:
81  std::map<std::string, int> intObservablesMap;
82  std::map<std::string, double> doubleObservablesMap;
83  std::map<std::string, std::vector<int>> arrayIntObservablesMap;
84  std::map<std::string, std::vector<double>> arrayDoubleObservablesMap;
85  std::vector<GIdentifier> gidentity;
86  [[nodiscard]] static bool validVarName(const std::string& varName, int which);
87  std::shared_ptr<GLogger> log;
88 };
GDigitizedData(GHit *ghit, const std::shared_ptr< GLogger > &logger)
Constructs a GDigitizedData object from a GHit.
std::map< std::string, std::vector< int > > getArrayIntObservablesMap() const
Returns the map of integer array observables.
int getIntObservable(const std::string &varName)
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)
std::map< std::string, double > getDblObservablesMap(int which) const
Returns the filtered map of double observables.
std::map< std::string, std::vector< double > > getArrayDblObservablesMap() const
Returns the map of double array observables.
std::string getIdentityString()
Returns a string representation of the hit identity.
double getDblObservable(const std::string &varName)
~GDigitizedData()
Destructor for GDigitizedData.