Belle II Software development
SensorInfo.cc
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#include <pxd/geometry/SensorInfo.h>
10#include <framework/gearbox/Unit.h>
11#include <framework/gearbox/Const.h>
12#include <framework/geometry/BFieldManager.h>
13#include <vxd/geometry/GeoCache.h>
14
15using namespace std;
16using namespace Belle2;
17using namespace Belle2::PXD;
18
19
21{
22 // Electron parameters - maximum velocity, critical intensity, beta factor
23 static double vmElec = 1.53 * pow(m_temperature, -0.87) * 1.E9 * Unit::cm
24 / Unit::s;
25 static double EcElec = 1.01 * pow(m_temperature, +1.55) * Unit::V
26 / Unit::cm;
27 static double betaElec = 2.57 * pow(m_temperature, +0.66) * 1.E-2;
28
29 return (vmElec / EcElec * 1.
30 / (pow(1. + pow((fabs(E) / EcElec), betaElec), (1. / betaElec))));
31}
32
33const ROOT::Math::XYZVector SensorInfo::getEField(const ROOT::Math::XYZVector& point) const
34{
35 // FIXME: Get rid of the gateDepth
36 double depletionVoltage = 0.5 * Unit::e * m_bulkDoping
38 double gateZ = 0.5 * m_thickness - m_gateDepth;
39 double Ez = 2 * depletionVoltage * (point.Z() - gateZ) / m_thickness
41 ROOT::Math::XYZVector E(0, 0, Ez);
42 return E;
43}
44
45const ROOT::Math::XYZVector SensorInfo::getBField(const ROOT::Math::XYZVector& point) const
46{
47 ROOT::Math::XYZVector pointGlobal = pointToGlobal(point, true);
48 ROOT::Math::XYZVector bGlobal = BFieldManager::getField(pointGlobal);
49 ROOT::Math::XYZVector bLocal = vectorToLocal(bGlobal, true);
50 return bLocal;
51}
52
53const ROOT::Math::XYZVector
54SensorInfo::getDriftVelocity(const ROOT::Math::XYZVector& E,
55 const ROOT::Math::XYZVector& B) const
56{
57 // Set mobility parameters
58 double mobility = -getElectronMobility(E.R());
59 double mobilityH = m_hallFactor * mobility;
60 // Calculate products
61 ROOT::Math::XYZVector EcrossB = E.Cross(B);
62 ROOT::Math::XYZVector BEdotB = E.Dot(B) * B;
63 ROOT::Math::XYZVector v = mobility * E + mobility * mobilityH * EcrossB
64 + mobility * mobilityH * mobilityH * BEdotB;
65 v *= 1.0 / (1.0 + mobilityH * mobilityH * B.Mag2());
66 return v;
67}
68
69int SensorInfo::getPixelKind(const VxdID sensorID, double v) const
70{
71 const SensorInfo& Info = dynamic_cast<const SensorInfo&>(VXD::GeoCache::getInstance().getSensorInfo(sensorID));
72 int i_pixelKind = Info.getVPitchID(v);
73 if (Info.getID().getLayerNumber() == 2) i_pixelKind += 4;
74 if (Info.getID().getSensorNumber() == 2) i_pixelKind += 2;
75 return i_pixelKind;
76}
77
78int SensorInfo::getPixelKindNew(const VxdID& sensorID, int vID) const
79{
80 const SensorInfo& Info = dynamic_cast<const SensorInfo&>(VXD::GeoCache::getInstance().getSensorInfo(sensorID));
81 double v = Info.getVCellPosition(vID);
82 double vPitch = Info.getVPitch(v);
83 int i_pixelKind = 0;
84
85 if (std::fabs(vPitch - 0.0055) < 0.0001)
86 i_pixelKind = 0;
87 else if (std::fabs(vPitch - 0.0060) < 0.0001)
88 i_pixelKind = 1;
89 else if (std::fabs(vPitch - 0.0070) < 0.0001)
90 i_pixelKind = 2;
91 else if (std::fabs(vPitch - 0.0085) < 0.0001)
92 i_pixelKind = 3;
93 else
94 B2FATAL("Unexpected pixel vPitch.");
95 return i_pixelKind;
96}
97
98
99const ROOT::Math::XYZVector SensorInfo::getLorentzShift(double u, double v) const
100{
101 // Constants for the 5-point Gauss quadrature formula
102 const double alphaGL = 1.0 / 3.0 * sqrt(5.0 + 2.0 * sqrt(10.0 / 7.0));
103 const double betaGL = 1.0 / 3.0 * sqrt(5.0 - 2.0 * sqrt(10.0 / 7.0));
104 const double walpha = (322 - 13.0 * sqrt(70)) / 900;
105 const double wbeta = (322 + 13.0 * sqrt(70)) / 900;
106 const double distanceToPlane = 0.5 * m_thickness - m_gateDepth;
107 const double midpoint = 0.5 * distanceToPlane;
108 const double h = 0.5 * distanceToPlane;
109 const double weightGL[5] = {
110 h * walpha, h * wbeta, h * 128.0 / 225.0, h * wbeta, h* walpha
111 };
112 const double zKnots[5] = {
113 midpoint - alphaGL * h, midpoint - betaGL * h, midpoint, midpoint + betaGL * h, midpoint + alphaGL* h
114 };
115 // Integrate v/v_z from z = 0 to z = distanceToPlane
116 ROOT::Math::XYZVector position(u, v, 0);
117 ROOT::Math::XYZVector currentBField = getBField(position);
118 for (int iz = 0; iz < 5; ++iz) {
119 // This is OK as long as E only depends on z
120 ROOT::Math::XYZVector currentEField = getEField(ROOT::Math::XYZVector(0, 0, zKnots[iz]));
121 ROOT::Math::XYZVector velocity = getDriftVelocity(currentEField, currentBField);
122 position += weightGL[iz] / velocity.Z() * velocity;
123 } // for knots
124 position.SetZ(0);
125 position.SetX(position.X() - u);
126 position.SetY(position.Y() - v);
127 return position;
128}
129
131{
134
135 m_vsplit = m_length * (m_splitLength - 0.5);
136
138 m_ivp = 1 / m_vp;
139
141 m_ivp2 = 1 / m_vp2;
142
148}
149
150int SensorInfo::getTrappedID(double x, double y) const
151{
152 double huCells = 0.5 * m_uCells;
153 double ix = floor(x * m_iup + huCells);
154 int jx = ix;
155 double x0 = (ix + 0.5 - huCells) * m_up;
156
157 if (fabs(x - x0) < m_hxIG) {
158 if ((unsigned)jx >= (unsigned)m_uCells) return -1;
159 double ys = y - m_vsplit;
160 if (ys >= 0) {
161 double iy = floor(ys * m_ivp2);
162 int jy = iy;
163 iy = jy / 2;
164 double y0 = iy * m_vp2 * 2 + m_vp2;
165 double yl = fabs(ys - y0);
166 if (fabs(yl - m_mIGS) < m_sIGS) {
167 if ((unsigned)jy >= (unsigned)m_vCells2) return -1;
168 return jx + m_uCells * (jy + m_vCells);
169 }
170 return -1;
171 } else {
172 ys = y + 0.5 * m_length;
173 double iy = floor(ys * m_ivp);
174 int jy = iy;
175 iy = jy / 2;
176 double y0 = iy * m_vp * 2 + m_vp;
177 double yl = fabs(ys - y0);
178 if (fabs(yl - m_mIGL) < m_sIGL) {
179 if ((unsigned)jy >= (unsigned)m_vCells) return -1;
180 return jx + m_uCells * jy;
181 }
182 return -1;
183 }
184 }
185 return -1;
186}
R E
internal precision of FFTW codelets
static const double permSi
Permittivity of Silicon.
Definition: Const.h:699
Specific implementation of SensorInfo for PXD Sensors which provides additional pixel specific inform...
Definition: SensorInfo.h:23
double m_vp2
small pixel pitch in v direction
Definition: SensorInfo.h:227
double m_iup
the reciprocal of the pixel pitch in u direction
Definition: SensorInfo.h:220
double m_hallFactor
The bulk doping of the Silicon sensor.
Definition: SensorInfo.h:186
double m_ivp2
the reciprocal of the small pixel pitch in v direction
Definition: SensorInfo.h:228
double m_bulkDoping
Doping concentration of the silicon bulk.
Definition: SensorInfo.h:188
double m_up
pixel pitch in u direction
Definition: SensorInfo.h:219
double m_ivp
the reciprocal of the large pixel pitch in v direction
Definition: SensorInfo.h:225
double m_sIGS
size in v direction of the internal gate trapping region for small pixels
Definition: SensorInfo.h:234
double m_vsplit
v coordinate which splits small and large pixel regions
Definition: SensorInfo.h:222
double m_clearBorderSmallPitch
The distance between the clear side of the pixel and the start of the Gate, small pitch area
Definition: SensorInfo.h:196
double getElectronMobility(double E) const
Calculate electron mobility at a given electric field.
Definition: SensorInfo.cc:20
double m_sourceBorderLargePitch
The distance between the source side of the pixel and the start of the Gate, large pitch area.
Definition: SensorInfo.h:200
double m_vp
large pixel pitch in v direction
Definition: SensorInfo.h:224
double m_mIGS
middle of the internal gate trapping region for small pixels
Definition: SensorInfo.h:233
double m_drainBorderLargePitch
The distance between the drain side of the pixel and the start of the Gate, large pitch area
Definition: SensorInfo.h:204
double m_hxIG
size in u direction of the internal gate trapping region
Definition: SensorInfo.h:230
double m_mIGL
middle of the internal gate trapping region for large pixels
Definition: SensorInfo.h:231
double m_sourceBorderSmallPitch
The distance between the source side of the pixel and the start of the Gate, small pitch area.
Definition: SensorInfo.h:194
int getTrappedID(double x, double y) const
Get pixel number if the given coordinate is in the correspondin internal gate trapping region or -1 o...
Definition: SensorInfo.cc:150
double m_gateDepth
Return depth of the surface where the electrons will be collected.
Definition: SensorInfo.h:206
const ROOT::Math::XYZVector getEField(const ROOT::Math::XYZVector &point) const
Model of the E field inside the sensor.
Definition: SensorInfo.cc:33
double m_drainBorderSmallPitch
The distance between the drain side of the pixel and the start of the Gate, small pitch area
Definition: SensorInfo.h:198
const ROOT::Math::XYZVector getLorentzShift(double u, double v) const
Calculate Lorentz shift.
Definition: SensorInfo.cc:99
int getPixelKindNew(const VxdID &sensorID, int vID) const
Return pixel kind ID.
Definition: SensorInfo.cc:78
const ROOT::Math::XYZVector getBField(const ROOT::Math::XYZVector &point) const
Get B field value from the field map.
Definition: SensorInfo.cc:45
void cook()
calculate constants in advance
Definition: SensorInfo.cc:130
int getPixelKind(const VxdID sensorID, double v) const
Return pixel kind ID.
Definition: SensorInfo.cc:69
const ROOT::Math::XYZVector getDriftVelocity(const ROOT::Math::XYZVector &E, const ROOT::Math::XYZVector &B) const
Calculate drift velocity of an electron.
Definition: SensorInfo.cc:54
double m_temperature
The temperature of the sensor.
Definition: SensorInfo.h:184
double m_sIGL
size in v direction of the internal gate trapping region for large pixels
Definition: SensorInfo.h:232
static const double e
Standard of [electric charge].
Definition: Unit.h:53
static const double V
[voltage]
Definition: Unit.h:117
static const double cm
Standard units with the value = 1.
Definition: Unit.h:47
static const double s
[second]
Definition: Unit.h:95
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
double getVCellPosition(int vID) const
Return the position of a specific strip/pixel in v direction.
ROOT::Math::XYZVector pointToGlobal(const ROOT::Math::XYZVector &local, bool reco=false) const
Convert a point from local to global coordinates.
ROOT::Math::XYZVector vectorToLocal(const ROOT::Math::XYZVector &global, bool reco=false) const
Convert a vector from global to local coordinates.
VxdID getID() const
Return the ID of the Sensor.
double getVPitch(double v=0) const
Return the pitch of the sensor.
double m_width
Width of the sensor.
double m_thickness
Thickness of the Sensor.
int m_vCells
Number of strips/pixels in v direction (up to splitLength for two pixel sizes)
int getVPitchID(double v=0) const
Return the pitch ID of the sensor.
double m_length
Length of the Sensor.
int m_vCells2
Number of strips/pixels in v direction after splitLength, 0 for only one pixel size.
int m_uCells
Number of strips/pixels in u direction.
double m_splitLength
Relative length at which second pixel size starts, 0 for only one pixel size.
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:33
baseType getSensorNumber() const
Get the sensor id.
Definition: VxdID.h:100
baseType getLayerNumber() const
Get the layer id.
Definition: VxdID.h:96
static void getField(const double *pos, double *field)
return the magnetic field at a given position.
Definition: BFieldManager.h:91
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28
Namespace to encapsulate code needed for simulation and reconstrucion of the PXD.
Abstract base class for different kinds of events.
STL namespace.