Belle II Software  release-08-01-10
TOPHitRateCounter Class Reference

Class for monitoring beam background hit rates of TOP. More...

#include <TOPHitRateCounter.h>

Inheritance diagram for TOPHitRateCounter:
Collaboration diagram for TOPHitRateCounter:

Classes

struct  TreeStruct
 tree structure More...
 

Public Member Functions

 TOPHitRateCounter (double timeOffset, double timeWindow)
 Constructor. More...
 
virtual void initialize (TTree *tree) override
 Class initializer: set branch addresses and other staf. More...
 
virtual void clear () override
 Clear time-stamp buffer to prepare for 'accumulate'.
 
virtual void accumulate (unsigned timeStamp) override
 Accumulate hits. More...
 
virtual void normalize (unsigned timeStamp) override
 Normalize accumulated hits (e.g. More...
 

Private Member Functions

void setActiveFractions ()
 Sets fractions of active channels.
 

Private Attributes

double m_timeOffset = 0
 time offset of hits [ns]
 
double m_timeWindow = 0
 time window in which to count hits [ns]
 
TreeStruct m_rates
 tree variables
 
std::map< unsigned, TreeStructm_buffer
 average rates in time stamps
 
StoreArray< TOPDigitm_digits
 collection of digits
 
DBObjPtr< TOPCalChannelMaskm_channelMask
 channel mask
 
TH1F * m_hits = 0
 time distribution of hits in wide range
 
TH1F * m_hitsInWindow = 0
 time distribution of hits inside timeWindow
 
double m_activeFractions [16] = {0}
 fractions of active channels in slots
 
double m_activeTotal = 0
 total fraction of active channels
 

Detailed Description

Class for monitoring beam background hit rates of TOP.

Hit rates are given in MHz per PMT and are already corrected for different pixel efficiencies and masked-out pixels.

Definition at line 33 of file TOPHitRateCounter.h.

Constructor & Destructor Documentation

◆ TOPHitRateCounter()

TOPHitRateCounter ( double  timeOffset,
double  timeWindow 
)
inline

Constructor.

Parameters
timeOffsettime offset to be subtracted from hit times [ns]
timeWindowtime window (full size) in which to count hits [ns]

Definition at line 63 of file TOPHitRateCounter.h.

63  :
64  m_timeOffset(timeOffset), m_timeWindow(timeWindow)
65  {}
double m_timeWindow
time window in which to count hits [ns]
double m_timeOffset
time offset of hits [ns]

Member Function Documentation

◆ accumulate()

void accumulate ( unsigned  timeStamp)
overridevirtual

Accumulate hits.

Parameters
timeStamptime stamp

Implements HitRateBase.

Definition at line 56 of file TOPHitRateCounter.cc.

57  {
58  // check if data are available
59  if (not m_digits.isValid()) return;
60 
61  // get buffer element
62  auto& rates = m_buffer[timeStamp];
63 
64  // increment event counter
65  rates.numEvents++;
66 
67  // accumulate hits (weighted by efficiency correction)
68  const auto* topgp = TOP::TOPGeometryPar::Instance();
69  for (const auto& digit : m_digits) {
70  if (digit.getHitQuality() != TOPDigit::c_Good) continue;
71  m_hits->Fill(digit.getTime());
72 
73  if (fabs(digit.getTime() - m_timeOffset) > m_timeWindow / 2) continue;
74  m_hitsInWindow->Fill(digit.getTime());
75 
76  auto effi = topgp->getRelativePixelEfficiency(digit.getModuleID(),
77  digit.getPixelID());
78  float wt = std::min(1.0 / effi, 10.0);
79  rates.slotRates[digit.getModuleID() - 1] += wt;
80  rates.averageRate += wt;
81  }
82 
83  // set flag to true to indicate the rates are valid
84  rates.valid = true;
85 
86  }
std::map< unsigned, TreeStruct > m_buffer
average rates in time stamps
TH1F * m_hitsInWindow
time distribution of hits inside timeWindow
StoreArray< TOPDigit > m_digits
collection of digits
TH1F * m_hits
time distribution of hits in wide range
static TOPGeometryPar * Instance()
Static method to obtain the pointer to its instance.

◆ initialize()

void initialize ( TTree *  tree)
overridevirtual

Class initializer: set branch addresses and other staf.

Parameters
treea valid TTree pointer

Implements HitRateBase.

Definition at line 28 of file TOPHitRateCounter.cc.

◆ normalize()

void normalize ( unsigned  timeStamp)
overridevirtual

Normalize accumulated hits (e.g.

transform to rates) and prepare for TTree::Fill

Parameters
timeStamptime stamp

Implements HitRateBase.

Definition at line 88 of file TOPHitRateCounter.cc.


The documentation for this class was generated from the following files: