ATLAS Offline Software
Loading...
Searching...
No Matches
AFP_HitCollectionBuilders.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef AFP_G4_SD_AFP_HITCOLLECTIONBUILDERS_H
6#define AFP_G4_SD_AFP_HITCOLLECTIONBUILDERS_H
7
10
11#include <array>
12
14{
15public:
16 static constexpr int TDMaxCnt = 4000;
17
18 using AFP_TDSimHitCollection::AFP_TDSimHitCollection;
19
20 bool HasReachedLimit(const int stationID, const int quarticID, const int detectorID) const
21 {
22 const int index = CounterIndex(stationID, quarticID);
23 return index >= 0 && detectorID >= 0 && detectorID < static_cast<int>(m_hitsPerBar[index].size()) &&
24 m_hitsPerBar[index][detectorID] >= TDMaxCnt;
25 }
26
27 void CountHit(const int stationID, const int quarticID, const int detectorID)
28 {
30 const int index = CounterIndex(stationID, quarticID);
31 if (index >= 0 && detectorID >= 0 && detectorID < static_cast<int>(m_hitsPerBar[index].size())) {
32 ++m_hitsPerBar[index][detectorID];
33 }
34 }
35
37
38 int NumberOfHits() const { return m_numberOfHits; }
39
40private:
41 static int CounterIndex(const int stationID, const int quarticID)
42 {
43 if (stationID == 0 && quarticID == 0) return 0;
44 if (stationID == 0 && quarticID == 1) return 1;
45 if (stationID == 3 && quarticID == 0) return 2;
46 if (stationID == 3 && quarticID == 1) return 3;
47 return -1;
48 }
49
51 std::array<std::array<int, 32>, 4> m_hitsPerBar{};
52};
53
55{
56public:
57 static constexpr int SiDMaxCnt = 1000;
58
59 using AFP_SIDSimHitCollection::AFP_SIDSimHitCollection;
60
61 bool HasReachedLimit(const int stationID) const
62 {
63 return stationID >= 0 && stationID < static_cast<int>(m_hitsPerStation.size()) &&
64 m_hitsPerStation[stationID] >= SiDMaxCnt;
65 }
66
67 void CountHit(const int stationID)
68 {
70 if (stationID >= 0 && stationID < static_cast<int>(m_hitsPerStation.size())) {
71 ++m_hitsPerStation[stationID];
72 }
73 }
74
75 int NumberOfHits() const { return m_numberOfHits; }
76
77private:
79 std::array<int, 4> m_hitsPerStation{};
80};
81
82#endif
AtlasHitsVector< AFP_SIDSimHit > AFP_SIDSimHitCollection
AtlasHitsVector< AFP_TDSimHit > AFP_TDSimHitCollection
bool HasReachedLimit(const int stationID) const
std::array< std::array< int, 32 >, 4 > m_hitsPerBar
bool HasReachedLimit(const int stationID, const int quarticID, const int detectorID) const
void CountHit(const int stationID, const int quarticID, const int detectorID)
static int CounterIndex(const int stationID, const int quarticID)
Definition index.py:1