CMS 3D CMS Logo

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

Public Member Functions

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

Additional Inherited Members

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

Detailed Description

Definition at line 66 of file PhotonPFIsolationWithMapBasedVeto.cc.

Constructor & Destructor Documentation

◆ PhotonPFIsolationWithMapBasedVeto() [1/2]

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

Definition at line 68 of file PhotonPFIsolationWithMapBasedVeto.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  _vertexIndex(c.getParameter<int>("vertexIndex")), //vertex of interest
74  _particleBasedIsolation(c.getParameter<edm::InputTag>("particleBasedIsolation")) {}

◆ PhotonPFIsolationWithMapBasedVeto() [2/2]

PhotonPFIsolationWithMapBasedVeto::PhotonPFIsolationWithMapBasedVeto ( const PhotonPFIsolationWithMapBasedVeto )
delete

◆ ~PhotonPFIsolationWithMapBasedVeto()

PhotonPFIsolationWithMapBasedVeto::~PhotonPFIsolationWithMapBasedVeto ( )
inlineoverride

Destructor.

Definition at line 96 of file PhotonPFIsolationWithMapBasedVeto.cc.

96 {};

Member Function Documentation

◆ getEventInfo()

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

◆ isInIsolationCone()

bool PhotonPFIsolationWithMapBasedVeto::isInIsolationCone ( const reco::CandidatePtr photon,
const reco::CandidatePtr pfCandidate 
) const
finalvirtual

Implements citk::IsolationConeDefinitionBase.

Definition at line 111 of file PhotonPFIsolationWithMapBasedVeto.cc.

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

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

◆ operator=()

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

◆ setConsumes()

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

Member Data Documentation

◆ _isolateAgainst

const std::string PhotonPFIsolationWithMapBasedVeto::_isolateAgainst
private

Definition at line 96 of file PhotonPFIsolationWithMapBasedVeto.cc.

◆ _miniAODVertexCodes

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

Definition at line 100 of file PhotonPFIsolationWithMapBasedVeto.cc.

Referenced by isInIsolationCone().

◆ _particleBasedIsolation

const edm::InputTag PhotonPFIsolationWithMapBasedVeto::_particleBasedIsolation
private

Definition at line 102 of file PhotonPFIsolationWithMapBasedVeto.cc.

Referenced by setConsumes().

◆ _vertexCollection

const std::string PhotonPFIsolationWithMapBasedVeto::_vertexCollection
private

Definition at line 96 of file PhotonPFIsolationWithMapBasedVeto.cc.

◆ _vertexIndex

const unsigned PhotonPFIsolationWithMapBasedVeto::_vertexIndex
private

Definition at line 101 of file PhotonPFIsolationWithMapBasedVeto.cc.

Referenced by isInIsolationCone().

◆ particleBasedIsolationMap

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

Definition at line 82 of file PhotonPFIsolationWithMapBasedVeto.cc.

Referenced by getEventInfo(), and isInIsolationCone().

◆ particleBasedIsolationToken_

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

Definition at line 83 of file PhotonPFIsolationWithMapBasedVeto.cc.

Referenced by getEventInfo(), and setConsumes().

muons2muons_cfi.photon
photon
Definition: muons2muons_cfi.py:28
PhotonPFIsolationWithMapBasedVeto::_particleBasedIsolation
const edm::InputTag _particleBasedIsolation
Definition: PhotonPFIsolationWithMapBasedVeto.cc:102
citk::IsolationConeDefinitionBase
Definition: CITKIsolationConeDefinitionBase.h:17
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:72
iEvent
int iEvent
Definition: GenABIO.cc:224
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
PhotonPFIsolationWithMapBasedVeto::particleBasedIsolationToken_
edm::EDGetTokenT< edm::ValueMap< std::vector< reco::PFCandidateRef > > > particleBasedIsolationToken_
Definition: PhotonPFIsolationWithMapBasedVeto.cc:83
PhotonPFIsolationWithMapBasedVeto::_vertexIndex
const unsigned _vertexIndex
Definition: PhotonPFIsolationWithMapBasedVeto.cc:101
edm::Ptr
Definition: AssociationVector.h:31
PhotonPFIsolationWithMapBasedVeto::_miniAODVertexCodes
const std::vector< unsigned > _miniAODVertexCodes
Definition: PhotonPFIsolationWithMapBasedVeto.cc:100
citk::IsolationConeDefinitionBase::_coneSize2
const float _coneSize2
Definition: CITKIsolationConeDefinitionBase.h:36
edm::ValueMap
Definition: ValueMap.h:107
Exception
Definition: hltDiff.cc:246
PhotonPFIsolationWithMapBasedVeto::particleBasedIsolationMap
edm::Handle< edm::ValueMap< std::vector< reco::PFCandidateRef > > > particleBasedIsolationMap
Definition: PhotonPFIsolationWithMapBasedVeto.cc:82
PhotonPFIsolationWithMapBasedVeto::_isolateAgainst
const std::string _isolateAgainst
Definition: PhotonPFIsolationWithMapBasedVeto.cc:96
mps_fire.result
result
Definition: mps_fire.py:311
edm::InputTag
Definition: InputTag.h:15