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_
 
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::AntiElectronDeadECAL ( const edm::ParameterSet cfg,
edm::ConsumesCollector &&  cc 
)
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")),
24  isFirstEvent_(true) {}

◆ ~AntiElectronDeadECAL()

AntiElectronDeadECAL::~AntiElectronDeadECAL ( )

Definition at line 26 of file AntiElectronDeadECAL.cc.

26 {}

Member Function Documentation

◆ beginEvent()

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

◆ operator()()

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

Definition at line 112 of file AntiElectronDeadECAL.cc.

112  {
113  bool isNearBadTower = false;
114  double tau_eta = tau->eta();
115  double tau_phi = tau->phi();
116  const reco::Candidate* leadChargedHadron = nullptr;
118  const reco::PFTau* pfTau = dynamic_cast<const reco::PFTau*>(tau);
119  if (pfTau != nullptr) {
120  leadChargedHadron = pfTau->leadChargedHadrCand().isNonnull() ? pfTau->leadChargedHadrCand().get() : nullptr;
121  } else {
122  const pat::Tau* patTau = dynamic_cast<const pat::Tau*>(tau);
123  if (patTau != nullptr) {
124  leadChargedHadron = patTau->leadChargedHadrCand().isNonnull() ? patTau->leadChargedHadrCand().get() : nullptr;
125  }
126  }
127  }
128  if (leadChargedHadron != nullptr) {
129  bool success = false;
130  reco::Candidate::Point positionAtECalEntrance = positionAtECalEntrance_(leadChargedHadron, success);
131  if (success) {
132  tau_eta = positionAtECalEntrance.eta();
133  tau_phi = positionAtECalEntrance.phi();
134  }
135  }
136  if (verbosity_) {
137  edm::LogPrint("TauAgainstEleDeadECAL") << "<AntiElectronDeadECal::operator()>:";
138  edm::LogPrint("TauAgainstEleDeadECAL") << " #badTowers = " << badTowers_.size();
139  if (leadChargedHadron != nullptr) {
140  edm::LogPrint("TauAgainstEleDeadECAL")
141  << " leadChargedHadron (" << leadChargedHadron->pdgId() << "): Pt = " << leadChargedHadron->pt()
142  << ", eta at ECAL (vtx) = " << tau_eta << " (" << leadChargedHadron->eta() << ")"
143  << ", phi at ECAL (vtx) = " << tau_phi << " (" << leadChargedHadron->phi() << ")";
144  } else {
145  edm::LogPrint("TauAgainstEleDeadECAL")
146  << " tau: Pt = " << tau->pt() << ", eta at vtx = " << tau_eta << ", phi at vtx = " << tau_phi;
147  }
148  }
149  for (auto const& badTower : badTowers_) {
150  if (deltaR2(badTower.eta_, badTower.phi_, tau_eta, tau_phi) < dR2_) {
151  if (verbosity_) {
152  edm::LogPrint("TauAgainstEleDeadECAL")
153  << " matches badTower: eta = " << badTower.eta_ << ", phi = " << badTower.phi_;
154  }
155  isNearBadTower = true;
156  break;
157  }
158  }
159  return isNearBadTower;
160 }

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_.

◆ updateBadTowers()

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

Definition at line 64 of file AntiElectronDeadECAL.cc.

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

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

Referenced by beginEvent().

Member Data Documentation

◆ badTowers_

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

Definition at line 64 of file AntiElectronDeadECAL.h.

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

◆ caloGeometryWatcher_

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

Definition at line 68 of file AntiElectronDeadECAL.h.

Referenced by updateBadTowers().

◆ channelStatusWatcher_

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

Definition at line 67 of file AntiElectronDeadECAL.h.

Referenced by updateBadTowers().

◆ dR2_

const double AntiElectronDeadECAL::dR2_
private

Definition at line 46 of file AntiElectronDeadECAL.h.

Referenced by operator()().

◆ extrapolateToECalEntrance_

const bool AntiElectronDeadECAL::extrapolateToECalEntrance_
private

Definition at line 47 of file AntiElectronDeadECAL.h.

Referenced by operator()().

◆ idealGeometryWatcher_

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

Definition at line 69 of file AntiElectronDeadECAL.h.

Referenced by updateBadTowers().

◆ isFirstEvent_

bool AntiElectronDeadECAL::isFirstEvent_
private

Definition at line 71 of file AntiElectronDeadECAL.h.

Referenced by updateBadTowers().

◆ minStatus_

const unsigned AntiElectronDeadECAL::minStatus_
private

Definition at line 45 of file AntiElectronDeadECAL.h.

Referenced by updateBadTowers().

◆ positionAtECalEntrance_

PositionAtECalEntranceComputer AntiElectronDeadECAL::positionAtECalEntrance_
private

Definition at line 50 of file AntiElectronDeadECAL.h.

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

◆ statusMask_

const uint16_t AntiElectronDeadECAL::statusMask_ = 0x1F
staticprivate

Definition at line 65 of file AntiElectronDeadECAL.h.

Referenced by updateBadTowers().

◆ verbosity_

const int AntiElectronDeadECAL::verbosity_
private

Definition at line 48 of file AntiElectronDeadECAL.h.

Referenced by operator()().

pat::Tau::leadChargedHadrCand
const reco::CandidatePtr leadChargedHadrCand() const
AntiElectronDeadECAL::statusMask_
static const uint16_t statusMask_
Definition: AntiElectronDeadECAL.h:65
edm::ESWatcher::check
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:52
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
AntiElectronDeadECAL::isFirstEvent_
bool isFirstEvent_
Definition: AntiElectronDeadECAL.h:71
runTauDisplay.tau_eta
tau_eta
Definition: runTauDisplay.py:126
AntiElectronDeadECAL::verbosity_
const int verbosity_
Definition: AntiElectronDeadECAL.h:48
metsig::tau
Definition: SignAlgoResolutions.h:49
reco::Candidate::eta
virtual double eta() const =0
momentum pseudorapidity
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
AntiElectronDeadECAL::dR2_
const double dR2_
Definition: AntiElectronDeadECAL.h:46
pat::Tau
Analysis-level tau class.
Definition: Tau.h:53
edm::LogPrint
Log< level::Warning, true > LogPrint
Definition: MessageLogger.h:130
reco::Candidate::pt
virtual double pt() const =0
transverse momentum
reco::PFTau
Definition: PFTau.h:36
edm::Ptr::get
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:139
AntiElectronDeadECAL::caloGeometryWatcher_
edm::ESWatcher< CaloGeometryRecord > caloGeometryWatcher_
Definition: AntiElectronDeadECAL.h:68
PositionAtECalEntranceComputer
Definition: PositionAtECalEntranceComputer.h:25
AntiElectronDeadECAL::updateBadTowers
void updateBadTowers(const edm::EventSetup &)
Definition: AntiElectronDeadECAL.cc:64
PositionAtECalEntranceComputer::beginEvent
void beginEvent(const edm::EventSetup &)
Definition: PositionAtECalEntranceComputer.cc:25
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
edm::ESHandle
Definition: DTSurvey.h:22
AntiElectronDeadECAL::idealGeometryWatcher_
edm::ESWatcher< IdealGeometryRecord > idealGeometryWatcher_
Definition: AntiElectronDeadECAL.h:69
summarizeEdmComparisonLogfiles.success
success
Definition: summarizeEdmComparisonLogfiles.py:115
runTauDisplay.tau_phi
tau_phi
Definition: runTauDisplay.py:127
reco::PFTau::leadChargedHadrCand
const CandidatePtr & leadChargedHadrCand() const
Definition: PFTau.cc:64
AntiElectronDeadECAL::positionAtECalEntrance_
PositionAtECalEntranceComputer positionAtECalEntrance_
Definition: AntiElectronDeadECAL.h:50
AntiElectronDeadECAL::minStatus_
const unsigned minStatus_
Definition: AntiElectronDeadECAL.h:45
EcalChannelStatusRcd
Definition: EcalChannelStatusRcd.h:5
get
#define get
cc
reco::Candidate::pdgId
virtual int pdgId() const =0
PDG identifier.
looper.cfg
cfg
Definition: looper.py:297
reco::Candidate
Definition: Candidate.h:27
AntiElectronDeadECAL::channelStatusWatcher_
edm::ESWatcher< EcalChannelStatusRcd > channelStatusWatcher_
Definition: AntiElectronDeadECAL.h:67
HLTMuonOfflineAnalyzer_cfi.deltaR2
deltaR2
Definition: HLTMuonOfflineAnalyzer_cfi.py:105
edm::Ptr::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:146
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
reco::Candidate::Point
math::XYZPoint Point
point in the space
Definition: Candidate.h:40
crabWrapper.key
key
Definition: crabWrapper.py:19
reco::Candidate::phi
virtual double phi() const =0
momentum azimuthal angle
AntiElectronDeadECAL::extrapolateToECalEntrance_
const bool extrapolateToECalEntrance_
Definition: AntiElectronDeadECAL.h:47
IdealGeometryRecord
Definition: IdealGeometryRecord.h:25
AntiElectronDeadECAL::badTowers_
std::vector< TowerInfo > badTowers_
Definition: AntiElectronDeadECAL.h:64