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>
17 using namespace TrackFindingCDC;
21 template<
class APredicate>
25 unsigned int numberOfHits = 0;
28 const SpacePoint* spacePoint = walkState->getHit();
32 for (
auto& cluster : spacePoint->getRelationsTo<
SVDCluster>()) {
38 return sum / numberOfHits;
42 template<
class APredicate>
45 double minimalValue = NAN;
48 const SpacePoint* spacePoint = walkState->getHit();
52 for (
auto& cluster : spacePoint->getRelationsTo<
SVDCluster>()) {
53 double currentValue = t(cluster);
54 if (std::isnan(minimalValue)) {
55 minimalValue = currentValue;
57 minimalValue = std::min(currentValue, minimalValue);
66 template<
class APredicate>
70 double sumSquared = 0;
71 unsigned int numberOfHits = 0;
74 const SpacePoint* spacePoint = walkState->getHit();
78 for (
auto& cluster : spacePoint->getRelationsTo<
SVDCluster>()) {
80 const auto& currentValue = t(cluster);
82 sumSquared += currentValue * currentValue;
86 return std::sqrt((sumSquared - sum * sum / numberOfHits) / (numberOfHits - 1));
92 const std::vector<TrackFindingCDC::WithWeight<const CKFToSVDState*>>& previousStates = pair->first;
95 const RecoTrack* cdcTrack = previousStates.front()->getSeed();
96 B2ASSERT(
"Path without seed?", cdcTrack);
99 B2ASSERT(
"Path without hit?", spacePoint);
101 std::vector<TrackFindingCDC::WithWeight<const CKFToSVDState*>> allStates = previousStates;
102 allStates.emplace_back(state, 0);
106 var<named(
"seed_cdc_hits")>() = cdcHits.size();
107 var<named(
"seed_lowest_cdc_layer")>() = cdcHits.front()->getICLayer();
113 B2ASSERT(
"Previous state was not fitted?", previousStates.back()->mSoPSet());
114 firstMeasurement = previousStates.back()->getMeasuredStateOnPlane();
128 Vector3D trackPositionAtHit(trackPositionAtHit2D, trackPositionAtHitZ);
130 const auto calculateCharge = [](
const auto & s) {
131 return s.getCharge();
133 const auto calculateSeedCharge = [](
const auto & s) {
134 return s.getSeedCharge();
136 const auto calculateSize = [](
const auto & s) {
139 const auto calculateSNR = [](
const auto & s) {
142 const auto calculateChargeSizeRatio = [](
const auto & s) {
143 return s.getCharge() / s.getSize();
146 if (spacePoint->
getType() == VXD::SensorInfoBase::SensorType::SVD) {
149 B2ASSERT(
"Must be related to exactly 2 clusters", clusters.size() == 2);
151 const SVDCluster* secondCluster = clusters[1];
153 var<named(
"cluster_1_charge")>() = calculateCharge(*firstCluster);
154 var<named(
"cluster_2_charge")>() = calculateCharge(*secondCluster);
155 var<named(
"mean_rest_cluster_charge")>() = meanOver(allStates, calculateCharge);
156 var<named(
"min_rest_cluster_charge")>() = minOver(allStates, calculateCharge);
157 var<named(
"std_rest_cluster_charge")>() = stdOver(allStates, calculateCharge);
159 var<named(
"cluster_1_seed_charge")>() = calculateSeedCharge(*firstCluster);
160 var<named(
"cluster_2_seed_charge")>() = calculateSeedCharge(*secondCluster);
161 var<named(
"mean_rest_cluster_seed_charge")>() = meanOver(allStates, calculateSeedCharge);
162 var<named(
"min_rest_cluster_seed_charge")>() = minOver(allStates, calculateSeedCharge);
163 var<named(
"std_rest_cluster_seed_charge")>() = stdOver(allStates, calculateSeedCharge);
165 var<named(
"cluster_1_size")>() = calculateSize(*firstCluster);
166 var<named(
"cluster_2_size")>() = calculateSize(*secondCluster);
167 var<named(
"mean_rest_cluster_size")>() = meanOver(allStates, calculateSize);
168 var<named(
"min_rest_cluster_size")>() = minOver(allStates, calculateSize);
169 var<named(
"std_rest_cluster_size")>() = stdOver(allStates, calculateSize);
171 var<named(
"cluster_1_snr")>() = calculateSNR(*firstCluster);
172 var<named(
"cluster_2_snr")>() = calculateSNR(*secondCluster);
173 var<named(
"mean_rest_cluster_snr")>() = meanOver(allStates, calculateSNR);
174 var<named(
"min_rest_cluster_snr")>() = minOver(allStates, calculateSNR);
175 var<named(
"std_rest_cluster_snr")>() = stdOver(allStates, calculateSNR);
177 var<named(
"cluster_1_charge_over_size")>() = calculateChargeSizeRatio(*firstCluster);
178 var<named(
"cluster_2_charge_over_size")>() = calculateChargeSizeRatio(*secondCluster);
179 var<named(
"mean_rest_cluster_charge_over_size")>() = meanOver(allStates, calculateChargeSizeRatio);
180 var<named(
"min_rest_cluster_charge_over_size")>() = minOver(allStates, calculateChargeSizeRatio);
181 var<named(
"std_rest_cluster_charge_over_size")>() = stdOver(allStates, calculateChargeSizeRatio);
184 std::vector<const SpacePoint*> spacePoints;
188 spacePoints.push_back(sp);
192 if (spacePoints.size() >= 3) {
193 var<named(
"quality_index_triplet")>() = m_qualityTriplet.estimateQuality(spacePoints);
194 var<named(
"quality_index_circle")>() = m_qualityCircle.estimateQuality(spacePoints);
195 var<named(
"quality_index_helix")>() = m_qualityHelix.estimateQuality(spacePoints);
197 var<named(
"quality_index_triplet")>() = 0;
198 var<named(
"quality_index_circle")>() = 0;
199 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.
This is the Reconstruction Event-Data Model Track.
short int getChargeSeed() const
Return the charge seed stored in the reco track. ATTENTION: This is not the fitted charge.
std::vector< Belle2::RecoTrack::UsedCDCHit * > getSortedCDCHitList() const
Return a sorted list of cdc hits. Sorted by the sortingParameter.
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.
SpacePoint typically is build from 1 PXDCluster or 1-2 SVDClusters.
const B2Vector3< double > & getPosition() const
return the position vector in global coordinates
Belle2::VXD::SensorInfoBase::SensorType getType() const
Return SensorType (PXD, SVD, ...) on which the SpacePoint lives.
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.
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
A mixin class to attach a weight to an object.
#StateOnPlane with additional covariance matrix.
HepGeom::Vector3D< double > Vector3D
3D Vector
Abstract base class for different kinds of events.