KaliVeda
Toolkit for HIC analysis
KVSegmentedDetector.h
1 #ifndef KVSEGMENTEDDETECTOR_H
2 #define KVSEGMENTEDDETECTOR_H
3 
4 #include "KVDetector.h"
5 #include <unordered_map>
13 class KVSegmentedDetector : public KVDetector {
14 
15  mutable std::unordered_map<int, std::unique_ptr<KVDetector>> fSubDetectors;
16  std::vector<int> fHitSubDetectors;
17 
18 public:
20  {
23  }
24 
25  void AddSubDetector(int i, KVDetector* D)
26  {
27  fSubDetectors[i].reset(D);
28  }
29 
31  {
32  return fSubDetectors.size();
33  }
34  KVDetector* GetSubDetector(int i) const
35  {
36  return fSubDetectors[i].get();
37  }
38 
39  Bool_t IsSegmented() const override
40  {
41  return kTRUE;
42  }
43 
44  void AddHitSubDetector(int i)
45  {
46  fHitSubDetectors.push_back(i);
47  }
48 
49  const std::vector<int>& GetHitSubDetectors() const
50  {
51  return fHitSubDetectors;
52  }
53 
54  void AddEnergyLossInSubDetector(int i, double e) override;
55 
56  void Clear(Option_t* opt = "") override;
57 
59 };
60 
61 #endif // KVSEGMENTEDDETECTOR_H
unsigned int UInt_t
bool Bool_t
constexpr Bool_t kTRUE
const char Option_t
#define ClassDefOverride(name, id)
A position-sensitive detector made up of several or many numbered sub-detector segments.
UInt_t GetNSegments() const
void AddEnergyLossInSubDetector(int i, double e) override
std::unordered_map< int, std::unique_ptr< KVDetector > > fSubDetectors
void AddSubDetector(int i, KVDetector *D)
const std::vector< int > & GetHitSubDetectors() const
std::vector< int > fHitSubDetectors
KVDetector * GetSubDetector(int i) const
Bool_t IsSegmented() const override
void Clear(Option_t *opt="") override