CMS 3D CMS Logo

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 override final
 
PhotonPFIsolationWithConeVetooperator= (const PhotonPFIsolationWithConeVeto &)=delete
 
 PhotonPFIsolationWithConeVeto (const edm::ParameterSet &c)
 
 PhotonPFIsolationWithConeVeto (const PhotonPFIsolationWithConeVeto &)=delete
 
void setConsumes (edm::ConsumesCollector) override
 
virtual ~PhotonPFIsolationWithConeVeto ()
 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 36 of file PhotonPFIsolationWithConeVeto.cc.

Constructor & Destructor Documentation

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

Definition at line 38 of file PhotonPFIsolationWithConeVeto.cc.

References mathSSE::sqrt(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

Destructor.

Definition at line 65 of file PhotonPFIsolationWithConeVeto.cc.

65 {};

Member Function Documentation

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

Implements citk::IsolationConeDefinitionBase.

Definition at line 80 of file PhotonPFIsolationWithConeVeto.cc.

References reco::deltaR2(), EcalBarrel, Exception, edm::Ptr< T >::get(), edm::Ptr< T >::isNonnull(), mps_fire::result, SurveyInfoScenario_cff::seed, and reco::Photon::superCluster().

81  {
82  reco::recoPhotonPtr photonref(photon);
83  pat::PackedCandidatePtr aspacked(pfCandidate);
84  reco::PFCandidatePtr aspf(pfCandidate);
85  const reco::CaloClusterPtr& seed = photonref->superCluster()->seed();
86  bool isEB = ( seed->seed().subdetId() == EcalBarrel );
87  const float deltar2 = reco::deltaR2(*photon,*pfCandidate);
88  const float vetoConeSize2 = ( isEB ? _vetoConeSize2EB : _vetoConeSize2EE );
89  bool result = true;
90  if( aspacked.isNonnull() && aspacked.get() ) {
91  if( aspacked->charge() != 0 ) {
92  bool is_vertex_allowed = false;
93  for( const unsigned vtxtype : _miniAODVertexCodes ) {
94  if( vtxtype == aspacked->fromPV(_vertexIndex) ) {
95  is_vertex_allowed = true;
96  break;
97  }
98  }
99  result &= ( is_vertex_allowed );
100  }
101  result &= deltar2 > vetoConeSize2 && deltar2 < _coneSize2 ;
102  } else if ( aspf.isNonnull() && aspf.get() ) {
103  result &= deltar2 > vetoConeSize2 && deltar2 < _coneSize2;
104  } else {
105  throw cms::Exception("InvalidIsolationInput")
106  << "The supplied candidate to be used as isolation "
107  << "was neither a reco::PFCandidate nor a pat::PackedCandidate!";
108  }
109  return result;
110 }
const std::vector< unsigned > _miniAODVertexCodes
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
Definition: deltaR.h:36
PhotonPFIsolationWithConeVeto& PhotonPFIsolationWithConeVeto::operator= ( const PhotonPFIsolationWithConeVeto )
delete
void PhotonPFIsolationWithConeVeto::setConsumes ( edm::ConsumesCollector  )
inlineoverridevirtual

Implements citk::IsolationConeDefinitionBase.

Definition at line 59 of file PhotonPFIsolationWithConeVeto.cc.

References muons2muons_cfi::photon.

59 {}

Member Data Documentation

const std::string PhotonPFIsolationWithConeVeto::_isolateAgainst
private

Definition at line 71 of file PhotonPFIsolationWithConeVeto.cc.

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

Definition at line 69 of file PhotonPFIsolationWithConeVeto.cc.

const unsigned PhotonPFIsolationWithConeVeto::_vertexIndex
private

Definition at line 70 of file PhotonPFIsolationWithConeVeto.cc.

const float PhotonPFIsolationWithConeVeto::_vetoConeSize2EB
private

Definition at line 65 of file PhotonPFIsolationWithConeVeto.cc.

const float PhotonPFIsolationWithConeVeto::_vetoConeSize2EE
private

Definition at line 65 of file PhotonPFIsolationWithConeVeto.cc.

edm::EDGetTokenT<reco::VertexCollection> PhotonPFIsolationWithConeVeto::_vtxToken
private

Definition at line 72 of file PhotonPFIsolationWithConeVeto.cc.