Belle II Software  release-05-01-25
PXDMCBgTupleProducerModule.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Benjamin Schwenker *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 #include <framework/core/Module.h>
14 #include <framework/gearbox/Unit.h>
15 #include <vxd/dataobjects/VxdID.h>
16 #include <vxd/geometry/SensorInfoBase.h>
17 #include <pxd/geometry/SensorInfo.h>
18 #include <vxd/geometry/GeoCache.h>
19 #include <string>
20 #include <vector>
21 #include <map>
22 
23 
24 namespace Belle2 {
30  namespace PXD {
31 
42  class PXDMCBgTupleProducerModule: public Module {
43 
44  public:
45 
47  struct SensorData {
49  double m_meanOccupancy;
51  double m_expo;
53  double m_dose;
60 
62  std::vector<double> m_regionExpoMap;
64  std::vector<double> m_regionDoseMap;
66  std::vector<double> m_regionSoftPhotonFluxMap;
68  std::vector<double> m_regionChargedParticleFluxMap;
70  std::vector<double> m_regionHardPhotonFluxMap;
71  };
72 
75 
76  /* Initialize module */
77  void initialize() override final;
78  /* Start-of-run initializations */
79  void beginRun() override final;
80  /* Event processing */
81  void event() override final;
82  /* Final summary and cleanup */
83  void terminate() override final;
84 
85  private:
86 
87  // General
88  const double c_densitySi = 2.3290 * Unit::g_cm3;
94  inline const PXD::SensorInfo& getInfo(VxdID sensorID) const;
96  inline double getSensorArea(VxdID sensorID) const;
98  inline int getRegionID(int uBin, int vBin) const;
100  inline double getRegionArea(VxdID sensorID, int vBin) const;
101 
102  // Output directory
103  std::string m_outputFileName;
105  // StoreArrays
106  std::string m_storeClustersName;
107  std::string m_storeDigitsName;
108  std::string m_storeBgMetaDataName;
109  double m_integrationTime;
110  bool m_maskDeadPixels;
111  int m_nBinsU;
112  int m_nBinsV;
115  std::map<VxdID, int> m_sensitivePixelMap;
116  std::map<VxdID, double> m_sensitiveAreaMap;
117  std::map<std::pair<VxdID, int>, int> m_regionSensitivePixelMap;
118  std::map<std::pair<VxdID, int>, double> m_regionSensitiveAreaMap;
121  double m_overrideComponentTime;
122  };
123 
124  inline int PXDMCBgTupleProducerModule::getRegionID(int uBin, int vBin) const
125  {
126  return uBin * m_nBinsV + vBin;
127  }
128 
130  {
131  return dynamic_cast<const PXD::SensorInfo&>(VXD::GeoCache::get(sensorID));
132  }
133 
134  inline double PXDMCBgTupleProducerModule::getSensorArea(VxdID sensorID) const
135  {
136  const PXD::SensorInfo& info = getInfo(sensorID);
137  return info.getWidth() * info.getLength();
138  }
139 
140  inline double PXDMCBgTupleProducerModule::getRegionArea(VxdID sensorID, int vBin) const
141  {
142  const PXD::SensorInfo& info = getInfo(sensorID);
143  int vi = vBin * info.getVCells() / m_nBinsV;
144  double length = info.getVPitch(info.getVCellPosition(vi)) * info.getVCells() / m_nBinsV;
145  return length * info.getWidth() / m_nBinsU;
146  }
147 
148  } // namespace PXD
150 } // namespace Belle2
151 
Belle2::VxdID
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:43
Belle2::PXD::PXDMCBgTupleProducerModule::terminate
void terminate() override final
This method is called at the end of the event processing.
Definition: PXDMCBgTupleProducerModule.cc:226
Belle2::PXD::PXDMCBgTupleProducerModule::m_maskDeadPixels
bool m_maskDeadPixels
Correct bg rates by taking into account masked pixels.
Definition: PXDMCBgTupleProducerModule.h:118
Belle2::PXD::PXDMCBgTupleProducerModule::SensorData::m_softPhotonFlux
double m_softPhotonFlux
Soft photon flux (selected clusters per cm and second)
Definition: PXDMCBgTupleProducerModule.h:63
Belle2::PXD::PXDMCBgTupleProducerModule::m_outputFileName
std::string m_outputFileName
output tuple file name
Definition: PXDMCBgTupleProducerModule.h:111
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::PXD::PXDMCBgTupleProducerModule::m_overrideComponentTime
double m_overrideComponentTime
Time of current component given by user.
Definition: PXDMCBgTupleProducerModule.h:129
Belle2::PXD::PXDMCBgTupleProducerModule::getRegionID
int getRegionID(int uBin, int vBin) const
Get region id from region uBin and vBin.
Definition: PXDMCBgTupleProducerModule.h:132
Belle2::PXD::PXDMCBgTupleProducerModule::event
void event() override final
This method is the core of the module.
Definition: PXDMCBgTupleProducerModule.cc:154
Belle2::PXD::PXDMCBgTupleProducerModule::c_densitySi
const double c_densitySi
Density of crystalline Silicon.
Definition: PXDMCBgTupleProducerModule.h:96
Belle2::PXD::PXDMCBgTupleProducerModule::SensorData::m_regionSoftPhotonFluxMap
std::vector< double > m_regionSoftPhotonFluxMap
Soft photon flux (selected clusters per cm and second) for sensor regions.
Definition: PXDMCBgTupleProducerModule.h:74
Belle2::PXD::PXDMCBgTupleProducerModule
PXD MC Background Tuple Producer.
Definition: PXDMCBgTupleProducerModule.h:50
Belle2::PXD::PXDMCBgTupleProducerModule::m_storeClustersName
std::string m_storeClustersName
PXDClusters StoreArray name.
Definition: PXDMCBgTupleProducerModule.h:114
Belle2::PXD::PXDMCBgTupleProducerModule::SensorData::m_regionDoseMap
std::vector< double > m_regionDoseMap
Dose (Gy per second) for sensor regions.
Definition: PXDMCBgTupleProducerModule.h:72
Belle2::PXD::PXDMCBgTupleProducerModule::m_storeBgMetaDataName
std::string m_storeBgMetaDataName
Name of the persistent BackgroundMetaDta object.
Definition: PXDMCBgTupleProducerModule.h:116
Belle2::PXD::PXDMCBgTupleProducerModule::SensorData::m_chargedParticleFlux
double m_chargedParticleFlux
Charged particle flux (selected clusters per cm and second)
Definition: PXDMCBgTupleProducerModule.h:65
Belle2::PXD::PXDMCBgTupleProducerModule::initialize
void initialize() override final
Initialize the Module.
Definition: PXDMCBgTupleProducerModule.cc:60
Belle2::PXD::PXDMCBgTupleProducerModule::getInfo
const PXD::SensorInfo & getInfo(VxdID sensorID) const
This is a shortcut to getting PXD::SensorInfo from the GeoCache.
Definition: PXDMCBgTupleProducerModule.h:137
Belle2::PXD::PXDMCBgTupleProducerModule::m_sensorData
std::map< VxdID, SensorData > m_sensorData
Struct to hold sensor-wise background data.
Definition: PXDMCBgTupleProducerModule.h:122
Belle2::PXD::PXDMCBgTupleProducerModule::SensorData::m_hardPhotonFlux
double m_hardPhotonFlux
Hard photon flux (selected clusters per cm and second)
Definition: PXDMCBgTupleProducerModule.h:67
Belle2::PXD::PXDMCBgTupleProducerModule::SensorData::m_meanOccupancy
double m_meanOccupancy
Average occupancy of all events inside one second block.
Definition: PXDMCBgTupleProducerModule.h:57
Belle2::PXD::PXDMCBgTupleProducerModule::m_storeDigitsName
std::string m_storeDigitsName
PXDDigits StoreArray name.
Definition: PXDMCBgTupleProducerModule.h:115
Belle2::PXD::PXDMCBgTupleProducerModule::m_sensitivePixelMap
std::map< VxdID, int > m_sensitivePixelMap
Struct to hold sensor-wise number of sensitive pixels.
Definition: PXDMCBgTupleProducerModule.h:123
Belle2::PXD::SensorInfo
Specific implementation of SensorInfo for PXD Sensors which provides additional pixel specific inform...
Definition: SensorInfo.h:34
Belle2::PXD::PXDMCBgTupleProducerModule::SensorData::m_regionExpoMap
std::vector< double > m_regionExpoMap
Expositions (energy deposited per cm2 and second) for sensor regions.
Definition: PXDMCBgTupleProducerModule.h:70
Belle2::PXD::PXDMCBgTupleProducerModule::m_hasPXDData
bool m_hasPXDData
Flag to indicate there was at least one PXDDigit in the run.
Definition: PXDMCBgTupleProducerModule.h:127
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::PXD::PXDMCBgTupleProducerModule::m_nBinsU
int m_nBinsU
Number of regions per sensor along u side.
Definition: PXDMCBgTupleProducerModule.h:119
Belle2::PXD::PXDMCBgTupleProducerModule::getRegionArea
double getRegionArea(VxdID sensorID, int vBin) const
Return area of the region with the given sensor ID and region vBin.
Definition: PXDMCBgTupleProducerModule.h:148
Belle2::PXD::PXDMCBgTupleProducerModule::m_regionSensitivePixelMap
std::map< std::pair< VxdID, int >, int > m_regionSensitivePixelMap
Struct to hold region-wise number of sensitive pixels.
Definition: PXDMCBgTupleProducerModule.h:125
Belle2::PXD::PXDMCBgTupleProducerModule::m_regionSensitiveAreaMap
std::map< std::pair< VxdID, int >, double > m_regionSensitiveAreaMap
Struct to hold region-wise sensitive area.
Definition: PXDMCBgTupleProducerModule.h:126
Belle2::PXD::PXDMCBgTupleProducerModule::getSensorArea
double getSensorArea(VxdID sensorID) const
Return area of the sensor with the given sensor ID.
Definition: PXDMCBgTupleProducerModule.h:142
Belle2::PXD::PXDMCBgTupleProducerModule::m_integrationTime
double m_integrationTime
Integration time of PXD.
Definition: PXDMCBgTupleProducerModule.h:117
Belle2::PXD::PXDMCBgTupleProducerModule::SensorData::m_regionChargedParticleFluxMap
std::vector< double > m_regionChargedParticleFluxMap
Charged particle flux (selected clusters per cm and second) for sensor regions.
Definition: PXDMCBgTupleProducerModule.h:76
Belle2::PXD::PXDMCBgTupleProducerModule::m_nBinsV
int m_nBinsV
Number of regions per sensor along v side.
Definition: PXDMCBgTupleProducerModule.h:120
Belle2::PXD::PXDMCBgTupleProducerModule::SensorData::m_expo
double m_expo
Exposition (energy deposited per cm2 and second)
Definition: PXDMCBgTupleProducerModule.h:59
Belle2::PXD::PXDMCBgTupleProducerModule::m_componentTime
double m_componentTime
Time of current component.
Definition: PXDMCBgTupleProducerModule.h:128
Belle2::PXD::PXDMCBgTupleProducerModule::m_sensitiveAreaMap
std::map< VxdID, double > m_sensitiveAreaMap
Struct to hold sensor-wise sensitive area.
Definition: PXDMCBgTupleProducerModule.h:124
Belle2::PXD::PXDMCBgTupleProducerModule::SensorData::m_regionHardPhotonFluxMap
std::vector< double > m_regionHardPhotonFluxMap
Hard photon flux (selected clusters per cm and second) for sensor regions.
Definition: PXDMCBgTupleProducerModule.h:78
Belle2::PXD::PXDMCBgTupleProducerModule::SensorData::m_dose
double m_dose
Dose (Gy per second)
Definition: PXDMCBgTupleProducerModule.h:61
Belle2::Unit
The Unit class.
Definition: Unit.h:50
Belle2::PXD::PXDMCBgTupleProducerModule::PXDMCBgTupleProducerModule
PXDMCBgTupleProducerModule()
Constructor.
Definition: PXDMCBgTupleProducerModule.cc:45
Belle2::PXD::PXDMCBgTupleProducerModule::beginRun
void beginRun() override final
Called when entering a new run.
Definition: PXDMCBgTupleProducerModule.cc:99
Belle2::PXD::PXDMCBgTupleProducerModule::SensorData
Struct to hold data of an PXD sensor.
Definition: PXDMCBgTupleProducerModule.h:55