Belle II Software development
PXDBackgroundModule.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 <pxd/geometry/SensorInfo.h>
15#include <vxd/geometry/GeoCache.h>
16#include <string>
17#include <memory>
18#include <map>
19#include <vxd/background/niel_fun.h>
20
21namespace Belle2 {
26
27 namespace PXD {
28
42
43 public:
44
45 // Reporting levels
46 static const unsigned short c_reportNone = 0;
47 static const unsigned short c_reportSummary = 1;
48 static const unsigned short c_reportNTuple = 2;
49
51 struct SensorData {
53 double m_expo;
55 double m_dose;
59 double m_fired;
62 };
63
67 virtual ~PXDBackgroundModule() override;
68
70 virtual void initialize() override;
72 virtual void event() override;
74 virtual void terminate() override;
75
76 private:
77
78 // General
79 const double c_densitySi = 2.3290 * Unit::g_cm3;
80 const double c_smy = 1.0e7 * Unit::s;
82 const std::string c_niel_neutronFile = "/vxd/data/neutrons.csv";
84 const std::string c_niel_protonFile = "/vxd/data/protons.csv";
86 const std::string c_niel_pionFile = "/vxd/data/pions.csv";
88 const std::string c_niel_electronFile = "/vxd/data/electrons.csv";
89 // No NIEL for photons.
90
95 static inline const PXD::SensorInfo& getInfo(const VxdID& sensorID);
97 static inline double getSensorThickness(VxdID sensorID);
99 inline double getSensorMass(VxdID sensorID) const;
101 static inline double getSensorArea(VxdID sensorID);
102
104 static const ROOT::Math::XYZVector& pointToGlobal(VxdID sensorID, const ROOT::Math::XYZVector& local);
106 static const ROOT::Math::XYZVector& vectorToGlobal(VxdID sensorID, const ROOT::Math::XYZVector& local);
107
109 static inline int getNumSensors(int layerNum);
111 inline int getTotalSensors();
112
113 // Output directory
117 // StoreArrays
119 std::string m_storeSimHitsName;
122 std::string m_storeDigitsName;
128
132
133 unsigned short m_doseReportingLevel;
134 unsigned short m_nfluxReportingLevel;
136
137 std::string m_componentName;
140
141 std::map<VxdID, SensorData> m_sensorData;
142
143 // NIEL tables
144 std::unique_ptr<TNiel> m_nielNeutrons;
145 std::unique_ptr<TNiel> m_nielProtons;
146 std::unique_ptr<TNiel> m_nielPions;
147 std::unique_ptr<TNiel> m_nielElectrons;
148
149 };
150
152 {
153 return dynamic_cast<const PXD::SensorInfo&>(VXD::GeoCache::getInstance().getSensorInfo(sensorID));
154 }
155
157 {
158 return getInfo(sensorID).getThickness();
159 }
160
161 inline double PXDBackgroundModule::getSensorMass(VxdID sensorID) const
162 {
163 const PXD::SensorInfo& info = getInfo(sensorID);
164 return info.getWidth() * info.getLength() * info.getThickness() * c_densitySi;
165 }
166
168 {
169 const PXD::SensorInfo& info = getInfo(sensorID);
170 return info.getWidth() * info.getLength();
171 }
172
173 inline int PXDBackgroundModule::getNumSensors(int layerNum)
174 {
175 VxdID layerID;
176 layerID.setLayerNumber(layerNum);
177 int result = 0;
178 for (auto ladderID : VXD::GeoCache::getInstance().getLadders(layerID))
179 result += VXD::GeoCache::getInstance().getSensors(ladderID).size();
180 return result;
181 }
182 } // namespace PXD
184} // namespace Belle2
185
Module()
Constructor.
Definition Module.cc:30
static const unsigned short c_reportNTuple
Summary and NTuple.
std::string m_storeFileMetaDataName
Name of the persistent FileMetaData object.
static const unsigned short c_reportSummary
Summary only.
unsigned short m_nfluxReportingLevel
0 - no data, 1 - summary only, 2 - ntuple
static const ROOT::Math::XYZVector & vectorToGlobal(VxdID sensorID, const ROOT::Math::XYZVector &local)
Convert local vector coordinates to global.
static const ROOT::Math::XYZVector & pointToGlobal(VxdID sensorID, const ROOT::Math::XYZVector &local)
Convert local sensor coordinates to global.
std::string m_storeEnergyDepositsName
PXDEnergyDepositEvents StoreArray name.
const double c_smy
Seconds in snowmass year.
unsigned short m_doseReportingLevel
0 - no data, 1 - summary only, 2 - ntuple
int getTotalSensors()
Get total number of sensors.
std::string m_storeOccupancyEventsName
PXDOccupancyEvents StoreArray name.
std::map< VxdID, SensorData > m_sensorData
Struct to hold sensor-wise background data.
virtual void initialize() override
Initialize module.
std::string m_relTrueHitsSimHitsName
PXDTrueHitsToPXDSimHits RelationArray name.
double m_integrationTime
Integration time of PXD.
std::string m_relDigitsMCParticlesName
StoreArray name of PXDDigits to MCParticles relation.
const std::string c_niel_neutronFile
NIEL-correction file for neutrons.
virtual void event() override
Event processing.
const double c_densitySi
Density of crystalline Silicon.
std::string m_relClusterDigitName
PXDClustersToPXDDigits RelationArray name.
double getSensorMass(VxdID sensorID) const
Return mass of the sensor with the given sensor ID.
static const unsigned short c_reportNone
No reporting.
static const PXD::SensorInfo & getInfo(const VxdID &sensorID)
This is a shortcut to getting PXD::SensorInfo from the GeoCache.
std::string m_storeNeutronFluxesName
PXDNeutronFluxEvents StoreArray name.
std::string m_storeTrueHitsName
PXDTrueHits StoreArray name.
virtual void terminate() override
Final summary and cleanup.
std::unique_ptr< TNiel > m_nielNeutrons
Pointer to Niel table for neutrons.
std::string m_storeMCParticlesName
MCParticles StoreArray name.
std::unique_ptr< TNiel > m_nielProtons
Pointer to Niel table for protons.
std::unique_ptr< TNiel > m_nielPions
Pointer to Niel table for pions.
static int getNumSensors(int layerNum)
Get number of sensors in a layer.
const std::string c_niel_electronFile
NIEL-correction file for electrons.
std::string m_storeBgMetaDataName
Name of the persistent BackgroundMetaDta object.
static double getSensorArea(VxdID sensorID)
Return area of the sensor with the given sensor ID.
std::string m_outputDirectoryName
Path to directory where output data will be stored.
std::string m_storeDigitsName
PXDDigits StoreArray name.
std::string m_storeClustersName
PXDClusters StoreArray name.
static double getSensorThickness(VxdID sensorID)
Return thickness of the sensor with the given sensor ID.
std::unique_ptr< TNiel > m_nielElectrons
Pointer to Niel table for electrons.
const std::string c_niel_protonFile
NIEL-correction file for protons.
virtual ~PXDBackgroundModule() override
Destructor.
const std::string c_niel_pionFile
NIEL-correction file for pions.
std::string m_relParticlesTrueHitsName
MCParticlesToPXDTrueHits RelationArray name.
std::string m_componentName
Name of the current bg component.
double m_componentTime
Time of current component.
unsigned short m_occupancyReportingLevel
0 - no data, 1 - summary only, 2 - ntuple
std::string m_storeSimHitsName
PXDSimHits StoreArray name.
std::string m_relDigitsTrueHitsName
StoreArray name of PXDDigits to PXDTrueHits relation.
Specific implementation of SensorInfo for PXD Sensors which provides additional pixel specific inform...
Definition SensorInfo.h:23
static const double g_cm3
Practical units with the value set at 1.
Definition Unit.h:60
static const double s
[second]
Definition Unit.h:95
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a reference to the SensorInfo of a given SensorID.
Definition GeoCache.cc:67
const std::set< Belle2::VxdID > & getSensors(Belle2::VxdID ladder) const
Return a set of all sensor IDs belonging to a given ladder.
Definition GeoCache.cc:204
static GeoCache & getInstance()
Return a reference to the singleton instance.
Definition GeoCache.cc:214
double getThickness() const
Return the thickness of the sensor.
Class to uniquely identify a any structure of the PXD and SVD.
Definition VxdID.h:32
void setLayerNumber(baseType layer)
Set the layer id.
Definition VxdID.h:106
Namespace to encapsulate code needed for simulation and reconstrucion of the PXD.
Abstract base class for different kinds of events.
Struct to hold data of an PXD sensor.
double m_expo
Exposition (energy deposited per cm2 and 1 second)
double m_fired
Fired pixels per cm2 and second, zero-suppression threshold.