diff --git a/RecoLocalCalo/EcalDeadChannelRecoveryAlgos/interface/EcalDeadChannelRecoveryBDTG.h b/RecoLocalCalo/EcalDeadChannelRecoveryAlgos/interface/EcalDeadChannelRecoveryBDTG.h index 58faf836b6594..9e89e76d8c295 100644 --- a/RecoLocalCalo/EcalDeadChannelRecoveryAlgos/interface/EcalDeadChannelRecoveryBDTG.h +++ b/RecoLocalCalo/EcalDeadChannelRecoveryAlgos/interface/EcalDeadChannelRecoveryBDTG.h @@ -1,7 +1,6 @@ #ifndef RecoLocalCalo_EcalDeadChannelRecoveryAlgos_EcalDeadChannelRecoveryBDTG_H #define RecoLocalCalo_EcalDeadChannelRecoveryAlgos_EcalDeadChannelRecoveryBDTG_H -#include "DataFormats/EcalRecHit/interface/EcalRecHit.h" #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" #include "DataFormats/EcalDetId/interface/EBDetId.h" @@ -25,7 +24,7 @@ class EcalDeadChannelRecoveryBDTG { ~EcalDeadChannelRecoveryBDTG(); void setParameters(const edm::ParameterSet &ps); - void setCaloTopology(const CaloTopology *topo) { topology_ = topo; }; + void setCaloTopology(const CaloTopology *topo) { topology_ = topo; } double recover( const DetIdT id, const EcalRecHitCollection &hit_collection, double single8Cut, double sum8Cut, bool *acceptFlag); @@ -45,8 +44,8 @@ class EcalDeadChannelRecoveryBDTG { edm::FileInPath bdtWeightFileNoCracks_; edm::FileInPath bdtWeightFileCracks_; - TMVA::Reader *readerNoCrack; - TMVA::Reader *readerCrack; + std::unique_ptr readerNoCrack; + std::unique_ptr readerCrack; }; #endif diff --git a/RecoLocalCalo/EcalDeadChannelRecoveryAlgos/src/EcalDeadChannelRecoveryBDTG.cc b/RecoLocalCalo/EcalDeadChannelRecoveryAlgos/src/EcalDeadChannelRecoveryBDTG.cc index 4a194135fcee3..8f2cee47c674c 100644 --- a/RecoLocalCalo/EcalDeadChannelRecoveryAlgos/src/EcalDeadChannelRecoveryBDTG.cc +++ b/RecoLocalCalo/EcalDeadChannelRecoveryAlgos/src/EcalDeadChannelRecoveryBDTG.cc @@ -30,14 +30,14 @@ void EcalDeadChannelRecoveryBDTG::addVariables(TMVA::Reader *reader) { } template <> void EcalDeadChannelRecoveryBDTG::loadFile() { - readerNoCrack = new TMVA::Reader("!Color:!Silent"); - readerCrack = new TMVA::Reader("!Color:!Silent"); + readerNoCrack = std::unique_ptr(new TMVA::Reader("!Color:!Silent")); + readerCrack = std::unique_ptr(new TMVA::Reader("!Color:!Silent")); - this->addVariables(readerNoCrack); - this->addVariables(readerCrack); + addVariables(readerNoCrack.get()); + addVariables(readerCrack.get()); - reco::details::loadTMVAWeights(readerNoCrack, "BDTG", bdtWeightFileNoCracks_.fullPath()); - reco::details::loadTMVAWeights(readerCrack, "BDTG", bdtWeightFileCracks_.fullPath()); + reco::details::loadTMVAWeights(readerNoCrack.get(), "BDTG", bdtWeightFileNoCracks_.fullPath()); + reco::details::loadTMVAWeights(readerCrack.get(), "BDTG", bdtWeightFileCracks_.fullPath()); } template @@ -51,7 +51,7 @@ void EcalDeadChannelRecoveryBDTG::setParameters(const edm::ParameterSet bdtWeightFileNoCracks_ = ps.getParameter("bdtWeightFileNoCracks"); bdtWeightFileCracks_ = ps.getParameter("bdtWeightFileCracks"); - this->loadFile(); + loadFile(); } template <> @@ -83,7 +83,6 @@ double EcalDeadChannelRecoveryBDTG::recover( for (auto const &theCells : m3x3aroundDC) { EBDetId cell = EBDetId(theCells); if (cell == id) { - int iEtaCentral = std::abs(cell.ieta()); int iPhiCentral = cell.iphi(); @@ -93,21 +92,21 @@ double EcalDeadChannelRecoveryBDTG::recover( } if (!cell.null()) { EcalRecHitCollection::const_iterator goS_it = hit_collection.find(cell); - if (goS_it != hit_collection.end() && cell!=id) { - if (goS_it->energy() < single8Cut) { - *acceptFlag = false; - return 0.; - } else { - neighTotEn += goS_it->energy(); - mx_.rEn[cellIndex] = goS_it->energy(); - mx_.iphi[cellIndex] = cell.iphi(); - mx_.ieta[cellIndex] = cell.ieta(); - cellIndex++; - } - } else if (cell==id) { // the cell is the central one - mx_.rEn[cellIndex] = 0; - cellIndex++; - }else { //goS_it is not in the rechitcollection + if (goS_it != hit_collection.end() && cell != id) { + if (goS_it->energy() < single8Cut) { + *acceptFlag = false; + return 0.; + } else { + neighTotEn += goS_it->energy(); + mx_.rEn[cellIndex] = goS_it->energy(); + mx_.iphi[cellIndex] = cell.iphi(); + mx_.ieta[cellIndex] = cell.ieta(); + cellIndex++; + } + } else if (cell == id) { // the cell is the central one + mx_.rEn[cellIndex] = 0; + cellIndex++; + } else { //goS_it is not in the rechitcollection *acceptFlag = false; return 0.; } diff --git a/RecoLocalCalo/EcalRecProducers/python/ecalRecHit_cfi.py b/RecoLocalCalo/EcalRecProducers/python/ecalRecHit_cfi.py index cab0a08e6ad4a..16ce8d61708c5 100644 --- a/RecoLocalCalo/EcalRecProducers/python/ecalRecHit_cfi.py +++ b/RecoLocalCalo/EcalRecProducers/python/ecalRecHit_cfi.py @@ -49,7 +49,7 @@ # for channel recovery algoRecover = cms.string("EcalRecHitWorkerRecover"), - recoverEBIsolatedChannels = cms.bool(True),##default is false + recoverEBIsolatedChannels = cms.bool(False),##default is false recoverEEIsolatedChannels = cms.bool(False), recoverEBVFE = cms.bool(False), recoverEEVFE = cms.bool(False),