CMS 3D CMS Logo

MuonPFIsolationWithConeVeto.cc
Go to the documentation of this file.
2 
8 
9 namespace pat {
11 }
12 
14 public:
17  _vetoThreshold(c.getParameter<double>("VetoThreshold")),
18  _vetoConeSize2(std::pow(c.getParameter<double>("VetoConeSize"), 2.0)),
19  _miniAODVertexCodes(c.getParameter<std::vector<unsigned> >("miniAODVertexCodes")) {
20  char buf[50];
21  snprintf(buf, 49, "ThresholdVeto%03.0f-ConeVeto%03.0f", 100 * _vetoThreshold, 100 * std::sqrt(_vetoConeSize2));
23  }
26 
28 
29  bool isInIsolationCone(const reco::CandidatePtr& physob, const reco::CandidatePtr& other) const final;
30 
33 
34 private:
35  const double _vetoThreshold, _vetoConeSize2;
36  const std::vector<unsigned> _miniAODVertexCodes;
38 };
39 
41 
43  const reco::CandidatePtr& iso_obj) const {
44  const pat::PackedCandidatePtr aspacked(iso_obj);
45  const reco::PFCandidatePtr aspf(iso_obj);
46  const double deltar2 = reco::deltaR2(*physob, *iso_obj);
47 
48  bool result = true;
49  if (aspacked.isNonnull() && aspacked.get()) {
50  if (aspacked->charge() != 0) {
51  bool is_vertex_allowed = false;
52  for (const unsigned vtxtype : _miniAODVertexCodes) {
53  if (vtxtype == aspacked->fromPV()) {
54  is_vertex_allowed = true;
55  break;
56  }
57  }
58  result = result && (is_vertex_allowed);
59  }
60  result = result && (aspacked->pt() > _vetoThreshold && deltar2 > _vetoConeSize2 && deltar2 < _coneSize2);
61  } else if (aspf.isNonnull() && aspf.get()) {
62  result = result && (aspf->pt() > _vetoThreshold && deltar2 > _vetoConeSize2 && deltar2 < _coneSize2);
63  } else {
64  throw cms::Exception("InvalidIsolationInput") << "The supplied candidate to be used as isolation "
65  << "was neither a reco::PFCandidate nor a pat::PackedCandidate!";
66  }
67  return result;
68 }
pat::PackedCandidatePtr
edm::Ptr< pat::PackedCandidate > PackedCandidatePtr
Definition: PATMuonMerger.cc:18
MuonPFIsolationWithConeVeto
Definition: MuonPFIsolationWithConeVeto.cc:13
MuonPFIsolationWithConeVeto::isInIsolationCone
bool isInIsolationCone(const reco::CandidatePtr &physob, const reco::CandidatePtr &other) const final
Definition: MuonPFIsolationWithConeVeto.cc:42
PFCandidate.h
edm::EDGetTokenT< reco::VertexCollection >
MuonPFIsolationWithConeVeto::setConsumes
void setConsumes(edm::ConsumesCollector) override
Definition: MuonPFIsolationWithConeVeto.cc:27
edm::Ptr::get
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:139
MuonPFIsolationWithConeVeto::~MuonPFIsolationWithConeVeto
~MuonPFIsolationWithConeVeto() override
Destructor.
Definition: MuonPFIsolationWithConeVeto.cc:32
citk
Definition: CITKIsolationConeDefinitionBase.h:16
MuonPFIsolationWithConeVeto::_vetoConeSize2
const double _vetoConeSize2
Definition: MuonPFIsolationWithConeVeto.cc:32
deltaR.h
citk::IsolationConeDefinitionBase
Definition: CITKIsolationConeDefinitionBase.h:17
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
trackingPlots.other
other
Definition: trackingPlots.py:1465
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: PluginFactory.h:124
MuonPFIsolationWithConeVeto::_miniAODVertexCodes
const std::vector< unsigned > _miniAODVertexCodes
Definition: MuonPFIsolationWithConeVeto.cc:36
MuonPFIsolationWithConeVeto::_vtxToken
edm::EDGetTokenT< reco::VertexCollection > _vtxToken
Definition: MuonPFIsolationWithConeVeto.cc:37
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:36
CITKIsolationConeDefinitionBase.h
edmplugin::PluginFactory
Definition: PluginFactory.h:34
PackedCandidate.h
reco::deltaR2
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
pat
Definition: HeavyIon.h:7
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
visDQMUpload.buf
buf
Definition: visDQMUpload.py:154
edm::Ptr
Definition: AssociationVector.h:31
citk::IsolationConeDefinitionBase::_coneSize2
const float _coneSize2
Definition: CITKIsolationConeDefinitionBase.h:36
std
Definition: JetResolutionObject.h:76
citk::IsolationConeDefinitionBase::_additionalCode
std::string _additionalCode
Definition: CITKIsolationConeDefinitionBase.h:40
MuonPFIsolationWithConeVeto::operator=
MuonPFIsolationWithConeVeto & operator=(const MuonPFIsolationWithConeVeto &)=delete
Exception
Definition: hltDiff.cc:246
MuonPFIsolationWithConeVeto::MuonPFIsolationWithConeVeto
MuonPFIsolationWithConeVeto(const edm::ParameterSet &c)
Definition: MuonPFIsolationWithConeVeto.cc:15
edm::Ptr::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:146
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
mps_fire.result
result
Definition: mps_fire.py:303
ConsumesCollector.h
MuonPFIsolationWithConeVeto::_vetoThreshold
const double _vetoThreshold
Definition: MuonPFIsolationWithConeVeto.cc:32
ParameterSet.h
edm::ConsumesCollector
Definition: ConsumesCollector.h:39
citk::IsolationConeDefinitionBase::IsolationConeDefinitionBase
IsolationConeDefinitionBase(const edm::ParameterSet &c)
Definition: CITKIsolationConeDefinitionBase.h:19