HerdSoftware  0.3.2
GGSFitHitsReader.h
Go to the documentation of this file.
1 /*
2  * GGSFitHitsReader.h
3  *
4  * Created on: 31 May 2021
5  * Author: Valerio Formato
6  */
7 
10 #ifndef HERD_GGSFITHITSREADER_H_
11 #define HERD_GGSFITHITSREADER_H_
12 
13 #ifndef GGSSMARTLOG_H_
14 #define HERD_GGSFITHITSREADER_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_GGSFITHITSREADER_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 <functional>
43 #include <string>
44 #include <utility>
45 
46 using namespace EA;
47 
48 namespace Herd {
49 
50 namespace Readers {
51 // clang-format off
57 // clang-format on
59 public:
60  explicit GGSFitHitsReader(std::shared_ptr<GGSTRootReader> ggsReader)
61  : m_ggsReader{std::move(ggsReader)}, m_hitReader{m_ggsReader->GetReader<GGSTHitsReader>()} {};
62 
71  bool IsFitHitsCollAvailable();
72 
79  RetrievalResult GetFitHitsColl(ObjectWrapper &wrapper);
80 
89  bool IsFitParticleHitsCollAvailable();
90 
97  RetrievalResult GetFitParticleHitsColl(ObjectWrapper &wrapper);
98 
111  std::vector<std::string> FreeObjects(const std::vector<std::string> &objs, Memory::Status memStatus);
112 
119  void SetFitGeoParamsColl(observer_ptr<FitGeoParamsColl> fitGeoParamsColl);
120 
125  void SetSideDetectorFirstVolumeID(std::array<int, 4> sideFitFirstVolumeID) {
126  m_sideFitFirstVolumeID = sideFitFirstVolumeID;
127  }
128 
129 private:
130  std::shared_ptr<GGSTRootReader> m_ggsReader;
131  GGSTHitsReader *m_hitReader = nullptr;
132  long long int m_lastHitsReadEvent = std::numeric_limits<long long int>::max();
133  long long int m_lastPartHitsReadEvent = std::numeric_limits<long long int>::max();
134 
135  observer_ptr<FitGeoParamsColl> m_fitGeoParamsColl = nullptr;
136  int m_topFitDetIndex = std::numeric_limits<int>::lowest();
137  int m_sideFitDetIndex = std::numeric_limits<int>::lowest();
138  std::array<int, 4> m_sideFitFirstVolumeID{}; // ID of the first MAT on each lateral FIT, indexed as in GGS files
139 
142 
143  bool SetupFitReadout();
144 };
145 } // namespace Readers
146 } // namespace Herd
147 
148 #endif
CssGeoParams.h CssGeoParams class declaration.
Definition: CaloPDCalibrationAlgo.h:24
CaloHits reader class.
Definition: GGSFitHitsReader.h:58
FitHitsColl m_fitHitsColl
Definition: GGSFitHitsReader.h:140
std::shared_ptr< GGSTRootReader > m_ggsReader
Definition: GGSFitHitsReader.h:130
void SetSideDetectorFirstVolumeID(std::array< int, 4 > sideFitFirstVolumeID)
Set the GGS volID of the first wafer for each side FIT detector.
Definition: GGSFitHitsReader.h:125
GGSFitHitsReader(std::shared_ptr< GGSTRootReader > ggsReader)
Definition: GGSFitHitsReader.h:60
FitParticleHitsColl m_fitParticleHitsColl
Definition: GGSFitHitsReader.h:141