26 #include <unordered_map> 39 citk::IsolationConeDefinitionBase(c),
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")) {
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(
'.');
68 const float _vetoConeSize2EB, _vetoConeSize2EE;
77 "PhotonPFIsolationWithConeVeto");
86 bool isEB = ( seed->seed().subdetId() ==
EcalBarrel );
88 const float vetoConeSize2 = ( isEB ? _vetoConeSize2EB : _vetoConeSize2EE );
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;
99 result &= ( is_vertex_allowed );
101 result &= deltar2 > vetoConeSize2 && deltar2 < _coneSize2 ;
103 result &= deltar2 > vetoConeSize2 && deltar2 < _coneSize2;
106 <<
"The supplied candidate to be used as isolation " 107 <<
"was neither a reco::PFCandidate nor a pat::PackedCandidate!";
const unsigned _vertexIndex
edm::Ptr< pat::PackedCandidate > PackedCandidatePtr
T const * get() const
Returns C++ pointer to the item.
const std::vector< unsigned > _miniAODVertexCodes
bool isInIsolationCone(const reco::CandidatePtr &photon, const reco::CandidatePtr &pfCandidate) const final
void setConsumes(edm::ConsumesCollector) override
const std::string _isolateAgainst
edm::EDGetTokenT< reco::VertexCollection > _vtxToken
bool isNonnull() const
Checks for non-null.
edm::Ptr< reco::Photon > recoPhotonPtr
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
~PhotonPFIsolationWithConeVeto() override
Destructor.
#define DEFINE_EDM_PLUGIN(factory, type, name)
PhotonPFIsolationWithConeVeto(const edm::ParameterSet &c)
Power< A, B >::type pow(const A &a, const B &b)