HerdSoftware  0.3.2
GGSSiliconDetectorHitsReader.h
Go to the documentation of this file.
1 /*
2  * GGSSiliconDetectorHitsReader.h
3  *
4  * Created on: 27 May 2021
5  * Author: Valerio Formato
6  */
7 
10 #ifndef HERD_GGSSILICONDETECTORHITSREADER_H_
11 #define HERD_GGSSILICONDETECTORHITSREADER_H_
12 
13 #ifndef GGSSMARTLOG_H_
14 #define HERD_GGSSILICONDETECTORHITSREADER_H_UNDEF_LOGGING
15 #endif
16 
17 // GGS headers
18 #include "montecarlo/readers/GGSTHitsReader.h"
19 #include "montecarlo/readers/GGSTRootReader.h"
20 
21 #ifdef HERD_GGSSILICONDETECTORHITSREADER_H_UNDEF_LOGGING
22 // Remove the definitions of GGS output macros (would conflict with the same macros defined in EventAnalysis)
23 // We only do this if GGSSmartLog.h is being parsed in this TU, otherwise there would be nothing to undef
24 // (or we could even be undefining the EA macros)
25 #undef COUT
26 #undef CCOUT
27 #undef ENDL
28 #endif
29 
30 // EA headers
31 #include "core/ObjectWrapper.h"
32 #include "core/RetrievalResult.h"
33 #include "utils/Memory.h"
34 
35 // HerdSoftware headers
36 #include "common/DefaultValues.h"
40 
41 // c++ headers
42 #include <string>
43 #include <utility>
44 
45 using namespace EA;
46 
47 namespace Herd {
48 
49 namespace Readers {
50 // clang-format off
56 // clang-format on
58 public:
59  enum class DetectorType { STK, SCD };
60 
61  GGSSiliconDetectorHitsReader(std::shared_ptr<GGSTRootReader> ggsReader, DetectorType type)
62  : m_ggsReader{std::move(ggsReader)}, m_hitReader{m_ggsReader->GetReader<GGSTHitsReader>()}, m_type{type} {};
63 
72  bool IsSiliconDetectorHitsCollAvailable();
80  RetrievalResult GetSiliconDetectorHitsColl(ObjectWrapper &wrapper);
81 
91  bool IsSiliconDetectorWaferParticleHitsCollAvailable() { return IsSiliconDetectorHitsCollAvailable(); };
92 
99  RetrievalResult GetSiliconDetectorWaferParticleHitsColl(ObjectWrapper &wrapper);
100 
115  std::vector<std::string> FreeObjects(const std::vector<std::string> &objs, Memory::Status memStatus);
116 
123  void SetSiliconDetectorGeoParamsColl(observer_ptr<SiliconDetectorGeoParamsColl> sdGeoParamsColl);
124 
129  void SetSideDetectorFirstWaferID(std::array<int, 4> sideSDFirstWaferID) { m_sideSDFirstWaferID = sideSDFirstWaferID; }
130 
135  // void SetSideDetectorFirstStripID(std::array<int, 4> sideSDFirstStripID) { m_sideSDFirstStripID =
136  // sideSDFirstStripID; }
137 
138 private:
139  std::shared_ptr<GGSTRootReader> m_ggsReader;
140  GGSTHitsReader *m_hitReader = nullptr;
141  long long int m_lastHitsReadEvent = std::numeric_limits<long long int>::max();
142  long long int m_lastPartHitsReadEvent = std::numeric_limits<long long int>::max();
143 
145 
146  observer_ptr<SiliconDetectorGeoParamsColl> m_sdGeoParamsColl = nullptr;
147  int m_topSDDetIndex = std::numeric_limits<int>::lowest();
148  int m_sideSDHDetIndex = std::numeric_limits<int>::lowest();
149  int m_sideSDVDetIndex = std::numeric_limits<int>::lowest();
150  std::array<int, 4> m_sideSDFirstWaferID{}; // ID of the first Wafer on each lateral SD, indexed as in GGS files
151 
154 
155  bool firstRun = true;
156  bool SetupSDReadout();
157 };
158 } // namespace Readers
159 } // namespace Herd
160 
161 #endif
std::shared_ptr< GGSTRootReader > m_ggsReader
Set the GGS volID of the first strip for each side SD detector.
Definition: GGSSiliconDetectorHitsReader.h:139
CssGeoParams.h CssGeoParams class declaration.
Definition: CaloPDCalibrationAlgo.h:24
SiliconDetectorParticleHitsColl m_sdWaferParticleHitsColl
Definition: GGSSiliconDetectorHitsReader.h:153
DetectorType
Definition: GGSSiliconDetectorHitsReader.h:59
void SetSideDetectorFirstWaferID(std::array< int, 4 > sideSDFirstWaferID)
Set the GGS volID of the first wafer for each side SD detector.
Definition: GGSSiliconDetectorHitsReader.h:129
DetectorType m_type
Definition: GGSSiliconDetectorHitsReader.h:144
SiliconDetectorHits reader class.
Definition: GGSSiliconDetectorHitsReader.h:57
bool IsSiliconDetectorWaferParticleHitsCollAvailable()
Checks if SiliconDetector particle hits are available in the simulation file.
Definition: GGSSiliconDetectorHitsReader.h:91
SiliconDetectorHitsColl m_sdHitsColl
Definition: GGSSiliconDetectorHitsReader.h:152
GGSSiliconDetectorHitsReader(std::shared_ptr< GGSTRootReader > ggsReader, DetectorType type)
Definition: GGSSiliconDetectorHitsReader.h:61