CMS 3D CMS Logo

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

Public Member Functions

 ElectronPFIsolationWithConeVeto (const edm::ParameterSet &c)
 
 ElectronPFIsolationWithConeVeto (const ElectronPFIsolationWithConeVeto &)=delete
 
bool isInIsolationCone (const reco::CandidatePtr &physob, const reco::CandidatePtr &other) const final
 
ElectronPFIsolationWithConeVetooperator= (const ElectronPFIsolationWithConeVeto &)=delete
 
void setConsumes (edm::ConsumesCollector) override
 
 ~ElectronPFIsolationWithConeVeto () 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 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 ElectronPFIsolationWithConeVeto.cc.

Constructor & Destructor Documentation

◆ ElectronPFIsolationWithConeVeto() [1/2]

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

Definition at line 37 of file ElectronPFIsolationWithConeVeto.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  _isolateAgainst(c.getParameter<std::string>("isolateAgainst")) {
43  char buf[50];
44  sprintf(buf, "BarVeto%.2f-EndVeto%.2f", std::sqrt(_vetoConeSize2EB), std::sqrt(_vetoConeSize2EE));
46  auto decimal = _additionalCode.find('.');
47  while (decimal != std::string::npos) {
48  _additionalCode.erase(decimal, 1);
49  decimal = _additionalCode.find('.');
50  }
51  }
T sqrt(T t)
Definition: SSEVec.h:19
const std::vector< unsigned > _miniAODVertexCodes
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ ElectronPFIsolationWithConeVeto() [2/2]

ElectronPFIsolationWithConeVeto::ElectronPFIsolationWithConeVeto ( const ElectronPFIsolationWithConeVeto )
delete

◆ ~ElectronPFIsolationWithConeVeto()

ElectronPFIsolationWithConeVeto::~ElectronPFIsolationWithConeVeto ( )
inlineoverride

Destructor.

Definition at line 60 of file ElectronPFIsolationWithConeVeto.cc.

60 {};

Member Function Documentation

◆ isInIsolationCone()

bool ElectronPFIsolationWithConeVeto::isInIsolationCone ( const reco::CandidatePtr physob,
const reco::CandidatePtr other 
) const
finalvirtual

Implements citk::IsolationConeDefinitionBase.

Definition at line 73 of file ElectronPFIsolationWithConeVeto.cc.

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

74  {
75  reco::GsfElectronPtr eleref(physob);
76  pat::PackedCandidatePtr aspacked(iso_obj);
77  reco::PFCandidatePtr aspf(iso_obj);
78  const reco::CaloClusterPtr& seed = eleref->superCluster()->seed();
79  bool isEB = (seed->seed().subdetId() == EcalBarrel);
80  const float deltar2 = reco::deltaR2(*physob, *iso_obj);
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()) {
88  is_vertex_allowed = true;
89  break;
90  }
91  }
92  result = result && (is_vertex_allowed);
93  }
94  result = result && (deltar2 > vetoConeSize2 && deltar2 < _coneSize2);
95  } else if (aspf.isNonnull() && aspf.get()) {
96  result = 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 }
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
const std::vector< unsigned > _miniAODVertexCodes

◆ operator=()

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

◆ setConsumes()

void ElectronPFIsolationWithConeVeto::setConsumes ( edm::ConsumesCollector  )
inlineoverridevirtual

Implements citk::IsolationConeDefinitionBase.

Definition at line 55 of file ElectronPFIsolationWithConeVeto.cc.

55 {}

Member Data Documentation

◆ _isolateAgainst

const std::string ElectronPFIsolationWithConeVeto::_isolateAgainst
private

Definition at line 65 of file ElectronPFIsolationWithConeVeto.cc.

◆ _miniAODVertexCodes

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

Definition at line 64 of file ElectronPFIsolationWithConeVeto.cc.

Referenced by isInIsolationCone().

◆ _vetoConeSize2EB

const float ElectronPFIsolationWithConeVeto::_vetoConeSize2EB
private

◆ _vetoConeSize2EE

const float ElectronPFIsolationWithConeVeto::_vetoConeSize2EE
private

◆ _vtxToken

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

Definition at line 66 of file ElectronPFIsolationWithConeVeto.cc.