@@ -298,24 +298,6 @@ reco::Muon MuonIdProducer::makeMuon(edm::Event& iEvent,
298298 return aMuon;
299299}
300300
301- bool MuonIdProducer::checkBounds (const GeomDet* geomDet,
302- const GlobalPoint& global_position,
303- const float bordercut) {
304- const TrapezoidalPlaneBounds* bounds = dynamic_cast <const TrapezoidalPlaneBounds*>(&geomDet->surface ().bounds ());
305- LocalPoint localPoint = geomDet->surface ().toLocal (global_position);
306- float wideWidth = bounds->width ();
307- float narrowWidth = 2 .f * bounds->widthAtHalfLength () - wideWidth;
308- float length = bounds->length ();
309- float tangent = (wideWidth - narrowWidth) / (2 .f * length);
310- float halfWidthAtY = tangent * localPoint.y () + 0 .25f * (narrowWidth + wideWidth);
311- float distanceY = std::abs (localPoint.y ()) - 0 .5f * length;
312- float distanceX = std::abs (localPoint.x ()) - halfWidthAtY;
313- if (distanceX < bordercut && distanceY < bordercut) {
314- return true ;
315- }
316- return false ;
317- }
318-
319301reco::CaloMuon MuonIdProducer::makeCaloMuon (const reco::Muon& muon) {
320302 LogTrace (" MuonIdentification" ) << " Creating a CaloMuon from a Muon" ;
321303
@@ -1148,9 +1130,20 @@ void MuonIdProducer::fillMuonId(edm::Event& iEvent,
11481130 int ieta = 0 ;
11491131 if (const GEMChamber* gemChamber = dynamic_cast <const GEMChamber*>(geomDet)) {
11501132 for (const GEMEtaPartition* eta_partition : gemChamber->etaPartitions ()) {
1133+ bool bounds = false ;
11511134 ieta = eta_partition->id ().ieta ();
11521135 if (ieta == gemRecHit.gemId ().ieta ()) {
1153- if (checkBounds (eta_partition, global_position, 2 )) {
1136+ float bordercut = 2 ;
1137+ const TrapezoidalPlaneBounds* bounds = dynamic_cast <const TrapezoidalPlaneBounds*>(&eta_partition->surface ().bounds ());
1138+ LocalPoint localPoint = eta_partition->surface ().toLocal (global_position);
1139+ float wideWidth = bounds->width ();
1140+ float narrowWidth = 2 .f * bounds->widthAtHalfLength () - wideWidth;
1141+ float length = bounds->length ();
1142+ float tangent = (wideWidth - narrowWidth) / (2 .f * length);
1143+ float halfWidthAtY = tangent * localPoint.y () + 0 .25f * (narrowWidth + wideWidth);
1144+ float distanceY = std::abs (localPoint.y ()) - 0 .5f * length;
1145+ float distanceX = std::abs (localPoint.x ()) - halfWidthAtY;
1146+ if (distanceX < bordercut && distanceY < bordercut) {
11541147 GEMmatched = true ;
11551148 }
11561149 }
0 commit comments