9#include <framework/logging/Logger.h>
10#include <framework/geometry/VectorUtil.h>
11#include <svd/reconstruction/SVDRecoHit2D.h>
12#include <svd/geometry/SensorInfo.h>
13#include <vxd/geometry/SensorPlane.h>
14#include <vxd/geometry/GeoCache.h>
16#include <genfit/DetPlane.h>
24 genfit::PlanarMeasurement(HIT_DIMENSIONS), m_sensorID(0), m_trueHit(0), m_uCluster(0), m_vCluster(0),
29 genfit::PlanarMeasurement(HIT_DIMENSIONS), m_sensorID(0), m_trueHit(hit), m_uCluster(0), m_vCluster(0),
32 if (!gRandom) B2FATAL(
"gRandom not initialized, please set up gRandom first");
38 if (sigmaU < 0 || sigmaV < 0) {
40 sigmaU = geometry.getUPitch(hit->getV()) /
sqrt(12);
41 sigmaV = geometry.getVPitch(hit->getV()) /
sqrt(12);
45 rawHitCoords_(0) = gRandom->Gaus(hit->getU(), sigmaU);
46 rawHitCoords_(1) = gRandom->Gaus(hit->getV(), sigmaV);
48 rawHitCov_(0, 0) = sigmaU * sigmaU;
51 rawHitCov_(1, 1) = sigmaV * sigmaV;
59 genfit::PlanarMeasurement(HIT_DIMENSIONS), m_sensorID(vxdid), m_trueHit(nullptr), m_uCluster(0), m_vCluster(0),
63 if (sigmaU < 0 || sigmaV < 0) {
65 sigmaU = geometry.getUPitch(v) /
sqrt(12);
66 sigmaV = geometry.getVPitch(v) /
sqrt(12);
72 rawHitCov_(0, 0) = sigmaU * sigmaU;
75 rawHitCov_(1, 1) = sigmaV * sigmaV;
81 genfit::PlanarMeasurement(HIT_DIMENSIONS), m_trueHit(nullptr), m_uCluster(&uHit), m_vCluster(&vHit),
85 B2FATAL(
"Error in SVDRecoHit2D: Incorrect SVDCluster instances on input!");
94 (info.getForwardWidth() - info.getBackwardWidth()) / info.getLength() / info.getWidth(0);
95 double scaleFactorU = 1 + DeltaU * vHit.
getPosition();
97 double one_over_cos_phi_sqr = 1 + tan_phi * tan_phi;
99 rawHitCoords_[0] = uHit.
getPosition() * scaleFactorU;
103 double sigmaU_sq = sigmaU * sigmaU;
105 double sigmaV_sq = sigmaV * sigmaV;
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;
118 genfit::PlanarMeasurement(HIT_DIMENSIONS), m_trueHit(nullptr), m_uCluster(0), m_vCluster(0), m_energyDep(0)
123 B2FATAL(
"Error in SVDRecoHit2D: Incorrect SVDCluster instances on input!");
134 (info.getForwardWidth() - info.getBackwardWidth()) / info.getLength() / info.getWidth(0);
135 double scaleFactorU = 1 + DeltaU * vHit.
getPosition();
137 double one_over_cos_phi_sqr = 1 + tan_phi * tan_phi;
139 rawHitCoords_[0] = uHit.
getPosition() * scaleFactorU;
143 double sigmaU_sq = sigmaU * sigmaU;
145 double sigmaV_sq = sigmaV * sigmaV;
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;
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);
174 const genfit::StateOnPlane& state)
const
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;};
184 double u = rawHit[0];
185 double v = rawHit[1];
186 double width = geometry.getWidth(v);
187 double length = geometry.getLength();
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(
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);
202 double du_dw = state.getState()[1];
203 double dv_dw = state.getState()[2];
210 pos[0] = u + dw * du_dw;
211 pos[1] = v + dw * dv_dw;
222 return std::vector<genfit::MeasurementOnPlane*>(1,
new genfit::MeasurementOnPlane(pos, rawHitCov_, state.getPlane(),
223 state.getRep(), this->constructHMatrix(state.getRep())));
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
float getCharge() const
Get collected charge.
bool isUCluster() const
Get the direction of strips.
float getPosition(double v=0) const
Get the coordinate of reconstructed hit.
float getPositionSigma() const
Get the error of the reconstructed hit coordinate.
unsigned short getRawSensorID() const
Get raw sensor ID.
virtual std::vector< genfit::MeasurementOnPlane * > constructMeasurementsOnPlane(const genfit::StateOnPlane &state) const override
Get deposited energy error.
TVectorD applyPlanarDeformation(TVectorD rawHit, std::vector< double > planarParameters, const genfit::StateOnPlane &state) const
Apply planar deformation of sensors.
float m_energyDep
deposited energy.
unsigned short m_sensorID
Unique sensor identifier.
const SVDCluster * m_uCluster
Pointer to mother uCluster.
void setDetectorPlane()
Set up Detector plane information.
genfit::AbsMeasurement * clone() const override
Creating a deep copy of this hit.
SVDRecoHit2D()
Default constructor for ROOT IO.
const SVDCluster * m_vCluster
Pointer to mother vCluster.
SVDRecoHit - an extended form of SVDHit containing geometry information.
const SVDCluster * getCluster() const
Get pointer to the Cluster used when creating this RecoHit, can be nullptr if created from something ...
Class SVDTrueHit - Records of tracks that either enter or leave the sensitive volume.
Specific implementation of SensorInfo for SVD Sensors which provides additional sensor specific infor...
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a referecne to the SensorInfo of a given SensorID.
static GeoCache & getInstance()
Return a reference to the singleton instance.
A Finite plane of one VXD Sensor.
unsigned short baseType
The base integer type for VxdID.
static constexpr auto XYZToTVector
Helper function to convert XYZVector to TVector3.
double sqrt(double a)
sqrt for double
Abstract base class for different kinds of events.