Generate and assign the variables from the VXD-CDC-pair.
25{
26 const std::vector<TrackingUtilities::WithWeight<const CKFToSVDState*>>& previousStates = pair->first;
27 CKFToSVDState* state = pair->second;
28
29 const RecoTrack* cdcTrack = previousStates.front()->getSeed();
30 B2ASSERT("Path without seed?", cdcTrack);
31
32 const SpacePoint* spacePoint = state->
getHit();
33 B2ASSERT("Path without hit?", spacePoint);
34
35 genfit::MeasuredStateOnPlane firstMeasurement;
38 } else {
39 B2ASSERT("Previous state was not fitted?", previousStates.back()->mSoPSet());
40 firstMeasurement = previousStates.back()->getMeasuredStateOnPlane();
41 }
42
43 const ROOT::Math::XYZVector position = ROOT::Math::XYZVector(firstMeasurement.getPos());
44 const ROOT::Math::XYZVector momentum = ROOT::Math::XYZVector(firstMeasurement.getMom());
45
46 const CDCTrajectory3D trajectory(position, 0, momentum, cdcTrack->
getChargeSeed());
47
48 const ROOT::Math::XYZVector& hitPosition = spacePoint->
getPosition();
49
50 const double arcLength = trajectory.calcArcLength2D(hitPosition);
51 const ROOT::Math::XYVector& trackPositionAtHit2D = trajectory.getTrajectory2D().getPos2DAtArcLength2D(arcLength);
52 double trackPositionAtHitZ = trajectory.getTrajectorySZ().mapSToZ(arcLength);
53
54 ROOT::Math::XYZVector trackPositionAtHit(trackPositionAtHit2D.X(), trackPositionAtHit2D.Y(), trackPositionAtHitZ);
55 ROOT::Math::XYZVector distance = trackPositionAtHit - hitPosition;
56
57 var<
named(
"distance")>() =
static_cast<Float_t
>(distance.R());
58 var<
named(
"xy_distance")>() =
static_cast<Float_t
>(distance.Rho());
59 var<
named(
"z_distance")>() =
static_cast<Float_t
>(distance.z());
60
61 ROOT::Math::XYZVector mSoP_distance = position - hitPosition;
62
63 var<
named(
"mSoP_distance")>() =
static_cast<Float_t
>(mSoP_distance.R());
64 var<
named(
"mSoP_xy_distance")>() =
static_cast<Float_t
>(mSoP_distance.Rho());
65 var<
named(
"mSoP_z_distance")>() =
static_cast<Float_t
>(mSoP_distance.z());
66
67 var<
named(
"same_hemisphere")>() = fabs(position.Phi() - hitPosition.Phi()) < TMath::PiOver2();
68
69 var<
named(
"arcLengthOfHitPosition")>() =
static_cast<Float_t
>(trajectory.calcArcLength2D(hitPosition));
70 var<
named(
"arcLengthOfCenterPosition")>() =
static_cast<Float_t
>(trajectory.calcArcLength2D(ROOT::Math::XYZVector(0, 0, 0)));
71
72 var<
named(
"pt")>() =
static_cast<Float_t
>(momentum.Rho());
73 var<
named(
"tan_lambda")>() =
static_cast<Float_t
>(trajectory.getTanLambda());
74 var<
named(
"phi")>() =
static_cast<Float_t
>(momentum.Phi());
75
76 const VxdID& sensorInfo = spacePoint->
getVxdID();
78 var<
named(
"number")>() = previousStates.size();
83
84
86 B2ASSERT("Must be related to exactly 2 clusters", clusters.size() == 2);
87 const SVDCluster* firstCluster = clusters[0];
88 const SVDCluster* secondCluster = clusters[1];
91
97 var<
named(
"last_cluster_1_time")>() = -999.9;
98 var<
named(
"last_cluster_2_time")>() = -999.9;
99
100 const CKFToSVDState* parent = previousStates.back();
101 const SpacePoint* parentSpacePoint = parent->getHit();
102 if (parentSpacePoint) {
103 const VxdID& parentSensorInfo = parentSpacePoint->
getVxdID();
104
110
111 const auto& parentclusters = parentSpacePoint->
getRelationsTo<SVDCluster>();
112 B2ASSERT("Must be related to exactly 2 clusters", parentclusters.size() == 2);
113 const SVDCluster* parentfirstCluster = parentclusters[0];
114 const SVDCluster* parentsecondCluster = parentclusters[1];
117 }
118
119 const double residual =
m_kalmanStepper.calculateResidual(firstMeasurement, *state);
120 var<
named(
"residual")>() = residual;
121
124 } else {
126 }
127
128 const TMatrixDSym& cov5 = firstMeasurement.getCov();
129 const Float_t sigmaUV = std::sqrt(std::max(cov5(4, 4), cov5(3, 3)));
131 var<
named(
"residual_over_sigma")>() = residual / sigmaUV;
132
133 return true;
134}
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.
double getChi2() const
Return the chi2 set during fitting. Is only valid after fitting.
bool isFitted() const
Check if state was already fitted.
bool mSoPSet() const
Is the mSoP already set? (= state was already extrapolated)
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.
float getClsTime() const
Get average of waveform maximum times of cluster strip signals.
SVDKalmanStepper m_kalmanStepper
Kalman stepper (CKF) for SVD.
VxdID getVxdID() const
Return the VxdID of the sensor on which the the cluster of the SpacePoint lives.
const B2Vector3D & getPosition() const
return the position vector in global coordinates
static constexpr int named(const char *name)
baseType getID() const
Get the unique id.
baseType getSensorNumber() const
Get the sensor id.
baseType getSegmentNumber() const
Get the sensor segment.
baseType getLadderNumber() const
Get the ladder id.
baseType getLayerNumber() const
Get the layer id.