test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
 
virtual void getEventInfo (const edm::Event &iEvent)
 
bool isInIsolationCone (const reco::CandidatePtr &photon, const reco::CandidatePtr &other) const overridefinal
 
ElectronPFIsolationWithMapBasedVetooperator= (const ElectronPFIsolationWithMapBasedVeto &)=delete
 
void setConsumes (edm::ConsumesCollector iC)
 
virtual ~ElectronPFIsolationWithMapBasedVeto ()
 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 std::string _vertexCollection
 

Additional Inherited Members

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

Detailed Description

Definition at line 69 of file ElectronPFIsolationWithMapBasedVeto.cc.

Constructor & Destructor Documentation

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

Definition at line 71 of file ElectronPFIsolationWithMapBasedVeto.cc.

71  :
73  _isolateAgainst(c.getParameter<std::string>("isolateAgainst")), //isolate against either h+, h0 or gamma
74  _miniAODVertexCodes(c.getParameter<std::vector<unsigned> >("miniAODVertexCodes")){} //quality flags to be used for association with the vertex configurable, the vertex can be chosen
T getParameter(std::string const &) const
ElectronPFIsolationWithMapBasedVeto::ElectronPFIsolationWithMapBasedVeto ( const ElectronPFIsolationWithMapBasedVeto )
delete
virtual ElectronPFIsolationWithMapBasedVeto::~ElectronPFIsolationWithMapBasedVeto ( )
inlinevirtual

Destructor.

Definition at line 100 of file ElectronPFIsolationWithMapBasedVeto.cc.

100 {};

Member Function Documentation

virtual void ElectronPFIsolationWithMapBasedVeto::getEventInfo ( const edm::Event iEvent)
inlinevirtual

Reimplemented from citk::IsolationConeDefinitionBase.

Definition at line 87 of file ElectronPFIsolationWithMapBasedVeto.cc.

References edm::Event::getByToken(), particleBasedIsolationMap, and particleBasedIsolationToken_.

88  {
90  };
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
edm::Handle< edm::ValueMap< std::vector< reco::PFCandidateRef > > > particleBasedIsolationMap
edm::EDGetTokenT< edm::ValueMap< std::vector< reco::PFCandidateRef > > > particleBasedIsolationToken_
bool ElectronPFIsolationWithMapBasedVeto::isInIsolationCone ( const reco::CandidatePtr photon,
const reco::CandidatePtr other 
) const
finaloverridevirtual

Implements citk::IsolationConeDefinitionBase.

Definition at line 117 of file ElectronPFIsolationWithMapBasedVeto.cc.

References citk::IsolationConeDefinitionBase::_coneSize2, _miniAODVertexCodes, reco::deltaR2(), Exception, edm::Ptr< T >::get(), isInFootprint(), particleBasedIsolationMap, and mps_fire::result.

117  {
118 
119  //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
120  pat::patElectronPtr aspat_electronptr(electron);
121 
122  pat::PackedCandidatePtr aspacked(pfCandidate);
123  reco::PFCandidatePtr aspf(pfCandidate);
124 
125 
126  bool inFootprint = false;
127  bool result = true;
128  const float deltar2 = reco::deltaR2(*electron,*pfCandidate); //calculate deltaR2 distance between PFCandidate and photon
129 
130  // dealing here with patObjects: miniAOD case
131  if ( aspacked.get() )
132  {
133  inFootprint = isInFootprint(aspat_electronptr ->associatedPackedPFCandidates(),aspacked);
134 
135  //checking if the charged candidates come from the appropriate vertex
136  if( aspacked->charge() != 0 )
137  {
138  bool is_vertex_allowed = false;
139  for( const unsigned vtxtype : _miniAODVertexCodes )
140  {
141  if( vtxtype == aspacked->fromPV() ) {
142  is_vertex_allowed = true;
143  break;
144  }
145  }
146 
147  result &= (is_vertex_allowed);
148  }
149  //return true if the candidate is inside the cone and not in the footprint
150  result &= deltar2 < _coneSize2 && (!inFootprint);
151  }
152 
153  // dealing here with recoObjects: AOD case
154  else if ( aspf.get())
155  {
156  inFootprint = isInFootprintAlternative((*particleBasedIsolationMap)[electron], pfCandidate);
157  //return true if the candidate is inside the cone and not in the footprint
158  result &= deltar2 < _coneSize2 && (!inFootprint);
159  }
160 
161  // throw exception if it is not a patObject or recoObject
162  else {
163  throw cms::Exception("InvalidIsolationInput")
164  << "The supplied candidate to be used as isolation "
165  << "was neither a reco::Photon nor a pat::Photon!";
166  }
167 
168  return result;
169 }
edm::Handle< edm::ValueMap< std::vector< reco::PFCandidateRef > > > particleBasedIsolationMap
tuple result
Definition: mps_fire.py:83
bool isInFootprint(const T &thefootprint, const U &theCandidate)
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
Definition: deltaR.h:36
ElectronPFIsolationWithMapBasedVeto& ElectronPFIsolationWithMapBasedVeto::operator= ( const ElectronPFIsolationWithMapBasedVeto )
delete
void ElectronPFIsolationWithMapBasedVeto::setConsumes ( edm::ConsumesCollector  iC)
inlinevirtual

Implements citk::IsolationConeDefinitionBase.

Definition at line 94 of file ElectronPFIsolationWithMapBasedVeto.cc.

References HLT_25ns10e33_v2_cff::InputTag, edm::ConsumesCollector::mayConsume(), and particleBasedIsolationToken_.

95  {
97  }
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
edm::EDGetTokenT< edm::ValueMap< std::vector< reco::PFCandidateRef > > > particleBasedIsolationToken_

Member Data Documentation

const std::string ElectronPFIsolationWithMapBasedVeto::_isolateAgainst
private

Definition at line 100 of file ElectronPFIsolationWithMapBasedVeto.cc.

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

Definition at line 105 of file ElectronPFIsolationWithMapBasedVeto.cc.

Referenced by isInIsolationCone().

const std::string ElectronPFIsolationWithMapBasedVeto::_vertexCollection
private

Definition at line 100 of file ElectronPFIsolationWithMapBasedVeto.cc.

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

Definition at line 84 of file ElectronPFIsolationWithMapBasedVeto.cc.

Referenced by getEventInfo(), and isInIsolationCone().

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

Definition at line 85 of file ElectronPFIsolationWithMapBasedVeto.cc.

Referenced by getEventInfo(), and setConsumes().