Belle II Software  release-05-02-19
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 43 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 73 of file TOPHitRateCounter.h.

92  :
93 

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  }

◆ 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:
Belle2::Background::TOPHitRateCounter::m_hits
TH1F * m_hits
time distribution of hits in wide range
Definition: TOPHitRateCounter.h:124
Belle2::Background::TOPHitRateCounter::m_timeOffset
double m_timeOffset
time offset of hits [ns]
Definition: TOPHitRateCounter.h:108
Belle2::TOP::TOPGeometryPar::Instance
static TOPGeometryPar * Instance()
Static method to obtain the pointer to its instance.
Definition: TOPGeometryPar.cc:45
Belle2::Background::TOPHitRateCounter::m_buffer
std::map< unsigned, TreeStruct > m_buffer
average rates in time stamps
Definition: TOPHitRateCounter.h:115
Belle2::Background::TOPHitRateCounter::m_timeWindow
double m_timeWindow
time window in which to count hits [ns]
Definition: TOPHitRateCounter.h:109
Belle2::Background::TOPHitRateCounter::m_digits
StoreArray< TOPDigit > m_digits
collection of digits
Definition: TOPHitRateCounter.h:118
Belle2::Background::TOPHitRateCounter::m_hitsInWindow
TH1F * m_hitsInWindow
time distribution of hits inside timeWindow
Definition: TOPHitRateCounter.h:125