9#include <tracking/ckf/svd/filters/states/SVDStateVarSet.h>
10#include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectory3D.h>
11#include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectory2D.h>
12#include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectorySZ.h>
13#include <tracking/dataobjects/RecoTrack.h>
16using namespace TrackFindingCDC;
20 template<
class APredicate>
24 unsigned int numberOfHits = 0;
27 const SpacePoint* spacePoint = walkState->getHit();
31 for (
auto& cluster : spacePoint->getRelationsTo<
SVDCluster>()) {
37 return sum / numberOfHits;
41 template<
class APredicate>
44 double minimalValue = NAN;
47 const SpacePoint* spacePoint = walkState->getHit();
51 for (
auto& cluster : spacePoint->getRelationsTo<
SVDCluster>()) {
52 double currentValue = t(cluster);
53 if (std::isnan(minimalValue)) {
54 minimalValue = currentValue;
56 minimalValue = std::min(currentValue, minimalValue);
65 template<
class APredicate>
69 double sumSquared = 0;
70 unsigned int numberOfHits = 0;
73 const SpacePoint* spacePoint = walkState->getHit();
77 for (
auto& cluster : spacePoint->getRelationsTo<
SVDCluster>()) {
79 const auto& currentValue = t(cluster);
81 sumSquared += currentValue * currentValue;
85 return std::sqrt((sumSquared - sum * sum / numberOfHits) / (numberOfHits - 1));
91 const std::vector<TrackFindingCDC::WithWeight<const CKFToSVDState*>>& previousStates = pair->first;
94 const RecoTrack* cdcTrack = previousStates.front()->getSeed();
95 B2ASSERT(
"Path without seed?", cdcTrack);
98 B2ASSERT(
"Path without hit?", spacePoint);
100 std::vector<TrackFindingCDC::WithWeight<const CKFToSVDState*>> allStates = previousStates;
101 allStates.emplace_back(state, 0);
105 var<
named(
"seed_cdc_hits")>() = cdcHits.size();
106 var<
named(
"seed_lowest_cdc_layer")>() = cdcHits.front()->getICLayer();
108 genfit::MeasuredStateOnPlane firstMeasurement;
112 B2ASSERT(
"Previous state was not fitted?", previousStates.back()->mSoPSet());
113 firstMeasurement = previousStates.back()->getMeasuredStateOnPlane();
127 Vector3D trackPositionAtHit(trackPositionAtHit2D, trackPositionAtHitZ);
129 const auto calculateCharge = [](
const auto & s) {
130 return s.getCharge();
132 const auto calculateSeedCharge = [](
const auto & s) {
133 return s.getSeedCharge();
135 const auto calculateSize = [](
const auto & s) {
138 const auto calculateSNR = [](
const auto & s) {
141 const auto calculateChargeSizeRatio = [](
const auto & s) {
142 return s.getCharge() / s.getSize();
148 B2ASSERT(
"Must be related to exactly 2 clusters", clusters.size() == 2);
150 const SVDCluster* secondCluster = clusters[1];
152 var<
named(
"cluster_1_charge")>() = calculateCharge(*firstCluster);
153 var<
named(
"cluster_2_charge")>() = calculateCharge(*secondCluster);
154 var<
named(
"mean_rest_cluster_charge")>() = meanOver(allStates, calculateCharge);
155 var<
named(
"min_rest_cluster_charge")>() = minOver(allStates, calculateCharge);
156 var<
named(
"std_rest_cluster_charge")>() = stdOver(allStates, calculateCharge);
158 var<
named(
"cluster_1_seed_charge")>() = calculateSeedCharge(*firstCluster);
159 var<
named(
"cluster_2_seed_charge")>() = calculateSeedCharge(*secondCluster);
160 var<
named(
"mean_rest_cluster_seed_charge")>() = meanOver(allStates, calculateSeedCharge);
161 var<
named(
"min_rest_cluster_seed_charge")>() = minOver(allStates, calculateSeedCharge);
162 var<
named(
"std_rest_cluster_seed_charge")>() = stdOver(allStates, calculateSeedCharge);
164 var<
named(
"cluster_1_size")>() = calculateSize(*firstCluster);
165 var<
named(
"cluster_2_size")>() = calculateSize(*secondCluster);
166 var<
named(
"mean_rest_cluster_size")>() = meanOver(allStates, calculateSize);
167 var<
named(
"min_rest_cluster_size")>() = minOver(allStates, calculateSize);
168 var<
named(
"std_rest_cluster_size")>() = stdOver(allStates, calculateSize);
170 var<
named(
"cluster_1_snr")>() = calculateSNR(*firstCluster);
171 var<
named(
"cluster_2_snr")>() = calculateSNR(*secondCluster);
172 var<
named(
"mean_rest_cluster_snr")>() = meanOver(allStates, calculateSNR);
173 var<
named(
"min_rest_cluster_snr")>() = minOver(allStates, calculateSNR);
174 var<
named(
"std_rest_cluster_snr")>() = stdOver(allStates, calculateSNR);
176 var<
named(
"cluster_1_charge_over_size")>() = calculateChargeSizeRatio(*firstCluster);
177 var<
named(
"cluster_2_charge_over_size")>() = calculateChargeSizeRatio(*secondCluster);
178 var<
named(
"mean_rest_cluster_charge_over_size")>() = meanOver(allStates, calculateChargeSizeRatio);
179 var<
named(
"min_rest_cluster_charge_over_size")>() = minOver(allStates, calculateChargeSizeRatio);
180 var<
named(
"std_rest_cluster_charge_over_size")>() = stdOver(allStates, calculateChargeSizeRatio);
183 std::vector<const SpacePoint*> spacePoints;
187 spacePoints.push_back(sp);
191 if (spacePoints.size() >= 3) {
196 var<
named(
"quality_index_triplet")>() = 0;
197 var<
named(
"quality_index_circle")>() = 0;
198 var<
named(
"quality_index_helix")>() = 0;
const genfit::MeasuredStateOnPlane & getMeasuredStateOnPlane() const
Get the mSoP if already set during extrapolation (or fitting)
const Hit * getHit() const
Return the SP this state is related to. May be nullptr.
bool mSoPSet() const
Is the mSoP already set? (= state was already extrapolated)
Specialized CKF State for extrapolating into the SVD.
virtual double estimateQuality(std::vector< SpacePoint const * > const &measurements) final
Minimal implementation of the quality estimation Calculates quality indicator in range [0,...
virtual double estimateQuality(std::vector< SpacePoint const * > const &measurements) final
Minimal implementation of the quality estimation Calculates quality indicator in range [0,...
virtual double estimateQuality(std::vector< SpacePoint const * > const &measurements) final
Calculating the quality estimate using a triplet fit.
This is the Reconstruction Event-Data Model Track.
std::vector< Belle2::RecoTrack::UsedCDCHit * > getSortedCDCHitList() const
Return a sorted list of cdc hits. Sorted by the sortingParameter.
short int getChargeSeed() const
Return the charge seed stored in the reco track. ATTENTION: This is not the fitted charge.
RelationVector< TO > getRelationsTo(const std::string &name="", const std::string &namedRelation="") const
Get the relations that point from this object to another store array.
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
QualityEstimatorRiemannHelixFit m_qualityHelix
Instance of the Riemann helix-fit class.
QualityEstimatorTripletFit m_qualityTriplet
Instance of the triplet-fit class.
QualityEstimatorCircleFit m_qualityCircle
Instance of the circle-fit class.
virtual bool extract(const BaseSVDStateFilter::Object *object) override
Generate and assign the variables from the VXD-CDC object.
SpacePoint typically is build from 1 PXDCluster or 1-2 SVDClusters.
Belle2::VXD::SensorInfoBase::SensorType getType() const
Return SensorType (PXD, SVD, ...) on which the SpacePoint lives.
const B2Vector3D & getPosition() const
return the position vector in global coordinates
Vector2D getPos2DAtArcLength2D(double arcLength2D)
Getter for the position at a given two dimensional arc length.
Particle full three dimensional trajectory.
double calcArcLength2D(const Vector3D &point) const
Calculate the travel distance from the start position of the trajectory.
CDCTrajectory2D getTrajectory2D() const
Getter for the two dimensional trajectory.
CDCTrajectorySZ getTrajectorySZ() const
Getter for the sz trajectory.
double mapSToZ(const double s=0) const
Translates the travel distance to the z coordinate.
AObject Object
Type of the object to be analysed.
static constexpr int named(const char *name)
Getter for the index from the name.
Float_t & var()
Reference getter for the value of the ith variable. Static version.
A two dimensional vector which is equipped with functions for correct handling of orientation relate...
A mixin class to attach a weight to an object.
HepGeom::Vector3D< double > Vector3D
3D Vector
Abstract base class for different kinds of events.