diff --git a/RecoEcal/EgammaClusterAlgos/interface/SCEnergyCorrectorSemiParm_DRN.h b/RecoEcal/EgammaClusterAlgos/interface/SCEnergyCorrectorDRN.h similarity index 83% rename from RecoEcal/EgammaClusterAlgos/interface/SCEnergyCorrectorSemiParm_DRN.h rename to RecoEcal/EgammaClusterAlgos/interface/SCEnergyCorrectorDRN.h index 2a11dc774f31c..a96b3e17e72da 100644 --- a/RecoEcal/EgammaClusterAlgos/interface/SCEnergyCorrectorSemiParm_DRN.h +++ b/RecoEcal/EgammaClusterAlgos/interface/SCEnergyCorrectorDRN.h @@ -1,6 +1,6 @@ //-------------------------------------------------------------------------------------------------- // -// SCEnergyCorrectorSemiParm_DRN +// SCEnergyCorrectorDRN // // Helper Class for applying regression-based energy corrections with DRN implimentation // @@ -10,8 +10,8 @@ // //-------------------------------------------------------------------------------------------------- -#ifndef Progression_EGM_DRN_SCEnergyCorrectorSemiParm_DRN_h -#define Progression_EGM_DRN_SCEnergyCorrectorSemiParm_DRN_h +#ifndef Progression_EGM_DRN_SCEnergyCorrectorDRN_h +#define Progression_EGM_DRN_SCEnergyCorrectorDRN_h #include "HeterogeneousCore/SonicTriton/interface/TritonEDProducer.h" @@ -44,12 +44,12 @@ #include #include -class SCEnergyCorrectorSemiParm_DRN { +class SCEnergyCorrectorDRN { public: - SCEnergyCorrectorSemiParm_DRN(); + SCEnergyCorrectorDRN(); //if you want override the default on where conditions are consumed, you need to use //the other constructor and then call setTokens approprately - SCEnergyCorrectorSemiParm_DRN(const edm::ParameterSet& iConfig, edm::ConsumesCollector cc); + SCEnergyCorrectorDRN(const edm::ParameterSet& iConfig, edm::ConsumesCollector cc); static void fillPSetDescription(edm::ParameterSetDescription& desc); static edm::ParameterSetDescription makePSetDescription(); @@ -62,13 +62,11 @@ class SCEnergyCorrectorSemiParm_DRN { //std::pair getCorrections(const reco::SuperCluster& sc) const; - void make_input(const edm::Event& iEvent, TritonInputMap& iInput, const reco::SuperClusterCollection& inputSCs) const; - TritonOutput get_output(const TritonOutputMap& iOutput); + void makeInput(const edm::Event& iEvent, TritonInputMap& iInput, const reco::SuperClusterCollection& inputSCs) const; + TritonOutput getOutput(const TritonOutputMap& iOutput); //void modifyObject(reco::SuperCluster& sc) const; - std::vector getRegData(const reco::SuperCluster& sc) const; - private: const CaloTopology* caloTopo_; const CaloGeometry* caloGeom_; @@ -86,7 +84,7 @@ class SCEnergyCorrectorSemiParm_DRN { }; template -void SCEnergyCorrectorSemiParm_DRN::setTokens(const edm::ParameterSet& iConfig, edm::ConsumesCollector cc) { +void SCEnergyCorrectorDRN::setTokens(const edm::ParameterSet& iConfig, edm::ConsumesCollector cc) { tokenEBRecHits_ = cc.consumes(iConfig.getParameter("ecalRecHitsEB")); tokenEERecHits_ = cc.consumes(iConfig.getParameter("ecalRecHitsEE")); caloGeomToken_ = cc.esConsumes(); diff --git a/RecoEcal/EgammaClusterAlgos/src/SCEnergyCorrectorSemiParm_DRN.cc b/RecoEcal/EgammaClusterAlgos/src/SCEnergyCorrectorDRN.cc similarity index 78% rename from RecoEcal/EgammaClusterAlgos/src/SCEnergyCorrectorSemiParm_DRN.cc rename to RecoEcal/EgammaClusterAlgos/src/SCEnergyCorrectorDRN.cc index 9da11e872aeb8..8ac16702fb240 100644 --- a/RecoEcal/EgammaClusterAlgos/src/SCEnergyCorrectorSemiParm_DRN.cc +++ b/RecoEcal/EgammaClusterAlgos/src/SCEnergyCorrectorDRN.cc @@ -1,4 +1,4 @@ -#include "RecoEcal/EgammaClusterAlgos/interface/SCEnergyCorrectorSemiParm_DRN.h" +#include "RecoEcal/EgammaClusterAlgos/interface/SCEnergyCorrectorDRN.h" #include "FWCore/Utilities/interface/isFinite.h" #include "FWCore/Utilities/interface/Transition.h" @@ -13,40 +13,40 @@ #include -SCEnergyCorrectorSemiParm_DRN::SCEnergyCorrectorSemiParm_DRN() +SCEnergyCorrectorDRN::SCEnergyCorrectorDRN() : caloTopo_(nullptr), caloGeom_(nullptr) {} -SCEnergyCorrectorSemiParm_DRN::SCEnergyCorrectorSemiParm_DRN(const edm::ParameterSet& iConfig, edm::ConsumesCollector cc) - : SCEnergyCorrectorSemiParm_DRN() { +SCEnergyCorrectorDRN::SCEnergyCorrectorDRN(const edm::ParameterSet& iConfig, edm::ConsumesCollector cc) + : SCEnergyCorrectorDRN() { setTokens(iConfig, cc); } -void SCEnergyCorrectorSemiParm_DRN::fillPSetDescription(edm::ParameterSetDescription& desc) { +void SCEnergyCorrectorDRN::fillPSetDescription(edm::ParameterSetDescription& desc) { desc.add("ecalRecHitsEE", edm::InputTag("ecalRecHit", "EcalRecHitsEE")); desc.add("ecalRecHitsEB", edm::InputTag("ecalRecHit", "EcalRecHitsEB")); desc.add("rhoFastJet"); } -edm::ParameterSetDescription SCEnergyCorrectorSemiParm_DRN::makePSetDescription() { +edm::ParameterSetDescription SCEnergyCorrectorDRN::makePSetDescription() { edm::ParameterSetDescription desc; fillPSetDescription(desc); return desc; } -void SCEnergyCorrectorSemiParm_DRN::setEventSetup(const edm::EventSetup& es) { +void SCEnergyCorrectorDRN::setEventSetup(const edm::EventSetup& es) { caloTopo_ = &es.getData(caloTopoToken_); caloGeom_ = &es.getData(caloGeomToken_); } -void SCEnergyCorrectorSemiParm_DRN::setEvent(const edm::Event& event) { +void SCEnergyCorrectorDRN::setEvent(const edm::Event& event) { event.getByToken(tokenEBRecHits_, recHitsEB_); event.getByToken(tokenEERecHits_, recHitsEE_); event.getByToken(rhoToken_, rhoHandle_); } -void SCEnergyCorrectorSemiParm_DRN::make_input(const edm::Event& iEvent, TritonInputMap& iInput, const reco::SuperClusterCollection& inputSCs ) const { - //get event-based seed for RNG +void SCEnergyCorrectorDRN::makeInput(const edm::Event& iEvent, TritonInputMap& iInput, const reco::SuperClusterCollection& inputSCs ) const { + std::vector nHits = {}; unsigned totalHits = 0; unsigned n; @@ -96,13 +96,14 @@ void SCEnergyCorrectorSemiParm_DRN::make_input(const edm::Event& iEvent, TritonI vdata3.push_back(0.0); ++batchNum; } + // convert to server format input1.toServer(data1); input2.toServer(data2); input3.toServer(data3); } -TritonOutput SCEnergyCorrectorSemiParm_DRN::get_output(const TritonOutputMap& iOutput) { +TritonOutput SCEnergyCorrectorDRN::getOutput(const TritonOutputMap& iOutput) { //check the results const auto& output1 = iOutput.begin()->second; // convert from server format diff --git a/RecoEcal/EgammaClusterProducers/src/SCEnergyCorrectorProducer_DRN.cc b/RecoEcal/EgammaClusterProducers/src/SCEnergyCorrectorDRNProducer.cc similarity index 72% rename from RecoEcal/EgammaClusterProducers/src/SCEnergyCorrectorProducer_DRN.cc rename to RecoEcal/EgammaClusterProducers/src/SCEnergyCorrectorDRNProducer.cc index 8109bca7cc6a9..c16bef8e48c31 100644 --- a/RecoEcal/EgammaClusterProducers/src/SCEnergyCorrectorProducer_DRN.cc +++ b/RecoEcal/EgammaClusterProducers/src/SCEnergyCorrectorDRNProducer.cc @@ -12,7 +12,7 @@ #include "DataFormats/EgammaCandidates/interface/GsfElectron.h" -#include "RecoEcal/EgammaClusterAlgos/interface/SCEnergyCorrectorSemiParm_DRN.h" +#include "RecoEcal/EgammaClusterAlgos/interface/SCEnergyCorrectorDRN.h" #include #include @@ -20,7 +20,7 @@ #include /* - * SCEnergyCorrectorProducer_DRN + * SCEnergyCorrectorDRNProducer * * Simple producer to generate a set of corrected superclusters with the DRN regression * Based on RecoEcal/EgammaClusterProducers/SCEnergyCorrectorProducer by S. Harper (RAL/CERN) @@ -42,9 +42,9 @@ static float correction(float x){ return exp(-logcorrection(x)); } -class SCEnergyCorrectorProducer_DRN : public TritonEDProducer<> { +class SCEnergyCorrectorDRNProducer : public TritonEDProducer<> { public: - explicit SCEnergyCorrectorProducer_DRN(const edm::ParameterSet& iConfig); + explicit SCEnergyCorrectorDRNProducer(const edm::ParameterSet& iConfig); void beginLuminosityBlock(const edm::LuminosityBlock& iLumi, const edm::EventSetup& iSetup) override; @@ -54,23 +54,23 @@ class SCEnergyCorrectorProducer_DRN : public TritonEDProducer<> { static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: - SCEnergyCorrectorSemiParm_DRN energyCorrector_; + SCEnergyCorrectorDRN energyCorrector_; edm::EDGetTokenT inputSCToken_; }; -SCEnergyCorrectorProducer_DRN::SCEnergyCorrectorProducer_DRN(const edm::ParameterSet& iConfig) - : TritonEDProducer<>(iConfig, "SCEnergyCorrectorProducer_DRN"), +SCEnergyCorrectorDRNProducer::SCEnergyCorrectorDRNProducer(const edm::ParameterSet& iConfig) + : TritonEDProducer<>(iConfig, "SCEnergyCorrectorDRNProducer"), energyCorrector_(iConfig.getParameterSet("correctorCfg"), consumesCollector()), inputSCToken_(consumes(iConfig.getParameter("inputSCs"))) { produces(); } -void SCEnergyCorrectorProducer_DRN::beginLuminosityBlock(const edm::LuminosityBlock& iLumi, const edm::EventSetup& iSetup) { +void SCEnergyCorrectorDRNProducer::beginLuminosityBlock(const edm::LuminosityBlock& iLumi, const edm::EventSetup& iSetup) { energyCorrector_.setEventSetup(iSetup); } -void SCEnergyCorrectorProducer_DRN::acquire(edm::Event const& iEvent, edm::EventSetup const& iSetup, Input& iInput){ +void SCEnergyCorrectorDRNProducer::acquire(edm::Event const& iEvent, edm::EventSetup const& iSetup, Input& iInput){ auto inputSCs = iEvent.get(inputSCToken_); if(inputSCs.size()==0){ @@ -81,15 +81,15 @@ void SCEnergyCorrectorProducer_DRN::acquire(edm::Event const& iEvent, edm::Event } energyCorrector_.setEvent(iEvent); - energyCorrector_.make_input(iEvent, iInput, inputSCs); + energyCorrector_.makeInput(iEvent, iInput, inputSCs); } -void SCEnergyCorrectorProducer_DRN::produce(edm::Event& iEvent, const edm::EventSetup& iSetup, Output const& iOutput){ +void SCEnergyCorrectorDRNProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup, Output const& iOutput){ auto inputSCs = iEvent.get(inputSCToken_); if (inputSCs.size()==0) return; - const auto& serverout = energyCorrector_.get_output(iOutput); + const auto& serverout = energyCorrector_.getOutput(iOutput); if(inputSCs.size() ==0){ return; @@ -109,12 +109,12 @@ void SCEnergyCorrectorProducer_DRN::produce(edm::Event& iEvent, const edm::Event auto scHandle = iEvent.put(std::move(corrSCs)); } -void SCEnergyCorrectorProducer_DRN::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { +void SCEnergyCorrectorDRNProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; - desc.add("correctorCfg", SCEnergyCorrectorSemiParm_DRN::makePSetDescription()); + desc.add("correctorCfg", SCEnergyCorrectorDRN::makePSetDescription()); TritonClient::fillPSetDescription(desc); desc.add("inputSCs", edm::InputTag("particleFlowSuperClusterECAL")); - descriptions.add("scEnergyCorrectorProducer_DRN", desc); + descriptions.add("scEnergyCorrectorDRNProducer", desc); } -DEFINE_FWK_MODULE(SCEnergyCorrectorProducer_DRN); +DEFINE_FWK_MODULE(SCEnergyCorrectorDRNProducer);