Belle II Software development
BaseMeasurementCreatorFromHit.cc
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#include <tracking/trackFitting/measurementCreator/creators/BaseMeasurementCreatorFromHit.h>
9#include <tracking/dataobjects/RecoTrack.h>
10#include <genfit/TrackPoint.h>
11#include <genfit/WireTrackCandHit.h>
12
13using namespace Belle2;
14
15template <class HitType, Const::EDetector detector>
17 genfit::MeasurementFactory<genfit::AbsMeasurement>& measurementFactory) :
18 BaseMeasurementCreator(), m_measurementFactory(measurementFactory) {}
19
20template <class HitType, Const::EDetector detector>
22 const RecoHitInformation& /*recoHitInformation*/) const
23{
24 // No one is using the trackCandHit (neither in SVDRecoHit nor in PXDRecoHit). So we do not provide any here!
25 genfit::AbsMeasurement* coordinateMeasurement = m_measurementFactory.createOne(detector, hit->getArrayIndex(),
26 nullptr);
27
28 return coordinateMeasurement;
29}
30
31template <class HitType, Const::EDetector detector>
33 genfit::AbsMeasurement* coordinateMeasurement,
34 RecoTrack& recoTrack, const RecoHitInformation& recoHitInformation) const
35{
36 genfit::TrackPoint* coordinateTrackPoint = new genfit::TrackPoint(coordinateMeasurement,
38 coordinateTrackPoint->setSortingParameter(recoHitInformation.getSortingParameter());
39
40 return coordinateTrackPoint;
41}
42
48
49// Silence Doxygen which is complaining that "no matching class member found for"
50// But there should be a better way that I just don't know of / find
52template<>
54 const RecoHitInformation& recoHitInformation) const
56{
57
58 // From the genfit code: < 0 means left, > 0 means right, = 0 is undefined
59 signed char rightLeftGenfitInformation = 0;
60 RecoHitInformation::RightLeftInformation rightLeftHitInformation = recoHitInformation.getRightLeftInformation();
61 if (rightLeftHitInformation == RecoHitInformation::RightLeftInformation::c_left) {
62 rightLeftGenfitInformation = -1;
63 } else if (rightLeftHitInformation == RecoHitInformation::RightLeftInformation::c_right) {
64 rightLeftGenfitInformation = 1;
65 }
66
67 // No one is using the WireTrackCandHit after this stage, as the CDCRecoHit does not store it (it is just needed or getting the rl info).
68 auto trackCandHit = std::unique_ptr<genfit::WireTrackCandHit>(new genfit::WireTrackCandHit(Const::CDC, cdcHit->getArrayIndex(), -1,
69 recoHitInformation.getSortingParameter(),
70 rightLeftGenfitInformation));
71
72 genfit::AbsMeasurement* coordinateMeasurement = m_measurementFactory.createOne(trackCandHit->getDetId(), trackCandHit->getHitId(),
73 trackCandHit.get());
74
75
76
77 return coordinateMeasurement;
78}
Base Class to create measurements based on a given hit related to the RecoTrack.
genfit::AbsMeasurement * createCoordinateMeasurement(HitType *hit, const RecoHitInformation &recoHitInformation) const
You probably need a coordinate measurement on which you can base your measurements in createMeasureme...
BaseMeasurementCreatorFromHit(const genfit::MeasurementFactory< genfit::AbsMeasurement > &measurementFactory)
Creates a MeasurementCreator which handles the creation of measurements of a given kind.
genfit::TrackPoint * createTrackPointWithRecoHitInformation(genfit::AbsMeasurement *coordinateMeasurement, RecoTrack &recoTrack, const RecoHitInformation &recoHitInformation) const
Helper: Create a TrackPoint from a measurement with a given RecoHitInformation.
Base class for all measurement creators.
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
Definition: CDCHit.h:40
This class stores additional information to every CDC/SVD/PXD hit stored in a RecoTrack.
RightLeftInformation
The RightLeft information of the hit which is only valid for CDC hits.
unsigned int getSortingParameter() const
Get the sorting parameter.
static genfit::Track & getGenfitTrack(RecoTrack &recoTrack)
Give access to the RecoTrack's genfit::Track.
Definition: RecoTrack.cc:404
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:79
Abstract base class for different kinds of events.