10#include <background/modules/BeamBkgHitRateMonitor/PXDHitRateCounter.h>
11#include <pxd/reconstruction/PXDGainCalibrator.h>
12#include <pxd/reconstruction/PXDPixelMasker.h>
16#include <framework/logging/Logger.h>
25 namespace Background {
31 if (gTools->getNumberOfPXDLayers() == 0) {
32 B2FATAL(
"Missing geometry for PXD.");
44 "meanOccupancies[40]/F:maxOccupancies[40]/F:doseRates[40]/F:softPhotonFluxes[40]/F:hardPhotonFluxes[40]/F:chargedFluxes[40]/F:segmentDoseRates[240]/F:segmentSoftPhotonFluxes[240]/F:segmentHardPhotonFluxes[240]/F:segmentChargedFluxes[240]/F:averageRate/F:numEvents/I:valid/O";
47 tree->Branch(
"pxd", &
m_rates, leaflist.c_str());
73 rates.averageRate +=
m_digits.getEntries();
79 float occupancies[40] = {0};
81 VxdID sensorID = storeDigit.getSensorID();
82 int index = gTools->getPXDSensorIndex(storeDigit.getSensorID());
85 storeDigit.getVCellID());
86 double hitEnergy = storeDigit.getCharge() * ADUToEnergy;
87 rates.doseRates[index] += (hitEnergy /
Unit::J);
88 occupancies[index] += 1.0;
89 rates.segmentDoseRates[vBin + index * 6] += (hitEnergy /
Unit::J);
96 rates.meanOccupancies[index] += occupancies[index];
97 if (rates.maxOccupancies[index] < occupancies[index]) {
98 rates.maxOccupancies[index] = occupancies[index];
105 VxdID sensorID = cluster.getSensorID();
106 int index = gTools->getPXDSensorIndex(sensorID);
109 auto cluster_uID = info.getUCellID(cluster.getU());
110 auto cluster_vID = info.getVCellID(cluster.getV());
113 double clusterEnergy = cluster.getCharge() * ADUToEnergy;
115 if (cluster.getSize() == 1 && clusterEnergy < 10000 * Unit::eV && clusterEnergy > 6000 *
Unit::eV) {
116 rates.softPhotonFluxes[index] += 1.0;
117 rates.segmentSoftPhotonFluxes[vBin + index * 6] += 1.0;
118 }
else if (cluster.getSize() == 1 && clusterEnergy > 10000 *
Unit::eV) {
119 rates.hardPhotonFluxes[index] += 1.0;
120 rates.segmentHardPhotonFluxes[vBin + index * 6] += 1.0;
121 }
else if (cluster.getSize() > 1 && clusterEnergy > 10000 *
Unit::eV) {
122 rates.chargedFluxes[index] += 1.0;
123 rates.segmentChargedFluxes[vBin + index * 6] += 1.0;
151 VxdID sensorID = gTools->getSensorIDFromPXDIndex(index);
157 if (currentSensorArea > 0) {
164 for (
int vBin = 0; vBin < 6; ++vBin) {
167 if (currentSegmentArea > 0) {
172 (currentComponentTime /
Unit::s));
186 VxdID sensorID = gTools->getSensorIDFromPXDIndex(index);
195 for (
int vBin = 0; vBin < 6; ++vBin) {
200 double v = info.getVCellPosition(vBin * info.getVCells() / 6);
202 m_segmentActiveAreas[vBin + index * 6] = info.getWidth() * info.getVPitch(v) * info.getVCells() / 6;
206 for (
int ui = 0; ui < info.getUCells(); ++ui) {
207 for (
int vi = 0; vi < info.getVCells(); ++vi) {
211 m_activeAreas[index] -= info.getVPitch(info.getVCellPosition(vi)) * info.getUPitch();
214 m_segmentActiveAreas[vBin + index * 6] -= info.getVPitch(info.getVCellPosition(vi)) * info.getUPitch();
double m_segmentActivePixels[240]
number of active pixels in v segements
std::map< unsigned, TreeStruct > m_buffer
average rates in time stamps
TreeStruct m_rates
tree variables
bool m_maskDeadPixels
Correct bg rates by taking into account masked pixels.
double m_integrationTime
Integration time of PXD in ns.
virtual void initialize(TTree *tree) override
Class initializer: set branch addresses and other staf.
const double c_densitySi
Density of crystalline Silicon.
StoreArray< PXDCluster > m_clusters
collection of clusters
double m_activePixels[40]
number of active pixels in sensor
virtual void accumulate(unsigned timeStamp) override
Accumulate hits.
const PXD::SensorInfo & getInfo(VxdID sensorID) const
Get PXD::SensorInfo.
StoreArray< PXDDigit > m_digits
collection of digits
void setActivePixels()
Sets fractions of active channels.
double m_activeAreas[40]
area of active pixels in sensor
double m_segmentActiveAreas[240]
area of active pixels in v segments
virtual void normalize(unsigned timeStamp) override
Normalize accumulated hits (e.g.
virtual void clear() override
Clear time-stamp buffer to prepare for 'accumulate'.
int m_nPXDSensors
number of sensors
The PXD Cluster class This class stores all information about reconstructed PXD clusters The position...
unsigned short getBinV(VxdID id, unsigned int vid) const
Get gain correction bin along sensor v side.
float getADUToEnergy(VxdID id, unsigned int uid, unsigned int vid) const
Get conversion factor from ADU to energy.
static PXDGainCalibrator & getInstance()
Main (and only) way to access the PXDGainCalibrator.
static PXDPixelMasker & getInstance()
Main (and only) way to access the PXDPixelMasker.
bool isOptional(const std::string &name="")
Tell the DataStore about an optional input.
bool isValid() const
Check wether the array was registered.
static const double eV
[electronvolt]
static const double J
[joule]
static const double s
[second]
static GeoCache & getInstance()
Return a reference to the singleton instance.
const GeoTools * getGeoTools()
Return a raw pointer to a GeoTools object.
Class to uniquely identify a any structure of the PXD and SVD.
Abstract base class for different kinds of events.
float doseRates[40]
mean dose rate from PXDDigits per sensor [Gy/s]
bool valid
status: true = rates valid
float meanOccupancies[40]
mean hit occupancy from PXDDigits per sensor [Hits/Channel]
float softPhotonFluxes[40]
mean soft photon flux per sensor (Single pixel cluster <10keV) [clusters/cm2/s]
float chargedFluxes[40]
mean charged particle flux per sensor (Multi pixel cluster >10keV) [clusters/cm2/s]
float segmentChargedFluxes[240]
mean charged particle flux per v segment of sensor (Multi pixel cluster >10keV) [clusters/cm2/s]
int numEvents
number of events accumulated
float segmentHardPhotonFluxes[240]
mean hard photon flux per v segment of sensor (Single pixel cluster >10keV) [clusters/cm2/s]
float hardPhotonFluxes[40]
mean hard photon flux per sensor (Single pixel cluster >10keV) [clusters/cm2/s]
float averageRate
total detector average hit rate
float segmentSoftPhotonFluxes[240]
mean soft photon flux per v segment of sensor (Single pixel cluster <10keV) [clusters/cm2/s]
float segmentDoseRates[240]
mean dose rate from PXDDigits per v segment of sensor [Gy/s]