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

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

#include <CDCHitRateCounter.h>

Inheritance diagram for CDCHitRateCounter:
Collaboration diagram for CDCHitRateCounter:

Classes

struct  TreeStruct
 tree structure More...
 

Public Member Functions

 CDCHitRateCounter (const int timeWindowLowerEdge_smallCell, const int timeWindowUpperEdge_smallCell, const int timeWindowLowerEdge_normalCell, const int timeWindowUpperEdge_normalCell, const bool enableBadWireTreatment, const bool enableBackgroundHitFilter, const bool enableMarkBackgroundHit)
 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

bool isInTimeWindow (const int SL, const short tdc)
 return true if the hit is in the given time window More...
 
void countActiveWires_countAll ()
 set m_nActiveWireInTotal, m_nActiveWireInLayer[] and m_nActiveWireInSuperLayer[]. More...
 
void countActiveWires ()
 set m_nActiveWireInTotal, m_nActiveWireInLayer[] and m_nActiveWireInSuperLayer[]. More...
 
unsigned short getIPhiBin (unsigned short iSL, unsigned short iWireInLayer)
 get the bin ID of the division.
 

Private Attributes

TreeStruct m_rates
 tree variables
 
std::map< unsigned, TreeStructm_buffer
 average rates in time stamps
 
StoreArray< CDCHitm_digits
 collection of digits
 
const int m_timeWindowLowerEdge_smallCell
 lower edge of the time window for small cells [tdc count = 0.982536 ns]
 
const int m_timeWindowUpperEdge_smallCell
 upper edge of the time window for small cells [tdc count = 0.982536 ns]
 
const int m_timeWindowLowerEdge_normalCell
 lower edge of the time window for normal cells [tdc count = 0.982536 ns]
 
const int m_timeWindowUpperEdge_normalCell
 upper edge of the time window for normal cells [tdc count = 0.982536 ns]
 
const bool m_enableBadWireTreatment
 flag to enable the bad wire treatment. More...
 
const bool m_enableBackgroundHitFilter
 flag to enable the CDC background hit (crosstakl, noise) filter. More...
 
const bool m_enableMarkBackgroundHit
 flag to enable to mark background flag on CDCHit (set 0x100 bit for CDCHit::m_status). More...
 
int m_nActiveWireInTotal
 the number of wires used in this hit-rate calculation in the whole CDC More...
 
int m_nActiveWireInSuperLayer [f_nSuperLayer] = {0}
 the number of wires used in this hit-rate calculation in each suler layer
 
int m_nActiveWireInLayer [f_nLayer] = {0}
 the number of wires used in this hit-rate calculation in each layer
 
int m_nActiveWireInLayerPhi [f_nLayer][f_nPhiDivision] = {{0}}
 the number of wires used in this hit-rate calculation in each phi bin in each layer
 

Static Private Attributes

static const int f_nSuperLayer = 9
 the number of super layers
 
static const int f_nLayer = 56
 the number of layers
 
static const int f_nPhiDivision = 8
 the number of division in phi
 

Detailed Description

Class for monitoring beam background hit rates of CDC.

Definition at line 28 of file CDCHitRateCounter.h.

Constructor & Destructor Documentation

◆ CDCHitRateCounter()

CDCHitRateCounter ( const int  timeWindowLowerEdge_smallCell,
const int  timeWindowUpperEdge_smallCell,
const int  timeWindowLowerEdge_normalCell,
const int  timeWindowUpperEdge_normalCell,
const bool  enableBadWireTreatment,
const bool  enableBackgroundHitFilter,
const bool  enableMarkBackgroundHit 
)
inline

Constructor.

Parameters
timeWindowLowerEdge_smallCelllower edge of the timing window for the layers with small cells (SL0)
timeWindowUpperEdge_smallCellupper edge of the timing window for the layers with small cells (SL0)
timeWindowLowerEdge_normalCelllower edge of the timing window for the layers with normal cells (SL1-8)
timeWindowUpperEdge_normalCellupper edge of the timing window for the layers with normal cells (SL1-8)
enableBadWireTreatmentflag to enable the bad wire treatment. default: true
enableBackgroundHitFilterflag to enable the CDC background hit (crosstakl, noise) filter. default: true
enableMarkBackgroundHitflag to enable to mark background flag on CDCHit (set 0x100 bit for CDCHit::m_status). default: false

Definition at line 108 of file CDCHitRateCounter.h.

114  :
115  m_timeWindowLowerEdge_smallCell(timeWindowLowerEdge_smallCell),
116  m_timeWindowUpperEdge_smallCell(timeWindowUpperEdge_smallCell),
117  m_timeWindowLowerEdge_normalCell(timeWindowLowerEdge_normalCell),
118  m_timeWindowUpperEdge_normalCell(timeWindowUpperEdge_normalCell),
119  m_enableBadWireTreatment(enableBadWireTreatment),
120  m_enableBackgroundHitFilter(enableBackgroundHitFilter),
121  m_enableMarkBackgroundHit(enableMarkBackgroundHit)
122  {
125  B2FATAL("invalid seting of CDC time window");
126  }
127  }
const bool m_enableBackgroundHitFilter
flag to enable the CDC background hit (crosstakl, noise) filter.
const int m_timeWindowLowerEdge_normalCell
lower edge of the time window for normal cells [tdc count = 0.982536 ns]
const int m_timeWindowUpperEdge_smallCell
upper edge of the time window for small cells [tdc count = 0.982536 ns]
const bool m_enableBadWireTreatment
flag to enable the bad wire treatment.
const int m_timeWindowUpperEdge_normalCell
upper edge of the time window for normal cells [tdc count = 0.982536 ns]
const bool m_enableMarkBackgroundHit
flag to enable to mark background flag on CDCHit (set 0x100 bit for CDCHit::m_status).
const int m_timeWindowLowerEdge_smallCell
lower edge of the time window for small cells [tdc count = 0.982536 ns]

Member Function Documentation

◆ accumulate()

void accumulate ( unsigned  timeStamp)
overridevirtual

Accumulate hits.

Parameters
timeStamptime stamp

Implements HitRateBase.

Definition at line 71 of file CDCHitRateCounter.cc.

72  {
73  // check if data are available
74  if (not m_digits.isValid()) return;
75 
76  // get buffer element
77  auto& rates = m_buffer[timeStamp];
78 
79  // increment event counter
80  rates.numEvents++;
81 
83  std::map<const CDCHit*, bool> CDCHitToBackgroundFlag;
85  StoreWrappedObjPtr<std::vector<CDCWireHit>> storeVector("CDCWireHitVector");
86  if (not storeVector) {
87  B2FATAL("CDCWireHitVector is unaccessible in DataStore."
88  "Need TFCDC_WireHitParameter module before.");
89  }
90  const std::vector<CDCWireHit>& cdcWireHitVector = *storeVector;
91  for (const auto& cdcWireHit : cdcWireHitVector) {
92  const CDCHit* cdcHit = cdcWireHit.getHit();
93  CDCHitToBackgroundFlag[cdcHit] = cdcWireHit->hasBackgroundFlag();
94  }
95  }
96 
97  CDC::CDCGeometryPar& geometryPar = CDC::CDCGeometryPar::Instance();
98 
106  for (CDCHit& hit : m_digits) {
107  const WireID wireID(hit.getID());
108  if (m_enableBadWireTreatment && geometryPar.isBadWire(wireID))
109  continue;
110 
111  const unsigned short iSuperLayer = hit.getISuperLayer();
112  const unsigned short iLayer = hit.getICLayer();
113  const unsigned short iWireInLayer = hit.getIWire();
114  const unsigned short iPhiBin = getIPhiBin(iSuperLayer, iWireInLayer);
115  const unsigned short adc = hit.getADCCount();
116  const short tdc = hit.getTDCCount();
117 
119  if (CDCHitToBackgroundFlag[&hit]) {
121  unsigned short newStatus = (hit.getStatus() | 0x100);
122  hit.setStatus(newStatus);
123  }
124  continue;
125  }
126  } else {
127  if (iSuperLayer == 0 && adc < 15)
128  continue;
129  if (iSuperLayer != 0 && adc < 18)
130  continue;
131  }
132 
133  if (not isInTimeWindow(iSuperLayer, tdc))
134  continue;
135 
136 
137  rates.averageRate += 1;
138  rates.superLayerHitRate[iSuperLayer] += 1;
139  rates.layerHitRate[iLayer] += 1;
140  rates.layerPhiHitRate[iLayer][iPhiBin] += 1;
141  }
142 
143  // set flag to true to indicate the rates are valid
144  rates.valid = true;
145  }
std::map< unsigned, TreeStruct > m_buffer
average rates in time stamps
bool isInTimeWindow(const int SL, const short tdc)
return true if the hit is in the given time window
StoreArray< CDCHit > m_digits
collection of digits
unsigned short getIPhiBin(unsigned short iSL, unsigned short iWireInLayer)
get the bin ID of the division.
static CDCGeometryPar & Instance(const CDCGeometry *=nullptr)
Static method to get a reference to the CDCGeometryPar instance.

◆ countActiveWires()

void countActiveWires ( )
private

set m_nActiveWireInTotal, m_nActiveWireInLayer[] and m_nActiveWireInSuperLayer[].

called in initialize function. count the number of wires excluding dead wires (bad channels).

end i loop

end iL loop

end iSL loop

Definition at line 230 of file CDCHitRateCounter.cc.

◆ countActiveWires_countAll()

void countActiveWires_countAll ( )
private

set m_nActiveWireInTotal, m_nActiveWireInLayer[] and m_nActiveWireInSuperLayer[].

called in initialize function. count the number of all the wires including dead wires (bad channels).

Definition at line 202 of file CDCHitRateCounter.cc.

◆ initialize()

void initialize ( TTree *  tree)
overridevirtual

Class initializer: set branch addresses and other staf.

Parameters
treea valid TTree pointer

Implements HitRateBase.

Definition at line 36 of file CDCHitRateCounter.cc.

◆ isInTimeWindow()

bool isInTimeWindow ( const int  SL,
const short  tdc 
)
inlineprivate

return true if the hit is in the given time window

Parameters
SLsuper layer ID which the wire of the hit belongs to
tdcTDC value of the hit

Definition at line 175 of file CDCHitRateCounter.h.

◆ normalize()

void normalize ( unsigned  timeStamp)
overridevirtual

Normalize accumulated hits (e.g.

transform to rates)

Parameters
timeStamptime stamp

copy nActiveWire

Implements HitRateBase.

Definition at line 147 of file CDCHitRateCounter.cc.

Member Data Documentation

◆ m_enableBackgroundHitFilter

const bool m_enableBackgroundHitFilter
private

flag to enable the CDC background hit (crosstakl, noise) filter.

default: true

Definition at line 188 of file CDCHitRateCounter.h.

◆ m_enableBadWireTreatment

const bool m_enableBadWireTreatment
private

flag to enable the bad wire treatment.

default: true

Definition at line 187 of file CDCHitRateCounter.h.

◆ m_enableMarkBackgroundHit

const bool m_enableMarkBackgroundHit
private

flag to enable to mark background flag on CDCHit (set 0x100 bit for CDCHit::m_status).

default: false

Definition at line 190 of file CDCHitRateCounter.h.

◆ m_nActiveWireInTotal

int m_nActiveWireInTotal
private
Initial value:
=
0

the number of wires used in this hit-rate calculation in the whole CDC

Definition at line 192 of file CDCHitRateCounter.h.


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