Generate and assign the variables from the VXD-CDC-pair.
25{
26 const std::vector<TrackFindingCDC::WithWeight<const CKFToPXDState*>>& previousStates = pair->first;
27 CKFToPXDState* state = pair->second;
28
29 const RecoTrack* seedTrack = previousStates.front()->getSeed();
30 B2ASSERT("Path without seed?", seedTrack);
31
32 const SpacePoint* spacePoint = state->getHit();
33 B2ASSERT("Path without hit?", spacePoint);
34
35 genfit::MeasuredStateOnPlane firstMeasurement;
36 if (state->mSoPSet()) {
37 firstMeasurement = state->getMeasuredStateOnPlane();
38 } else {
39 firstMeasurement = previousStates.back()->getMeasuredStateOnPlane();
40 }
41
44
45 const CDCTrajectory3D trajectory(position, 0, momentum, seedTrack->
getChargeSeed());
46
48
49 const double arcLength = trajectory.calcArcLength2D(hitPosition);
50 const Vector2D& trackPositionAtHit2D = trajectory.getTrajectory2D().getPos2DAtArcLength2D(arcLength);
51 double trackPositionAtHitZ = trajectory.getTrajectorySZ().mapSToZ(arcLength);
52
53 Vector3D trackPositionAtHit(trackPositionAtHit2D, trackPositionAtHitZ);
54 Vector3D distance = trackPositionAtHit - hitPosition;
55
56 var<
named(
"distance")>() =
static_cast<Float_t
>(distance.
norm());
57 var<
named(
"xy_distance")>() =
static_cast<Float_t
>(distance.
xy().
norm());
58 var<
named(
"z_distance")>() =
static_cast<Float_t
>(distance.
z());
59
60 Vector3D mSoP_distance = position - hitPosition;
61
62 var<
named(
"mSoP_distance")>() =
static_cast<Float_t
>(mSoP_distance.
norm());
63 var<
named(
"mSoP_xy_distance")>() =
static_cast<Float_t
>(mSoP_distance.
xy().
norm());
64 var<
named(
"mSoP_z_distance")>() =
static_cast<Float_t
>(mSoP_distance.
z());
65
66 var<
named(
"same_hemisphere")>() = fabs(position.
phi() - hitPosition.phi()) < TMath::PiOver2();
67
68 var<
named(
"arcLengthOfHitPosition")>() =
static_cast<Float_t
>(trajectory.calcArcLength2D(hitPosition));
69 var<
named(
"arcLengthOfCenterPosition")>() =
static_cast<Float_t
>(trajectory.calcArcLength2D(
Vector3D(0, 0, 0)));
70
72 var<
named(
"number")>() = previousStates.size();
73
74 var<
named(
"pt")>() =
static_cast<Float_t
>(momentum.xy().norm());
75 var<
named(
"tan_lambda")>() =
static_cast<Float_t
>(trajectory.getTanLambda());
76 var<
named(
"phi")>() =
static_cast<Float_t
>(momentum.phi());
77
78 const VxdID& sensorInfo = spacePoint->
getVxdID();
79
84
86 B2ASSERT("Must be related to exactly 1 cluster", clusters.size() == 1);
87 var<
named(
"cluster_charge")>() = clusters[0]->getCharge();
88 var<
named(
"cluster_seed_charge")>() = clusters[0]->getSeedCharge();
89 var<
named(
"cluster_size")>() = clusters[0]->getSize();
90 var<
named(
"cluster_size_u")>() = clusters[0]->getUSize();
91 var<
named(
"cluster_size_v")>() = clusters[0]->getVSize();
92
98 var<
named(
"last_cluster_charge")>() = 0;
99 var<
named(
"last_cluster_seed_charge")>() = 0;
100 var<
named(
"last_cluster_size")>() = 0;
101 var<
named(
"last_cluster_size_u")>() = 0;
102 var<
named(
"last_cluster_size_v")>() = 0;
103
104 const CKFToPXDState* parent = previousStates.back();
105 const SpacePoint* parentSpacePoint = parent->getHit();
106 if (parentSpacePoint) {
107 const VxdID& parentSensorInfo = parentSpacePoint->
getVxdID();
108
114
115 const auto& parentclusters = parentSpacePoint->
getRelationsTo<PXDCluster>();
116 B2ASSERT("Must be related to exactly 1 cluster", parentclusters.size() == 1);
117 var<
named(
"last_cluster_charge")>() = parentclusters[0]->getCharge();
118 var<
named(
"last_cluster_seed_charge")>() = parentclusters[0]->getSeedCharge();
119 var<
named(
"last_cluster_size")>() = parentclusters[0]->getSize();
120 var<
named(
"last_cluster_size_u")>() = parentclusters[0]->getUSize();
121 var<
named(
"last_cluster_size_v")>() = parentclusters[0]->getVSize();
122 }
123
124 const double residual =
m_kalmanStepper.calculateResidual(firstMeasurement, *state);
125 var<
named(
"residual")>() = residual;
126
127 if (state->isFitted()) {
128 var<
named(
"chi2")>() =
static_cast<Float_t
>(state->getChi2());
129 } else {
131 }
132
133 const TMatrixDSym& cov5 = firstMeasurement.getCov();
134 const Float_t sigmaUV = std::sqrt(std::max(cov5(4, 4), cov5(3, 3)));
136 var<
named(
"residual_over_sigma")>() = residual / sigmaUV;
137
138 return true;
139}
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)
double norm() const
Calculates the length of the vector.
const Vector2D & xy() const
Getter for the xy projected vector ( reference ! )
double phi() const
Getter for the azimuth angle.
double norm() const
Calculates the length of the vector.
double z() const
Getter for the z coordinate.
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.
HepGeom::Vector3D< double > Vector3D
3D Vector