Skip to content

Commit 39cb23a

Browse files
authored
Merge pull request #48735 from jo100sun/GEMEtawiseMatching
GEM Eta-partition id check in Muon-Rechit matching
2 parents 586d4cf + 59cf0c3 commit 39cb23a

File tree

2 files changed

+31
-6
lines changed

2 files changed

+31
-6
lines changed

RecoMuon/MuonIdentification/plugins/MuonIdProducer.cc

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ MuonIdProducer::MuonIdProducer(const edm::ParameterSet& iConfig)
166166
//create mesh holder
167167
meshAlgo_ = std::make_unique<MuonMesh>(iConfig.getParameter<edm::ParameterSet>("arbitrationCleanerOptions"));
168168

169+
gemgeomToken_ = esConsumes<GEMGeometry, MuonGeometryRecord>();
169170
edm::InputTag rpcHitTag("rpcRecHits");
170171
rpcHitToken_ = consumes<RPCRecHitCollection>(rpcHitTag);
171172

@@ -274,6 +275,8 @@ void MuonIdProducer::init(edm::Event& iEvent, const edm::EventSetup& iSetup) {
274275
iEvent.getByToken(glbQualToken_, glbQualHandle_);
275276
if (selectHighPurity_)
276277
iEvent.getByToken(pvToken_, pvHandle_);
278+
if (gemHitHandle_.isValid())
279+
gemgeom = &iSetup.getData(gemgeomToken_);
277280
}
278281

279282
reco::Muon MuonIdProducer::makeMuon(edm::Event& iEvent,
@@ -1122,11 +1125,29 @@ void MuonIdProducer::fillMuonId(edm::Event& iEvent,
11221125
gemHitMatch.mask = 0;
11231126
gemHitMatch.bx = gemRecHit.BunchX();
11241127

1125-
const double absDx = std::abs(gemRecHit.localPosition().x() - chamber.tState.localPosition().x());
1126-
if (absDx <= 5 or absDx * absDx <= 16 * localError.xx())
1127-
matchedChamber.gemHitMatches.push_back(gemHitMatch);
1128+
const GeomDet* geomDet = gemgeom->idToDetUnit(chamber.id);
1129+
const GlobalPoint& global_position = geomDet->toGlobal(lPos);
1130+
if (const GEMChamber* gemChamber = dynamic_cast<const GEMChamber*>(geomDet)) {
1131+
const GeomDet* eta_geomdet = gemChamber->component(gemRecHit.gemId());
1132+
const GEMEtaPartition* eta_partition = dynamic_cast<const GEMEtaPartition*>(eta_geomdet);
1133+
float bordercut = 2;
1134+
const TrapezoidalPlaneBounds* bounds =
1135+
dynamic_cast<const TrapezoidalPlaneBounds*>(&eta_partition->surface().bounds());
1136+
LocalPoint localPoint = eta_partition->surface().toLocal(global_position);
1137+
float wideWidth = bounds->width();
1138+
float narrowWidth = 2.f * bounds->widthAtHalfLength() - wideWidth;
1139+
float length = bounds->length();
1140+
float tangent = (wideWidth - narrowWidth) / (2.f * length);
1141+
float halfWidthAtY = tangent * localPoint.y() + 0.25f * (narrowWidth + wideWidth);
1142+
float distanceY = std::abs(localPoint.y()) - 0.5f * length;
1143+
float distanceX = std::abs(localPoint.x()) - halfWidthAtY;
1144+
if (distanceX < bordercut && distanceY < bordercut) {
1145+
const double absDx = std::abs(gemRecHit.localPosition().x() - chamber.tState.localPosition().x());
1146+
if (absDx <= 5 or absDx * absDx <= 16 * localError.xx())
1147+
matchedChamber.gemHitMatches.push_back(gemHitMatch);
1148+
}
1149+
}
11281150
}
1129-
11301151
muonChamberMatches.push_back(matchedChamber);
11311152
}
11321153
}
@@ -1223,8 +1244,8 @@ void MuonIdProducer::fillArbitrationInfo(reco::MuonCollection* pOutputMuons, uns
12231244
arbitrationPairs.push_back(std::make_pair(&chamber2, &segment2));
12241245
}
12251246
} // segmentIter2
1226-
} // chamberIter2
1227-
} // muonIndex2
1247+
} // chamberIter2
1248+
} // muonIndex2
12281249
}
12291250

12301251
// arbitration segment sort

RecoMuon/MuonIdentification/plugins/MuonIdProducer.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
#include "RecoMuon/MuonIdentification/interface/MuonIdTruthInfo.h"
6262
#include "RecoMuon/MuonIdentification/interface/MuonArbitrationMethods.h"
6363
#include "DataFormats/Common/interface/ValueMap.h"
64+
#include "Geometry/GEMGeometry/interface/GEMGeometry.h"
6465

6566
class MuonMesh;
6667
class MuonKinkFinder;
@@ -281,5 +282,8 @@ class MuonIdProducer : public edm::stream::EDProducer<> {
281282

282283
bool arbClean_;
283284
std::unique_ptr<MuonMesh> meshAlgo_;
285+
edm::ESGetToken<GEMGeometry, MuonGeometryRecord> gemgeomToken_;
286+
const GEMGeometry* gemgeom;
287+
double GEM_edgecut_;
284288
};
285289
#endif

0 commit comments

Comments
 (0)