Skip to content

Commit

Permalink
use edm::ESWatcher to see if records change
Browse files Browse the repository at this point in the history
  • Loading branch information
guitargeek committed Oct 20, 2020
1 parent ad22b28 commit 6828a9f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/ESWatcher.h"
#include "FWCore/Framework/interface/EDConsumerBase.h"

#include "TrackingTools/KalmanUpdators/interface/KFUpdator.h"
Expand Down Expand Up @@ -74,6 +75,8 @@ class ElectronSeedGenerator {
const edm::EDGetTokenT<reco::BeamSpot> beamSpotTag_;
const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> magFieldToken_;
const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> trackerGeometryToken_;
edm::ESWatcher<IdealMagneticFieldRecord> magneticFieldWatcher_;
edm::ESWatcher<TrackerDigiGeometryRecord> trackerGeometryWatcher_;

const float lowPtThresh_;
const float highPtThresh_;
Expand All @@ -90,11 +93,6 @@ class ElectronSeedGenerator {

const std::vector<const TrajectorySeedCollection*>* initialSeedCollectionVector_ = nullptr;

// keep cacheIds to get records only when necessary
unsigned long long cacheIDMagField_ = 0;
unsigned long long cacheIDCkfComp_ = 0;
unsigned long long cacheIDTrkGeom_ = 0;

const bool useRecoVertex_;

const float deltaPhi2B_;
Expand Down
4 changes: 3 additions & 1 deletion RecoEgamma/EgammaElectronAlgos/src/ElectronSeedGenerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@ ElectronSeedGenerator::ElectronSeedGenerator(const edm::ParameterSet &pset,
useRecoVertex_) {}

void ElectronSeedGenerator::setupES(const edm::EventSetup &setup) {
matcher_.setES(setup.getData(magFieldToken_), setup.getData(trackerGeometryToken_));
if (magneticFieldWatcher_.check(setup) || trackerGeometryWatcher_.check(setup)) {
matcher_.setES(setup.getData(magFieldToken_), setup.getData(trackerGeometryToken_));
}
}

void ElectronSeedGenerator::run(edm::Event &e,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ ElectronSeedProducer::ElectronSeedProducer(const edm::ParameterSet& conf)
auto theconsumes = consumesCollector();

// new beamSpot tag
beamSpotTag_ = consumes<reco::BeamSpot>(conf.getParameter<edm::InputTag>("beamSpot"));
beamSpotTag_ = consumes(conf.getParameter<edm::InputTag>("beamSpot"));

// for H/E
applyHOverECut_ = conf.getParameter<bool>("applyHOverECut");
Expand All @@ -81,7 +81,7 @@ ElectronSeedProducer::ElectronSeedProducer(const edm::ParameterSet& conf)
hcalCfg.hOverEConeSize = conf.getParameter<double>("hOverEConeSize");
if (hcalCfg.hOverEConeSize > 0) {
hcalCfg.useTowers = true;
hcalCfg.hcalTowers = consumes<CaloTowerCollection>(conf.getParameter<edm::InputTag>("hcalTowers"));
hcalCfg.hcalTowers = consumes(conf.getParameter<edm::InputTag>("hcalTowers"));
hcalCfg.hOverEPtMin = conf.getParameter<double>("hOverEPtMin");
}
hcalHelper_ = std::make_unique<ElectronHcalHelper>(hcalCfg, consumesCollector());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,15 @@ TrackingRegionsFromSuperClustersProducer::TrackingRegionsFromSuperClustersProduc
auto measTrackerEventTag = regionPSet.getParameter<edm::InputTag>("measurementTrackerEvent");

if (useZInVertex_) {
verticesToken_ = iC.consumes<reco::VertexCollection>(verticesTag);
verticesToken_ = iC.consumes(verticesTag);
} else {
beamSpotToken_ = iC.consumes<reco::BeamSpot>(beamSpotTag);
beamSpotToken_ = iC.consumes(beamSpotTag);
}
if (whereToUseMeasTracker_ != RectangularEtaPhiTrackingRegion::UseMeasurementTracker::kNever) {
measTrackerEventToken_ = iC.consumes<MeasurementTrackerEvent>(measTrackerEventTag);
measTrackerEventToken_ = iC.consumes(measTrackerEventTag);
}
for (const auto& tag : superClustersTags) {
superClustersTokens_.emplace_back(iC.consumes<std::vector<reco::SuperClusterRef>>(tag));
superClustersTokens_.emplace_back(iC.consumes(tag));
}
}

Expand Down
2 changes: 1 addition & 1 deletion RecoLocalCalo/HGCalRecAlgos/interface/ClusterTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#include "DataFormats/HGCRecHit/interface/HGCRecHitCollections.h"
#include "DataFormats/CaloRecHit/interface/CaloCluster.h"
#include "DataFormats/ParticleFlowReco/interface/HGCalMultiCluster.h"
#include "Geometry/Records/interface/IdealGeometryRecord.h"
#include "Geometry/CaloGeometry/interface/CaloGeometry.h"
#include "Geometry/Records/interface/CaloGeometryRecord.h"

#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Framework/interface/ConsumesCollector.h"
Expand Down

0 comments on commit 6828a9f

Please sign in to comment.