Skip to content

Commit e8e4a05

Browse files
committed
Use float litterals when appropriate
1 parent f8a8222 commit e8e4a05

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

TrackingTools/TrackAssociator/src/TrackDetectorAssociator.cc

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -630,8 +630,8 @@ void TrackDetectorAssociator::getTAMuonChamberMatches(std::vector<TAMuonChamberM
630630
}
631631
LocalPoint localPoint = geomDet->surface().toLocal(stateOnSurface.freeState()->position());
632632
LocalError localError = stateOnSurface.localError().positionError();
633-
float distanceX = 0;
634-
float distanceY = 0;
633+
float distanceX = 0.f;
634+
float distanceY = 0.f;
635635
if (const CSCChamber* cscChamber = dynamic_cast<const CSCChamber*>(geomDet)) {
636636
const CSCChamberSpecs* chamberSpecs = cscChamber->specs();
637637
if (!chamberSpecs) {
@@ -653,21 +653,21 @@ void TrackDetectorAssociator::getTAMuonChamberMatches(std::vector<TAMuonChamberM
653653
float narrowWidth = wireTopology->narrowWidthOfPlane();
654654
float length = wireTopology->lengthOfPlane();
655655
// If slanted, there is no y offset between local origin and symmetry center of wire plane
656-
float yOfFirstWire = std::abs(wireTopology->wireAngle()) > 1.E-06 ? -0.5 * length : wireTopology->yOfWire(1);
656+
float yOfFirstWire = std::abs(wireTopology->wireAngle()) > 1.E-06f ? -0.5 * length : wireTopology->yOfWire(1);
657657
// y offset between local origin and symmetry center of wire plane
658-
float yCOWPOffset = yOfFirstWire + 0.5 * length;
658+
float yCOWPOffset = yOfFirstWire + 0.5f * length;
659659

660660
// tangent of the incline angle from inside the trapezoid
661-
float tangent = (wideWidth - narrowWidth) / (2. * length);
661+
float tangent = (wideWidth - narrowWidth) / (2.f * length);
662662
// y position wrt bottom of trapezoid
663663
float yPrime = localPoint.y() + std::abs(yOfFirstWire);
664664
// half trapezoid width at y' is 0.5 * narrowWidth + x side of triangle with the above tangent and side y'
665-
float halfWidthAtYPrime = 0.5 * narrowWidth + yPrime * tangent;
665+
float halfWidthAtYPrime = 0.5f * narrowWidth + yPrime * tangent;
666666
distanceX = std::abs(localPoint.x()) - halfWidthAtYPrime;
667-
distanceY = std::abs(localPoint.y() - yCOWPOffset) - 0.5 * length;
667+
distanceY = std::abs(localPoint.y() - yCOWPOffset) - 0.5f * length;
668668
} else {
669-
distanceX = std::abs(localPoint.x()) - 0.5 * geomDet->surface().bounds().width();
670-
distanceY = std::abs(localPoint.y()) - 0.5 * geomDet->surface().bounds().length();
669+
distanceX = std::abs(localPoint.x()) - 0.5f * geomDet->surface().bounds().width();
670+
distanceY = std::abs(localPoint.y()) - 0.5f * geomDet->surface().bounds().length();
671671
}
672672
if ((distanceX < parameters.muonMaxDistanceX && distanceY < parameters.muonMaxDistanceY) ||
673673
(distanceX * distanceX <
@@ -815,8 +815,8 @@ bool TrackDetectorAssociator::addTAMuonSegmentMatch(TAMuonChamberMatch& matchedC
815815
isDTWithoutY = true;
816816

817817
float deltaPhi(std::abs(segmentGlobalPosition.phi() - trajectoryStateOnSurface.freeState()->position().phi()));
818-
if (deltaPhi > M_PI)
819-
deltaPhi = std::abs(deltaPhi - M_PI * 2.);
818+
if (deltaPhi > float(M_PI))
819+
deltaPhi = std::abs(deltaPhi - float(M_PI) * 2.f);
820820
float deltaEta = std::abs(segmentGlobalPosition.eta() - trajectoryStateOnSurface.freeState()->position().eta());
821821

822822
if (isDTWithoutY) {
@@ -841,13 +841,13 @@ bool TrackDetectorAssociator::addTAMuonSegmentMatch(TAMuonChamberMatch& matchedC
841841
// AlgebraicSymMatrix segmentCovMatrix = segment->parametersError();
842842
// muonSegment.segmentLocalErrorXDxDz = segmentCovMatrix[2][0];
843843
// muonSegment.segmentLocalErrorYDyDz = segmentCovMatrix[3][1];
844-
muonSegment.segmentLocalErrorXDxDz = -999;
845-
muonSegment.segmentLocalErrorYDyDz = -999;
844+
muonSegment.segmentLocalErrorXDxDz = -999.f;
845+
muonSegment.segmentLocalErrorYDyDz = -999.f;
846846
muonSegment.hasZed = true;
847847
muonSegment.hasPhi = true;
848848

849849
// timing information
850-
muonSegment.t0 = 0;
850+
muonSegment.t0 = 0.f;
851851
if (dtseg) {
852852
if ((dtseg->hasPhi()) && (!isDTWithoutY)) {
853853
int phiHits = dtseg->phiSegment()->specificRecHits().size();
@@ -1019,7 +1019,7 @@ TrackDetMatchInfo TrackDetectorAssociator::associate(const edm::Event& iEvent,
10191019
track.outerPosition().Dot(track.outerMomentum()) < 0) {
10201020
cachedTrajectory_.setPropagationStep(-std::abs(currentStepSize));
10211021
TrackDetMatchInfo result;
1022-
if (track.innerPosition().R() < track.outerPosition().R())
1022+
if (track.innerPosition().Mag2() < track.outerPosition().Mag2())
10231023
result = associate(iEvent, iSetup, parameters, &innerState, &outerState);
10241024
else
10251025
result = associate(iEvent, iSetup, parameters, &outerState, &innerState);

0 commit comments

Comments
 (0)