CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes
PFRecoTauDiscriminationAgainstElectronDeadECAL Class Reference
Inheritance diagram for PFRecoTauDiscriminationAgainstElectronDeadECAL:
TauDiscriminationProducerBase< TauType, TauDiscriminator > edm::stream::EDProducer<>

Classes

struct  towerInfo
 

Public Member Functions

void beginEvent (const edm::Event &evt, const edm::EventSetup &es) override
 
double discriminate (const PFTauRef &pfTau) const override
 
 PFRecoTauDiscriminationAgainstElectronDeadECAL (const edm::ParameterSet &cfg)
 
 ~PFRecoTauDiscriminationAgainstElectronDeadECAL () override
 
- Public Member Functions inherited from TauDiscriminationProducerBase< TauType, TauDiscriminator >
virtual double discriminate (const TauRef &tau) const =0
 
virtual void endEvent (edm::Event &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 TauDiscriminationProducerBase (const edm::ParameterSet &iConfig)
 
 TauDiscriminationProducerBase ()
 
 ~TauDiscriminationProducerBase () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from TauDiscriminationProducerBase< TauType, TauDiscriminator >
static void fillProducerDescriptions (edm::ParameterSetDescription &desc)
 

Private Types

typedef ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiE4D< double > > PolarLorentzVector
 

Private Member Functions

template<class Id >
void loopXtals (std::map< uint32_t, unsigned > &nBadCrystals, std::map< uint32_t, unsigned > &maxStatus, std::map< uint32_t, double > &sumEta, std::map< uint32_t, double > &sumPhi, const EcalChannelStatus *channelStatus, const CaloGeometry *caloGeometry, const EcalTrigTowerConstituentsMap *ttMap) const
 
void updateBadTowers (const edm::EventSetup &es)
 

Private Attributes

std::vector< towerInfobadTowers_
 
uint32_t caloGeometryId_cache_
 
uint32_t channelStatusId_cache_
 
double dR_
 
uint32_t idealGeometryId_cache_
 
bool isFirstEvent_
 
unsigned minStatus_
 
std::string moduleLabel_
 
int verbosity_
 

Static Private Attributes

static const uint16_t statusMask_ = 0x1F
 

Additional Inherited Members

- Public Types inherited from TauDiscriminationProducerBase< TauType, TauDiscriminator >
typedef std::vector< TauType > TauCollection
 
typedef edm::Ref< TauCollectionTauRef
 
typedef edm::RefProd< TauCollectionTauRefProd
 
- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Protected Attributes inherited from TauDiscriminationProducerBase< TauType, TauDiscriminator >
std::string moduleLabel_
 
double prediscriminantFailValue_
 
edm::EDGetTokenT< TauCollectionTau_token
 
size_t tauIndex_
 
edm::InputTag TauProducer_
 

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

Authors
Lauri Andreas Wendland, Christian Veelken

Definition at line 38 of file PFRecoTauDiscriminationAgainstElectronDeadECAL.cc.

Member Typedef Documentation

Constructor & Destructor Documentation

PFRecoTauDiscriminationAgainstElectronDeadECAL::PFRecoTauDiscriminationAgainstElectronDeadECAL ( const edm::ParameterSet cfg)
inlineexplicit
PFRecoTauDiscriminationAgainstElectronDeadECAL::~PFRecoTauDiscriminationAgainstElectronDeadECAL ( )
inlineoverride

Definition at line 49 of file PFRecoTauDiscriminationAgainstElectronDeadECAL.cc.

49 {}

Member Function Documentation

void PFRecoTauDiscriminationAgainstElectronDeadECAL::beginEvent ( const edm::Event evt,
const edm::EventSetup es 
)
inlineoverridevirtual
double PFRecoTauDiscriminationAgainstElectronDeadECAL::discriminate ( const PFTauRef pfTau) const
inlineoverride

Definition at line 53 of file PFRecoTauDiscriminationAgainstElectronDeadECAL.cc.

References reco::deltaR(), PDWG_TauSkim_cff::discriminator, and fillDescriptions().

53  {
54  if (verbosity_) {
55  edm::LogPrint("PFTauAgainstEleDeadECAL") << "<PFRecoTauDiscriminationAgainstElectronDeadECAL::discriminate>:";
56  edm::LogPrint("PFTauAgainstEleDeadECAL") << " moduleLabel = " << moduleLabel_;
57  edm::LogPrint("PFTauAgainstEleDeadECAL") << "#badTowers = " << badTowers_.size();
58  edm::LogPrint("PFTauAgainstEleDeadECAL")
59  << "tau: Pt = " << pfTau->pt() << ", eta = " << pfTau->eta() << ", phi = " << pfTau->phi();
60  }
61  double discriminator = 1.;
62  for (std::vector<towerInfo>::const_iterator badTower = badTowers_.begin(); badTower != badTowers_.end();
63  ++badTower) {
64  if (deltaR(badTower->eta_, badTower->phi_, pfTau->eta(), pfTau->phi()) < dR_) {
65  if (verbosity_) {
66  edm::LogPrint("PFTauAgainstEleDeadECAL")
67  << " matches badTower: eta = " << badTower->eta_ << ", phi = " << badTower->phi_;
68  }
69  discriminator = 0.;
70  }
71  }
72  if (verbosity_) {
73  edm::LogPrint("PFTauAgainstEleDeadECAL") << "--> discriminator = " << discriminator;
74  }
75  return discriminator;
76  }
void PFRecoTauDiscriminationAgainstElectronDeadECAL::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 175 of file PFRecoTauDiscriminationAgainstElectronDeadECAL.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addOptional(), DEFINE_FWK_MODULE, HLT_2018_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

175  {
176  // pfRecoTauDiscriminationAgainstElectronDeadECAL
178  desc.add<int>("verbosity", 0);
179  {
180  edm::ParameterSetDescription pset_Prediscriminants;
181  pset_Prediscriminants.add<std::string>("BooleanOperator", "and");
182  {
184  psd1.add<double>("cut");
185  psd1.add<edm::InputTag>("Producer");
186  pset_Prediscriminants.addOptional<edm::ParameterSetDescription>("leadTrack", psd1);
187  }
188  {
189  // encountered this at
190  // RecoTauTag/Configuration/python/HPSPFTaus_cff.py
192  psd1.add<double>("cut");
193  psd1.add<edm::InputTag>("Producer");
194  pset_Prediscriminants.addOptional<edm::ParameterSetDescription>("decayMode", psd1);
195  }
196  desc.add<edm::ParameterSetDescription>("Prediscriminants", pset_Prediscriminants);
197  }
198  desc.add<double>("dR", 0.08);
199  desc.add<edm::InputTag>("PFTauProducer", edm::InputTag("pfTauProducer"));
200  desc.add<unsigned int>("minStatus", 12);
201  descriptions.add("pfRecoTauDiscriminationAgainstElectronDeadECAL", desc);
202 }
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
template<class Id >
void PFRecoTauDiscriminationAgainstElectronDeadECAL::loopXtals ( std::map< uint32_t, unsigned > &  nBadCrystals,
std::map< uint32_t, unsigned > &  maxStatus,
std::map< uint32_t, double > &  sumEta,
std::map< uint32_t, double > &  sumPhi,
const EcalChannelStatus channelStatus,
const CaloGeometry caloGeometry,
const EcalTrigTowerConstituentsMap ttMap 
) const
inlineprivate

Definition at line 123 of file PFRecoTauDiscriminationAgainstElectronDeadECAL.cc.

References EcalCondObjectContainer< T >::end(), PV3DBase< T, PVType, FrameType >::eta(), EcalCondObjectContainer< T >::find(), EcalCondObjectContainer< T >::getMap(), CaloGeometry::getPosition(), mps_fire::i, crabWrapper::key, Max(), PV3DBase< T, PVType, FrameType >::phi(), point, mps_update::status, and EcalTrigTowerConstituentsMap::towerOf().

129  {
130  // NOTE: modified version of SUSY CAF code
131  // UserCode/SusyCAF/plugins/SusyCAF_EcalDeadChannels.cc
132  for (int i = 0; i < Id::kSizeForDenseIndexing; ++i) {
133  Id id = Id::unhashIndex(i);
134  if (id == Id(0))
135  continue;
136  EcalChannelStatusMap::const_iterator it = channelStatus->getMap().find(id.rawId());
137  unsigned status = (it == channelStatus->end()) ? 0 : (it->getStatusCode() & statusMask_);
138  if (status >= minStatus_) {
139  const GlobalPoint& point = caloGeometry->getPosition(id);
140  uint32_t key = ttMap->towerOf(id);
141  maxStatus[key] = TMath::Max(status, maxStatus[key]);
142  ++nBadCrystals[key];
143  sumEta[key] += point.eta();
144  sumPhi[key] += point.phi();
145  }
146  }
147  }
const self & getMap() const
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
EcalTrigTowerDetId towerOf(const DetId &id) const
Get the tower id for this det id (or null if not known)
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:50
T Max(T a, T b)
Definition: MathUtil.h:44
std::vector< Item >::const_iterator const_iterator
T eta() const
Definition: PV3DBase.h:73
const_iterator find(uint32_t rawId) const
const_iterator end() const
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
void PFRecoTauDiscriminationAgainstElectronDeadECAL::updateBadTowers ( const edm::EventSetup es)
inlineprivate

Definition at line 81 of file PFRecoTauDiscriminationAgainstElectronDeadECAL.cc.

References edm::EventSetup::get(), crabWrapper::key, and edm::ESHandle< T >::product().

81  {
82  // NOTE: modified version of SUSY CAF code
83  // UserCode/SusyCAF/plugins/SusyCAF_EcalDeadChannels.cc
84  const uint32_t channelStatusId = es.get<EcalChannelStatusRcd>().cacheIdentifier();
85  const uint32_t caloGeometryId = es.get<CaloGeometryRecord>().cacheIdentifier();
86  const uint32_t idealGeometryId = es.get<IdealGeometryRecord>().cacheIdentifier();
87 
88  if (!isFirstEvent_ && channelStatusId == channelStatusId_cache_ && caloGeometryId == caloGeometryId_cache_ &&
89  idealGeometryId == idealGeometryId_cache_)
90  return;
91 
93  es.get<EcalChannelStatusRcd>().get(channelStatus);
94  channelStatusId_cache_ = channelStatusId;
95 
96  edm::ESHandle<CaloGeometry> caloGeometry;
97  es.get<CaloGeometryRecord>().get(caloGeometry);
98  caloGeometryId_cache_ = caloGeometryId;
99 
101  es.get<IdealGeometryRecord>().get(ttMap);
102  idealGeometryId_cache_ = idealGeometryId;
103 
104  std::map<uint32_t, unsigned> nBadCrystals, maxStatus;
105  std::map<uint32_t, double> sumEta, sumPhi;
106 
107  loopXtals<EBDetId>(
108  nBadCrystals, maxStatus, sumEta, sumPhi, channelStatus.product(), caloGeometry.product(), ttMap.product());
109  loopXtals<EEDetId>(
110  nBadCrystals, maxStatus, sumEta, sumPhi, channelStatus.product(), caloGeometry.product(), ttMap.product());
111 
112  badTowers_.clear();
113  for (std::map<uint32_t, unsigned>::const_iterator it = nBadCrystals.begin(); it != nBadCrystals.end(); ++it) {
114  uint32_t key = it->first;
115  badTowers_.push_back(
116  towerInfo(key, it->second, maxStatus[key], sumEta[key] / it->second, sumPhi[key] / it->second));
117  }
118 
119  isFirstEvent_ = false;
120  }
T get() const
Definition: EventSetup.h:73
T const * product() const
Definition: ESHandle.h:86

Member Data Documentation

std::vector<towerInfo> PFRecoTauDiscriminationAgainstElectronDeadECAL::badTowers_
private
uint32_t PFRecoTauDiscriminationAgainstElectronDeadECAL::caloGeometryId_cache_
private
uint32_t PFRecoTauDiscriminationAgainstElectronDeadECAL::channelStatusId_cache_
private
double PFRecoTauDiscriminationAgainstElectronDeadECAL::dR_
private
uint32_t PFRecoTauDiscriminationAgainstElectronDeadECAL::idealGeometryId_cache_
private
bool PFRecoTauDiscriminationAgainstElectronDeadECAL::isFirstEvent_
private
unsigned PFRecoTauDiscriminationAgainstElectronDeadECAL::minStatus_
private
std::string PFRecoTauDiscriminationAgainstElectronDeadECAL::moduleLabel_
private
const uint16_t PFRecoTauDiscriminationAgainstElectronDeadECAL::statusMask_ = 0x1F
staticprivate
int PFRecoTauDiscriminationAgainstElectronDeadECAL::verbosity_
private