CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
PhotonPFIsolationWithConeVeto Class Reference
Inheritance diagram for PhotonPFIsolationWithConeVeto:
citk::IsolationConeDefinitionBase

Public Member Functions

bool isInIsolationCone (const reco::CandidatePtr &photon, const reco::CandidatePtr &pfCandidate) const final
 
PhotonPFIsolationWithConeVetooperator= (const PhotonPFIsolationWithConeVeto &)=delete
 
 PhotonPFIsolationWithConeVeto (const edm::ParameterSet &c)
 
 PhotonPFIsolationWithConeVeto (const PhotonPFIsolationWithConeVeto &)=delete
 
void setConsumes (edm::ConsumesCollector) override
 
 ~PhotonPFIsolationWithConeVeto () override
 Destructor. More...
 
- Public Member Functions inherited from citk::IsolationConeDefinitionBase
const std::string & additionalCode () const
 
virtual void getEventInfo (const edm::Event &)
 
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...
 

Private Attributes

const std::string _isolateAgainst
 
const std::vector< unsigned > _miniAODVertexCodes
 
const unsigned _vertexIndex
 
const float _vetoConeSize2EB
 
const float _vetoConeSize2EE
 
edm::EDGetTokenT
< reco::VertexCollection
_vtxToken
 

Additional Inherited Members

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

Detailed Description

Definition at line 35 of file PhotonPFIsolationWithConeVeto.cc.

Constructor & Destructor Documentation

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

Definition at line 37 of file PhotonPFIsolationWithConeVeto.cc.

References citk::IsolationConeDefinitionBase::_additionalCode, _vetoConeSize2EB, _vetoConeSize2EE, visDQMUpload::buf, mathSSE::sqrt(), and AlCaHLTBitMon_QueryRunRegistry::string.

39  _vetoConeSize2EB(std::pow(c.getParameter<double>("VetoConeSizeBarrel"), 2.0)),
40  _vetoConeSize2EE(std::pow(c.getParameter<double>("VetoConeSizeEndcaps"), 2.0)),
41  _miniAODVertexCodes(c.getParameter<std::vector<unsigned> >("miniAODVertexCodes")),
42  _vertexIndex(c.getParameter<int>("vertexIndex")),
43  _isolateAgainst(c.getParameter<std::string>("isolateAgainst")) {
44  char buf[50];
45  sprintf(buf, "BarVeto%.2f-EndVeto%.2f", std::sqrt(_vetoConeSize2EB), std::sqrt(_vetoConeSize2EE));
47  auto decimal = _additionalCode.find('.');
48  while (decimal != std::string::npos) {
49  _additionalCode.erase(decimal, 1);
50  decimal = _additionalCode.find('.');
51  }
52  }
const std::vector< unsigned > _miniAODVertexCodes
T sqrt(T t)
Definition: SSEVec.h:19
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
PhotonPFIsolationWithConeVeto::PhotonPFIsolationWithConeVeto ( const PhotonPFIsolationWithConeVeto )
delete
PhotonPFIsolationWithConeVeto::~PhotonPFIsolationWithConeVeto ( )
inlineoverride

Destructor.

Definition at line 61 of file PhotonPFIsolationWithConeVeto.cc.

61 {};

Member Function Documentation

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

Implements citk::IsolationConeDefinitionBase.

Definition at line 73 of file PhotonPFIsolationWithConeVeto.cc.

References citk::IsolationConeDefinitionBase::_coneSize2, _miniAODVertexCodes, _vertexIndex, _vetoConeSize2EB, _vetoConeSize2EE, reco::deltaR2(), EcalBarrel, Exception, edm::Ptr< T >::get(), edm::Ptr< T >::isNonnull(), mps_fire::result, and fileCollector::seed.

74  {
75  reco::recoPhotonPtr photonref(photon);
76  pat::PackedCandidatePtr aspacked(pfCandidate);
77  reco::PFCandidatePtr aspf(pfCandidate);
78  const reco::CaloClusterPtr& seed = photonref->superCluster()->seed();
79  bool isEB = (seed->seed().subdetId() == EcalBarrel);
80  const float deltar2 = reco::deltaR2(*photon, *pfCandidate);
81  const float vetoConeSize2 = (isEB ? _vetoConeSize2EB : _vetoConeSize2EE);
82  bool result = true;
83  if (aspacked.isNonnull() && aspacked.get()) {
84  if (aspacked->charge() != 0) {
85  bool is_vertex_allowed = false;
86  for (const unsigned vtxtype : _miniAODVertexCodes) {
87  if (vtxtype == aspacked->fromPV(_vertexIndex)) {
88  is_vertex_allowed = true;
89  break;
90  }
91  }
92  result &= (is_vertex_allowed);
93  }
94  result &= deltar2 > vetoConeSize2 && deltar2 < _coneSize2;
95  } else if (aspf.isNonnull() && aspf.get()) {
96  result &= deltar2 > vetoConeSize2 && deltar2 < _coneSize2;
97  } else {
98  throw cms::Exception("InvalidIsolationInput") << "The supplied candidate to be used as isolation "
99  << "was neither a reco::PFCandidate nor a pat::PackedCandidate!";
100  }
101  return result;
102 }
const std::vector< unsigned > _miniAODVertexCodes
tuple result
Definition: mps_fire.py:311
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
PhotonPFIsolationWithConeVeto& PhotonPFIsolationWithConeVeto::operator= ( const PhotonPFIsolationWithConeVeto )
delete
void PhotonPFIsolationWithConeVeto::setConsumes ( edm::ConsumesCollector  )
inlineoverridevirtual

Implements citk::IsolationConeDefinitionBase.

Definition at line 56 of file PhotonPFIsolationWithConeVeto.cc.

56 {}

Member Data Documentation

const std::string PhotonPFIsolationWithConeVeto::_isolateAgainst
private

Definition at line 67 of file PhotonPFIsolationWithConeVeto.cc.

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

Definition at line 65 of file PhotonPFIsolationWithConeVeto.cc.

Referenced by isInIsolationCone().

const unsigned PhotonPFIsolationWithConeVeto::_vertexIndex
private

Definition at line 66 of file PhotonPFIsolationWithConeVeto.cc.

Referenced by isInIsolationCone().

const float PhotonPFIsolationWithConeVeto::_vetoConeSize2EB
private
const float PhotonPFIsolationWithConeVeto::_vetoConeSize2EE
private
edm::EDGetTokenT<reco::VertexCollection> PhotonPFIsolationWithConeVeto::_vtxToken
private

Definition at line 68 of file PhotonPFIsolationWithConeVeto.cc.