CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
muonisolation::CandViewExtractor Class Reference
Inheritance diagram for muonisolation::CandViewExtractor:
reco::isodeposit::IsoDepositExtractor

Public Member Functions

 CandViewExtractor ()
 
 CandViewExtractor (const edm::ParameterSet &par, edm::ConsumesCollector &&iC)
 
reco::IsoDeposit deposit (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &muon) const override
 
reco::IsoDeposit deposit (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Candidate &muon) const override
 
template<typename T >
IsoDeposit depositFromObject (const Event &event, const EventSetup &eventSetup, const T &cand) const
 
void fillVetos (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::TrackCollection &cand) override
 
void initEvent (const edm::Event &ev, const edm::EventSetup &evSetup) override
 perform some constly initialization More...
 
 ~CandViewExtractor () override
 
- Public Member Functions inherited from reco::isodeposit::IsoDepositExtractor
virtual reco::IsoDeposit deposit (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::TrackBaseRef &track) const
 make single IsoDeposit based on trackRef as input More...
 
virtual reco::IsoDeposit deposit (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::CandidateBaseRef &track) const
 make single IsoDeposit based on a CandidateBaseRef as input More...
 
virtual std::vector< reco::IsoDepositdeposits (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &track) const
 
virtual std::vector< reco::IsoDepositdeposits (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::TrackBaseRef &track) const
 
virtual std::vector< reco::IsoDepositdeposits (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Candidate &track) const
 
virtual std::vector< reco::IsoDepositdeposits (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::CandidateBaseRef &track) const
 
virtual ~IsoDepositExtractor ()
 Destructor. More...
 

Private Member Functions

template<typename T >
reco::IsoDeposit depositFromObject (const edm::Event &ev, const edm::EventSetup &evSetup, const T &cand) const
 
reco::IsoDeposit::Veto veto (const reco::IsoDeposit::Direction &dir) const
 

Private Attributes

edm::Event::CacheIdentifier_t theCacheID
 
edm::Handle< edm::View< reco::Candidate > > theCandViewH
 
edm::EDGetTokenT< edm::View< reco::Candidate > > theCandViewToken
 
std::string theDepositLabel
 
double theDiff_r
 
double theDiff_z
 
double theDR_Max
 
double theDR_Veto
 

Detailed Description

Definition at line 16 of file CandViewExtractor.cc.

Constructor & Destructor Documentation

◆ CandViewExtractor() [1/2]

muonisolation::CandViewExtractor::CandViewExtractor ( )
inline

Definition at line 18 of file CandViewExtractor.cc.

18 {}

◆ CandViewExtractor() [2/2]

CandViewExtractor::CandViewExtractor ( const edm::ParameterSet par,
edm::ConsumesCollector &&  iC 
)

Definition at line 104 of file CandViewExtractor.cc.

105  : theCandViewToken(iC.consumes<View<Candidate> >(par.getParameter<edm::InputTag>("inputCandView"))),
106  theDepositLabel(par.getUntrackedParameter<std::string>("DepositLabel")),
107  theDiff_r(par.getParameter<double>("Diff_r")),
108  theDiff_z(par.getParameter<double>("Diff_z")),
109  theDR_Max(par.getParameter<double>("DR_Max")),
110  theDR_Veto(par.getParameter<double>("DR_Veto")) {}
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< edm::View< reco::Candidate > > theCandViewToken
T getUntrackedParameter(std::string const &, T const &) const

◆ ~CandViewExtractor()

muonisolation::CandViewExtractor::~CandViewExtractor ( )
inlineoverride

Definition at line 21 of file CandViewExtractor.cc.

21 {}

Member Function Documentation

◆ deposit() [1/2]

reco::IsoDeposit muonisolation::CandViewExtractor::deposit ( const edm::Event ev,
const edm::EventSetup evSetup,
const reco::Track track 
) const
inlineoverridevirtual

make single IsoDeposit based on track as input purely virtual: have to implement in concrete implementations

Implements reco::isodeposit::IsoDepositExtractor.

Definition at line 34 of file CandViewExtractor.cc.

References depositFromObject(), and makeMEIFBenchmarkPlots::ev.

36  {
37  return depositFromObject(ev, evSetup, muon);
38  }
reco::IsoDeposit depositFromObject(const edm::Event &ev, const edm::EventSetup &evSetup, const T &cand) const

◆ deposit() [2/2]

reco::IsoDeposit muonisolation::CandViewExtractor::deposit ( const edm::Event ev,
const edm::EventSetup evSetup,
const reco::Candidate track 
) const
inlineoverridevirtual

make single IsoDeposit based on a candidate as input purely virtual: have to implement in concrete implementations

Reimplemented from reco::isodeposit::IsoDepositExtractor.

Definition at line 40 of file CandViewExtractor.cc.

References depositFromObject(), and makeMEIFBenchmarkPlots::ev.

42  {
43  return depositFromObject(ev, evSetup, muon);
44  }
reco::IsoDeposit depositFromObject(const edm::Event &ev, const edm::EventSetup &evSetup, const T &cand) const

◆ depositFromObject() [1/2]

template<typename T >
reco::IsoDeposit muonisolation::CandViewExtractor::depositFromObject ( const edm::Event ev,
const edm::EventSetup evSetup,
const T cand 
) const
private

Referenced by deposit().

◆ depositFromObject() [2/2]

template<typename T >
IsoDeposit muonisolation::CandViewExtractor::depositFromObject ( const Event event,
const EventSetup eventSetup,
const T cand 
) const

Definition at line 70 of file CandViewExtractor.cc.

References funct::abs(), eleIsoSequence_cff::deltaR, HGC3DClusterGenMatchSelector_cfi::dR, PVValHelper::eta, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, LogDebug, metname, AlCaHLTBitMon_QueryRunRegistry::string, relval_cleanedupgrade::veto, and L1BJetProducer_cff::vtx.

70  {
71  static const std::string metname = "MuonIsolation|CandViewExtractor";
72 
73  reco::isodeposit::Direction candDir(cand.eta(), cand.phi());
74  IsoDeposit deposit(candDir);
75  deposit.setVeto(veto(candDir));
77 
78  Handle<View<Candidate> > candViewH;
79  if (theCacheID != event.cacheIdentifier()) {
80  event.getByToken(theCandViewToken, candViewH);
81  } else {
82  candViewH = theCandViewH;
83  }
84 
85  double eta = cand.eta(), phi = cand.phi();
86  const reco::Particle::Point& vtx = cand.vertex();
87  LogDebug(metname) << "cand eta=" << eta << " phi=" << phi << " vtx=" << vtx;
88  for (View<Candidate>::const_iterator it = candViewH->begin(), ed = candViewH->end(); it != ed; ++it) {
89  double dR = deltaR(it->eta(), it->phi(), eta, phi);
90  LogDebug(metname) << "pdgid=" << it->pdgId() << " vtx=" << it->vertex() << " dR=" << dR
91  << " dvz=" << it->vz() - cand.vz() << " drho=" << (it->vertex() - vtx).Rho();
92  if ((dR < theDR_Max) && (dR > theDR_Veto) && (std::abs(it->vz() - cand.vz()) < theDiff_z) &&
93  ((it->vertex() - vtx).Rho() < theDiff_r)) {
94  // ok
95  reco::isodeposit::Direction dirTrk(it->eta(), it->phi());
96  deposit.addDeposit(dirTrk, it->pt());
97  LogDebug(metname) << "pt=" << it->pt();
98  }
99  }
100 
101  return deposit;
102 }
void setVeto(const Veto &aVeto)
Set veto.
Definition: IsoDeposit.h:82
const std::string metname
edm::Event::CacheIdentifier_t theCacheID
edm::EDGetTokenT< edm::View< reco::Candidate > > theCandViewToken
edm::Handle< edm::View< reco::Candidate > > theCandViewH
void addDeposit(double dr, double deposit)
Add deposit (ie. transverse energy or pT)
Definition: IsoDeposit.cc:19
reco::IsoDeposit deposit(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &muon) const override
reco::IsoDeposit::Veto veto(const reco::IsoDeposit::Direction &dir) const
void addCandEnergy(double et)
Set energy or pT attached to cand trajectory.
Definition: IsoDeposit.h:132
math::XYZPoint Point
point in the space
Definition: Particle.h:25
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:88
Definition: event.py:1
#define LogDebug(id)

◆ fillVetos()

void muonisolation::CandViewExtractor::fillVetos ( const edm::Event ev,
const edm::EventSetup evSetup,
const reco::TrackCollection tracks 
)
inlineoverridevirtual

fill vetoes: to exclude deposits at IsoDeposit creation stage check concrete extractors if it's no-op !

Implements reco::isodeposit::IsoDepositExtractor.

Definition at line 23 of file CandViewExtractor.cc.

23 {}

◆ initEvent()

void CandViewExtractor::initEvent ( const edm::Event ,
const edm::EventSetup  
)
overridevirtual

perform some constly initialization

Reimplemented from reco::isodeposit::IsoDepositExtractor.

Definition at line 127 of file CandViewExtractor.cc.

References makeMEIFBenchmarkPlots::ev, theCacheID, theCandViewH, and theCandViewToken.

127  {
128  ev.getByToken(theCandViewToken, theCandViewH);
129  theCacheID = ev.cacheIdentifier();
130 }
edm::Event::CacheIdentifier_t theCacheID
edm::EDGetTokenT< edm::View< reco::Candidate > > theCandViewToken
edm::Handle< edm::View< reco::Candidate > > theCandViewH

◆ veto()

reco::IsoDeposit::Veto CandViewExtractor::veto ( const reco::IsoDeposit::Direction dir) const
private

Member Data Documentation

◆ theCacheID

edm::Event::CacheIdentifier_t muonisolation::CandViewExtractor::theCacheID
private

Definition at line 56 of file CandViewExtractor.cc.

Referenced by initEvent().

◆ theCandViewH

edm::Handle<edm::View<reco::Candidate> > muonisolation::CandViewExtractor::theCandViewH
private

Definition at line 55 of file CandViewExtractor.cc.

Referenced by initEvent().

◆ theCandViewToken

edm::EDGetTokenT<edm::View<reco::Candidate> > muonisolation::CandViewExtractor::theCandViewToken
private

Definition at line 53 of file CandViewExtractor.cc.

Referenced by initEvent().

◆ theDepositLabel

std::string muonisolation::CandViewExtractor::theDepositLabel
private

Definition at line 54 of file CandViewExtractor.cc.

◆ theDiff_r

double muonisolation::CandViewExtractor::theDiff_r
private

Definition at line 57 of file CandViewExtractor.cc.

◆ theDiff_z

double muonisolation::CandViewExtractor::theDiff_z
private

Definition at line 58 of file CandViewExtractor.cc.

◆ theDR_Max

double muonisolation::CandViewExtractor::theDR_Max
private

Definition at line 59 of file CandViewExtractor.cc.

◆ theDR_Veto

double muonisolation::CandViewExtractor::theDR_Veto
private

Definition at line 60 of file CandViewExtractor.cc.

Referenced by veto().