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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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 51 of file PFRecoTauDiscriminationAgainstElectronDeadECAL.cc.

51 {}

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

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

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

Definition at line 184 of file PFRecoTauDiscriminationAgainstElectronDeadECAL.cc.

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

184  {
185  // pfRecoTauDiscriminationAgainstElectronDeadECAL
187  desc.add<int>("verbosity", 0);
188  {
189  edm::ParameterSetDescription pset_Prediscriminants;
190  pset_Prediscriminants.add<std::string>("BooleanOperator", "and");
191  {
193  psd1.add<double>("cut");
194  psd1.add<edm::InputTag>("Producer");
195  pset_Prediscriminants.addOptional<edm::ParameterSetDescription>("leadTrack", psd1);
196  }
197  {
198  // encountered this at
199  // RecoTauTag/Configuration/python/HPSPFTaus_cff.py
201  psd1.add<double>("cut");
202  psd1.add<edm::InputTag>("Producer");
203  pset_Prediscriminants.addOptional<edm::ParameterSetDescription>("decayMode", psd1);
204  }
205  desc.add<edm::ParameterSetDescription>("Prediscriminants", pset_Prediscriminants);
206  }
207  desc.add<double>("dR", 0.08);
208  desc.add<edm::InputTag>("PFTauProducer", edm::InputTag("pfTauProducer"));
209  desc.add<unsigned int>("minStatus", 12);
210  descriptions.add("pfRecoTauDiscriminationAgainstElectronDeadECAL", desc);
211 }
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 124 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().

131  {
132  // NOTE: modified version of SUSY CAF code
133  // UserCode/SusyCAF/plugins/SusyCAF_EcalDeadChannels.cc
134  for ( int i = 0; i < Id::kSizeForDenseIndexing; ++i ) {
135  Id id = Id::unhashIndex(i);
136  if ( id == Id(0) ) continue;
137  EcalChannelStatusMap::const_iterator it = channelStatus->getMap().find(id.rawId());
138  unsigned status = ( it == channelStatus->end() ) ?
139  0 : (it->getStatusCode() & statusMask_);
140  if ( status >= minStatus_ ) {
141  const GlobalPoint& point = caloGeometry->getPosition(id);
142  uint32_t key = ttMap->towerOf(id);
143  maxStatus[key] = TMath::Max(status, maxStatus[key]);
144  ++nBadCrystals[key];
145  sumEta[key] += point.eta();
146  sumPhi[key] += point.phi();
147  }
148  }
149  }
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 85 of file PFRecoTauDiscriminationAgainstElectronDeadECAL.cc.

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

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