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
PhotonPFIsolationWithMapBasedVeto Class Reference
Inheritance diagram for PhotonPFIsolationWithMapBasedVeto:
citk::IsolationConeDefinitionBase

Public Member Functions

virtual void getEventInfo (const edm::Event &iEvent)
 
bool isInIsolationCone (const reco::CandidatePtr &photon, const reco::CandidatePtr &pfCandidate) const overridefinal
 
PhotonPFIsolationWithMapBasedVetooperator= (const PhotonPFIsolationWithMapBasedVeto &)=delete
 
 PhotonPFIsolationWithMapBasedVeto (const edm::ParameterSet &c)
 
 PhotonPFIsolationWithMapBasedVeto (const PhotonPFIsolationWithMapBasedVeto &)=delete
 
void setConsumes (edm::ConsumesCollector iC)
 
virtual ~PhotonPFIsolationWithMapBasedVeto ()
 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
 
const unsigned _vertexIndex
 

Additional Inherited Members

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

Detailed Description

Definition at line 69 of file PhotonPFIsolationWithMapBasedVeto.cc.

Constructor & Destructor Documentation

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

Definition at line 71 of file PhotonPFIsolationWithMapBasedVeto.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
75  _vertexIndex(c.getParameter<int> ("vertexIndex")){} //vertex of interest
T getParameter(std::string const &) const
PhotonPFIsolationWithMapBasedVeto::PhotonPFIsolationWithMapBasedVeto ( const PhotonPFIsolationWithMapBasedVeto )
delete
virtual PhotonPFIsolationWithMapBasedVeto::~PhotonPFIsolationWithMapBasedVeto ( )
inlinevirtual

Destructor.

Definition at line 101 of file PhotonPFIsolationWithMapBasedVeto.cc.

101 {};

Member Function Documentation

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

Reimplemented from citk::IsolationConeDefinitionBase.

Definition at line 88 of file PhotonPFIsolationWithMapBasedVeto.cc.

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

89  {
91  };
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 PhotonPFIsolationWithMapBasedVeto::isInIsolationCone ( const reco::CandidatePtr photon,
const reco::CandidatePtr pfCandidate 
) const
finaloverridevirtual

Implements citk::IsolationConeDefinitionBase.

Definition at line 119 of file PhotonPFIsolationWithMapBasedVeto.cc.

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

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

Implements citk::IsolationConeDefinitionBase.

Definition at line 95 of file PhotonPFIsolationWithMapBasedVeto.cc.

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

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

Member Data Documentation

const std::string PhotonPFIsolationWithMapBasedVeto::_isolateAgainst
private

Definition at line 101 of file PhotonPFIsolationWithMapBasedVeto.cc.

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

Definition at line 106 of file PhotonPFIsolationWithMapBasedVeto.cc.

Referenced by isInIsolationCone().

const std::string PhotonPFIsolationWithMapBasedVeto::_vertexCollection
private

Definition at line 101 of file PhotonPFIsolationWithMapBasedVeto.cc.

const unsigned PhotonPFIsolationWithMapBasedVeto::_vertexIndex
private

Definition at line 107 of file PhotonPFIsolationWithMapBasedVeto.cc.

Referenced by isInIsolationCone().

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

Definition at line 85 of file PhotonPFIsolationWithMapBasedVeto.cc.

Referenced by getEventInfo(), and isInIsolationCone().

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

Definition at line 86 of file PhotonPFIsolationWithMapBasedVeto.cc.

Referenced by getEventInfo(), and setConsumes().