Belle II Software prerelease-11-00-00d
SVDRecoHit Class Reference

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

#include <SVDRecoHit.h>

Inheritance diagram for SVDRecoHit:
Collaboration diagram for SVDRecoHit:

Public Member Functions

 SVDRecoHit ()
 Default constructor for ROOT IO.
 
 SVDRecoHit (const SVDTrueHit *hit, bool uDirection, float sigma=-1)
 Construct SVDRecoHit from a SVDTrueHit for Monte Carlo based tracking.
 
 SVDRecoHit (const SVDCluster *hit, const genfit::TrackCandHit *trackCandHit=nullptr)
 Construct SVDRecoHit from a SVD cluster.
 
virtual ~SVDRecoHit () override
 Destructor.
 
genfit::AbsMeasurement * clone () const override
 Creating a deep copy of this hit.
 
VxdID getSensorID () const
 Get the compact ID.
 
const SVDTrueHit * getTrueHit () const
 Get pointer to the TrueHit used when creating this RecoHit, can be nullptr if created from something else.
 
const SVDCluster * getCluster () const
 Get pointer to the Cluster used when creating this RecoHit, can be nullptr if created from something else.
 
bool isU () const
 Is the coordinate u or v?
 
float getPosition () const
 Get coordinate.
 
float getPositionVariance () const
 Get coordinate variance.
 
float getEnergyDep () const
 Get deposited energy.
 
float getRotation () const
 Get rotation angle.
 
virtual std::vector< genfit::MeasurementOnPlane * > constructMeasurementsOnPlane (const genfit::StateOnPlane &state) const override
 Methods that actually interface to Genfit.
 
virtual const genfit::AbsHMatrix * constructHMatrix (const genfit::AbsTrackRep *) const override
 Methods that actually interface to Genfit.
 

Private Types

enum  { HIT_DIMENSIONS = 1 }
 

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

const SVDTrueHit * m_trueHit
 Pointer to the Truehit used to generate this hit.
 
const SVDCluster * m_cluster
 transient member (not written out during streaming)
 
float m_energyDep
 transient member (not written out during streaming)
 
float m_rotationPhi
 angle of the plane rotation, for u in wedge sensors.
 
unsigned short m_sensorID
 Unique sensor identifier.
 
bool m_isU
 True if the hit has u-coordinate, false if v.
 

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.
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()
Default constructor for ROOT IO.
Definition SVDRecoHit.cc:23

Definition at line 47 of file SVDRecoHit.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
HIT_DIMENSIONS 

sensitive Dimensions of the Hit

Definition at line 115 of file SVDRecoHit.h.

115{ HIT_DIMENSIONS = 1 };

Constructor & Destructor Documentation

◆ SVDRecoHit() [1/3]

Default constructor for ROOT IO.

Definition at line 23 of file SVDRecoHit.cc.

23 :
24 genfit::PlanarMeasurement(HIT_DIMENSIONS), m_trueHit(0),
26{
27 setStripV(!m_isU);
28}
const SVDTrueHit * m_trueHit
Pointer to the Truehit used to generate this hit.
Definition SVDRecoHit.h:118
float m_energyDep
transient member (not written out during streaming)
Definition SVDRecoHit.h:121
bool m_isU
True if the hit has u-coordinate, false if v.
Definition SVDRecoHit.h:125
unsigned short m_sensorID
Unique sensor identifier.
Definition SVDRecoHit.h:124
float m_rotationPhi
angle of the plane rotation, for u in wedge sensors.
Definition SVDRecoHit.h:123
const SVDCluster * m_cluster
transient member (not written out during streaming)
Definition SVDRecoHit.h:120
@ HIT_DIMENSIONS
sensitive Dimensions of the Hit
Definition SVDRecoHit.h:115

◆ SVDRecoHit() [2/3]

SVDRecoHit ( const SVDTrueHit * hit,
bool uDirection,
float sigma = -1 )

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 sigma along u or v, depending on uDirection.

If the error is set to <0, the resolution will be set to pitch/sqrt(12).

Parameters
hitSVDTrueHit to use as base
uDirectionIf true, the hit has u coordinate, otherwise v
sigmaError of the hit coordinate

Definition at line 30 of file SVDRecoHit.cc.

30 :
31 genfit::PlanarMeasurement(HIT_DIMENSIONS), m_trueHit(hit),
32 m_cluster(0), m_energyDep(0), m_rotationPhi(0), m_sensorID(0), m_isU(uDirection)
33{
34 setStripV(!m_isU);
35
36 // Smear the coordinate when constructing from a TrueHit.
37 if (!gRandom) B2FATAL("gRandom not initialized, please set up gRandom first");
38
39 // Set the sensor UID
40 m_sensorID = hit->getSensorID();
41
42 //If no error is given, estimate the error to pitch/sqrt(12)
43 if (sigma < 0) {
44 const SVD::SensorInfo& geometry = dynamic_cast<const SVD::SensorInfo&>(VXD::GeoCache::getInstance().getSensorInfo(m_sensorID));
45 sigma = (m_isU) ? geometry.getUPitch(hit->getV()) / sqrt(12) : geometry.getVPitch() / sqrt(12);
46 }
47
48 // Set positions
49 rawHitCoords_(0) = (m_isU) ? gRandom->Gaus(hit->getU(), sigma) : gRandom->Gaus(hit->getV(), sigma);
50 // Set the error covariance matrix
51 rawHitCov_(0, 0) = sigma * sigma;
52 // Set physical parameters
54 // Setup geometry information
56}
void setDetectorPlane()
Set up Detector plane information.
Definition SVDRecoHit.cc:89
float getV() const
Return local v coordinate of hit.
Definition VXDTrueHit.h:74
float getEnergyDep() const
Return energy deposited during traversal of sensor.
Definition VXDTrueHit.h:90
VxdID getSensorID() const
Return the Sensor ID.
Definition VXDTrueHit.h:68
float getU() const
Return local u coordinate of hit.
Definition VXDTrueHit.h:72
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a reference 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

◆ SVDRecoHit() [3/3]

SVDRecoHit ( const SVDCluster * hit,
const genfit::TrackCandHit * trackCandHit = nullptr )
explicit

Construct SVDRecoHit from a SVD cluster.

Parameters
hitSVDCluster to use as base.
trackCandHitFIXME: Parameter sigma is no longer used and will be removed.

Definition at line 58 of file SVDRecoHit.cc.

58 :
59 genfit::PlanarMeasurement(HIT_DIMENSIONS), m_trueHit(0),
61{
62 // Set the sensor UID
63 m_sensorID = hit->getSensorID();
64 m_isU = hit->isUCluster();
65
66 setStripV(!m_isU);
67
68 // Determine if we have a wedge sensor.
69 const SVD::SensorInfo& geometry = dynamic_cast<const SVD::SensorInfo&>(VXD::GeoCache::getInstance().getSensorInfo(m_sensorID));
70
71 bool isWedgeU = m_isU && (geometry.getBackwardWidth() > geometry.getForwardWidth());
72
73 // Set positions
74 rawHitCoords_(0) = hit->getPosition();
75 if (isWedgeU) {
76 // For u coordinate in a wedge sensor, the position line is not u = const.
77 // We have to rotate the coordinate system to achieve this.
78 m_rotationPhi = atan2((geometry.getBackwardWidth() - geometry.getForwardWidth()) / geometry.getWidth(0) * hit->getPosition(),
79 geometry.getLength());
80 }
81 // Set the error covariance matrix (this does not scale with position)
82 rawHitCov_(0, 0) = hit->getPositionSigma() * hit->getPositionSigma();
83 // Set physical parameters
84 m_energyDep = hit->getCharge();
85 // Setup geometry information
87}
float getCharge() const
Get collected charge.
Definition SVDCluster.h:144
VxdID getSensorID() const
Get the sensor ID.
Definition SVDCluster.h:102
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

◆ ~SVDRecoHit()

virtual ~SVDRecoHit ( )
inlineoverridevirtual

Destructor.

Definition at line 74 of file SVDRecoHit.h.

74{}

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 115 of file SVDRecoHit.cc.

117{
118 // Legendre parametrization of deformation
119 auto L1 = [](double x) {return x;};
120 auto L2 = [](double x) {return (3 * x * x - 1) / 2;};
121 auto L3 = [](double x) {return (5 * x * x * x - 3 * x) / 2;};
122 auto L4 = [](double x) {return (35 * x * x * x * x - 30 * x * x + 3) / 8;};
123
124 const SVD::SensorInfo& geometry = dynamic_cast<const SVD::SensorInfo&>(VXD::GeoCache::getInstance().getSensorInfo(m_sensorID));
125
126 double u = 0;
127 double v = 0;
128 double length = 0;
129 double width = 0;
130
131 if (m_isU) {
132 u = rawHit[0]; // U coordinate of hit
133 v = state.getState()(4); // V coordinate of hit
134 width = geometry.getWidth(v); // Width of sensor (U side) is function of V (slanted)
135 length = geometry.getLength(); // Length of sensor (V side)
136
137 u = u * 2 / width; // Legendre parametrization required U in (-1, 1)
138 v = v * 2 / length; // Legendre parametrization required V in (-1, 1)
139
140 } else {
141 v = rawHit[0]; // V coordinate of hit
142 u = state.getState()(3); // U coordinate of hit
143 length = geometry.getLength(); // Length of sensor (V side) is function of V (slanted)
144 width = geometry.getWidth(v); // Width of sensor (U side)
145
146 v = v * 2 / length; // Legendre parametrization required V in (-1, 1)
147 u = u * 2 / width; // Legendre parametrization required U in (-1, 1)
148
149 }
150
151 /* Planar deformation using Legendre parametrization
152 w(u, v) = L_{31} * L2(u) + L_{32} * L1(u) * L1(v) + L_{33} * L2(v) +
153 L_{41} * L3(u) + L_{42} * L2(u) * L1(v) + L_{43} * L1(u) * L2(v) + L_{44} * L3(v) +
154 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); */
155 double dw =
156 planarParameters[0] * L2(u) + planarParameters[1] * L1(u) * L1(v) + planarParameters[2] * L2(v) +
157 planarParameters[3] * L3(u) + planarParameters[4] * L2(u) * L1(v) + planarParameters[5] * L1(u) * L2(v) + planarParameters[6] * L3(
158 v) +
159 planarParameters[7] * L4(u) + planarParameters[8] * L3(u) * L1(v) + planarParameters[9] * L2(u) * L2(v) + planarParameters[10] * L1(
160 u) * L3(v) + planarParameters[11] * L4(v);
161
162 double du_dw = state.getState()[1]; // slope in U direction
163 double dv_dw = state.getState()[2]; // slope in V direction
164
165 u = u * width / 2; // from Legendre to Local parametrization
166 v = v * length / 2; // from Legendre to Local parametrization
167
168 TVectorD pos(1);
169
170 if (m_isU) {
171 pos[0] = u + dw * du_dw;
172 } else {
173 pos[0] = v + dw * dv_dw;
174 }
175
176 return pos;
177}

◆ clone()

genfit::AbsMeasurement * clone ( ) const
override

Creating a deep copy of this hit.

Overrides the method inherited from GFRecoHit.

Definition at line 110 of file SVDRecoHit.cc.

111{
112 return new SVDRecoHit(*this);
113}

◆ constructHMatrix()

virtual const genfit::AbsHMatrix * constructHMatrix ( const genfit::AbsTrackRep * ) const
inlineoverridevirtual

Methods that actually interface to Genfit.

Definition at line 111 of file SVDRecoHit.h.

111{ if (m_isU) return new genfit::HMatrixU(); else return new genfit::HMatrixV(); }

◆ constructMeasurementsOnPlane()

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

Methods that actually interface to Genfit.

Definition at line 179 of file SVDRecoHit.cc.

180{
181 if (!m_isU || m_rotationPhi == 0.0) {
182
183 // Apply planar deformation to rectangular sensor or V coordinate of slanted sensor
184 TVectorD pos = applyPlanarDeformation(rawHitCoords_, VXD::GeoCache::getInstance().getSensorInfo(m_sensorID).getSurfaceParameters(),
185 state);
186
187 return std::vector<genfit::MeasurementOnPlane*>(1, new genfit::MeasurementOnPlane(pos, rawHitCov_, state.getPlane(),
188 state.getRep(), this->constructHMatrix(state.getRep())));
189 }
190
191 // Wedged sensor: the measured coordinate in U depends on V and the
192 // rotation angle. Namely, it needs to be scaled.
193 double u = rawHitCoords_(0);
194 double v = state.getState()(4);
195 double uPrime = u - v * tan(m_rotationPhi);
196 double scale = uPrime / u;
197
198 TVectorD coords(1);
199 coords(0) = uPrime;
200
201 // Apply planar deformation to U coordinate of slanted sensor
202 TVectorD pos = applyPlanarDeformation(coords, VXD::GeoCache::getInstance().getSensorInfo(m_sensorID).getSurfaceParameters(), state);
203
204 TMatrixDSym cov(scale * scale * rawHitCov_);
205
206 return std::vector<genfit::MeasurementOnPlane*>(1, new genfit::MeasurementOnPlane(pos, cov, state.getPlane(), state.getRep(),
207 this->constructHMatrix(state.getRep())));
208}
TVectorD applyPlanarDeformation(TVectorD rawHit, std::vector< double > planarParameters, const genfit::StateOnPlane &state) const
Apply planar deformation of sensors.
double tan(double a)
tan for double
Definition beamHelpers.h:31

◆ getCluster()

const SVDCluster * getCluster ( ) const
inline

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

Definition at line 88 of file SVDRecoHit.h.

88{ return m_cluster; }

◆ getEnergyDep()

float getEnergyDep ( ) const
inline

Get deposited energy.

Definition at line 100 of file SVDRecoHit.h.

100{ return m_energyDep; }

◆ getPosition()

float getPosition ( ) const
inline

Get coordinate.

Definition at line 94 of file SVDRecoHit.h.

94{ return rawHitCoords_(0); }

◆ getPositionVariance()

float getPositionVariance ( ) const
inline

Get coordinate variance.

Definition at line 97 of file SVDRecoHit.h.

97{ return rawHitCov_(0, 0); }

◆ getRotation()

float getRotation ( ) const
inline

Get rotation angle.

Definition at line 103 of file SVDRecoHit.h.

103{ return m_rotationPhi; }

◆ getSensorID()

VxdID getSensorID ( ) const
inline

Get the compact ID.

Definition at line 82 of file SVDRecoHit.h.

82{ 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 85 of file SVDRecoHit.h.

85{ return m_trueHit; }

◆ isU()

bool isU ( ) const
inline

Is the coordinate u or v?

Definition at line 91 of file SVDRecoHit.h.

91{ return m_isU; }

◆ setDetectorPlane()

void setDetectorPlane ( )
private

Set up Detector plane information.

Definition at line 89 of file SVDRecoHit.cc.

90{
91 // Construct a finite detector plane and set it.
92 const SVD::SensorInfo& geometry = dynamic_cast<const SVD::SensorInfo&>(VXD::GeoCache::getInstance().getSensorInfo(m_sensorID));
93 bool isWedgeU = m_isU && (geometry.getBackwardWidth() > geometry.getForwardWidth());
94
95 // Construct vectors o, u, v
96 ROOT::Math::XYZVector uLocal(1, 0, 0);
97 ROOT::Math::XYZVector vLocal(0, 1, 0);
98 ROOT::Math::XYZVector origin = geometry.pointToGlobal(ROOT::Math::XYZVector(0, 0, 0), true);
99 ROOT::Math::XYZVector uGlobal = geometry.vectorToGlobal(uLocal, true);
100 ROOT::Math::XYZVector vGlobal = geometry.vectorToGlobal(vLocal, true);
101
102 //Construct the detector plane
103 VXD::SensorPlane* finitePlane = new VXD::SensorPlane(m_sensorID, 20.0, 20.0);
104 if (isWedgeU) finitePlane->setRotation(m_rotationPhi);
105 genfit::SharedPlanePtr detPlane(new genfit::DetPlane(XYZToTVector(origin), XYZToTVector(uGlobal), XYZToTVector(vGlobal),
106 finitePlane));
107 setPlane(detPlane, m_sensorID);
108}
void setRotation(double phi)
Set plane rotation angle.
Definition SensorPlane.h:49
static constexpr auto XYZToTVector
Helper function to convert XYZVector to TVector3.
Definition VectorUtil.h:26

Member Data Documentation

◆ m_cluster

const SVDCluster* m_cluster
private

transient member (not written out during streaming)

Pointer to the Cluster used to generate this hit

Definition at line 120 of file SVDRecoHit.h.

◆ m_energyDep

float m_energyDep
private

transient member (not written out during streaming)

deposited energy.

Definition at line 121 of file SVDRecoHit.h.

◆ m_isU

bool m_isU
private

True if the hit has u-coordinate, false if v.

Definition at line 125 of file SVDRecoHit.h.

◆ m_rotationPhi

float m_rotationPhi
private

angle of the plane rotation, for u in wedge sensors.

Definition at line 123 of file SVDRecoHit.h.

◆ m_sensorID

unsigned short m_sensorID
private

Unique sensor identifier.

Definition at line 124 of file SVDRecoHit.h.

◆ m_trueHit

const SVDTrueHit* m_trueHit
private

Pointer to the Truehit used to generate this hit.

Definition at line 118 of file SVDRecoHit.h.


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