11#include <tracking/trackFitting/measurementCreator/measurements/PlanarMomentumMeasurement.h>
12#include <tracking/vxdMomentumEstimation/VXDMomentumEstimation.h>
13#include <tracking/vxdMomentumEstimation/VXDMomentumEstimationTools.h>
14#include <mdst/dataobjects/MCParticle.h>
15#include <tracking/dataobjects/RecoTrack.h>
26 template <
class HitType>
37 rawHitCoords_.ResizeTo(1);
38 rawHitCov_.ResizeTo(1, 1);
40 setHitId(hit->getArrayIndex());
121 template <
class HitType>
123 const genfit::StateOnPlane& state)
const
128 TVectorD rawHitCoordinates(1);
129 TMatrixDSym rawHitCovariance(1);
132 const B2Vector3D& statePosition(state.getPos());
133 const B2Vector3D& stateMomentum(state.getMom());
134 short stateCharge = state.getCharge();
138 const B2Vector3D& trackPosition(m_recoTrack->getPositionSeed());
139 const B2Vector3D& trackMomentum(m_recoTrack->getMomentumSeed());
140 short trackCharge = m_recoTrack->getChargeSeed();
143 MCParticle* relatedMCParticle = m_hit->template getRelated<MCParticle>(
"MCParticles");
145 ROOT::Math::XYZVector mcMomentum;
146 ROOT::Math::XYZVector mcPosition;
149 if (relatedMCParticle ==
nullptr) {
150 mcMomentum = ROOT::Math::XYZVector(trackMomentum);
151 mcPosition = ROOT::Math::XYZVector(trackPosition);
152 mcCharge = trackCharge;
156 mcCharge = relatedMCParticle->
getCharge();
164 if (m_useThickness) {
166 m_correctionFitParameters);
168 if (m_useTrackingSeeds) {
169 if (m_useMCInformation) {
170 rawHitCoordinates(0) = momentumEstimator.
estimateQOverP(*m_hit, mcMomentum, mcPosition, mcCharge,
172 m_correctionFitParameters);
175 rawHitCoordinates(0) = momentumEstimator.
estimateQOverP(*m_hit, ROOT::Math::XYZVector(trackMomentum),
176 ROOT::Math::XYZVector(trackPosition), trackCharge,
178 m_correctionFitParameters);
181 if (m_useMCInformation) {
182 rawHitCoordinates(0) = momentumEstimator.
estimateQOverP(*m_hit, hitMCMomentum, hitMCPosition, stateCharge,
184 m_correctionFitParameters);
186 rawHitCoordinates(0) = momentumEstimator.
estimateQOverP(*m_hit, ROOT::Math::XYZVector(stateMomentum),
187 ROOT::Math::XYZVector(statePosition), stateCharge,
189 m_correctionFitParameters);
194 rawHitCovariance(0, 0) = m_sigma;
196 genfit::MeasurementOnPlane* mop =
new genfit::MeasurementOnPlane(rawHitCoordinates, rawHitCovariance,
197 state.getPlane(), state.getRep(), constructHMatrix(state.getRep()));
A Class to store the Monte Carlo particle information.
ROOT::Math::XYZVector getProductionVertex() const
Return production vertex position.
float getCharge() const
Return the particle charge defined in TDatabasePDG.
ROOT::Math::XYZVector getMomentum() const
Return momentum.
Measurement class implementing a planar hit geometry (1 or 2D) with only a momentum measurement.
Measurement class implementing a planar hit geometry (1 or 2D) with a momentum measurement based on t...
void setUseTrackingSeeds(bool useTrackingSeeds)
Set whether to use tracking seeds not the current state.
VXDMomentumEstimation< HitType >::CorrectionFitParameters m_correctionFitParameters
Parameters for the correction function.
void setSigma(double sigma)
Set the measurement sigma.
bool m_useMCInformation
Use the seeds of the track finder or the seeds of the MC particles.
HitType * getHit() const
Get the underlying hit (cluster).
void setUseMCInformation(bool useMCInformation)
Set whether to use mc information.
const RecoTrack * m_recoTrack
RecoTrack for which the hit is created.
void setUseThickness(bool useThickness)
Set whether to use the thickness.
void setCorrectionFitParameters(const typename VXDMomentumEstimation< HitType >::CorrectionFitParameters &correctionFitParameters)
Set the correction fit parameters.
HitType * m_hit
Underlying hit/cluster.
PlanarVXDMomentumMeasurement(const genfit::PlanarMeasurement &parentElement, HitType *hit, const Belle2::RecoTrack *recoTrack)
Initialize the momentum measurement with a planar measurement as a parent, the corresponding hit and ...
virtual genfit::AbsMeasurement * clone() const override
Clone the measurement.
bool m_useTrackingSeeds
Use the tracking seeds in the origin for calculating the path length rather than the current state.
VXDMomentumEstimation< HitType >::FitParameters m_fitParameters
Parameters for the main function.
double m_sigma
Value of the measurement sigma.
bool m_useThickness
Use the thickness of the clusters of the path length for estimating dX.
void setFitParameters(const typename VXDMomentumEstimation< HitType >::FitParameters &fitParameters)
Set the fit parameters.
int getDetId() const
Return the detector ID.
This is the Reconstruction Event-Data Model Track.
Class doing the momentum estimation from dEdX for SVDClusters and PXDClusters.
double estimateQOverP(const ClusterType &cluster, const ROOT::Math::XYZVector &momentum, const ROOT::Math::XYZVector &position, short charge, const FitParameters &fitParameters, const CorrectionFitParameters &correctionFitParameters) const
Main function: Estimate p over q for the given cluster and the path length calculated using the given...
double estimateQOverPWithThickness(const ClusterType &cluster, short charge, const FitParameters &fitParameters, const CorrectionFitParameters &correctionFitParameters) const
Main function: Estimate p over q for the given cluster and the thickness of the cluster with the fit ...
static const VXDMomentumEstimation & getInstance()
Use this class as a singleton.
virtual std::vector< genfit::MeasurementOnPlane * > constructMeasurementsOnPlane(const genfit::StateOnPlane &state) const override
Construct the measurement on the plane set in the parent element.
Abstract base class for different kinds of events.
Struct holding the parameters of the correction function to map them median of the estimation functio...
Struct holding the parameters of the estimation function which maps dEdX to p.