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 | 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 overridefinal
 
PhotonPFIsolationWithConeVetooperator= (const PhotonPFIsolationWithConeVeto &)=delete
 
 PhotonPFIsolationWithConeVeto (const edm::ParameterSet &c)
 
 PhotonPFIsolationWithConeVeto (const PhotonPFIsolationWithConeVeto &)=delete
 
void setConsumes (edm::ConsumesCollector)
 
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 citk::IsolationConeDefinitionBase::_additionalCode, _vetoConeSize2EB, _vetoConeSize2EE, 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 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.

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
tuple result
Definition: mps_fire.py:84
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  )
inlinevirtual

Implements citk::IsolationConeDefinitionBase.

Definition at line 59 of file PhotonPFIsolationWithConeVeto.cc.

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.

Referenced by isInIsolationCone().

const unsigned PhotonPFIsolationWithConeVeto::_vertexIndex
private

Definition at line 70 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 72 of file PhotonPFIsolationWithConeVeto.cc.