gdata
gEventDataCollection.h
Go to the documentation of this file.
1 #ifndef GEVENTDATA_H
2 #define GEVENTDATA_H 1
3 
13 #include "gDataCollection.h"
14 #include <vector>
15 #include <map>
16 #include <string>
17 
19 public:
26  GEventDataCollection(GEventDataCollectionHeader* header, std::shared_ptr<GLogger> logger) : log(std::move(logger)),
27  gheader(header) {
28  log->debug(CONSTRUCTOR, "GEventDataCollection");
29  gdataCollectionMap = new std::map<std::string, GDataCollection*>();
30  }
31 
38  log->debug(DESTRUCTOR, "GEventDataCollection");
39  for (auto& [keys, values] : (*gdataCollectionMap)) { delete values; }
40  delete gheader;
41  delete gdataCollectionMap;
42  }
43 
49  void addDetectorTrueInfoData(std::string sdName, GTrueInfoData* data);
50 
56  void addDetectorDigitizedData(std::string sdName, GDigitizedData* data);
57 
62  [[nodiscard]] inline const GEventDataCollectionHeader* getHeader() const { return gheader; }
63 
68  [[nodiscard]] inline const std::map<std::string, GDataCollection*>* getDataCollectionMap() const {
69  return gdataCollectionMap;
70  }
71 
76  [[nodiscard]] inline int getEventNumber() const { return gheader->getG4LocalEvn(); }
77 
83  [[nodiscard]] const std::vector<GTrueInfoData*>* getTrueInfoDataForDetector(std::string detector) const;
84 
90  [[nodiscard]] const std::vector<GDigitizedData*>* getDigitizedDataForDetector(std::string detector) const;
91 
92 private:
93  std::shared_ptr<GLogger> log;
94  GEventDataCollectionHeader* gheader = nullptr;
95  std::map<std::string, GDataCollection*>* gdataCollectionMap;
96 };
97 
98 #endif
int getG4LocalEvn() const
Gets the local event number.
const std::vector< GDigitizedData * > * getDigitizedDataForDetector(std::string detector) const
Gets the digitized hit data for a specific detector.
void addDetectorTrueInfoData(std::string sdName, GTrueInfoData *data)
Adds true hit information data for a detector.
GEventDataCollection(GEventDataCollectionHeader *header, std::shared_ptr< GLogger > logger)
Constructs a GEventDataCollection.
const std::map< std::string, GDataCollection * > * getDataCollectionMap() const
Gets the map of data collections.
int getEventNumber() const
Gets the event number.
void addDetectorDigitizedData(std::string sdName, GDigitizedData *data)
Adds digitized hit data for a detector.
const GEventDataCollectionHeader * getHeader() const
Gets the event header.
const std::vector< GTrueInfoData * > * getTrueInfoDataForDetector(std::string detector) const
Gets the true hit information data for a specific detector.
~GEventDataCollection()
Destructor for GEventDataCollection.