10#include <background/modules/BeamBkgHitRateMonitor/ARICHHitRateCounter.h>
13#include <framework/logging/Logger.h>
22 namespace Background {
30 tree->Branch(
"arich", &
m_rates,
"segmentRates[18]/F:averageRate/F:numEvents/I:valid/O");
34 const int nModInRing[7] = {0, 42, 90, 144, 204, 270, 342};
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;
56 if (not
m_hits.isValid())
return;
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;
91 for (
int iSegment = 0; iSegment < 18; iSegment++) {
106 B2WARNING(
"ARICHHitRateCounter: no valid channel mask - all HAPDs set to active");
110 int nactiveTotal = 0;
111 for (
unsigned imod = 1; imod < 421; imod++) {
113 for (
unsigned ichn = 0; ichn < 144; ichn++) {
116 nactiveTotal += nactive;
std::map< unsigned, TreeStruct > m_buffer
average rates in time stamps
TreeStruct m_rates
tree variables
void setActiveHapds()
Sets number of active hapds in each segment.
virtual void initialize(TTree *tree) override
Class initializer: set branch addresses and other staf.
double m_activeTotal
total number of active HAPDS
int m_segmentMap[420]
mapping from module ID to segments
virtual void accumulate(unsigned timeStamp) override
Accumulate hits.
StoreArray< ARICHHit > m_hits
collection of digits
DBObjPtr< ARICHModulesInfo > m_modulesInfo
HAPD modules info.
DBObjPtr< ARICHChannelMask > m_channelMask
channel mask
double m_activeHapds[18]
number of active HAPDS in each segment
virtual void normalize(unsigned timeStamp) override
Normalize accumulated hits (e.g.
virtual void clear() override
Clear time-stamp buffer to prepare for 'accumulate'.
Abstract base class for different kinds of events.
bool valid
status: true = rates valid
float segmentRates[18]
hit rates per HAPD [Hz] for 18 segments of arich
float averageRate
total detector average hit rate per HAPD [Hz]
void normalize()
normalize accumulated hits to single event