Generate and assign the variables from the VXD-CDC-pair.
27{
28 const std::vector<TrackingUtilities::WithWeight<const CKFToPXDState*>>& previousStates = pair->first;
29 CKFToPXDState* state = pair->second;
30
31 const RecoTrack* seedTrack = previousStates.front()->getSeed();
32 B2ASSERT("Path without seed?", seedTrack);
33
34 const SpacePoint* spacePoint = state->
getHit();
35 B2ASSERT("Path without hit?", spacePoint);
36
37 genfit::MeasuredStateOnPlane firstMeasurement;
40 } else {
41 firstMeasurement = previousStates.back()->getMeasuredStateOnPlane();
42 }
43
44 ROOT::Math::XYZVector position = ROOT::Math::XYZVector(firstMeasurement.getPos());
45 ROOT::Math::XYZVector momentum = ROOT::Math::XYZVector(firstMeasurement.getMom());
46
47 const CDCTrajectory3D trajectory(position, 0, momentum, seedTrack->
getChargeSeed());
48
49 const ROOT::Math::XYZVector& hitPosition = spacePoint->
getPosition();
50
51 const double arcLength = trajectory.calcArcLength2D(hitPosition);
52 const ROOT::Math::XYVector& trackPositionAtHit2D = trajectory.getTrajectory2D().getPos2DAtArcLength2D(arcLength);
53 double trackPositionAtHitZ = trajectory.getTrajectorySZ().mapSToZ(arcLength);
54
55 ROOT::Math::XYZVector trackPositionAtHit(trackPositionAtHit2D.X(), trackPositionAtHit2D.Y(), trackPositionAtHitZ);
56 ROOT::Math::XYZVector distance = trackPositionAtHit - hitPosition;
57
58 var<
named(
"distance")>() =
static_cast<Float_t
>(distance.R());
59 var<
named(
"xy_distance")>() =
static_cast<Float_t
>(distance.Rho());
60 var<
named(
"z_distance")>() =
static_cast<Float_t
>(distance.z());
61
62 ROOT::Math::XYZVector mSoP_distance = position - hitPosition;
63
64 var<
named(
"mSoP_distance")>() =
static_cast<Float_t
>(mSoP_distance.R());
65 var<
named(
"mSoP_xy_distance")>() =
static_cast<Float_t
>(mSoP_distance.Rho());
66 var<
named(
"mSoP_z_distance")>() =
static_cast<Float_t
>(mSoP_distance.z());
67
68 var<
named(
"same_hemisphere")>() = fabs(position.Phi() - hitPosition.Phi()) < TMath::PiOver2();
69
70 var<
named(
"arcLengthOfHitPosition")>() =
static_cast<Float_t
>(trajectory.calcArcLength2D(hitPosition));
71 var<
named(
"arcLengthOfCenterPosition")>() =
static_cast<Float_t
>(trajectory.calcArcLength2D(ROOT::Math::XYZVector(0, 0, 0)));
72
74 var<
named(
"number")>() = previousStates.size();
75
76 var<
named(
"pt")>() =
static_cast<Float_t
>(momentum.Rho());
77 var<
named(
"tan_lambda")>() =
static_cast<Float_t
>(trajectory.getTanLambda());
78 var<
named(
"phi")>() =
static_cast<Float_t
>(momentum.Phi());
79
80 const VxdID& sensorInfo = spacePoint->
getVxdID();
81
86
88 B2ASSERT("Must be related to exactly 1 cluster", clusters.size() == 1);
89 var<
named(
"cluster_charge")>() = clusters[0]->getCharge();
90 var<
named(
"cluster_seed_charge")>() = clusters[0]->getSeedCharge();
91 var<
named(
"cluster_size")>() = clusters[0]->getSize();
92 var<
named(
"cluster_size_u")>() = clusters[0]->getUSize();
93 var<
named(
"cluster_size_v")>() = clusters[0]->getVSize();
94
100 var<
named(
"last_cluster_charge")>() = 0;
101 var<
named(
"last_cluster_seed_charge")>() = 0;
102 var<
named(
"last_cluster_size")>() = 0;
103 var<
named(
"last_cluster_size_u")>() = 0;
104 var<
named(
"last_cluster_size_v")>() = 0;
105
106 const CKFToPXDState* parent = previousStates.back();
107 const SpacePoint* parentSpacePoint = parent->getHit();
108 if (parentSpacePoint) {
109 const VxdID& parentSensorInfo = parentSpacePoint->
getVxdID();
110
116
117 const auto& parentclusters = parentSpacePoint->
getRelationsTo<PXDCluster>();
118 B2ASSERT("Must be related to exactly 1 cluster", parentclusters.size() == 1);
119 var<
named(
"last_cluster_charge")>() = parentclusters[0]->getCharge();
120 var<
named(
"last_cluster_seed_charge")>() = parentclusters[0]->getSeedCharge();
121 var<
named(
"last_cluster_size")>() = parentclusters[0]->getSize();
122 var<
named(
"last_cluster_size_u")>() = parentclusters[0]->getUSize();
123 var<
named(
"last_cluster_size_v")>() = parentclusters[0]->getVSize();
124 }
125
126 const double residual =
m_kalmanStepper.calculateResidual(firstMeasurement, *state);
127 var<
named(
"residual")>() = residual;
128
131 } else {
133 }
134
135 const TMatrixDSym& cov5 = firstMeasurement.getCov();
136 const Float_t sigmaUV = std::sqrt(std::max(cov5(4, 4), cov5(3, 3)));
138 var<
named(
"residual_over_sigma")>() = residual / sigmaUV;
139
140 return true;
141}
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)
PXDKalmanStepper m_kalmanStepper
Kalmap update filter used in this var set.
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.
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.