Skip to content

Commit

Permalink
Merge pull request #33100 from thomreis/mustache-rcd-only-for-mustach…
Browse files Browse the repository at this point in the history
…e-algo-112x

Consume records for mustache SC only if the mustache algo is used - 112x backport
  • Loading branch information
cmsbuild authored Mar 10, 2021
2 parents aadda34 + d764fed commit 129a1fe
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
17 changes: 13 additions & 4 deletions RecoEcal/EgammaClusterAlgos/src/PFECALSuperClusterAlgo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,13 @@ void PFECALSuperClusterAlgo::setTokens(const edm::ParameterSet& iConfig, edm::Co
esEEInterCalibToken_ =
cc.esConsumes<ESEEIntercalibConstants, ESEEIntercalibConstantsRcd, edm::Transition::BeginLuminosityBlock>();
esChannelStatusToken_ = cc.esConsumes<ESChannelStatus, ESChannelStatusRcd, edm::Transition::BeginLuminosityBlock>();
ecalMustacheSCParametersToken_ = cc.esConsumes<EcalMustacheSCParameters, EcalMustacheSCParametersRcd>();
ecalSCDynamicDPhiParametersToken_ = cc.esConsumes<EcalSCDynamicDPhiParameters, EcalSCDynamicDPhiParametersRcd>();

if (_clustype == PFECALSuperClusterAlgo::kMustache) {
ecalMustacheSCParametersToken_ = cc.esConsumes<EcalMustacheSCParameters, EcalMustacheSCParametersRcd>();
}
if (useDynamicDPhi_) {
ecalSCDynamicDPhiParametersToken_ = cc.esConsumes<EcalSCDynamicDPhiParameters, EcalSCDynamicDPhiParametersRcd>();
}

if (useRegression_) {
const edm::ParameterSet& regconf = iConfig.getParameter<edm::ParameterSet>("regressionConfig");
Expand Down Expand Up @@ -151,8 +156,12 @@ void PFECALSuperClusterAlgo::update(const edm::EventSetup& setup) {
}

void PFECALSuperClusterAlgo::updateSCParams(const edm::EventSetup& setup) {
mustacheSCParams_ = &setup.getData(ecalMustacheSCParametersToken_);
scDynamicDPhiParams_ = &setup.getData(ecalSCDynamicDPhiParametersToken_);
if (_clustype == PFECALSuperClusterAlgo::kMustache) {
mustacheSCParams_ = &setup.getData(ecalMustacheSCParametersToken_);
}
if (useDynamicDPhi_) {
scDynamicDPhiParams_ = &setup.getData(ecalSCDynamicDPhiParametersToken_);
}
}

void PFECALSuperClusterAlgo::loadAndSortPFClusters(const edm::Event& iEvent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ PFECALSuperClusterProducer::PFECALSuperClusterProducer(const edm::ParameterSet&
isOOTCollection_ = iConfig.getParameter<bool>("isOOTCollection");
superClusterAlgo_.setIsOOTCollection(isOOTCollection_);

superClusterAlgo_.setTokens(iConfig, consumesCollector());

std::string _typename = iConfig.getParameter<std::string>("ClusteringType");
if (_typename == ClusterType__BOX) {
_theclusteringtype = PFECALSuperClusterAlgo::kBOX;
Expand All @@ -62,6 +60,10 @@ PFECALSuperClusterProducer::PFECALSuperClusterProducer(const edm::ParameterSet&
throw cms::Exception("InvalidClusteringType") << "You have not chosen a valid clustering type,"
<< " please choose from \"Box\" or \"Mustache\"!";
}
superClusterAlgo_.setClusteringType(_theclusteringtype);
superClusterAlgo_.setUseDynamicDPhi(iConfig.getParameter<bool>("useDynamicDPhiWindow"));
// clusteringType and useDynamicDPhi need to be defined before setting the tokens in order to esConsume only the necessary records
superClusterAlgo_.setTokens(iConfig, consumesCollector());

std::string _weightname = iConfig.getParameter<std::string>("EnergyWeight");
if (_weightname == EnergyWeight__Raw) {
Expand All @@ -79,8 +81,6 @@ PFECALSuperClusterProducer::PFECALSuperClusterProducer(const edm::ParameterSet&
// parameters for clustering
bool seedThresholdIsET = iConfig.getParameter<bool>("seedThresholdIsET");

bool useDynamicDPhi = iConfig.getParameter<bool>("useDynamicDPhiWindow");

double threshPFClusterSeedBarrel = iConfig.getParameter<double>("thresh_PFClusterSeedBarrel");
double threshPFClusterBarrel = iConfig.getParameter<double>("thresh_PFClusterBarrel");

Expand All @@ -102,10 +102,8 @@ PFECALSuperClusterProducer::PFECALSuperClusterProducer(const edm::ParameterSet&
bool dropUnseedable = iConfig.getParameter<bool>("dropUnseedable");

superClusterAlgo_.setVerbosityLevel(verbose_);
superClusterAlgo_.setClusteringType(_theclusteringtype);
superClusterAlgo_.setEnergyWeighting(_theenergyweight);
superClusterAlgo_.setUseETForSeeding(seedThresholdIsET);
superClusterAlgo_.setUseDynamicDPhi(useDynamicDPhi);

superClusterAlgo_.setThreshSuperClusterEt(iConfig.getParameter<double>("thresh_SCEt"));

Expand Down

0 comments on commit 129a1fe

Please sign in to comment.