Belle II Software  release-05-01-25
PXDHitRateCounter.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2019 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Marko Staric, Benjamin Schwenker *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 #include <background/modules/BeamBkgHitRateMonitor/HitRateBase.h>
14 #include <framework/datastore/StoreArray.h>
15 #include <pxd/dataobjects/PXDDigit.h>
16 #include <pxd/dataobjects/PXDCluster.h>
17 #include <vxd/dataobjects/VxdID.h>
18 #include <pxd/geometry/SensorInfo.h>
19 #include <vxd/geometry/GeoCache.h>
20 #include <TTree.h>
21 #include <map>
22 
23 #include <framework/gearbox/Unit.h>
24 
25 namespace Belle2 {
30  namespace Background {
31 
35  class PXDHitRateCounter: public HitRateBase {
36 
37  public:
38 
42  struct TreeStruct {
43  float meanOccupancies[40] = {0};
44  float maxOccupancies[40] = {0};
45  float doseRates[40] = {0};
46  float softPhotonFluxes[40] = {0};
47  float hardPhotonFluxes[40] = {0};
48  float chargedFluxes[40] = {0};
49  float segmentDoseRates[240] = {0};
50  float segmentSoftPhotonFluxes[240] = {0};
51  float segmentHardPhotonFluxes[240] = {0};
52  float segmentChargedFluxes[240] = {0};
53  float averageRate = 0;
54  int numEvents = 0;
55  bool valid = false;
56  };
57 
62  {}
63 
68  virtual void initialize(TTree* tree) override;
69 
73  virtual void clear() override;
74 
79  virtual void accumulate(unsigned timeStamp) override;
80 
85  virtual void normalize(unsigned timeStamp) override;
86 
87  private:
88 
92  inline const PXD::SensorInfo& getInfo(VxdID sensorID) const;
93 
97  void setActivePixels();
98 
99  // class parameters: to be set via constructor or setters
100  double m_integrationTime = 20 * Unit::us;
101  bool m_maskDeadPixels = true;
102  int m_nPXDSensors = 0;
104  const double c_densitySi = 2.3290 * Unit::g_cm3;
106  // tree structure
109  // buffer
110  std::map<unsigned, TreeStruct> m_buffer;
112  // collections
116  // other
117  double m_activePixels[40] = {0};
118  double m_activeAreas[40] = {0};
119  double m_segmentActivePixels[240] = {0};
120  double m_segmentActiveAreas[240] = {0};
121  };
122 
123  inline const PXD::SensorInfo& PXDHitRateCounter::getInfo(VxdID sensorID) const
124  {
125  return dynamic_cast<const PXD::SensorInfo&>(VXD::GeoCache::get(sensorID));
126  }
127 
128  } // Background namespace
130 } // Belle2 namespace
Belle2::Background::PXDHitRateCounter::TreeStruct::maxOccupancies
float maxOccupancies[40]
max hit occupancy from PXDDigits per sensor [Hits/Channel]
Definition: PXDHitRateCounter.h:52
Belle2::Background::PXDHitRateCounter::getInfo
const PXD::SensorInfo & getInfo(VxdID sensorID) const
Get PXD::SensorInfo.
Definition: PXDHitRateCounter.h:131
Belle2::Background::PXDHitRateCounter::TreeStruct::segmentSoftPhotonFluxes
float segmentSoftPhotonFluxes[240]
mean soft photon flux per v segment of sensor (Single pixel cluster <10keV) [clusters/cm2/s]
Definition: PXDHitRateCounter.h:58
Belle2::VxdID
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:43
Belle2::Background::PXDHitRateCounter::normalize
virtual void normalize(unsigned timeStamp) override
Normalize accumulated hits (e.g.
Definition: PXDHitRateCounter.cc:133
Belle2::Background::PXDHitRateCounter::setActivePixels
void setActivePixels()
Sets fractions of active channels.
Definition: PXDHitRateCounter.cc:181
Belle2::Background::PXDHitRateCounter::TreeStruct::valid
bool valid
status: true = rates valid
Definition: PXDHitRateCounter.h:63
Belle2::VXD::GeoCache::get
static const SensorInfoBase & get(Belle2::VxdID id)
Return a reference to the SensorInfo of a given SensorID.
Definition: GeoCache.h:141
Belle2::Background::PXDHitRateCounter::PXDHitRateCounter
PXDHitRateCounter()
Constructor.
Definition: PXDHitRateCounter.h:69
Belle2::Background::PXDHitRateCounter::m_activeAreas
double m_activeAreas[40]
area of active pixels in sensor
Definition: PXDHitRateCounter.h:126
Belle2::Background::PXDHitRateCounter::m_digits
StoreArray< PXDDigit > m_digits
collection of digits
Definition: PXDHitRateCounter.h:121
Belle2::Background::PXDHitRateCounter::c_densitySi
const double c_densitySi
Density of crystalline Silicon.
Definition: PXDHitRateCounter.h:112
Belle2::Background::PXDHitRateCounter::m_maskDeadPixels
bool m_maskDeadPixels
Correct bg rates by taking into account masked pixels.
Definition: PXDHitRateCounter.h:109
Belle2::Background::PXDHitRateCounter::TreeStruct
tree structure
Definition: PXDHitRateCounter.h:50
Belle2::Background::PXDHitRateCounter::TreeStruct::averageRate
float averageRate
total detector average hit rate
Definition: PXDHitRateCounter.h:61
Belle2::Background::PXDHitRateCounter::TreeStruct::segmentChargedFluxes
float segmentChargedFluxes[240]
mean charged particle flux per v segment of sensor (Multi pixel cluster >10keV) [clusters/cm2/s]
Definition: PXDHitRateCounter.h:60
Belle2::Background::PXDHitRateCounter::m_clusters
StoreArray< PXDCluster > m_clusters
collection of clusters
Definition: PXDHitRateCounter.h:122
Belle2::Background::PXDHitRateCounter::clear
virtual void clear() override
Clear time-stamp buffer to prepare for 'accumulate'.
Definition: PXDHitRateCounter.cc:58
Belle2::PXD::SensorInfo
Specific implementation of SensorInfo for PXD Sensors which provides additional pixel specific inform...
Definition: SensorInfo.h:34
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::Background::PXDHitRateCounter::TreeStruct::segmentHardPhotonFluxes
float segmentHardPhotonFluxes[240]
mean hard photon flux per v segment of sensor (Single pixel cluster >10keV) [clusters/cm2/s]
Definition: PXDHitRateCounter.h:59
Belle2::Background::PXDHitRateCounter::TreeStruct::chargedFluxes
float chargedFluxes[40]
mean charged particle flux per sensor (Multi pixel cluster >10keV) [clusters/cm2/s]
Definition: PXDHitRateCounter.h:56
Belle2::Background::PXDHitRateCounter::TreeStruct::meanOccupancies
float meanOccupancies[40]
mean hit occupancy from PXDDigits per sensor [Hits/Channel]
Definition: PXDHitRateCounter.h:51
Belle2::Background::PXDHitRateCounter::m_buffer
std::map< unsigned, TreeStruct > m_buffer
average rates in time stamps
Definition: PXDHitRateCounter.h:118
Belle2::Background::PXDHitRateCounter::m_rates
TreeStruct m_rates
tree variables
Definition: PXDHitRateCounter.h:115
Belle2::Background::PXDHitRateCounter::m_segmentActivePixels
double m_segmentActivePixels[240]
number of active pixels in v segements
Definition: PXDHitRateCounter.h:127
Belle2::Background::PXDHitRateCounter::m_integrationTime
double m_integrationTime
Integration time of PXD in ns.
Definition: PXDHitRateCounter.h:108
Belle2::Background::PXDHitRateCounter::TreeStruct::numEvents
int numEvents
number of events accumulated
Definition: PXDHitRateCounter.h:62
Belle2::Background::PXDHitRateCounter::m_segmentActiveAreas
double m_segmentActiveAreas[240]
area of active pixels in v segments
Definition: PXDHitRateCounter.h:128
Belle2::StoreArray
Accessor to arrays stored in the data store.
Definition: ECLMatchingPerformanceExpertModule.h:33
Belle2::Background::PXDHitRateCounter::initialize
virtual void initialize(TTree *tree) override
Class initializer: set branch addresses and other staf.
Definition: PXDHitRateCounter.cc:29
Belle2::Background::PXDHitRateCounter::m_activePixels
double m_activePixels[40]
number of active pixels in sensor
Definition: PXDHitRateCounter.h:125
Belle2::Background::PXDHitRateCounter::accumulate
virtual void accumulate(unsigned timeStamp) override
Accumulate hits.
Definition: PXDHitRateCounter.cc:63
Belle2::Background::PXDHitRateCounter::TreeStruct::softPhotonFluxes
float softPhotonFluxes[40]
mean soft photon flux per sensor (Single pixel cluster <10keV) [clusters/cm2/s]
Definition: PXDHitRateCounter.h:54
Belle2::Background::PXDHitRateCounter::TreeStruct::hardPhotonFluxes
float hardPhotonFluxes[40]
mean hard photon flux per sensor (Single pixel cluster >10keV) [clusters/cm2/s]
Definition: PXDHitRateCounter.h:55
Belle2::Unit::g_cm3
static const double g_cm3
Practical units with the value set at 1.
Definition: Unit.h:70
Belle2::Background::PXDHitRateCounter::TreeStruct::doseRates
float doseRates[40]
mean dose rate from PXDDigits per sensor [Gy/s]
Definition: PXDHitRateCounter.h:53
Belle2::Background::PXDHitRateCounter::TreeStruct::segmentDoseRates
float segmentDoseRates[240]
mean dose rate from PXDDigits per v segment of sensor [Gy/s]
Definition: PXDHitRateCounter.h:57
Belle2::Unit::us
static const double us
[microsecond]
Definition: Unit.h:107
Belle2::Background::PXDHitRateCounter::m_nPXDSensors
int m_nPXDSensors
number of sensors
Definition: PXDHitRateCounter.h:110