Belle II Software  release-05-02-19
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...
 

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 = ns]
 
const int m_timeWindowUpperEdge_smallCell
 upper edge of the time window for small cells [tdc count = ns]
 
const int m_timeWindowLowerEdge_normalCell
 lower edge of the time window for normal cells [tdc count = ns]
 
const int m_timeWindowUpperEdge_normalCell
 upper edge of the time window for normal cells [tdc count = 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 = 0
 the number of wires used in this hit-rate calculation in the whole CDC
 
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
 

Static Private Attributes

static const int f_nLayer = 56
 the number of layers
 
static const int f_nSuperLayer = 9
 the number of super layers
 

Detailed Description

Class for monitoring beam background hit rates of CDC.

Definition at line 38 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 96 of file CDCHitRateCounter.h.

102  {
105  B2FATAL("invalid seting of CDC time window");
106  }
107  }
112  virtual void initialize(TTree* tree) override;
113 

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 int iLayer = hit.getICLayer();
112  const int iSuperLayer = hit.getISuperLayer();
113  const unsigned short adc = hit.getADCCount();
114  const short tdc = hit.getTDCCount();
115 
117  if (CDCHitToBackgroundFlag[&hit]) {
119  unsigned short newStatus = (hit.getStatus() | 0x100);
120  hit.setStatus(newStatus);
121  }
122  continue;
123  }
124  } else {
125  if (iSuperLayer == 0 && adc < 15)
126  continue;
127  if (iSuperLayer != 0 && adc < 18)
128  continue;
129  }
130 
131  if (not isInTimeWindow(iSuperLayer, tdc))
132  continue;
133 
134 
135  rates.layerHitRate[iLayer] += 1;
136  rates.superLayerHitRate[iSuperLayer] += 1;
137  rates.averageRate += 1;
138  }
139 
140  // set flag to true to indicate the rates are valid
141  rates.valid = true;
142  }

◆ 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 212 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 186 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 38 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 163 of file CDCHitRateCounter.h.

◆ normalize()

void normalize ( unsigned  timeStamp)
overridevirtual

Normalize accumulated hits (e.g.

transform to rates)

Parameters
timeStamptime stamp

Implements HitRateBase.

Definition at line 144 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 176 of file CDCHitRateCounter.h.

◆ m_enableBadWireTreatment

const bool m_enableBadWireTreatment
private

flag to enable the bad wire treatment.

default: true

Definition at line 175 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 178 of file CDCHitRateCounter.h.


The documentation for this class was generated from the following files:
Belle2::Background::CDCHitRateCounter::m_timeWindowUpperEdge_smallCell
const int m_timeWindowUpperEdge_smallCell
upper edge of the time window for small cells [tdc count = ns]
Definition: CDCHitRateCounter.h:154
Belle2::Background::CDCHitRateCounter::m_digits
StoreArray< CDCHit > m_digits
collection of digits
Definition: CDCHitRateCounter.h:150
Belle2::Background::CDCHitRateCounter::m_enableBadWireTreatment
const bool m_enableBadWireTreatment
flag to enable the bad wire treatment.
Definition: CDCHitRateCounter.h:175
Belle2::Background::CDCHitRateCounter::m_timeWindowUpperEdge_normalCell
const int m_timeWindowUpperEdge_normalCell
upper edge of the time window for normal cells [tdc count = ns]
Definition: CDCHitRateCounter.h:156
Belle2::Background::CDCHitRateCounter::m_timeWindowLowerEdge_normalCell
const int m_timeWindowLowerEdge_normalCell
lower edge of the time window for normal cells [tdc count = ns]
Definition: CDCHitRateCounter.h:155
Belle2::Background::CDCHitRateCounter::m_buffer
std::map< unsigned, TreeStruct > m_buffer
average rates in time stamps
Definition: CDCHitRateCounter.h:147
Belle2::Background::CDCHitRateCounter::initialize
virtual void initialize(TTree *tree) override
Class initializer: set branch addresses and other staf.
Definition: CDCHitRateCounter.cc:38
Belle2::Background::CDCHitRateCounter::m_enableMarkBackgroundHit
const bool m_enableMarkBackgroundHit
flag to enable to mark background flag on CDCHit (set 0x100 bit for CDCHit::m_status).
Definition: CDCHitRateCounter.h:178
Belle2::CDC::CDCGeometryPar::Instance
static CDCGeometryPar & Instance(const CDCGeometry *=nullptr)
Static method to get a reference to the CDCGeometryPar instance.
Definition: CDCGeometryPar.cc:41
Belle2::Background::CDCHitRateCounter::isInTimeWindow
bool isInTimeWindow(const int SL, const short tdc)
return true if the hit is in the given time window
Definition: CDCHitRateCounter.h:163
Belle2::Background::CDCHitRateCounter::m_enableBackgroundHitFilter
const bool m_enableBackgroundHitFilter
flag to enable the CDC background hit (crosstakl, noise) filter.
Definition: CDCHitRateCounter.h:176
Belle2::Background::CDCHitRateCounter::m_timeWindowLowerEdge_smallCell
const int m_timeWindowLowerEdge_smallCell
lower edge of the time window for small cells [tdc count = ns]
Definition: CDCHitRateCounter.h:153