CMS 3D CMS Logo

MuIsoByTrackPt.cc
Go to the documentation of this file.
2 
6 
9 
12 
13 #include <vector>
14 #include <iostream>
15 
16 using std::vector;
17 using std::string;
18 using reco::IsoDeposit;
19 using namespace muonisolation;
20 
21 
23  : theExtractor(nullptr), theIsolator(nullptr)
24 {
25  edm::ParameterSet extractorPSet = conf.getParameter<edm::ParameterSet>("ExtractorPSet");
26  string extractorName = extractorPSet.getParameter<string>("ComponentName");
27  theExtractor = IsoDepositExtractorFactoryFromHelper::get()->create(extractorName, extractorPSet, iC);
28 
29  theCut = conf.getUntrackedParameter<double>("Threshold", 0.);
30  float coneSize = conf.getUntrackedParameter<double>("ConeSize", 0.);
31  vector<double> weights(1,1.);
32  theIsolator = new IsolatorByDeposit(coneSize, weights);
33 }
34 
36 {
37  delete theExtractor;
38  delete theIsolator;
39 }
40 
42 {
44 }
45 
47 {
48  IsoDeposit dep = extractor()->deposit(ev,es,muon);
50  deposits.push_back(&dep);
51  if (isolator()->resultType() == MuIsoBaseIsolator::ISOL_FLOAT_TYPE){
52  return isolator()->result(deposits).valFloat;
53  }
54 
55  return -999.;
56 }
57 
59 {
60  return (isolation(ev,es,muon) > theCut);
61 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
Result result(const DepositContainer &deposits, const edm::Event *=0) const override
Compute the deposit within the cone and return the isolation result.
virtual muonisolation::IsolatorByDeposit * isolator()
MuIsoByTrackPt(const edm::ParameterSet &conf, edm::ConsumesCollector &&iC)
virtual reco::isodeposit::IsoDepositExtractor * extractor()
~MuIsoByTrackPt() override
bool ev
#define nullptr
virtual reco::IsoDeposit deposit(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &track) const =0
void setConeSize(float dr)
void setConeSize(float conesize)
Compute the count of deposit within the cone and return the isolation result.
float isolation(const edm::Event &, const edm::EventSetup &, const reco::Track &muon) override
The isolation result for one muon.
std::vector< DepositAndVetos > DepositContainer
reco::IsoDeposit IsoDeposit
Definition: Isolation.h:7
reco::isodeposit::IsoDepositExtractor * theExtractor
muonisolation::IsolatorByDeposit * theIsolator
bool isIsolated(const edm::Event &, const edm::EventSetup &, const reco::Track &muon) override
T get(const Candidate &c)
Definition: component.h:55