Skip to content

Commit df6698f

Browse files
committed
Inline boundcheck, geomToken to gemgeomToken
1 parent f560fac commit df6698f

File tree

2 files changed

+12
-21
lines changed

2 files changed

+12
-21
lines changed

RecoMuon/MuonIdentification/plugins/MuonIdProducer.cc

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -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-
319301
reco::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
}

RecoMuon/MuonIdentification/plugins/MuonIdProducer.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ class MuonIdProducer : public edm::stream::EDProducer<> {
8080
static double sectorPhi(const DetId& id);
8181

8282
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
83-
84-
bool checkBounds(const GeomDet* geomDet, const GlobalPoint& global_position, const float bordercut);
8583

8684
private:
8785
void fillMuonId(edm::Event&,

0 commit comments

Comments
 (0)