CMS 3D CMS Logo

List of all members | Classes | 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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

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 35 of file PFRecoTauDiscriminationAgainstElectronDeadECAL.cc.

Member Typedef Documentation

Constructor & Destructor Documentation

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

Definition at line 38 of file PFRecoTauDiscriminationAgainstElectronDeadECAL.cc.

References edm::ParameterSet::exists(), and edm::ParameterSet::getParameter().

40  moduleLabel_(cfg.getParameter<std::string>("@module_label")),
41  isFirstEvent_(true)
42  {
43  minStatus_ = cfg.getParameter<uint32_t>("minStatus");
44  dR_ = cfg.getParameter<double>("dR");
45 
46  verbosity_ = ( cfg.exists("verbosity") ) ?
47  cfg.getParameter<int>("verbosity") : 0;
48  }
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
TauDiscriminationProducerBase< reco::PFTau, reco::PFTauDiscriminator > PFTauDiscriminationProducerBase
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 56 of file PFRecoTauDiscriminationAgainstElectronDeadECAL.cc.

References reco::deltaR(), and mvaPFMET_leptons_cfi::discriminator.

57  {
58  if ( verbosity_ ) {
59  edm::LogPrint("PFTauAgainstEleDeadECAL") << "<PFRecoTauDiscriminationAgainstElectronDeadECAL::discriminate>:" ;
60  edm::LogPrint("PFTauAgainstEleDeadECAL") << " moduleLabel = " << moduleLabel_ ;
61  edm::LogPrint("PFTauAgainstEleDeadECAL") << "#badTowers = " << badTowers_.size() ;
62  edm::LogPrint("PFTauAgainstEleDeadECAL") << "tau: Pt = " << pfTau->pt() << ", eta = " << pfTau->eta() << ", phi = " << pfTau->phi() ;
63  }
64  double discriminator = 1.;
65  for ( std::vector<towerInfo>::const_iterator badTower = badTowers_.begin();
66  badTower != badTowers_.end(); ++badTower ) {
67  if ( deltaR(badTower->eta_, badTower->phi_, pfTau->eta(), pfTau->phi()) < dR_ ) {
68  if ( verbosity_ ) {
69  edm::LogPrint("PFTauAgainstEleDeadECAL") << " matches badTower: eta = " << badTower->eta_ << ", phi = " << badTower->phi_ ;
70  }
71  discriminator = 0.;
72  }
73  }
74  if ( verbosity_ ) {
75  edm::LogPrint("PFTauAgainstEleDeadECAL") << "--> discriminator = " << discriminator ;
76  }
77  return discriminator;
78  }
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
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 120 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().

127  {
128  // NOTE: modified version of SUSY CAF code
129  // UserCode/SusyCAF/plugins/SusyCAF_EcalDeadChannels.cc
130  for ( int i = 0; i < Id::kSizeForDenseIndexing; ++i ) {
131  Id id = Id::unhashIndex(i);
132  if ( id == Id(0) ) continue;
133  EcalChannelStatusMap::const_iterator it = channelStatus->getMap().find(id.rawId());
134  unsigned status = ( it == channelStatus->end() ) ?
135  0 : (it->getStatusCode() & statusMask_);
136  if ( status >= minStatus_ ) {
137  const GlobalPoint& point = caloGeometry->getPosition(id);
138  uint32_t key = ttMap->towerOf(id);
139  maxStatus[key] = TMath::Max(status, maxStatus[key]);
140  ++nBadCrystals[key];
141  sumEta[key] += point.eta();
142  sumPhi[key] += point.phi();
143  }
144  }
145  }
const self & getMap() const
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
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:74
T Max(T a, T b)
Definition: MathUtil.h:44
std::vector< Item >::const_iterator const_iterator
T eta() const
Definition: PV3DBase.h:76
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().

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