From 4e76e0cd395ef235c42fef1739d5ecbdc9855a38 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Fri, 24 Sep 2021 11:35:37 +0200 Subject: [PATCH 1/2] Remove unused class SingleEleCalibSelector. --- Calibration/Tools/plugins/SealModule.cc | 3 - .../Tools/plugins/SingleEleCalibSelector.cc | 168 ------------------ .../Tools/plugins/SingleEleCalibSelector.h | 52 ------ 3 files changed, 223 deletions(-) delete mode 100644 Calibration/Tools/plugins/SingleEleCalibSelector.cc delete mode 100644 Calibration/Tools/plugins/SingleEleCalibSelector.h diff --git a/Calibration/Tools/plugins/SealModule.cc b/Calibration/Tools/plugins/SealModule.cc index 296027173aa53..ed0c1f7b4d90b 100644 --- a/Calibration/Tools/plugins/SealModule.cc +++ b/Calibration/Tools/plugins/SealModule.cc @@ -3,7 +3,6 @@ #include "Calibration/Tools/interface/PhiRangeSelector.h" #include "Calibration/Tools/interface/IMASelector.h" -#include "Calibration/Tools/plugins/SingleEleCalibSelector.h" #include "CommonTools/UtilAlgos/interface/ObjectSelector.h" #include "CommonTools/UtilAlgos/interface/SingleObjectSelector.h" @@ -29,5 +28,3 @@ namespace reco { DEFINE_FWK_MODULE(ElectronSqPtTkIsolationProducer); -// typedef SelectorWithEventSetup SingleElectronCalibrationSelector; -// DEFINE_FWK_MODULE( SingleElectronCalibrationSelector ); diff --git a/Calibration/Tools/plugins/SingleEleCalibSelector.cc b/Calibration/Tools/plugins/SingleEleCalibSelector.cc deleted file mode 100644 index 2f7c7165d3b36..0000000000000 --- a/Calibration/Tools/plugins/SingleEleCalibSelector.cc +++ /dev/null @@ -1,168 +0,0 @@ -// my includes -#include "CommonTools/UtilAlgos/interface/ParameterAdapter.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -// Geometry -#include "Geometry/Records/interface/CaloTopologyRecord.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h" - -#include "DataFormats/EgammaCandidates/interface/GsfElectron.h" -#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" - -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" -#include "DataFormats/DetId/interface/DetId.h" -#include "DataFormats/EcalDetId/interface/EBDetId.h" -#include "DataFormats/EcalDetId/interface/EEDetId.h" - -#include "Calibration/Tools/plugins/SingleEleCalibSelector.h" - -//CLHEP -#include - -#include - -SingleEleCalibSelector::SingleEleCalibSelector(const edm::ParameterSet& iConfig) { - ESCOPinMin_ = iConfig.getParameter("ESCOPinMin"); - ESCOPinMax_ = iConfig.getParameter("ESCOPinMax"); - ESeedOPoutMin_ = iConfig.getParameter("ESeedOPoutMin"); - ESeedOPoutMax_ = iConfig.getParameter("ESeedOPoutMax"); - PinMPoutOPinMin_ = iConfig.getParameter("PinMPoutOPinMin"); - PinMPoutOPinMax_ = iConfig.getParameter("PinMPoutOPinMax"); - E5x5OPoutMin_ = iConfig.getParameter("E5x5OPoutMin"); - E5x5OPoutMax_ = iConfig.getParameter("E5x5OPoutMax"); - E3x3OPinMin_ = iConfig.getParameter("E3x3OPinMin"); - E3x3OPinMax_ = iConfig.getParameter("E3x3OPinMax"); - E3x3OE5x5Min_ = iConfig.getParameter("E3x3OE5x5Min"); - E3x3OE5x5Max_ = iConfig.getParameter("E3x3OE5x5Max"); - EBrecHitLabel_ = iConfig.getParameter("alcaBarrelHitCollection"); - EErecHitLabel_ = iConfig.getParameter("alcaEndcapHitCollection"); -} - -// ------------------------------------------------------------ - -void - -SingleEleCalibSelector::select (edm::Handle inputHandle, - const edm::Event& iEvent , const edm::EventSetup& iSetup) -{ - selected_.clear(); - - //Get the EB rechit collection - edm::Handle barrelRecHitsHandle; - iEvent.getByLabel(EBrecHitLabel_, barrelRecHitsHandle); - const EBRecHitCollection* EBHitsColl = barrelRecHitsHandle.product(); - - //Get the EE rechit collection - edm::Handle endcapRecHitsHandle; - iEvent.getByLabel(EErecHitLabel_, endcapRecHitsHandle); - const EERecHitCollection* EEHitsColl = endcapRecHitsHandle.product(); - - //To deal with Geometry - iSetup.get().get(theCaloTopology); - - //Loop over electrons - for (collection::const_iterator ele = (*inputHandle).begin(); ele != (*inputHandle).end(); ++ele) { - //Find DetID max hit - DetId maxHitId = findMaxHit((*ele).superCluster()->hitsAndFractions(), EBHitsColl, EEHitsColl); - - if (maxHitId.null()) { - std::cout << " Null Id" << std::endl; - continue; - } - - // Find 3x3 and 5x5 windows around xtal max and compute E3x3,E5x5 - double E5x5 = 0.; - double E3x3 = 0.; - - const CaloSubdetectorTopology* topology = theCaloTopology->getSubdetectorTopology(DetId::Ecal, maxHitId.subdetId()); - int WindowSize = 5; - std::vector m5x5aroundMax = topology->getWindow(maxHitId, WindowSize, WindowSize); - E5x5 = EnergyNxN(m5x5aroundMax, EBHitsColl, EEHitsColl); - WindowSize = 3; - std::vector m3x3aroundMax = topology->getWindow(maxHitId, WindowSize, WindowSize); - E3x3 = EnergyNxN(m3x3aroundMax, EBHitsColl, EEHitsColl); - - double pin = ele->trackMomentumAtVtx().R(); - double piMpoOpi = (pin - ele->trackMomentumOut().R()) / pin; - double E5x5OPout = E5x5 / ele->trackMomentumOut().R(); - double E3x3OPin = E3x3 / pin; - double E3x3OE5x5 = E3x3 / E5x5; - double EseedOPout = ele->eSeedClusterOverPout(); - double EoPin = ele->eSuperClusterOverP(); - - if (piMpoOpi > PinMPoutOPinMin_ && piMpoOpi < PinMPoutOPinMax_ && EseedOPout > ESeedOPoutMin_ && - EseedOPout < ESeedOPoutMax_ && EoPin > ESCOPinMin_ && EoPin < ESCOPinMax_ && E5x5OPout > E5x5OPoutMin_ && - E5x5OPout < E5x5OPoutMax_ && E3x3OPin > E3x3OPinMin_ && E3x3OPin < E3x3OPinMax_ && E3x3OE5x5 > E3x3OE5x5Min_ && - E3x3OE5x5 < E3x3OE5x5Max_) { - selected_.push_back(&(*ele)); - } - } - - return; -} - -// ------------------------------------------------------------ - -SingleEleCalibSelector::~SingleEleCalibSelector() {} - -// ------------------------------------------------------------ - -// To find Max Hit -DetId SingleEleCalibSelector::findMaxHit(const std::vector >& v1, - const EBRecHitCollection* EBhits, - const EERecHitCollection* EEhits) { - double currEnergy = 0.; - DetId maxHit; - for (std::vector >::const_iterator idsIt = v1.begin(); idsIt != v1.end(); ++idsIt) { - if (idsIt->first.subdetId() == EcalBarrel) { - EBRecHitCollection::const_iterator itrechit; - itrechit = EBhits->find((*idsIt).first); - if (itrechit == EBhits->end()) { - edm::LogInfo("reading") << "[findMaxHit] rechit not found! "; - continue; - } - //FIXME: use fraction ?? - if (itrechit->energy() > currEnergy) { - currEnergy = itrechit->energy(); - maxHit = (*idsIt).first; - } - } else { - EERecHitCollection::const_iterator itrechit; - itrechit = EEhits->find((*idsIt).first); - if (itrechit == EEhits->end()) { - edm::LogInfo("reading") << "[findMaxHit] rechit not found! "; - continue; - } - - if (itrechit->energy() > currEnergy) { - currEnergy = itrechit->energy(); - maxHit = (*idsIt).first; - } - } - } - return maxHit; -} - -// Energy in a window NxN -double SingleEleCalibSelector::EnergyNxN(const std::vector& vNxN, - const EBRecHitCollection* EBhits, - const EERecHitCollection* EEhits) { - double dummy = 0.; - int window_size = vNxN.size(); - for (int ixtal = 0; ixtal < window_size; ixtal++) { - if (vNxN[ixtal].subdetId() == EcalBarrel) { - EBRecHitCollection::const_iterator it_rechit; - it_rechit = EBhits->find(vNxN[ixtal]); - dummy += it_rechit->energy(); - } else { - EERecHitCollection::const_iterator it_rechit; - it_rechit = EEhits->find(vNxN[ixtal]); - dummy += it_rechit->energy(); - } - } - - return dummy; -} diff --git a/Calibration/Tools/plugins/SingleEleCalibSelector.h b/Calibration/Tools/plugins/SingleEleCalibSelector.h deleted file mode 100644 index a50106549fc6b..0000000000000 --- a/Calibration/Tools/plugins/SingleEleCalibSelector.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef SingleEleCalibSelector_h -#define SingleEleCalibSelector_h - -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" -#include "DataFormats/EgammaCandidates/interface/GsfElectron.h" -#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h" -#include "Geometry/CaloTopology/interface/CaloTopology.h" - -#include -#include -#include - -class SingleEleCalibSelector { -public: - typedef reco::GsfElectronCollection collection; - typedef reco::GsfElectronRef electron; - typedef std::vector container; - typedef container::const_iterator const_iterator; - - //! ctor - SingleEleCalibSelector(const edm::ParameterSet& iConfig); - //!dtor - ~SingleEleCalibSelector(); - - const_iterator begin() const { return selected_.begin(); } - const_iterator end() const { return selected_.end(); } - - void select(edm::Handle, const edm::Event&, const edm::EventSetup&); - -private: - container selected_; //! the selected collection - - edm::ESHandle theCaloTopology; - - DetId findMaxHit(const std::vector >& v1, - const EBRecHitCollection* EBhits, - const EERecHitCollection* EEhits); - - double EnergyNxN(const std::vector& vNxN, const EBRecHitCollection* EBhits, const EERecHitCollection* EEhits); - - double ESCOPinMin_, ESeedOPoutMin_, PinMPoutOPinMin_, E5x5OPoutMin_, E3x3OPinMin_, E3x3OE5x5Min_; - double ESCOPinMax_, ESeedOPoutMax_, PinMPoutOPinMax_, E5x5OPoutMax_, E3x3OPinMax_, E3x3OE5x5Max_; - edm::InputTag EBrecHitLabel_; - edm::InputTag EErecHitLabel_; -}; - -#endif From 8ee1d30269dc0b00eb6e0a37572cb3d48ecfdb01 Mon Sep 17 00:00:00 2001 From: Thomas Reis Date: Fri, 24 Sep 2021 11:53:42 +0200 Subject: [PATCH 2/2] Code format. --- Calibration/Tools/plugins/SealModule.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/Calibration/Tools/plugins/SealModule.cc b/Calibration/Tools/plugins/SealModule.cc index ed0c1f7b4d90b..289dc8bc5e39d 100644 --- a/Calibration/Tools/plugins/SealModule.cc +++ b/Calibration/Tools/plugins/SealModule.cc @@ -27,4 +27,3 @@ namespace reco { } // namespace reco DEFINE_FWK_MODULE(ElectronSqPtTkIsolationProducer); -