Belle II Software  release-08-01-10
VXDMomentumEstimationMeasurementCreator.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #pragma once
9 
10 #include <tracking/trackFitting/measurementCreator/creators/BaseMeasurementCreatorFromCoordinateMeasurement.h>
11 #include <tracking/vxdMomentumEstimation/VXDMomentumEstimation.h>
12 #include <tracking/trackFitting/measurementCreator/measurements/PlanarVXDMomentumMeasurement.h>
13 #include <genfit/PlanarMeasurement.h>
14 
15 namespace Belle2 {
26  template <class HitType, Const::EDetector detector>
28  public:
31  BaseMeasurementCreatorFromCoordinateMeasurement<HitType, detector>(measurementFactory) {}
32 
35 
37  void setParameter(const std::string& parameterName, const std::string& parameterValue) override
38  {
39  if (parameterName == "minimumMomentum") {
40  m_minimumMomentum = std::stod(parameterValue);
41  } else if (parameterName == "aE") {
42  m_fitParameters.aE = std::stod(parameterValue);
43  } else if (parameterName == "bE") {
44  m_fitParameters.bE = std::stod(parameterValue);
45  } else if (parameterName == "cE") {
46  m_fitParameters.cE = std::stod(parameterValue);
47  } else if (parameterName == "dE") {
48  m_fitParameters.dE = std::stod(parameterValue);
49  } else if (parameterName == "aM") {
50  m_correctionFitParameters.aM = std::stod(parameterValue);
51  } else if (parameterName == "bM") {
52  m_correctionFitParameters.bM = std::stod(parameterValue);
53  } else if (parameterName == "cM") {
54  m_correctionFitParameters.cM = std::stod(parameterValue);
55  } else if (parameterName == "dM") {
56  m_correctionFitParameters.dM = std::stod(parameterValue);
57  } else if (parameterName == "useMCInformation") {
58  m_useMCInformation = std::stoi(parameterValue);
59  } else if (parameterName == "useThickness") {
60  m_useThickness = std::stoi(parameterValue);
61  } else if (parameterName == "sigma") {
62  m_sigma = std::stod(parameterValue);
63  } else if (parameterName == "useTrackingSeeds") {
64  m_useTrackingSeeds = std::stoi(parameterValue);
65  } else {
66  B2FATAL("A parameter with the name " << parameterName << " and the value " << parameterValue << " could not be set.");
67  }
68  }
69 
70  protected:
74  virtual std::vector<genfit::AbsMeasurement*> createMeasurementFromCoordinateMeasurement(HitType* hit,
75  const RecoTrack& recoTrack, const RecoHitInformation&,
76  genfit::AbsMeasurement* coordinateMeasurement) const override
77  {
78  genfit::PlanarMeasurement* planarMeasurement = dynamic_cast<genfit::PlanarMeasurement*>(coordinateMeasurement);
79  if (planarMeasurement == nullptr) {
80  B2FATAL("Can only add VXD hits which are based on PlanarMeasurements with momentum estimation!");
81  // Make CPP check happy
82  return {};
83  }
84 
85  const ROOT::Math::XYZVector& momentum = recoTrack.getMomentumSeed();
86 
87  if (momentum.R() > m_minimumMomentum) {
88  return {};
89  }
90 
91  // cppcheck-suppress nullPointerRedundantCheck
92  PlanarVXDMomentumMeasurement<HitType>* momentumMeasurement = new PlanarVXDMomentumMeasurement<HitType>(*planarMeasurement, hit,
93  &recoTrack);
95  momentumMeasurement->setFitParameters(m_fitParameters);
96  momentumMeasurement->setSigma(m_sigma);
97  momentumMeasurement->setUseMCInformation(m_useMCInformation);
98  momentumMeasurement->setUseThickness(m_useThickness);
99  momentumMeasurement->setUseTrackingSeeds(m_useTrackingSeeds);
100  return {momentumMeasurement};
101  }
102 
103  private:
109  bool m_useMCInformation = false;
111  bool m_useThickness = false;
113  double m_minimumMomentum = 0.1;
115  double m_sigma = 0.03;
117  bool m_useTrackingSeeds = false;
118  };
119 
125 }
Baseclass to create measurement track points based on the coordinate measurements.
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.
void setSigma(double sigma)
Set the measurement sigma.
void setUseMCInformation(bool useMCInformation)
Set whether to use mc information.
void setUseThickness(bool useThickness)
Set whether to use the thickness.
void setCorrectionFitParameters(const typename VXDMomentumEstimation< HitType >::CorrectionFitParameters &correctionFitParameters)
Set the correction fit parameters.
void setFitParameters(const typename VXDMomentumEstimation< HitType >::FitParameters &fitParameters)
Set the fit parameters.
This class stores additional information to every CDC/SVD/PXD hit stored in a RecoTrack.
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:79
ROOT::Math::XYZVector getMomentumSeed() const
Return the momentum seed stored in the reco track. ATTENTION: This is not the fitted momentum.
Definition: RecoTrack.h:487
Creator for VXDMeasurements with momentum estimation based on the dEdX information.
VXDMomentumEstimation< HitType >::CorrectionFitParameters m_correctionFitParameters
Parameters for the correction function.
bool m_useMCInformation
Use the seeds of the track finder or the seeds of the MC particles.
void setParameter(const std::string &parameterName, const std::string &parameterValue) override
Set the parameters of the fit functions and whether to use the thickness or not or the tracking seeds...
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_minimumMomentum
Minimal value for the momentum below the estimation is used.
bool m_useThickness
Use the thickness of the clusters of the path length for estimating dX.
VXDMomentumEstimationMeasurementCreator(const genfit::MeasurementFactory< genfit::AbsMeasurement > &measurementFactory)
Constructor.
virtual std::vector< genfit::AbsMeasurement * > createMeasurementFromCoordinateMeasurement(HitType *hit, const RecoTrack &recoTrack, const RecoHitInformation &, genfit::AbsMeasurement *coordinateMeasurement) const override
Create a measurement based on the momentum estimation given by the VXDMomentumEstimation class.
Class doing the momentum estimation from dEdX for SVDClusters and PXDClusters.
Contains the measurement and covariance in raw detector coordinates.
Measurement class implementing a planar hit geometry (1 or 2D).
Abstract base class for different kinds of events.