CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
AntiElectronDeadECAL Class Reference

#include <AntiElectronDeadECAL.h>

Classes

struct  TowerInfo
 

Public Member Functions

 AntiElectronDeadECAL (const edm::ParameterSet &, edm::ConsumesCollector &&)
 
void beginEvent (const edm::EventSetup &)
 
bool operator() (const reco::Candidate *tau) const
 
 ~AntiElectronDeadECAL ()
 

Private Member Functions

void updateBadTowers (const edm::EventSetup &)
 

Private Attributes

std::vector< TowerInfobadTowers_
 
const edm::ESGetToken< CaloGeometry, CaloGeometryRecordcaloGeometryToken_
 
edm::ESWatcher< CaloGeometryRecordcaloGeometryWatcher_
 
const edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcdchannelStatusToken_
 
edm::ESWatcher< EcalChannelStatusRcdchannelStatusWatcher_
 
const double dR2_
 
const bool extrapolateToECalEntrance_
 
edm::ESWatcher< IdealGeometryRecordidealGeometryWatcher_
 
bool isFirstEvent_
 
const unsigned minStatus_
 
PositionAtECalEntranceComputer positionAtECalEntrance_
 
const edm::ESGetToken< EcalTrigTowerConstituentsMap, IdealGeometryRecordttMapToken_
 
const int verbosity_
 

Static Private Attributes

static const uint16_t statusMask_ = 0x1F
 

Detailed Description

Flag tau candidates reconstructed near dead ECAL channels, in order to reduce e -> tau fakes not rejected by anti-e MVA discriminator

The motivation for this flag is this presentation: https://indico.cern.ch/getFile.py/access?contribId=0&resId=0&materialId=slides&confId=177223

Code adapted from: RecoTauTag/RecoTau/plugins/PFRecoTauDiscriminationAgainstElectronDeadECAL.cc

Authors
Lauri Andreas Wendland, Christian Veelken

Definition at line 37 of file AntiElectronDeadECAL.h.

Constructor & Destructor Documentation

◆ AntiElectronDeadECAL()

AntiElectronDeadECAL::AntiElectronDeadECAL ( const edm::ParameterSet cfg,
edm::ConsumesCollector &&  cc 
)
explicit

Definition at line 16 of file AntiElectronDeadECAL.cc.

17  : minStatus_(cfg.getParameter<uint32_t>("minStatus")),
18  dR2_(std::pow(cfg.getParameter<double>("dR"), 2)),
19  extrapolateToECalEntrance_(cfg.getParameter<bool>("extrapolateToECalEntrance")),
20  verbosity_(cfg.getParameter<int>("verbosity")),
23  ttMapToken_(cc.esConsumes()),
25  isFirstEvent_(true) {}
PositionAtECalEntranceComputer positionAtECalEntrance_
const edm::ESGetToken< EcalTrigTowerConstituentsMap, IdealGeometryRecord > ttMapToken_
const bool extrapolateToECalEntrance_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
const edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcd > channelStatusToken_
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ ~AntiElectronDeadECAL()

AntiElectronDeadECAL::~AntiElectronDeadECAL ( )

Definition at line 27 of file AntiElectronDeadECAL.cc.

27 {}

Member Function Documentation

◆ beginEvent()

void AntiElectronDeadECAL::beginEvent ( const edm::EventSetup es)

◆ operator()()

bool AntiElectronDeadECAL::operator() ( const reco::Candidate tau) const

Definition at line 94 of file AntiElectronDeadECAL.cc.

References badTowers_, HLTMuonOfflineAnalyzer_cfi::deltaR2, dR2_, reco::Candidate::eta(), extrapolateToECalEntrance_, edm::Ptr< T >::get(), edm::Ptr< T >::isNonnull(), reco::PFTau::leadChargedHadrCand(), pat::Tau::leadChargedHadrCand(), reco::Candidate::pdgId(), reco::Candidate::phi(), positionAtECalEntrance_, reco::Candidate::pt(), summarizeEdmComparisonLogfiles::success, metsig::tau, runTauDisplay::tau_eta, runTauDisplay::tau_phi, and verbosity_.

94  {
95  bool isNearBadTower = false;
96  double tau_eta = tau->eta();
97  double tau_phi = tau->phi();
98  const reco::Candidate* leadChargedHadron = nullptr;
100  const reco::PFTau* pfTau = dynamic_cast<const reco::PFTau*>(tau);
101  if (pfTau != nullptr) {
102  leadChargedHadron = pfTau->leadChargedHadrCand().isNonnull() ? pfTau->leadChargedHadrCand().get() : nullptr;
103  } else {
104  const pat::Tau* patTau = dynamic_cast<const pat::Tau*>(tau);
105  if (patTau != nullptr) {
106  leadChargedHadron = patTau->leadChargedHadrCand().isNonnull() ? patTau->leadChargedHadrCand().get() : nullptr;
107  }
108  }
109  }
110  if (leadChargedHadron != nullptr) {
111  bool success = false;
112  reco::Candidate::Point positionAtECalEntrance = positionAtECalEntrance_(leadChargedHadron, success);
113  if (success) {
114  tau_eta = positionAtECalEntrance.eta();
115  tau_phi = positionAtECalEntrance.phi();
116  }
117  }
118  if (verbosity_) {
119  edm::LogPrint("TauAgainstEleDeadECAL") << "<AntiElectronDeadECal::operator()>:";
120  edm::LogPrint("TauAgainstEleDeadECAL") << " #badTowers = " << badTowers_.size();
121  if (leadChargedHadron != nullptr) {
122  edm::LogPrint("TauAgainstEleDeadECAL")
123  << " leadChargedHadron (" << leadChargedHadron->pdgId() << "): Pt = " << leadChargedHadron->pt()
124  << ", eta at ECAL (vtx) = " << tau_eta << " (" << leadChargedHadron->eta() << ")"
125  << ", phi at ECAL (vtx) = " << tau_phi << " (" << leadChargedHadron->phi() << ")";
126  } else {
127  edm::LogPrint("TauAgainstEleDeadECAL")
128  << " tau: Pt = " << tau->pt() << ", eta at vtx = " << tau_eta << ", phi at vtx = " << tau_phi;
129  }
130  }
131  for (auto const& badTower : badTowers_) {
132  if (deltaR2(badTower.eta_, badTower.phi_, tau_eta, tau_phi) < dR2_) {
133  if (verbosity_) {
134  edm::LogPrint("TauAgainstEleDeadECAL")
135  << " matches badTower: eta = " << badTower.eta_ << ", phi = " << badTower.phi_;
136  }
137  isNearBadTower = true;
138  break;
139  }
140  }
141  return isNearBadTower;
142 }
PositionAtECalEntranceComputer positionAtECalEntrance_
virtual double pt() const =0
transverse momentum
const CandidatePtr & leadChargedHadrCand() const
Definition: PFTau.cc:63
const bool extrapolateToECalEntrance_
std::vector< TowerInfo > badTowers_
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:146
const reco::CandidatePtr leadChargedHadrCand() const
Log< level::Warning, true > LogPrint
Analysis-level tau class.
Definition: Tau.h:53
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:139
virtual int pdgId() const =0
PDG identifier.
math::XYZPoint Point
point in the space
Definition: Candidate.h:40
virtual double phi() const =0
momentum azimuthal angle
virtual double eta() const =0
momentum pseudorapidity

◆ updateBadTowers()

void AntiElectronDeadECAL::updateBadTowers ( const edm::EventSetup es)
private

Definition at line 65 of file AntiElectronDeadECAL.cc.

References badTowers_, caloGeometryToken_, caloGeometryWatcher_, channelStatusToken_, channelStatusWatcher_, edm::ESWatcher< T >::check(), edm::EventSetup::getData(), idealGeometryWatcher_, isFirstEvent_, crabWrapper::key, minStatus_, statusMask_, and ttMapToken_.

Referenced by beginEvent().

65  {
66  // NOTE: modified version of SUSY CAF code
67  // UserCode/SusyCAF/plugins/SusyCAF_EcalDeadChannels.cc
68 
71  return;
72 
73  auto const& channelStatus = es.getData(channelStatusToken_);
74  auto const& caloGeometry = es.getData(caloGeometryToken_);
75  auto const& ttMap = es.getData(ttMapToken_);
76 
77  std::map<uint32_t, unsigned> nBadCrystals, maxStatus;
78  std::map<uint32_t, double> sumEta, sumPhi;
79 
80  loopXtals<EBDetId>(
81  nBadCrystals, maxStatus, sumEta, sumPhi, &channelStatus, &caloGeometry, &ttMap, minStatus_, statusMask_);
82  loopXtals<EEDetId>(
83  nBadCrystals, maxStatus, sumEta, sumPhi, &channelStatus, &caloGeometry, &ttMap, minStatus_, statusMask_);
84 
85  badTowers_.clear();
86  for (auto it : nBadCrystals) {
87  uint32_t key = it.first;
88  badTowers_.push_back(TowerInfo(key, it.second, maxStatus[key], sumEta[key] / it.second, sumPhi[key] / it.second));
89  }
90 
91  isFirstEvent_ = false;
92 }
edm::ESWatcher< CaloGeometryRecord > caloGeometryWatcher_
const edm::ESGetToken< EcalTrigTowerConstituentsMap, IdealGeometryRecord > ttMapToken_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
edm::ESWatcher< IdealGeometryRecord > idealGeometryWatcher_
const edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcd > channelStatusToken_
std::vector< TowerInfo > badTowers_
edm::ESWatcher< EcalChannelStatusRcd > channelStatusWatcher_
bool getData(T &iHolder) const
Definition: EventSetup.h:122
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
static const uint16_t statusMask_

Member Data Documentation

◆ badTowers_

std::vector<TowerInfo> AntiElectronDeadECAL::badTowers_
private

Definition at line 69 of file AntiElectronDeadECAL.h.

Referenced by operator()(), and updateBadTowers().

◆ caloGeometryToken_

const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> AntiElectronDeadECAL::caloGeometryToken_
private

Definition at line 52 of file AntiElectronDeadECAL.h.

Referenced by updateBadTowers().

◆ caloGeometryWatcher_

edm::ESWatcher<CaloGeometryRecord> AntiElectronDeadECAL::caloGeometryWatcher_
private

Definition at line 73 of file AntiElectronDeadECAL.h.

Referenced by updateBadTowers().

◆ channelStatusToken_

const edm::ESGetToken<EcalChannelStatus, EcalChannelStatusRcd> AntiElectronDeadECAL::channelStatusToken_
private

Definition at line 51 of file AntiElectronDeadECAL.h.

Referenced by updateBadTowers().

◆ channelStatusWatcher_

edm::ESWatcher<EcalChannelStatusRcd> AntiElectronDeadECAL::channelStatusWatcher_
private

Definition at line 72 of file AntiElectronDeadECAL.h.

Referenced by updateBadTowers().

◆ dR2_

const double AntiElectronDeadECAL::dR2_
private

Definition at line 48 of file AntiElectronDeadECAL.h.

Referenced by operator()().

◆ extrapolateToECalEntrance_

const bool AntiElectronDeadECAL::extrapolateToECalEntrance_
private

Definition at line 49 of file AntiElectronDeadECAL.h.

Referenced by operator()().

◆ idealGeometryWatcher_

edm::ESWatcher<IdealGeometryRecord> AntiElectronDeadECAL::idealGeometryWatcher_
private

Definition at line 74 of file AntiElectronDeadECAL.h.

Referenced by updateBadTowers().

◆ isFirstEvent_

bool AntiElectronDeadECAL::isFirstEvent_
private

Definition at line 76 of file AntiElectronDeadECAL.h.

Referenced by updateBadTowers().

◆ minStatus_

const unsigned AntiElectronDeadECAL::minStatus_
private

Definition at line 47 of file AntiElectronDeadECAL.h.

Referenced by updateBadTowers().

◆ positionAtECalEntrance_

PositionAtECalEntranceComputer AntiElectronDeadECAL::positionAtECalEntrance_
private

Definition at line 55 of file AntiElectronDeadECAL.h.

Referenced by beginEvent(), and operator()().

◆ statusMask_

const uint16_t AntiElectronDeadECAL::statusMask_ = 0x1F
staticprivate

Definition at line 70 of file AntiElectronDeadECAL.h.

Referenced by updateBadTowers().

◆ ttMapToken_

const edm::ESGetToken<EcalTrigTowerConstituentsMap, IdealGeometryRecord> AntiElectronDeadECAL::ttMapToken_
private

Definition at line 53 of file AntiElectronDeadECAL.h.

Referenced by updateBadTowers().

◆ verbosity_

const int AntiElectronDeadECAL::verbosity_
private

Definition at line 50 of file AntiElectronDeadECAL.h.

Referenced by operator()().