Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consume records for mustache SC only if the mustache algo is used #32997

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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