Belle II Software development
SVDRecoHit2D Class Reference

SVDRecoHit - an extended form of SVDHit containing geometry information. More...

#include <SVDRecoHit2D.h>

Inheritance diagram for SVDRecoHit2D:
AlignableSVDRecoHit2D

Public Member Functions

 SVDRecoHit2D ()
 Default constructor for ROOT IO.
 
 SVDRecoHit2D (const SVDTrueHit *hit, const genfit::TrackCandHit *trackCandHit=nullptr, float sigmaU=-1, float sigmaV=-1)
 Construct SVDRecoHit from a SVDTrueHit for Monte Carlo based tracking.
 
 SVDRecoHit2D (VxdID::baseType vxdid, const double u, const double v, double sigmaU=-1, double sigmaV=-1)
 Construct SVDRecoHit directly from vxdid and coordinates without using a hit object from the storearray in the constructor.
 
 SVDRecoHit2D (const SVDCluster &uHit, const SVDCluster &vHit)
 Construct SVDRecoHit from a u- and v- SVDCluster.
 
 SVDRecoHit2D (const SVDRecoHit &uRecoHit, const SVDRecoHit &vRecoHit)
 Construct SVDRecoHit from a u- and v- (1D) SVDRecoHit.
 
virtual ~SVDRecoHit2D ()
 Destructor.
 
genfit::AbsMeasurement * clone () const override
 Creating a deep copy of this hit.
 
VxdID getSensorID () const
 Get the compact ID.
 
const SVDTrueHitgetTrueHit () const
 Get pointer to the TrueHit used when creating this RecoHit, can be nullptr if created from something else.
 
const SVDClustergetUCluster () const
 Get pointer to the u cluster used to create this RecoHit.
 
const SVDClustergetVCluster () const
 Get pointer to the u cluster used to create this RecoHit.
 
float getU () const
 Get u coordinate.
 
float getV () const
 Get v coordinate.
 
float getUVariance () const
 Get u coordinate variance.
 
float getVVariance () const
 Get v coordinate variance.
 
float getUVCov () const
 Get u-v error covariance.
 
float getEnergyDep () const
 Get deposited energy.
 
virtual std::vector< genfit::MeasurementOnPlane * > constructMeasurementsOnPlane (const genfit::StateOnPlane &state) const override
 Get deposited energy error.
 

Private Types

enum  { HIT_DIMENSIONS = 2 }
 

Private Member Functions

void setDetectorPlane ()
 Set up Detector plane information.
 
TVectorD applyPlanarDeformation (TVectorD rawHit, std::vector< double > planarParameters, const genfit::StateOnPlane &state) const
 Apply planar deformation of sensors.
 

Private Attributes

unsigned short m_sensorID
 Unique sensor identifier.
 
const SVDTrueHitm_trueHit
 Pointer to the Truehit used to generate this hit.
 
const SVDClusterm_uCluster
 Pointer to mother uCluster.
 
const SVDClusterm_vCluster
 Pointer to mother vCluster.
 
float m_energyDep
 deposited energy.
 

Detailed Description

SVDRecoHit - an extended form of SVDHit containing geometry information.

To create a list of SVDRecoHits for all SVDTrueHits belonging to one MCParticle do something like:

//Get the MCParticle in question
MCParticle* mcParticle = ...
//Iterate over the relation and create a list of hits
vector<SVDRecoHit*> hits;
for(; it.first!=it.second; ++it.first){
hits.push_back(new SVDRecoHit(it.first->to));
}
A Class to store the Monte Carlo particle information.
Definition: MCParticle.h:32
Provides access to fast ( O(log n) ) bi-directional lookups on a specified relation.
Definition: RelationIndex.h:76
range_from getElementsFrom(const FROM *from) const
Return a range of all elements pointing from the given object.
boost::iterator_range< iterator_from > range_from
Iterator range [first,second) of the from side.
SVDRecoHit - an extended form of SVDHit containing geometry information.
Definition: SVDRecoHit.h:47

Definition at line 46 of file SVDRecoHit2D.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
HIT_DIMENSIONS 

sensitive Dimensions of the Hit

Definition at line 133 of file SVDRecoHit2D.h.

133{ HIT_DIMENSIONS = 2 };
@ HIT_DIMENSIONS
sensitive Dimensions of the Hit
Definition: SVDRecoHit2D.h:133

Constructor & Destructor Documentation

◆ SVDRecoHit2D() [1/5]

Default constructor for ROOT IO.

Definition at line 23 of file SVDRecoHit2D.cc.

23 :
24 genfit::PlanarMeasurement(HIT_DIMENSIONS), m_sensorID(0), m_trueHit(0), m_uCluster(0), m_vCluster(0),
25 m_energyDep(0)//, m_energyDepError(0)
26{}
const SVDTrueHit * m_trueHit
Pointer to the Truehit used to generate this hit.
Definition: SVDRecoHit2D.h:136
float m_energyDep
deposited energy.
Definition: SVDRecoHit2D.h:140
unsigned short m_sensorID
Unique sensor identifier.
Definition: SVDRecoHit2D.h:135
const SVDCluster * m_uCluster
Pointer to mother uCluster.
Definition: SVDRecoHit2D.h:137
const SVDCluster * m_vCluster
Pointer to mother vCluster.
Definition: SVDRecoHit2D.h:138

◆ SVDRecoHit2D() [2/5]

SVDRecoHit2D ( const SVDTrueHit hit,
const genfit::TrackCandHit *  trackCandHit = nullptr,
float  sigmaU = -1,
float  sigmaV = -1 
)
explicit

Construct SVDRecoHit from a SVDTrueHit for Monte Carlo based tracking.

This requires a valid random number generator to be initialized at gRandom. The Hit position will be smeared using a gaussian smearing with sigmaU and sigmaV along u and v respectively

If one of the errors is set <0, a default resolution will be assumed for both values by dividing the pixel size by sqrt(12).

Parameters
hitSVDTrueHit to use as base
trackCandHit
sigmaUError of the Hit along u
sigmaVError of the Hit along v

Definition at line 28 of file SVDRecoHit2D.cc.

28 :
29 genfit::PlanarMeasurement(HIT_DIMENSIONS), m_sensorID(0), m_trueHit(hit), m_uCluster(0), m_vCluster(0),
30 m_energyDep(0)//, m_energyDepError(0)
31{
32 if (!gRandom) B2FATAL("gRandom not initialized, please set up gRandom first");
33
34 // Set the sensor UID
35 m_sensorID = hit->getSensorID();
36
37 //If no error is given, estimate the error by dividing the pixel size by sqrt(12)
38 if (sigmaU < 0 || sigmaV < 0) {
40 sigmaU = geometry.getUPitch(hit->getV()) / sqrt(12);
41 sigmaV = geometry.getVPitch(hit->getV()) / sqrt(12);
42 }
43
44 // Set positions
45 rawHitCoords_(0) = gRandom->Gaus(hit->getU(), sigmaU);
46 rawHitCoords_(1) = gRandom->Gaus(hit->getV(), sigmaV);
47 // Set the error covariance matrix
48 rawHitCov_(0, 0) = sigmaU * sigmaU;
49 rawHitCov_(0, 1) = 0;
50 rawHitCov_(1, 0) = 0;
51 rawHitCov_(1, 1) = sigmaV * sigmaV;
52 // Set physical parameters
53 m_energyDep = hit->getEnergyDep();
54 // Setup geometry information
56}
void setDetectorPlane()
Set up Detector plane information.
Specific implementation of SensorInfo for SVD Sensors which provides additional sensor specific infor...
Definition: SensorInfo.h:25
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 sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28

◆ SVDRecoHit2D() [3/5]

SVDRecoHit2D ( VxdID::baseType  vxdid,
const double  u,
const double  v,
double  sigmaU = -1,
double  sigmaV = -1 
)

Construct SVDRecoHit directly from vxdid and coordinates without using a hit object from the storearray in the constructor.

Parameters
vxdidthe vxd id so the reco hit knows on which sensor the measurment took place
ucoordinate of the Hit along u
vcoordinate of the Hit along v
sigmaUError of the Hit along u
sigmaVError of the Hit along v

Definition at line 58 of file SVDRecoHit2D.cc.

58 :
59 genfit::PlanarMeasurement(HIT_DIMENSIONS), m_sensorID(vxdid), m_trueHit(nullptr), m_uCluster(0), m_vCluster(0),
60 m_energyDep(0)//, m_energyDepError(0)
61{
62 //If no error is given, estimate the error by dividing the pixel size by sqrt(12)
63 if (sigmaU < 0 || sigmaV < 0) {
65 sigmaU = geometry.getUPitch(v) / sqrt(12);
66 sigmaV = geometry.getVPitch(v) / sqrt(12);
67 }
68 // Set positions
69 rawHitCoords_(0) = u;
70 rawHitCoords_(1) = v;
71 // Set the error covariance matrix
72 rawHitCov_(0, 0) = sigmaU * sigmaU;
73 rawHitCov_(0, 1) = 0;
74 rawHitCov_(1, 0) = 0;
75 rawHitCov_(1, 1) = sigmaV * sigmaV;
76 // Setup geometry information
78}

◆ SVDRecoHit2D() [4/5]

SVDRecoHit2D ( const SVDCluster uHit,
const SVDCluster vHit 
)

Construct SVDRecoHit from a u- and v- SVDCluster.

Parameters
uHitthe u-type SVDCluster
vHitthe v-type SVDCluster

Definition at line 80 of file SVDRecoHit2D.cc.

80 :
81 genfit::PlanarMeasurement(HIT_DIMENSIONS), m_trueHit(nullptr), m_uCluster(&uHit), m_vCluster(&vHit),
83{
84 if ((uHit.getRawSensorID() != vHit.getRawSensorID()) || !uHit.isUCluster() || vHit.isUCluster())
85 B2FATAL("Error in SVDRecoHit2D: Incorrect SVDCluster instances on input!");
86
88
89 // Now that we have a v coordinate, we can rescale u.
90 const SVD::SensorInfo& info =
92
93 double DeltaU =
94 (info.getForwardWidth() - info.getBackwardWidth()) / info.getLength() / info.getWidth(0);
95 double scaleFactorU = 1 + DeltaU * vHit.getPosition();
96 double tan_phi = DeltaU * uHit.getPosition(); // need u at v=0!
97 double one_over_cos_phi_sqr = 1 + tan_phi * tan_phi;
98
99 rawHitCoords_[0] = uHit.getPosition() * scaleFactorU;
100 rawHitCoords_[1] = vHit.getPosition();
101
102 double sigmaU = uHit.getPositionSigma() * scaleFactorU;
103 double sigmaU_sq = sigmaU * sigmaU;
104 double sigmaV = vHit.getPositionSigma();
105 double sigmaV_sq = sigmaV * sigmaV;
106
107 m_energyDep = 0.5 * (uHit.getCharge() + vHit.getCharge());
108
109 rawHitCov_(0, 0) = sigmaV_sq * tan_phi * tan_phi + sigmaU_sq * one_over_cos_phi_sqr;
110 rawHitCov_(0, 1) = sigmaV_sq * tan_phi;
111 rawHitCov_(1, 0) = sigmaV_sq * tan_phi;
112 rawHitCov_(1, 1) = sigmaV_sq;
113 // Setup geometry information
115}
float getCharge() const
Get collected charge.
Definition: SVDCluster.h:144
bool isUCluster() const
Get the direction of strips.
Definition: SVDCluster.h:110
float getPosition(double v=0) const
Get the coordinate of reconstructed hit.
Definition: SVDCluster.h:117
float getPositionSigma() const
Get the error of the reconstructed hit coordinate.
Definition: SVDCluster.h:129
unsigned short getRawSensorID() const
Get raw sensor ID.
Definition: SVDCluster.h:105

◆ SVDRecoHit2D() [5/5]

SVDRecoHit2D ( const SVDRecoHit uRecoHit,
const SVDRecoHit vRecoHit 
)

Construct SVDRecoHit from a u- and v- (1D) SVDRecoHit.

Parameters
uRecoHitthe u-type SVDRecoHit
vRecoHitthe v-type SVDRecoHit

Definition at line 117 of file SVDRecoHit2D.cc.

117 :
118 genfit::PlanarMeasurement(HIT_DIMENSIONS), m_trueHit(nullptr), m_uCluster(0), m_vCluster(0), m_energyDep(0)
119{
120 const SVDCluster& uHit = *(uRecoHit.getCluster());
121 const SVDCluster& vHit = *(vRecoHit.getCluster());
122 if ((uHit.getRawSensorID() != vHit.getRawSensorID()) || !uHit.isUCluster() || vHit.isUCluster())
123 B2FATAL("Error in SVDRecoHit2D: Incorrect SVDCluster instances on input!");
124
125 m_sensorID = uHit.getRawSensorID();
126 m_uCluster = &uHit;
127 m_vCluster = &vHit;
128
129 // Now that we have a v coordinate, we can rescale u.
130 const SVD::SensorInfo& info =
132
133 double DeltaU =
134 (info.getForwardWidth() - info.getBackwardWidth()) / info.getLength() / info.getWidth(0);
135 double scaleFactorU = 1 + DeltaU * vHit.getPosition();
136 double tan_phi = DeltaU * uHit.getPosition(); // need u at v=0!
137 double one_over_cos_phi_sqr = 1 + tan_phi * tan_phi;
138
139 rawHitCoords_[0] = uHit.getPosition() * scaleFactorU;
140 rawHitCoords_[1] = vHit.getPosition();
141
142 double sigmaU = uHit.getPositionSigma() * scaleFactorU;
143 double sigmaU_sq = sigmaU * sigmaU;
144 double sigmaV = vHit.getPositionSigma();
145 double sigmaV_sq = sigmaV * sigmaV;
146
147 m_energyDep = 0.5 * (uHit.getCharge() + vHit.getCharge());
148
149 rawHitCov_(0, 0) = sigmaV_sq * tan_phi * tan_phi + sigmaU_sq * one_over_cos_phi_sqr;
150 rawHitCov_(0, 1) = sigmaV_sq * tan_phi;
151 rawHitCov_(1, 0) = sigmaV_sq * tan_phi;
152 rawHitCov_(1, 1) = sigmaV_sq;
153 // Setup geometry information
155}
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
Definition: SVDCluster.h:29
const SVDCluster * getCluster() const
Get pointer to the Cluster used when creating this RecoHit, can be nullptr if created from something ...
Definition: SVDRecoHit.h:88

◆ ~SVDRecoHit2D()

virtual ~SVDRecoHit2D ( )
inlinevirtual

Destructor.

Definition at line 92 of file SVDRecoHit2D.h.

92{}

Member Function Documentation

◆ applyPlanarDeformation()

TVectorD applyPlanarDeformation ( TVectorD  rawHit,
std::vector< double >  planarParameters,
const genfit::StateOnPlane &  state 
) const
private

Apply planar deformation of sensors.

Definition at line 173 of file SVDRecoHit2D.cc.

175{
176 // Legendre parametrization of deformation
177 auto L1 = [](double x) {return x;};
178 auto L2 = [](double x) {return (3 * x * x - 1) / 2;};
179 auto L3 = [](double x) {return (5 * x * x * x - 3 * x) / 2;};
180 auto L4 = [](double x) {return (35 * x * x * x * x - 30 * x * x + 3) / 8;};
181
182 const SVD::SensorInfo& geometry = dynamic_cast<const SVD::SensorInfo&>(VXD::GeoCache::getInstance().getSensorInfo(m_sensorID));
183
184 double u = rawHit[0]; // U coordinate of hit
185 double v = rawHit[1]; // V coordinate of hit
186 double width = geometry.getWidth(v); // Width of sensor (U side)
187 double length = geometry.getLength(); // Length of sensor (V side)
188 u = u * 2 / width; // Legendre parametrization required U in (-1, 1)
189 v = v * 2 / length; // Legendre parametrization required V in (-1, 1)
190
191 /* Planar deformation using Legendre parametrization
192 w(u, v) = L_{31} * L2(u) + L_{32} * L1(u) * L1(v) + L_{33} * L2(v) +
193 L_{41} * L3(u) + L_{42} * L2(u) * L1(v) + L_{43} * L1(u) * L2(v) + L_{44} * L3(v) +
194 L_{51} * L4(u) + L_{52} * L3(u) * L1(v) + L_{53} * L2(u) * L2(v) + L_{54} * L1(u) * L3(v) + L_{55} * L4(v); */
195 double dw =
196 planarParameters[0] * L2(u) + planarParameters[1] * L1(u) * L1(v) + planarParameters[2] * L2(v) +
197 planarParameters[3] * L3(u) + planarParameters[4] * L2(u) * L1(v) + planarParameters[5] * L1(u) * L2(v) + planarParameters[6] * L3(
198 v) +
199 planarParameters[7] * L4(u) + planarParameters[8] * L3(u) * L1(v) + planarParameters[9] * L2(u) * L2(v) + planarParameters[10] * L1(
200 u) * L3(v) + planarParameters[11] * L4(v);
201
202 double du_dw = state.getState()[1]; // slope in U direction
203 double dv_dw = state.getState()[2]; // slope in V direction
204
205 u = u * width / 2; // from Legendre to Local parametrization
206 v = v * length / 2; // from Legendre to Local parametrization
207
208 TVectorD pos(2);
209
210 pos[0] = u + dw * du_dw;
211 pos[1] = v + dw * dv_dw;
212
213 return pos;
214}

◆ clone()

genfit::AbsMeasurement * clone ( ) const
override

Creating a deep copy of this hit.

Overrides the method inherited from GFRecoHit.

Definition at line 226 of file SVDRecoHit2D.cc.

227{
228 return new SVDRecoHit2D(*this);
229}
SVDRecoHit2D()
Default constructor for ROOT IO.
Definition: SVDRecoHit2D.cc:23

◆ constructMeasurementsOnPlane()

std::vector< genfit::MeasurementOnPlane * > constructMeasurementsOnPlane ( const genfit::StateOnPlane &  state) const
overridevirtual

Get deposited energy error.

Methods that actually interface to Genfit.

Definition at line 216 of file SVDRecoHit2D.cc.

217{
218 // Apply planar deformation
219 TVectorD pos = applyPlanarDeformation(rawHitCoords_, VXD::GeoCache::getInstance().getSensorInfo(m_sensorID).getSurfaceParameters(),
220 state);
221
222 return std::vector<genfit::MeasurementOnPlane*>(1, new genfit::MeasurementOnPlane(pos, rawHitCov_, state.getPlane(),
223 state.getRep(), this->constructHMatrix(state.getRep())));
224}
TVectorD applyPlanarDeformation(TVectorD rawHit, std::vector< double > planarParameters, const genfit::StateOnPlane &state) const
Apply planar deformation of sensors.

◆ getEnergyDep()

float getEnergyDep ( ) const
inline

Get deposited energy.

Definition at line 122 of file SVDRecoHit2D.h.

122{ return m_energyDep; }

◆ getSensorID()

VxdID getSensorID ( ) const
inline

Get the compact ID.

Definition at line 100 of file SVDRecoHit2D.h.

100{ return m_sensorID; }

◆ getTrueHit()

const SVDTrueHit * getTrueHit ( ) const
inline

Get pointer to the TrueHit used when creating this RecoHit, can be nullptr if created from something else.

Definition at line 103 of file SVDRecoHit2D.h.

103{ return m_trueHit; }

◆ getU()

float getU ( ) const
inline

Get u coordinate.

Definition at line 110 of file SVDRecoHit2D.h.

110{ return rawHitCoords_(0); }

◆ getUCluster()

const SVDCluster * getUCluster ( ) const
inline

Get pointer to the u cluster used to create this RecoHit.

Definition at line 105 of file SVDRecoHit2D.h.

105{return m_uCluster; }

◆ getUVariance()

float getUVariance ( ) const
inline

Get u coordinate variance.

Definition at line 115 of file SVDRecoHit2D.h.

115{ return rawHitCov_(0, 0); }

◆ getUVCov()

float getUVCov ( ) const
inline

Get u-v error covariance.

Definition at line 119 of file SVDRecoHit2D.h.

119{ return rawHitCov_(0, 1); }

◆ getV()

float getV ( ) const
inline

Get v coordinate.

Definition at line 112 of file SVDRecoHit2D.h.

112{ return rawHitCoords_(1); }

◆ getVCluster()

const SVDCluster * getVCluster ( ) const
inline

Get pointer to the u cluster used to create this RecoHit.

Definition at line 107 of file SVDRecoHit2D.h.

107{return m_vCluster; }

◆ getVVariance()

float getVVariance ( ) const
inline

Get v coordinate variance.

Definition at line 117 of file SVDRecoHit2D.h.

117{ return rawHitCov_(1, 1); }

◆ setDetectorPlane()

void setDetectorPlane ( )
private

Set up Detector plane information.

Definition at line 157 of file SVDRecoHit2D.cc.

158{
159 // Construct a finite detector plane and set it.
160 const SVD::SensorInfo& geometry = dynamic_cast<const SVD::SensorInfo&>(VXD::GeoCache::getInstance().getSensorInfo(m_sensorID));
161
162 // Construct vectors o, u, v
163 ROOT::Math::XYZVector origin = geometry.pointToGlobal(ROOT::Math::XYZVector(0, 0, 0), true);
164 ROOT::Math::XYZVector uGlobal = geometry.vectorToGlobal(ROOT::Math::XYZVector(1, 0, 0), true);
165 ROOT::Math::XYZVector vGlobal = geometry.vectorToGlobal(ROOT::Math::XYZVector(0, 1, 0), true);
166
167 //Construct the detector plane
168 genfit::SharedPlanePtr detPlane(new genfit::DetPlane(XYZToTVector(origin), XYZToTVector(uGlobal), XYZToTVector(vGlobal),
169 new VXD::SensorPlane(m_sensorID, 20, 20)));
170 setPlane(detPlane, m_sensorID);
171}
A Finite plane of one VXD Sensor.
Definition: SensorPlane.h:34
static constexpr auto XYZToTVector
Helper function to convert XYZVector to TVector3.
Definition: VectorUtil.h:24

Member Data Documentation

◆ m_energyDep

float m_energyDep
private

deposited energy.

Definition at line 140 of file SVDRecoHit2D.h.

◆ m_sensorID

unsigned short m_sensorID
private

Unique sensor identifier.

Definition at line 135 of file SVDRecoHit2D.h.

◆ m_trueHit

const SVDTrueHit* m_trueHit
private

Pointer to the Truehit used to generate this hit.

Definition at line 136 of file SVDRecoHit2D.h.

◆ m_uCluster

const SVDCluster* m_uCluster
private

Pointer to mother uCluster.

Definition at line 137 of file SVDRecoHit2D.h.

◆ m_vCluster

const SVDCluster* m_vCluster
private

Pointer to mother vCluster.

Definition at line 138 of file SVDRecoHit2D.h.


The documentation for this class was generated from the following files: