gdata
Loading...
Searching...
No Matches
gDataCollection.h
Go to the documentation of this file.
1#pragma once
2
11#include "gTrueInfoData.h"
12#include "gDigitizedData.h"
13
14// c++
15#include <memory>
16#include <vector>
17
18
20public:
25 explicit GDataCollection(std::shared_ptr<GLogger> logger)
26 : log(logger) { log->debug(CONSTRUCTOR, "GDataCollection"); }
27
33 ~GDataCollection() { if (log) log->debug(DESTRUCTOR, "GDataCollection"); }
34
39 void addTrueInfoData(std::unique_ptr<GTrueInfoData> data) {
40 log->debug(NORMAL, " adding hit to trueInfosData with identity: ", data->getIdentityString());
41 trueInfosData.push_back(std::move(data)); // taking ownership of the unique_ptr
42 }
43
48 void addDigitizedData(std::unique_ptr<GDigitizedData> data) {
49 log->debug(NORMAL, " adding hit to digitizedData with identity: ", data->getIdentityString());
50 digitizedData.push_back(std::move(data)); // taking ownership of the unique_ptr
51 }
52
63 [[nodiscard]] inline const std::vector<std::unique_ptr<GTrueInfoData>>& getTrueInfoData() const { return trueInfosData; }
64
74 [[nodiscard]] inline const std::vector<std::unique_ptr<GDigitizedData>>& getDigitizedData() const { return digitizedData; }
75
76private:
77 std::vector<std::unique_ptr<GTrueInfoData>> trueInfosData;
78 std::vector<std::unique_ptr<GDigitizedData>> digitizedData;
79 std::shared_ptr<GLogger> log;
80
81};
~GDataCollection()
Destructor for GDataCollection.
void addTrueInfoData(std::unique_ptr< GTrueInfoData > data)
Adds true hit information data.
void addDigitizedData(std::unique_ptr< GDigitizedData > data)
Adds digitized hit data.
const std::vector< std::unique_ptr< GDigitizedData > > & getDigitizedData() const
Provides read-only access to the stored digitized hit data.
const std::vector< std::unique_ptr< GTrueInfoData > > & getTrueInfoData() const
Provides read-only access to the stored true hit data.
GDataCollection(std::shared_ptr< GLogger > logger)
Constructs a GDataCollection.
Defines the GTrueInfoData class which holds true hit data.