CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Attributes
ElectronPFIsolationWithMapBasedVeto Class Reference
Inheritance diagram for ElectronPFIsolationWithMapBasedVeto:
citk::IsolationConeDefinitionBase

Public Member Functions

 ElectronPFIsolationWithMapBasedVeto (const edm::ParameterSet &c)
 
 ElectronPFIsolationWithMapBasedVeto (const ElectronPFIsolationWithMapBasedVeto &)=delete
 
void getEventInfo (const edm::Event &iEvent) override
 
bool isInIsolationCone (const reco::CandidatePtr &photon, const reco::CandidatePtr &other) const final
 
ElectronPFIsolationWithMapBasedVetooperator= (const ElectronPFIsolationWithMapBasedVeto &)=delete
 
void setConsumes (edm::ConsumesCollector iC) override
 
 ~ElectronPFIsolationWithMapBasedVeto () override
 Destructor. More...
 
- Public Member Functions inherited from citk::IsolationConeDefinitionBase
const std::string & additionalCode () const
 
virtual void getEventSetupInfo (const edm::EventSetup &)
 
 IsolationConeDefinitionBase (const edm::ParameterSet &c)
 
 IsolationConeDefinitionBase (const IsolationConeDefinitionBase &)=delete
 
const std::string & name () const
 
IsolationConeDefinitionBaseoperator= (const IsolationConeDefinitionBase &)=delete
 
virtual ~IsolationConeDefinitionBase ()
 Destructor. More...
 

Public Attributes

edm::Handle< edm::ValueMap< std::vector< reco::PFCandidateRef > > > particleBasedIsolationMap
 
edm::EDGetTokenT< edm::ValueMap< std::vector< reco::PFCandidateRef > > > particleBasedIsolationToken_
 

Private Attributes

const std::string _isolateAgainst
 
const std::vector< unsigned > _miniAODVertexCodes
 
const edm::InputTag _particleBasedIsolation
 
const std::string _vertexCollection
 

Additional Inherited Members

- Protected Attributes inherited from citk::IsolationConeDefinitionBase
std::string _additionalCode
 
const float _coneSize2
 

Detailed Description

Definition at line 66 of file ElectronPFIsolationWithMapBasedVeto.cc.

Constructor & Destructor Documentation

◆ ElectronPFIsolationWithMapBasedVeto() [1/2]

ElectronPFIsolationWithMapBasedVeto::ElectronPFIsolationWithMapBasedVeto ( const edm::ParameterSet c)
inline

Definition at line 68 of file ElectronPFIsolationWithMapBasedVeto.cc.

70  _isolateAgainst(c.getParameter<std::string>("isolateAgainst")), //isolate against either h+, h0 or gamma
71  _miniAODVertexCodes(c.getParameter<std::vector<unsigned> >(
72  "miniAODVertexCodes")), //quality flags to be used for association with the vertex configurable, the vertex can be chosen
73  _particleBasedIsolation(c.getParameter<edm::InputTag>("particleBasedIsolation")) {
74  } // particle based isolation map (used for footprint removal)

◆ ElectronPFIsolationWithMapBasedVeto() [2/2]

ElectronPFIsolationWithMapBasedVeto::ElectronPFIsolationWithMapBasedVeto ( const ElectronPFIsolationWithMapBasedVeto )
delete

◆ ~ElectronPFIsolationWithMapBasedVeto()

ElectronPFIsolationWithMapBasedVeto::~ElectronPFIsolationWithMapBasedVeto ( )
inlineoverride

Destructor.

Definition at line 96 of file ElectronPFIsolationWithMapBasedVeto.cc.

96 {};

Member Function Documentation

◆ getEventInfo()

void ElectronPFIsolationWithMapBasedVeto::getEventInfo ( const edm::Event iEvent)
inlineoverridevirtual

◆ isInIsolationCone()

bool ElectronPFIsolationWithMapBasedVeto::isInIsolationCone ( const reco::CandidatePtr photon,
const reco::CandidatePtr other 
) const
finalvirtual

Implements citk::IsolationConeDefinitionBase.

Definition at line 110 of file ElectronPFIsolationWithMapBasedVeto.cc.

111  {
112  //convert the electron and candidate objects to the corresponding pat or reco objects. What is used depends on what is user running on: miniAOD or AOD
113  pat::patElectronPtr aspat_electronptr(electron);
114 
115  pat::PackedCandidatePtr aspacked(pfCandidate);
116  reco::PFCandidatePtr aspf(pfCandidate);
117 
118  bool inFootprint = false;
119  bool result = true;
120  const float deltar2 =
121  reco::deltaR2(*electron, *pfCandidate); //calculate deltaR2 distance between PFCandidate and photon
122 
123  // dealing here with patObjects: miniAOD case
124  if (aspacked.get()) {
125  inFootprint = isInFootprint(aspat_electronptr->associatedPackedPFCandidates(), aspacked);
126 
127  //checking if the charged candidates come from the appropriate vertex
128  if (aspacked->charge() != 0) {
129  bool is_vertex_allowed = false;
130  for (const unsigned vtxtype : _miniAODVertexCodes) {
131  if (vtxtype == aspacked->fromPV()) {
132  is_vertex_allowed = true;
133  break;
134  }
135  }
136 
137  result &= (is_vertex_allowed);
138  }
139  //return true if the candidate is inside the cone and not in the footprint
140  result &= deltar2 < _coneSize2 && (!inFootprint);
141  }
142 
143  // dealing here with recoObjects: AOD case
144  else if (aspf.get()) {
145  inFootprint = isInFootprintAlternative((*particleBasedIsolationMap)[electron], pfCandidate);
146  //return true if the candidate is inside the cone and not in the footprint
147  result &= deltar2 < _coneSize2 && (!inFootprint);
148  }
149 
150  // throw exception if it is not a patObject or recoObject
151  else {
152  throw cms::Exception("InvalidIsolationInput") << "The supplied candidate to be used as isolation "
153  << "was neither a reco::Photon nor a pat::Photon!";
154  }
155 
156  return result;
157 }

References citk::IsolationConeDefinitionBase::_coneSize2, _miniAODVertexCodes, pat::Electron::associatedPackedPFCandidates(), reco::deltaR2(), metsig::electron, Exception, edm::Ptr< T >::get(), particleBasedIsolationMap, and mps_fire::result.

◆ operator=()

ElectronPFIsolationWithMapBasedVeto& ElectronPFIsolationWithMapBasedVeto::operator= ( const ElectronPFIsolationWithMapBasedVeto )
delete

◆ setConsumes()

void ElectronPFIsolationWithMapBasedVeto::setConsumes ( edm::ConsumesCollector  iC)
inlineoverridevirtual

Member Data Documentation

◆ _isolateAgainst

const std::string ElectronPFIsolationWithMapBasedVeto::_isolateAgainst
private

Definition at line 96 of file ElectronPFIsolationWithMapBasedVeto.cc.

◆ _miniAODVertexCodes

const std::vector<unsigned> ElectronPFIsolationWithMapBasedVeto::_miniAODVertexCodes
private

Definition at line 100 of file ElectronPFIsolationWithMapBasedVeto.cc.

Referenced by isInIsolationCone().

◆ _particleBasedIsolation

const edm::InputTag ElectronPFIsolationWithMapBasedVeto::_particleBasedIsolation
private

Definition at line 101 of file ElectronPFIsolationWithMapBasedVeto.cc.

Referenced by setConsumes().

◆ _vertexCollection

const std::string ElectronPFIsolationWithMapBasedVeto::_vertexCollection
private

Definition at line 96 of file ElectronPFIsolationWithMapBasedVeto.cc.

◆ particleBasedIsolationMap

edm::Handle<edm::ValueMap<std::vector<reco::PFCandidateRef> > > ElectronPFIsolationWithMapBasedVeto::particleBasedIsolationMap

Definition at line 82 of file ElectronPFIsolationWithMapBasedVeto.cc.

Referenced by getEventInfo(), and isInIsolationCone().

◆ particleBasedIsolationToken_

edm::EDGetTokenT<edm::ValueMap<std::vector<reco::PFCandidateRef> > > ElectronPFIsolationWithMapBasedVeto::particleBasedIsolationToken_

Definition at line 83 of file ElectronPFIsolationWithMapBasedVeto.cc.

Referenced by getEventInfo(), and setConsumes().

ElectronPFIsolationWithMapBasedVeto::_miniAODVertexCodes
const std::vector< unsigned > _miniAODVertexCodes
Definition: ElectronPFIsolationWithMapBasedVeto.cc:100
ElectronPFIsolationWithMapBasedVeto::_isolateAgainst
const std::string _isolateAgainst
Definition: ElectronPFIsolationWithMapBasedVeto.cc:96
ElectronPFIsolationWithMapBasedVeto::particleBasedIsolationMap
edm::Handle< edm::ValueMap< std::vector< reco::PFCandidateRef > > > particleBasedIsolationMap
Definition: ElectronPFIsolationWithMapBasedVeto.cc:82
ElectronPFIsolationWithMapBasedVeto::_particleBasedIsolation
const edm::InputTag _particleBasedIsolation
Definition: ElectronPFIsolationWithMapBasedVeto.cc:101
citk::IsolationConeDefinitionBase
Definition: CITKIsolationConeDefinitionBase.h:17
metsig::electron
Definition: SignAlgoResolutions.h:48
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
reco::deltaR2
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
edm::ConsumesCollector::mayConsume
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
Definition: ConsumesCollector.h:61
iEvent
int iEvent
Definition: GenABIO.cc:224
ElectronPFIsolationWithMapBasedVeto::particleBasedIsolationToken_
edm::EDGetTokenT< edm::ValueMap< std::vector< reco::PFCandidateRef > > > particleBasedIsolationToken_
Definition: ElectronPFIsolationWithMapBasedVeto.cc:83
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
edm::Ptr< pat::Electron >
citk::IsolationConeDefinitionBase::_coneSize2
const float _coneSize2
Definition: CITKIsolationConeDefinitionBase.h:36
edm::ValueMap
Definition: ValueMap.h:107
Exception
Definition: hltDiff.cc:246
mps_fire.result
result
Definition: mps_fire.py:303
edm::InputTag
Definition: InputTag.h:15