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 &)
 
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_
 
edm::ESWatcher< CaloGeometryRecordcaloGeometryWatcher_
 
edm::ESWatcher< EcalChannelStatusRcdchannelStatusWatcher_
 
const double dR2_
 
const bool extrapolateToECalEntrance_
 
edm::ESWatcher< IdealGeometryRecordidealGeometryWatcher_
 
bool isFirstEvent_
 
const unsigned minStatus_
 
PositionAtECalEntranceComputer positionAtECalEntrance_
 
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 35 of file AntiElectronDeadECAL.h.

Constructor & Destructor Documentation

AntiElectronDeadECAL::AntiElectronDeadECAL ( const edm::ParameterSet cfg)
explicit

Definition at line 18 of file AntiElectronDeadECAL.cc.

19  : minStatus_(cfg.getParameter<uint32_t>("minStatus")),
20  dR2_(std::pow(cfg.getParameter<double>("dR"), 2)),
21  extrapolateToECalEntrance_(cfg.getParameter<bool>("extrapolateToECalEntrance")),
22  verbosity_(cfg.getParameter<int>("verbosity")),
23  isFirstEvent_(true) {}
T getParameter(std::string const &) const
const bool extrapolateToECalEntrance_
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
AntiElectronDeadECAL::~AntiElectronDeadECAL ( )

Definition at line 25 of file AntiElectronDeadECAL.cc.

25 {}

Member Function Documentation

void AntiElectronDeadECAL::beginEvent ( const edm::EventSetup es)
bool AntiElectronDeadECAL::operator() ( const reco::Candidate tau) const

Definition at line 111 of file AntiElectronDeadECAL.cc.

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

111  {
112  bool isNearBadTower = false;
113  double tau_eta = tau->eta();
114  double tau_phi = tau->phi();
115  const reco::Candidate* leadChargedHadron = nullptr;
117  const reco::PFTau* pfTau = dynamic_cast<const reco::PFTau*>(tau);
118  if (pfTau != nullptr) {
119  leadChargedHadron = pfTau->leadPFChargedHadrCand().isNonnull() ? pfTau->leadPFChargedHadrCand().get() : nullptr;
120  } else {
121  const pat::Tau* patTau = dynamic_cast<const pat::Tau*>(tau);
122  if (patTau != nullptr) {
123  leadChargedHadron = patTau->leadChargedHadrCand().isNonnull() ? patTau->leadChargedHadrCand().get() : nullptr;
124  }
125  }
126  }
127  if (leadChargedHadron != nullptr) {
128  bool success = false;
129  reco::Candidate::Point positionAtECalEntrance = positionAtECalEntrance_(leadChargedHadron, success);
130  if (success) {
131  tau_eta = positionAtECalEntrance.eta();
132  tau_phi = positionAtECalEntrance.phi();
133  }
134  }
135  if (verbosity_) {
136  edm::LogPrint("TauAgainstEleDeadECAL") << "<AntiElectronDeadECal::operator()>:";
137  edm::LogPrint("TauAgainstEleDeadECAL") << " #badTowers = " << badTowers_.size();
138  if (leadChargedHadron != nullptr) {
139  edm::LogPrint("TauAgainstEleDeadECAL")
140  << " leadChargedHadron (" << leadChargedHadron->pdgId() << "): Pt = " << leadChargedHadron->pt()
141  << ", eta at ECAL (vtx) = " << tau_eta << " (" << leadChargedHadron->eta() << ")"
142  << ", phi at ECAL (vtx) = " << tau_phi << " (" << leadChargedHadron->phi() << ")";
143  } else {
144  edm::LogPrint("TauAgainstEleDeadECAL")
145  << " tau: Pt = " << tau->pt() << ", eta at vtx = " << tau_eta << ", phi at vtx = " << tau_phi;
146  }
147  }
148  for (auto const& badTower : badTowers_) {
149  if (deltaR2(badTower.eta_, badTower.phi_, tau_eta, tau_phi) < dR2_) {
150  if (verbosity_) {
151  edm::LogPrint("TauAgainstEleDeadECAL")
152  << " matches badTower: eta = " << badTower.eta_ << ", phi = " << badTower.phi_;
153  }
154  isNearBadTower = true;
155  break;
156  }
157  }
158  return isNearBadTower;
159 }
PositionAtECalEntranceComputer positionAtECalEntrance_
const PFCandidatePtr & leadPFChargedHadrCand() const
Definition: PFTau.cc:67
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:159
const bool extrapolateToECalEntrance_
std::vector< TowerInfo > badTowers_
virtual int pdgId() const =0
PDG identifier.
const reco::CandidatePtr leadChargedHadrCand() const
Analysis-level tau class.
Definition: Tau.h:55
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:168
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
virtual double eta() const =0
momentum pseudorapidity
virtual double pt() const =0
transverse momentum
math::XYZPoint Point
point in the space
Definition: Candidate.h:41
virtual double phi() const =0
momentum azimuthal angle
void AntiElectronDeadECAL::updateBadTowers ( const edm::EventSetup es)
private

Definition at line 63 of file AntiElectronDeadECAL.cc.

References badTowers_, caloGeometryWatcher_, channelStatusWatcher_, edm::ESWatcher< T >::check(), edm::EventSetup::get(), idealGeometryWatcher_, isFirstEvent_, crabWrapper::key, minStatus_, edm::ESHandle< T >::product(), and statusMask_.

Referenced by beginEvent().

63  {
64  // NOTE: modified version of SUSY CAF code
65  // UserCode/SusyCAF/plugins/SusyCAF_EcalDeadChannels.cc
66 
69  return;
70 
72  es.get<EcalChannelStatusRcd>().get(channelStatus);
73 
74  edm::ESHandle<CaloGeometry> caloGeometry;
75  es.get<CaloGeometryRecord>().get(caloGeometry);
76 
78  es.get<IdealGeometryRecord>().get(ttMap);
79 
80  std::map<uint32_t, unsigned> nBadCrystals, maxStatus;
81  std::map<uint32_t, double> sumEta, sumPhi;
82 
83  loopXtals<EBDetId>(nBadCrystals,
84  maxStatus,
85  sumEta,
86  sumPhi,
87  channelStatus.product(),
88  caloGeometry.product(),
89  ttMap.product(),
90  minStatus_,
91  statusMask_);
92  loopXtals<EEDetId>(nBadCrystals,
93  maxStatus,
94  sumEta,
95  sumPhi,
96  channelStatus.product(),
97  caloGeometry.product(),
98  ttMap.product(),
99  minStatus_,
100  statusMask_);
101 
102  badTowers_.clear();
103  for (auto it : nBadCrystals) {
104  uint32_t key = it.first;
105  badTowers_.push_back(TowerInfo(key, it.second, maxStatus[key], sumEta[key] / it.second, sumPhi[key] / it.second));
106  }
107 
108  isFirstEvent_ = false;
109 }
edm::ESWatcher< CaloGeometryRecord > caloGeometryWatcher_
edm::ESWatcher< IdealGeometryRecord > idealGeometryWatcher_
std::vector< TowerInfo > badTowers_
edm::ESWatcher< EcalChannelStatusRcd > channelStatusWatcher_
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
static const uint16_t statusMask_
T get() const
Definition: EventSetup.h:63
T const * product() const
Definition: ESHandle.h:86

Member Data Documentation

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

Definition at line 64 of file AntiElectronDeadECAL.h.

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

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

Definition at line 68 of file AntiElectronDeadECAL.h.

Referenced by updateBadTowers().

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

Definition at line 67 of file AntiElectronDeadECAL.h.

Referenced by updateBadTowers().

const double AntiElectronDeadECAL::dR2_
private

Definition at line 46 of file AntiElectronDeadECAL.h.

Referenced by operator()().

const bool AntiElectronDeadECAL::extrapolateToECalEntrance_
private

Definition at line 47 of file AntiElectronDeadECAL.h.

Referenced by operator()().

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

Definition at line 69 of file AntiElectronDeadECAL.h.

Referenced by updateBadTowers().

bool AntiElectronDeadECAL::isFirstEvent_
private

Definition at line 71 of file AntiElectronDeadECAL.h.

Referenced by updateBadTowers().

const unsigned AntiElectronDeadECAL::minStatus_
private

Definition at line 45 of file AntiElectronDeadECAL.h.

Referenced by updateBadTowers().

PositionAtECalEntranceComputer AntiElectronDeadECAL::positionAtECalEntrance_
private

Definition at line 50 of file AntiElectronDeadECAL.h.

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

const uint16_t AntiElectronDeadECAL::statusMask_ = 0x1F
staticprivate

Definition at line 65 of file AntiElectronDeadECAL.h.

Referenced by updateBadTowers().

const int AntiElectronDeadECAL::verbosity_
private

Definition at line 48 of file AntiElectronDeadECAL.h.

Referenced by operator()().