gdata
gEventDataCollection.h
Go to the documentation of this file.
1 #pragma once
2 
12 #include "gDataCollection.h"
13 #include <vector>
14 #include <map>
15 #include <string>
16 
18 public:
25  GEventDataCollection(GEventDataCollectionHeader* header, std::shared_ptr<GLogger> logger) : log(logger),
26  gheader(header) {
27  log->debug(CONSTRUCTOR, "GEventDataCollection");
28  gdataCollectionMap = new std::map<std::string, GDataCollection*>();
29  }
30 
37  log->debug(DESTRUCTOR, "GEventDataCollection");
38  for (auto& [keys, values] : (*gdataCollectionMap)) { delete values; }
39  delete gheader;
40  delete gdataCollectionMap;
41  }
42 
48  void addDetectorTrueInfoData(std::string sdName, GTrueInfoData* data);
49 
55  void addDetectorDigitizedData(std::string sdName, GDigitizedData* data);
56 
61  [[nodiscard]] inline const GEventDataCollectionHeader* getHeader() const { return gheader; }
62 
67  [[nodiscard]] inline const std::map<std::string, GDataCollection*>* getDataCollectionMap() const {
68  return gdataCollectionMap;
69  }
70 
75  [[nodiscard]] inline int getEventNumber() const { return gheader->getG4LocalEvn(); }
76 
82  [[nodiscard]] const std::vector<GTrueInfoData*>* getTrueInfoDataForDetector(std::string detector) const;
83 
89  [[nodiscard]] const std::vector<GDigitizedData*>* getDigitizedDataForDetector(std::string detector) const;
90 
91 private:
92  std::shared_ptr<GLogger> log;
93  GEventDataCollectionHeader* gheader = nullptr;
94  std::map<std::string, GDataCollection*>* gdataCollectionMap;
95 };
96 
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.