diff --git a/PhysicsTools/PatAlgos/plugins/PATElectronProducer.cc b/PhysicsTools/PatAlgos/plugins/PATElectronProducer.cc index 303f2195f214b..045630c611f15 100644 --- a/PhysicsTools/PatAlgos/plugins/PATElectronProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATElectronProducer.cc @@ -536,6 +536,13 @@ void PATElectronProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSe // This is needed by the IPTools methods from the tracking group trackBuilder = iSetup.getHandle(trackBuilderToken_); + if (beamSpotHandle.isValid()) { + beamSpot = *beamSpotHandle; + beamSpotIsValid = true; + } else { + edm::LogError("DataNotAvailable") << "No beam spot available from EventSetup, not adding high level selection \n"; + } + if (pvHandle.isValid() && !pvHandle->empty()) { primaryVertex = pvHandle->at(0); primaryVertexIsValid = true;