Skip to content

Commit 5e9ff21

Browse files
committed
fix sign of cosPhi3D, make code more readable
1 parent 6ca6c26 commit 5e9ff21

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

DQM/TrackingMonitorSource/plugins/StandaloneTrackMonitor.cc

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1836,17 +1836,18 @@ void StandaloneTrackMonitor::analyze(edm::Event const& iEvent, edm::EventSetup c
18361836
theMainVtx = *theClosestVertex;
18371837
}
18381838
if (theMainVtx.isValid()) {
1839-
const math::XYZPoint theMainVtxPos(
1840-
theMainVtx.position().x(), theMainVtx.position().y(), theMainVtx.position().z());
1841-
const math::XYZPoint myVertex(
1842-
mumuTransientVtx.position().x(), mumuTransientVtx.position().y(), mumuTransientVtx.position().z());
1843-
const math::XYZPoint deltaVtx(
1844-
theMainVtxPos.x() - myVertex.x(), theMainVtxPos.y() - myVertex.y(), theMainVtxPos.z() - myVertex.z());
1845-
double cosphi3D =
1846-
(Zp.Px() * deltaVtx.x() + Zp.Py() * deltaVtx.y() + Zp.Pz() * deltaVtx.z()) /
1847-
(sqrt(Zp.Px() * Zp.Px() + Zp.Py() * Zp.Py() + Zp.Pz() * Zp.Pz()) *
1848-
sqrt(deltaVtx.x() * deltaVtx.x() + deltaVtx.y() * deltaVtx.y() + deltaVtx.z() * deltaVtx.z()));
1849-
cosPhi3DdileptonH_->Fill(cosphi3D, wfac);
1839+
const auto& mainVertexPos = theMainVtx.position();
1840+
const auto& myVertexPos = mumuTransientVtx.position();
1841+
1842+
const double deltaX = myVertexPos.x() - mainVertexPos.x();
1843+
const double deltaY = myVertexPos.y() - mainVertexPos.y();
1844+
const double deltaZ = myVertexPos.z() - mainVertexPos.z();
1845+
1846+
const double deltaNorm = sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ);
1847+
const double zpNorm = sqrt(Zp.Px() * Zp.Px() + Zp.Py() * Zp.Py() + Zp.Pz() * Zp.Pz());
1848+
1849+
const double cosPhi3D = (Zp.Px() * deltaX + Zp.Py() * deltaY + Zp.Pz() * deltaZ) / (zpNorm * deltaNorm);
1850+
cosPhi3DdileptonH_->Fill(cosPhi3D, wfac);
18501851
}
18511852
}
18521853
}

0 commit comments

Comments
 (0)