Skip to content

Commit 59cf0c3

Browse files
committed
Asking for GEMGeomtry only when the GEM is available. For backward compatibility.
1 parent c4b959a commit 59cf0c3

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

RecoMuon/MuonIdentification/plugins/MuonIdProducer.cc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,8 @@ void MuonIdProducer::init(edm::Event& iEvent, const edm::EventSetup& iSetup) {
275275
iEvent.getByToken(glbQualToken_, glbQualHandle_);
276276
if (selectHighPurity_)
277277
iEvent.getByToken(pvToken_, pvHandle_);
278-
gemgeom = &iSetup.getData(gemgeomToken_);
278+
if (gemHitHandle_.isValid())
279+
gemgeom = &iSetup.getData(gemgeomToken_);
279280
}
280281

281282
reco::Muon MuonIdProducer::makeMuon(edm::Event& iEvent,
@@ -1123,14 +1124,15 @@ void MuonIdProducer::fillMuonId(edm::Event& iEvent,
11231124
gemHitMatch.x = gemRecHit.localPosition().x();
11241125
gemHitMatch.mask = 0;
11251126
gemHitMatch.bx = gemRecHit.BunchX();
1126-
1127+
11271128
const GeomDet* geomDet = gemgeom->idToDetUnit(chamber.id);
11281129
const GlobalPoint& global_position = geomDet->toGlobal(lPos);
11291130
if (const GEMChamber* gemChamber = dynamic_cast<const GEMChamber*>(geomDet)) {
11301131
const GeomDet* eta_geomdet = gemChamber->component(gemRecHit.gemId());
11311132
const GEMEtaPartition* eta_partition = dynamic_cast<const GEMEtaPartition*>(eta_geomdet);
11321133
float bordercut = 2;
1133-
const TrapezoidalPlaneBounds* bounds = dynamic_cast<const TrapezoidalPlaneBounds*>(&eta_partition->surface().bounds());
1134+
const TrapezoidalPlaneBounds* bounds =
1135+
dynamic_cast<const TrapezoidalPlaneBounds*>(&eta_partition->surface().bounds());
11341136
LocalPoint localPoint = eta_partition->surface().toLocal(global_position);
11351137
float wideWidth = bounds->width();
11361138
float narrowWidth = 2.f * bounds->widthAtHalfLength() - wideWidth;
@@ -1242,8 +1244,8 @@ void MuonIdProducer::fillArbitrationInfo(reco::MuonCollection* pOutputMuons, uns
12421244
arbitrationPairs.push_back(std::make_pair(&chamber2, &segment2));
12431245
}
12441246
} // segmentIter2
1245-
} // chamberIter2
1246-
} // muonIndex2
1247+
} // chamberIter2
1248+
} // muonIndex2
12471249
}
12481250

12491251
// arbitration segment sort

0 commit comments

Comments
 (0)