43 {
44
45 const std::vector<RecoHitInformation*>& recoHitInformations = recoTrack.getRecoHitInformations(true);
46 std::vector<const genfit::KalmanFitterInfo*> kalmanFitterInfos;
47 kalmanFitterInfos.reserve(recoHitInformations.size());
48
49 int n_no_trackPoint = 0;
50 int n_no_KalmanFitterInfo = 0;
51 for (const RecoHitInformation* recoHitInformation : recoHitInformations) {
52 const genfit::TrackPoint* trackPoint = recoTrack.getCreatedTrackPoint(recoHitInformation);
53 if (trackPoint) {
54 const genfit::KalmanFitterInfo* kalmanFitterInfo = trackPoint->getKalmanFitterInfo();
55 if (kalmanFitterInfo) {
56 kalmanFitterInfos.push_back(kalmanFitterInfo);
57 } else {
58 n_no_KalmanFitterInfo++;
59 }
60 } else {
61 n_no_trackPoint++;
62 }
63 }
64 m_variables.at(
"N_Hits_without_TrackPoint") = n_no_trackPoint;
65 m_variables.at(
"N_TrackPoints_without_KalmanFitterInfo") = n_no_KalmanFitterInfo;
66
67
68
69 const auto hitHasKalmanInfoAndIsFromDetector =
70 [&recoTrack, this](const auto & recoHitInformation,
73 and (recoHitInformation->getTrackingDetector() == trackingDetector));
74 };
75 const auto hitHasKalmanInfoAndIsFromCDC = std::bind(hitHasKalmanInfoAndIsFromDetector,
76 std::placeholders::_1,
77 RecoHitInformation::c_CDC);
78 const auto hitHasKalmanInfoAndIsFromSVD = std::bind(hitHasKalmanInfoAndIsFromDetector,
79 std::placeholders::_1,
80 RecoHitInformation::c_SVD);
81
82
83 const auto firstHitWithCDCKalmanInfoIter = std::find_if(recoHitInformations.begin(),
84 recoHitInformations.end(),
85 hitHasKalmanInfoAndIsFromCDC);
86 std::optional<float> weight_firstCDCHit;
87 std::optional<float> smoothedChi2_firstCDCHit;
88 if (firstHitWithCDCKalmanInfoIter != recoHitInformations.end()) {
89 const genfit::KalmanFitterInfo* kalmanFitterInfo = this->
getKalmanFitterInfo(recoTrack, *firstHitWithCDCKalmanInfoIter);
90 weight_firstCDCHit = kalmanFitterInfo->getWeights().front();
92 }
95
96
97 const auto lastHitWithSVDKalmanInfoIter = std::find_if(recoHitInformations.rbegin(),
98 recoHitInformations.rend(),
99 hitHasKalmanInfoAndIsFromSVD);
100 std::optional<float> weight_lastSVDHit;
101 std::optional<float> smoothedChi2_lastSVDHit;
102 if (lastHitWithSVDKalmanInfoIter != recoHitInformations.rend()) {
103 const genfit::KalmanFitterInfo* kalmanFitterInfo = this->
getKalmanFitterInfo(recoTrack, *lastHitWithSVDKalmanInfoIter);
104 weight_lastSVDHit = kalmanFitterInfo->getWeights().front();
106 }
109
110 std::vector<float> fitWeights;
111 std::vector<float> chi2Values;
112 fitWeights.reserve(kalmanFitterInfos.size());
113 chi2Values.reserve(kalmanFitterInfos.size());
114 for (const auto& kalmanFitterInfo : kalmanFitterInfos) {
115 fitWeights.push_back(kalmanFitterInfo->getWeights().front());
117 }
119 setStats(
"smoothedChi2", chi2Values);
120 }