Skip to content

Commit

Permalink
Copy EcalDeadChannelRecoveryBDTG.* from master and fix ecalRecHit_cfi…
Browse files Browse the repository at this point in the history
….py for dead cells recovery to be off per default
  • Loading branch information
Rajdeep Mohan Chatterjee committed Feb 4, 2020
1 parent 606742e commit 7637c55
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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);
Expand All @@ -45,8 +44,8 @@ class EcalDeadChannelRecoveryBDTG {
edm::FileInPath bdtWeightFileNoCracks_;
edm::FileInPath bdtWeightFileCracks_;

TMVA::Reader *readerNoCrack;
TMVA::Reader *readerCrack;
std::unique_ptr<TMVA::Reader> readerNoCrack;
std::unique_ptr<TMVA::Reader> readerCrack;
};

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ void EcalDeadChannelRecoveryBDTG<EBDetId>::addVariables(TMVA::Reader *reader) {
}
template <>
void EcalDeadChannelRecoveryBDTG<EBDetId>::loadFile() {
readerNoCrack = new TMVA::Reader("!Color:!Silent");
readerCrack = new TMVA::Reader("!Color:!Silent");
readerNoCrack = std::unique_ptr<TMVA::Reader>(new TMVA::Reader("!Color:!Silent"));
readerCrack = std::unique_ptr<TMVA::Reader>(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 <typename T>
Expand All @@ -51,7 +51,7 @@ void EcalDeadChannelRecoveryBDTG<EBDetId>::setParameters(const edm::ParameterSet
bdtWeightFileNoCracks_ = ps.getParameter<edm::FileInPath>("bdtWeightFileNoCracks");
bdtWeightFileCracks_ = ps.getParameter<edm::FileInPath>("bdtWeightFileCracks");

this->loadFile();
loadFile();
}

template <>
Expand Down Expand Up @@ -83,7 +83,6 @@ double EcalDeadChannelRecoveryBDTG<EBDetId>::recover(
for (auto const &theCells : m3x3aroundDC) {
EBDetId cell = EBDetId(theCells);
if (cell == id) {

int iEtaCentral = std::abs(cell.ieta());
int iPhiCentral = cell.iphi();

Expand All @@ -93,21 +92,21 @@ double EcalDeadChannelRecoveryBDTG<EBDetId>::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.;
}
Expand Down
2 changes: 1 addition & 1 deletion RecoLocalCalo/EcalRecProducers/python/ecalRecHit_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 7637c55

Please sign in to comment.