Belle II Software  release-05-02-19
ECLHitRateCounter Class Reference

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

#include <ECLHitRateCounter.h>

Inheritance diagram for ECLHitRateCounter:
Collaboration diagram for ECLHitRateCounter:

Classes

struct  TreeStruct
 tree structure More...
 

Public Member Functions

 ECLHitRateCounter ()
 Constructor.
 
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 segmentECL ()
 Performs ECL segmentation; Done once per run; Populates a map which connects each ECL crystal with a segment number (0-15); Segments 0-3 are in the forward endcap, 4-7 are in the barrel with z<0, 8-11 are in the barrel with z>0, 12-15 are in the backward endcap; Segment 0 contains crystals with 45deg < phi < 135deg, Segment 1 contains crystals with 135deg < phi < 225deg, Segment 2 contains crystals with 225deg < phi < 315deg, Segment 3 contains crystals with phi < 45deg or phi > 315deg, With the same angular patter continuing for barrel and BWD encap segments.
 
int findECLSegment (int cellid)
 Find the correcsponding ECL segment based on the cellID. More...
 
void findElectronicsNoise ()
 Find the electronics noise correction for each cellID Reads a file with a histogram containing electronics noise level of each crystal.
 

Private Attributes

TreeStruct m_rates
 tree variables
 
std::map< unsigned, TreeStructm_buffer
 average rates in time stamps
 
StoreArray< ECLDigitm_digits
 collection of digits
 
StoreArray< ECLDspm_dsps
 collection of ECL waveforms
 
std::vector< float > m_ADCtoEnergy
 vector used to store ECL calibration constants for each crystal
 
std::vector< float > m_waveformNoise
 vector used to store ECL electronic noise constants foe each crystal
 
Belle2::ECL::ECLGeometryParm_geometry {nullptr}
 pointer to ECLGeometryPar
 
std::map< int, int > m_segmentMap
 map with keys containing ECL CellID and values containing segment number
 
int m_crystalsInSegment [16] = {0}
 array cotaining the number of crystals in given segment
 

Detailed Description

Class for monitoring beam background hit rates of ECL.

Definition at line 38 of file ECLHitRateCounter.h.

Member Function Documentation

◆ accumulate()

void accumulate ( unsigned  timeStamp)
overridevirtual

Accumulate hits.

Parameters
timeStamptime stamp

Implements HitRateBase.

Definition at line 54 of file ECLHitRateCounter.cc.

55  {
56  // check if data are available
57  if (not m_dsps.isValid()) return;
58 
59  //calculate rates using waveforms
60  //The background rate for a crystal is calculated as
61  //rate = rms_pedestal_squared / (average_photon_energy_squared * time_constant)
62  //where time_constant=2.53 us and average_photon_energy_squared = 1 MeV
63  if (m_dsps.getEntries() == 8736) {
64 
65  // get buffer element
66  auto& rates = m_buffer[timeStamp];
67 
68  // increment event counter
69  rates.numEvents++;
70 
71  for (auto& aECLDsp : m_dsps) {
72 
73  int nadc = aECLDsp.getNADCPoints();
74  int cellID = aECLDsp.getCellId();
75  int segmentNumber = findECLSegment(cellID);
76  int crysID = cellID - 1;
77  std::vector<int> dspAv = aECLDsp.getDspA();
78 
79  //finding the pedestal value
80  double dspMean = (std::accumulate(dspAv.begin(), dspAv.begin() + nadc, 0.0)) / nadc;
81  double wpsum = 0;
82  for (int v = 0; v < nadc; v++) {
83  wpsum += pow(dspAv[v] - dspMean, 2);
84  }
85  double dspRMS = sqrt(wpsum / nadc);
86  double dspSigma = dspRMS * abs(m_ADCtoEnergy[crysID]);
87 
88  //calculating the background rate per second
89  double dspBkgRate = ((pow(dspSigma, 2)) - (pow(m_waveformNoise[crysID], 2))) / (2.53 * 1e-12);
90  if (dspBkgRate < 0) {
91  dspBkgRate = 0;
92  }
93 
94  //hit rate for segment in ECL, which is later normalized per 1Hz
95  rates.averageDspBkgRate[segmentNumber] += dspBkgRate;
96 
97  }
98 
99  // set flag to true to indicate the rates are valid
100  rates.validDspRate = true;
101  }
102  }

◆ findECLSegment()

int findECLSegment ( int  cellid)
inlineprivate

Find the correcsponding ECL segment based on the cellID.

Parameters
cellidECL crystal CellID

Definition at line 118 of file ECLHitRateCounter.h.

◆ initialize()

void initialize ( TTree *  tree)
overridevirtual

Class initializer: set branch addresses and other staf.

Parameters
treea valid TTree pointer

Implements HitRateBase.

Definition at line 30 of file ECLHitRateCounter.cc.

◆ normalize()

void normalize ( unsigned  timeStamp)
overridevirtual

Normalize accumulated hits (e.g.

transform to rates)

Parameters
timeStamptime stamp

Implements HitRateBase.

Definition at line 104 of file ECLHitRateCounter.cc.


The documentation for this class was generated from the following files:
prepareAsicCrosstalkSimDB.e
e
aux.
Definition: prepareAsicCrosstalkSimDB.py:53
Belle2::Background::ECLHitRateCounter::m_waveformNoise
std::vector< float > m_waveformNoise
vector used to store ECL electronic noise constants foe each crystal
Definition: ECLHitRateCounter.h:140
Belle2::Background::ECLHitRateCounter::m_dsps
StoreArray< ECLDsp > m_dsps
collection of ECL waveforms
Definition: ECLHitRateCounter.h:137
Belle2::Background::ECLHitRateCounter::m_buffer
std::map< unsigned, TreeStruct > m_buffer
average rates in time stamps
Definition: ECLHitRateCounter.h:133
Belle2::Background::ECLHitRateCounter::m_ADCtoEnergy
std::vector< float > m_ADCtoEnergy
vector used to store ECL calibration constants for each crystal
Definition: ECLHitRateCounter.h:139
Belle2::Background::ECLHitRateCounter::findECLSegment
int findECLSegment(int cellid)
Find the correcsponding ECL segment based on the cellID.
Definition: ECLHitRateCounter.h:118