9#include <framework/logging/Logger.h>
10#include <framework/geometry/VectorUtil.h>
11#include <pxd/reconstruction/PXDRecoHit.h>
12#include <pxd/reconstruction/PXDClusterPositionEstimator.h>
13#include <pxd/reconstruction/PXDGainCalibrator.h>
14#include <pxd/dataobjects/PXDTrueHit.h>
15#include <pxd/dataobjects/PXDCluster.h>
16#include <pxd/geometry/SensorInfo.h>
17#include <vxd/geometry/SensorPlane.h>
18#include <vxd/geometry/GeoCache.h>
20#include <genfit/DetPlane.h>
27 genfit::PlanarMeasurement(HIT_DIMENSIONS), m_sensorID(0), m_trueHit(0), m_cluster(0),
32 genfit::PlanarMeasurement(HIT_DIMENSIONS), m_sensorID(0), m_trueHit(hit), m_cluster(0),
35 if (!gRandom) B2FATAL(
"gRandom not initialized, please set up gRandom first");
41 if (sigmaU < 0 || sigmaV < 0) {
43 sigmaU = geometry.getUPitch(hit->getV()) /
sqrt(12);
44 sigmaV = geometry.getVPitch(hit->getV()) /
sqrt(12);
48 rawHitCoords_(0) = gRandom->Gaus(hit->getU(), sigmaU);
49 rawHitCoords_(1) = gRandom->Gaus(hit->getV(), sigmaV);
51 rawHitCov_(0, 0) = sigmaU * sigmaU;
54 rawHitCov_(1, 1) = sigmaV * sigmaV;
62 genfit::PlanarMeasurement(HIT_DIMENSIONS), m_sensorID(0), m_trueHit(0), m_cluster(hit),
68 rawHitCoords_(0) = hit->getU();
69 rawHitCoords_(1) = hit->getV();
71 rawHitCov_(0, 0) = sigmaU * sigmaU;
72 rawHitCov_(0, 1) = covUV;
73 rawHitCov_(1, 0) = covUV;
74 rawHitCov_(1, 1) = sigmaV * sigmaV;
87 genfit::PlanarMeasurement(HIT_DIMENSIONS), m_sensorID(0), m_trueHit(0), m_cluster(hit),
93 rawHitCoords_(0) = hit->getU();
94 rawHitCoords_(1) = hit->getV();
96 rawHitCov_(0, 0) = hit->getUSigma() * hit->getUSigma();
97 rawHitCov_(0, 1) = hit->getRho() * hit->getUSigma() * hit->getVSigma();
98 rawHitCov_(1, 0) = hit->getRho() * hit->getUSigma() * hit->getVSigma();
99 rawHitCov_(1, 1) = hit->getVSigma() * hit->getVSigma();
122 ROOT::Math::XYZVector uLocal(1, 0, 0);
123 ROOT::Math::XYZVector vLocal(0, 1, 0);
124 ROOT::Math::XYZVector origin = geometry.pointToGlobal(ROOT::Math::XYZVector(0, 0, 0),
true);
125 ROOT::Math::XYZVector uGlobal = geometry.vectorToGlobal(uLocal,
true);
126 ROOT::Math::XYZVector vGlobal = geometry.vectorToGlobal(vLocal,
true);
141 const TVectorD& state5 = state.getState();
149 const genfit::StateOnPlane& state)
const
152 auto L1 = [](
double x) {
return x;};
153 auto L2 = [](
double x) {
return (3 * x * x - 1) / 2;};
154 auto L3 = [](
double x) {
return (5 * x * x * x - 3 * x) / 2;};
155 auto L4 = [](
double x) {
return (35 * x * x * x * x - 30 * x * x + 3) / 8;};
159 double u = hitCoords[0];
160 double v = hitCoords[1];
161 double width = geometry.getWidth(v);
162 double length = geometry.getLength();
171 planarParameters[0] * L2(u) + planarParameters[1] * L1(u) * L1(v) + planarParameters[2] * L2(v) +
172 planarParameters[3] * L3(u) + planarParameters[4] * L2(u) * L1(v) + planarParameters[5] * L1(u) * L2(v) + planarParameters[6] * L3(
174 planarParameters[7] * L4(u) + planarParameters[8] * L3(u) * L1(v) + planarParameters[9] * L2(u) * L2(v) + planarParameters[10] * L1(
175 u) * L3(v) + planarParameters[11] * L4(v);
177 double du_dw = state.getState()[1];
178 double dv_dw = state.getState()[2];
185 pos[0] = u + dw * du_dw;
186 pos[1] = v + dw * dv_dw;
196 const TVectorD& state5 = state.getState();
199 if (offset !=
nullptr) {
207 TVectorD hitCoords(2);
208 hitCoords(0) = posU + offset->getU();
209 hitCoords(1) = posV + offset->getV();
210 TMatrixDSym hitCov(2);
211 hitCov(0, 0) = offset->getUSigma2();
212 hitCov(0, 1) = offset->getUVCovariance();
213 hitCov(1, 0) = offset->getUVCovariance();
214 hitCov(1, 1) = offset->getVSigma2();
220 return std::vector<genfit::MeasurementOnPlane*>(1,
new genfit::MeasurementOnPlane(
221 pos, hitCov, state.getPlane(), state.getRep(), this->constructHMatrix(state.getRep())
231 return std::vector<genfit::MeasurementOnPlane*>(1,
new genfit::MeasurementOnPlane(
232 pos, rawHitCov_, state.getPlane(), state.getRep(), this->constructHMatrix(state.getRep())
The PXD Cluster class This class stores all information about reconstructed PXD clusters The position...
float getShapeLikelyhood(const genfit::StateOnPlane &state) const
Get deposited energy error.
virtual std::vector< genfit::MeasurementOnPlane * > constructMeasurementsOnPlane(const genfit::StateOnPlane &state) const override
Methods that actually interface to Genfit.
float m_energyDep
transient member (not written out during streaming)
unsigned short m_sensorID
Unique sensor identifier.
PXDRecoHit()
Default constructor for ROOT IO.
TVectorD applyPlanarDeformation(TVectorD hitCoords, std::vector< double > planarParameters, const genfit::StateOnPlane &state) const
Apply planar deformation of sensors.
void setDetectorPlane()
Set up Detector plane information.
const PXDCluster * getCluster() const
Get pointer to the Cluster used when creating this RecoHit, can be NULL if created from something els...
VxdID getSensorID() const
Get the compact ID.
genfit::AbsMeasurement * clone() const override
Creating a deep copy of this hit.
Class PXDTrueHit - Records of tracks that either enter or leave the sensitive volume.
static PXDClusterPositionEstimator & getInstance()
Main (and only) way to access the PXDClusterPositionEstimator.
const PXDClusterOffsetPar * getClusterOffset(const PXDCluster &cluster, double tu, double tv) const
Return pointer to cluster offsets, can be nullptr.
float getShapeLikelyhood(const PXDCluster &cluster, double tu, double tv) const
Return cluster shape likelyhood.
float getADUToEnergy(VxdID id, unsigned int uid, unsigned int vid) const
Get conversion factor from ADU to energy.
static PXDGainCalibrator & getInstance()
Main (and only) way to access the PXDGainCalibrator.
Specific implementation of SensorInfo for PXD Sensors which provides additional pixel specific inform...
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.
double getVCellPosition(int vID) const
Return the position of a specific strip/pixel in v direction.
double getUCellPosition(int uID, int vID=-1) const
Return the position of a specific strip/pixel in u direction.
int getVCellID(double v, bool clamp=false) const
Return the corresponding pixel/strip ID of a given v coordinate.
int getUCellID(double u, double v=0, bool clamp=false) const
Return the corresponding pixel/strip ID of a given u coordinate.
A Finite plane of one VXD Sensor.
Class to uniquely identify a any structure of the PXD and SVD.
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.