Belle II Software  release-08-01-10
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 28 of file ECLHitRateCounter.h.

Member Function Documentation

◆ accumulate()

void accumulate ( unsigned  timeStamp)
overridevirtual

Accumulate hits.

Parameters
timeStamptime stamp

Implements HitRateBase.

Definition at line 52 of file ECLHitRateCounter.cc.

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

◆ findECLSegment()

int findECLSegment ( int  cellid)
inlineprivate

Find the correcsponding ECL segment based on the cellID.

Parameters
cellidECL crystal CellID

Definition at line 108 of file ECLHitRateCounter.h.

109  {
110  return m_segmentMap.find(cellid)->second;
111  }
std::map< int, int > m_segmentMap
map with keys containing ECL CellID and values containing segment number

◆ 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 ECLHitRateCounter.cc.

◆ normalize()

void normalize ( unsigned  timeStamp)
overridevirtual

Normalize accumulated hits (e.g.

transform to rates)

Parameters
timeStamptime stamp

Implements HitRateBase.

Definition at line 102 of file ECLHitRateCounter.cc.


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