10#include <background/modules/BeamBkgHitRateMonitor/TOPHitRateCounter.h>
13#include <top/geometry/TOPGeometryPar.h>
16#include <framework/gearbox/Unit.h>
17#include <framework/logging/Logger.h>
26 namespace Background {
34 tree->Branch(
"top", &
m_rates,
"slotRates[16]/F:averageRate/F:numEvents/I:valid/O");
37 m_hits =
new TH1F(
"top_hits",
"time distribution of hits; digit.time [ns]",
40 "time distribution of hits; digit.time [ns]",
70 if (digit.getHitQuality() != TOPDigit::c_Good)
continue;
71 m_hits->Fill(digit.getTime());
76 auto effi = topgp->getRelativePixelEfficiency(digit.getModuleID(),
78 float wt = std::min(1.0 / effi, 10.0);
79 rates.slotRates[digit.getModuleID() - 1] += wt;
80 rates.averageRate += wt;
108 for (
int m = 0; m < 16; m++) {
125 B2WARNING(
"TOPHitRateCounter: no valid channel mask - active fractions set to 1");
129 for (
int m = 0; m < 16; m++) {
std::map< unsigned, TreeStruct > m_buffer
average rates in time stamps
DBObjPtr< TOPCalChannelMask > m_channelMask
channel mask
void setActiveFractions()
Sets fractions of active channels.
TreeStruct m_rates
tree variables
TH1F * m_hitsInWindow
time distribution of hits inside timeWindow
virtual void initialize(TTree *tree) override
Class initializer: set branch addresses and other staf.
double m_activeTotal
total fraction of active channels
virtual void accumulate(unsigned timeStamp) override
Accumulate hits.
double m_activeFractions[16]
fractions of active channels in slots
double m_timeWindow
time window in which to count hits [ns]
StoreArray< TOPDigit > m_digits
collection of digits
TH1F * m_hits
time distribution of hits in wide range
double m_timeOffset
time offset of hits [ns]
virtual void normalize(unsigned timeStamp) override
Normalize accumulated hits (e.g.
virtual void clear() override
Clear time-stamp buffer to prepare for 'accumulate'.
static TOPGeometryPar * Instance()
Static method to obtain the pointer to its instance.
static const double us
[microsecond]
Abstract base class for different kinds of events.
bool valid
status: true = rates valid
float slotRates[16]
hit rates per PMT of the modules (slots) [MHz]
float averageRate
average hit rate per PMT [MHz]
void normalize()
normalize accumulated hits to single event