Belle II Software development
PXDBgTupleProducerModule.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <framework/core/Module.h>
12#include <framework/gearbox/Unit.h>
13#include <vxd/dataobjects/VxdID.h>
14#include <vxd/geometry/SensorInfoBase.h>
15#include <pxd/geometry/SensorInfo.h>
16#include <vxd/geometry/GeoCache.h>
17#include <string>
18#include <vector>
19#include <map>
20
21
22namespace Belle2 {
28 namespace PXD {
29
38
39 public:
40
42 struct SensorData {
44 int m_run;
54 double m_expo;
56 double m_dose;
63
65 std::vector<double> m_regionExpoMap;
67 std::vector<double> m_regionDoseMap;
69 std::vector<double> m_regionSoftPhotonFluxMap;
71 std::vector<double> m_regionChargedParticleFluxMap;
73 std::vector<double> m_regionHardPhotonFluxMap;
74 };
75
78
80 void initialize() override final;
82 void beginRun() override final;
84 void event() override final;
86 void terminate() override final;
87
88 private:
89
90 // General
91 const double c_densitySi = 2.3290 * Unit::g_cm3;
97 inline const PXD::SensorInfo& getInfo(VxdID sensorID) const;
99 inline double getSensorArea(VxdID sensorID) const;
101 inline int getRegionID(int uBin, int vBin) const;
103 inline double getRegionArea(VxdID sensorID, int vBin) const;
104
105 // Output directory
108 // StoreArrays
120 std::map<unsigned long long int, std::map<VxdID, SensorData> > m_buffer;
123 std::map<std::pair<VxdID, int>, int> m_regionSensitivePixelMap;
124 std::map<std::pair<VxdID, int>, double> m_regionSensitiveAreaMap;
127 };
128
129 inline int PXDBgTupleProducerModule::getRegionID(int uBin, int vBin) const
130 {
131 return uBin * m_nBinsV + vBin;
132 }
133
135 {
136 return dynamic_cast<const PXD::SensorInfo&>(VXD::GeoCache::getInstance().getSensorInfo(sensorID));
137 }
138
139 inline double PXDBgTupleProducerModule::getSensorArea(VxdID sensorID) const
140 {
141 const PXD::SensorInfo& info = getInfo(sensorID);
142 return info.getWidth() * info.getLength();
143 }
144
145 inline double PXDBgTupleProducerModule::getRegionArea(VxdID sensorID, int vBin) const
146 {
147 const PXD::SensorInfo& info = getInfo(sensorID);
148 int vi = vBin * info.getVCells() / m_nBinsV;
149 double length = info.getVPitch(info.getVCellPosition(vi)) * info.getVCells() / m_nBinsV;
150 return length * info.getWidth() / m_nBinsU;
151 }
152
153 } // namespace PXD
155} // namespace Belle2
156
Base class for Modules.
Definition: Module.h:72
std::map< std::pair< VxdID, int >, int > m_regionSensitivePixelMap
Struct to hold region-wise number of sensitive pixels.
double m_timePeriod
Period for background time series.
void initialize() override final
Initialize module.
bool m_maskDeadPixels
Correct bg rates by taking into account masked pixels.
std::map< VxdID, SensorData > m_sensorData
Struct to hold sensor-wise background data.
std::map< VxdID, double > m_sensitiveAreaMap
Struct to hold sensor-wise sensitive area.
double m_integrationTime
Integration time of PXD.
int m_nBinsV
Number of regions per sensor along v side.
const double c_densitySi
Density of crystalline Silicon.
void terminate() override final
Final summary and cleanup.
int getRegionID(int uBin, int vBin) const
Get region id from region uBin and vBin.
const PXD::SensorInfo & getInfo(VxdID sensorID) const
This is a shortcut to getting PXD::SensorInfo from the GeoCache.
void event() override final
Event processing.
int m_nBinsU
Number of regions per sensor along u side.
std::map< std::pair< VxdID, int >, double > m_regionSensitiveAreaMap
Struct to hold region-wise sensitive area.
std::map< VxdID, int > m_sensitivePixelMap
Struct to hold sensor-wise number of sensitive pixels.
double getRegionArea(VxdID sensorID, int vBin) const
Return area of the region with the given sensor ID and region vBin.
std::map< unsigned long long int, std::map< VxdID, SensorData > > m_buffer
Struct to hold sensor-wise background data.
double getSensorArea(VxdID sensorID) const
Return area of the sensor with the given sensor ID.
std::string m_storeDigitsName
PXDDigits StoreArray name.
std::string m_storeClustersName
PXDClusters StoreArray name.
bool m_hasPXDData
Flag to indicate there was at least one PXDDigit in the run.
void beginRun() override final
Start-of-run initializations.
std::string m_outputFileName
output tuple file name
int m_nPXDSensors
Total number of PXD sensors.
Specific implementation of SensorInfo for PXD Sensors which provides additional pixel specific inform...
Definition: SensorInfo.h:23
The Unit class.
Definition: Unit.h:40
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a referecne to the SensorInfo of a given SensorID.
Definition: GeoCache.cc:67
static GeoCache & getInstance()
Return a reference to the singleton instance.
Definition: GeoCache.cc:214
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:33
Abstract base class for different kinds of events.
STL namespace.
double m_expo
Exposition (energy deposited per cm2 and second)
double m_minOccupancy
Minimum occupancy of all events inside one second block.
double m_meanOccupancy
Average occupancy of all events inside one second block.
std::vector< double > m_regionChargedParticleFluxMap
Charged particle flux (selected clusters per cm and second) for sensor regions.
double m_hardPhotonFlux
Hard photon flux (selected clusters per cm and second)
double m_maxOccupancy
Maximum occupancy of all events inside one second block.
double m_softPhotonFlux
Soft photon flux (selected clusters per cm and second)
std::vector< double > m_regionDoseMap
Dose (Gy per second) for sensor regions.
std::vector< double > m_regionHardPhotonFluxMap
Hard photon flux (selected clusters per cm and second) for sensor regions.
std::vector< double > m_regionExpoMap
Expositions (energy deposited per cm2 and second) for sensor regions.
std::vector< double > m_regionSoftPhotonFluxMap
Soft photon flux (selected clusters per cm and second) for sensor regions.
double m_chargedParticleFlux
Charged particle flux (selected clusters per cm and second)
int m_nEvents
Number of Belle 2 events per second.