Class for monitoring beam background hit rates of ARICH.
More...
#include <ARICHHitRateCounter.h>
|
| ARICHHitRateCounter () |
| Constructor.
|
|
virtual void | initialize (TTree *tree) override |
| Class initializer: set branch addresses and other staf.
|
|
virtual void | clear () override |
| Clear time-stamp buffer to prepare for 'accumulate'.
|
|
virtual void | accumulate (unsigned timeStamp) override |
| Accumulate hits.
|
|
virtual void | normalize (unsigned timeStamp) override |
| Normalize accumulated hits (e.g.
|
|
Class for monitoring beam background hit rates of ARICH.
Definition at line 31 of file ARICHHitRateCounter.h.
◆ ARICHHitRateCounter()
◆ accumulate()
void accumulate |
( |
unsigned | timeStamp | ) |
|
|
overridevirtual |
Accumulate hits.
- Parameters
-
Implements HitRateBase.
Definition at line 53 of file ARICHHitRateCounter.cc.
54 {
55
56 if (not m_hits.isValid()) return;
57
58
59 auto& rates = m_buffer[timeStamp];
60
61
62 rates.numEvents++;
63
64
65 for (const auto& hit : m_hits) {
66 if (hit.getModule() < 1 || hit.getModule() > 420) continue;
67 auto effi = m_modulesInfo->getChannelQE(hit.getModule(), hit.getChannel());
68 float wt = std::min(1.0 / effi, 100.);
69 rates.segmentRates[m_segmentMap[hit.getModule() - 1]] += wt;
70 rates.averageRate += wt;
71 }
72
73
74 rates.valid = true;
75
76 }
◆ clear()
◆ initialize()
void initialize |
( |
TTree * | tree | ) |
|
|
overridevirtual |
Class initializer: set branch addresses and other staf.
- Parameters
-
tree | a valid TTree pointer |
Implements HitRateBase.
Definition at line 24 of file ARICHHitRateCounter.cc.
25 {
26
27 m_hits.isOptional();
28
29
30 tree->Branch("arich", &m_rates, "segmentRates[18]/F:averageRate/F:numEvents/I:valid/O");
31
32
33
34 const int nModInRing[7] = {0, 42, 90, 144, 204, 270, 342};
35 int iRing = 0;
36 for (int i = 0; i < 420; i++) {
37 if (i == nModInRing[iRing + 1]) iRing++;
38 int segment = (i - nModInRing[iRing]) / (7 + iRing);
39 if (iRing > 0) segment += 6;
40 if (iRing > 3) segment += 6;
41 m_segmentMap[i] = segment;
42 }
43
44
45 setActiveHapds();
46 }
◆ normalize()
void normalize |
( |
unsigned | timeStamp | ) |
|
|
overridevirtual |
Normalize accumulated hits (e.g.
transform to rates)
- Parameters
-
Implements HitRateBase.
Definition at line 78 of file ARICHHitRateCounter.cc.
79 {
80
81 m_rates = m_buffer[timeStamp];
82
83 if (not m_rates.valid) return;
84
85
86 m_rates.normalize();
87
88
89 if (m_channelMask.hasChanged()) setActiveHapds();
90
91 for (int iSegment = 0; iSegment < 18; iSegment++) {
92 double nHapds = m_activeHapds[iSegment];
93 if (nHapds > 0) m_rates.segmentRates[iSegment] /= nHapds;
94 else m_rates.segmentRates[iSegment] = 0;
95 }
96 m_rates.averageRate /= m_activeTotal;
97 }
◆ setActiveHapds()
Sets number of active hapds in each segment.
Definition at line 99 of file ARICHHitRateCounter.cc.
100 {
101 for (auto& nactive : m_activeHapds) nactive = 0;
102
103 if (not m_channelMask.isValid()) {
104 for (unsigned imod = 1; imod < 421; imod++) m_activeHapds[m_segmentMap[imod - 1]] += 1.;
105 m_activeTotal = 420;
106 B2WARNING("ARICHHitRateCounter: no valid channel mask - all HAPDs set to active");
107 return;
108 }
109
110 int nactiveTotal = 0;
111 for (unsigned imod = 1; imod < 421; imod++) {
112 int nactive = 0;
113 for (unsigned ichn = 0; ichn < 144; ichn++) {
114 if (m_channelMask->isActive(imod, ichn)) nactive++;
115 }
116 nactiveTotal += nactive;
117 m_activeHapds[m_segmentMap[imod - 1]] += (float)nactive / 144.;
118 }
119 m_activeTotal = (float)nactiveTotal / 144.;
120 }
◆ m_activeHapds
double m_activeHapds[18] = {0} |
|
private |
◆ m_activeTotal
◆ m_buffer
◆ m_channelMask
◆ m_hits
◆ m_modulesInfo
◆ m_rates
◆ m_segmentMap
int m_segmentMap[420] = {0} |
|
private |
The documentation for this class was generated from the following files: