CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
EgammaL1TkIsolation Class Reference

#include <EgammaL1TkIsolation.h>

Classes

struct  TrkCuts
 

Public Member Functions

std::pair< int, double > calIsol (const reco::TrackBase &trk, const L1TrackCollection &l1Tks) const
 
std::pair< int, double > calIsol (const double objEta, const double objPhi, const double objZ, const L1TrackCollection &l1Tks) const
 
template<typename... Args>
double calIsolPt (Args &&... args) const
 
 EgammaL1TkIsolation (const edm::ParameterSet &para)
 

Static Public Member Functions

static void fillPSetDescription (edm::ParameterSetDescription &desc)
 
static edm::ParameterSetDescription makePSetDescription ()
 

Private Member Functions

size_t etaBinNr (double eta) const
 

Static Private Member Functions

static bool passTrkSel (const L1Track &trk, const double trkPt, const TrkCuts &cuts, const double objEta, const double objPhi, const double objZ)
 

Private Attributes

std::vector< double > etaBoundaries_
 
std::vector< TrkCutstrkCuts_
 
bool useAbsEta_
 

Detailed Description

Definition at line 13 of file EgammaL1TkIsolation.h.

Constructor & Destructor Documentation

◆ EgammaL1TkIsolation()

EgammaL1TkIsolation::EgammaL1TkIsolation ( const edm::ParameterSet para)
explicit

Definition at line 7 of file EgammaL1TkIsolation.cc.

References etaBoundaries_, Exception, edm::ParameterSet::getParameter(), submitPVValidationJobs::params, and trkCuts_.

8  : useAbsEta_(para.getParameter<bool>("useAbsEta")),
9  etaBoundaries_(para.getParameter<std::vector<double>>("etaBoundaries")) {
10  const auto& trkCutParams = para.getParameter<std::vector<edm::ParameterSet>>("trkCuts");
11  for (const auto& params : trkCutParams) {
12  trkCuts_.emplace_back(TrkCuts(params));
13  }
14  if (etaBoundaries_.size() + 1 != trkCuts_.size()) {
15  throw cms::Exception("ConfigError") << "EgammaL1TkIsolation: etaBoundaries parameters size ("
16  << etaBoundaries_.size()
17  << ") should be one less than the size of trkCuts VPSet (" << trkCuts_.size()
18  << ")";
19  }
20  if (!std::is_sorted(etaBoundaries_.begin(), etaBoundaries_.end())) {
21  throw cms::Exception("ConfigError")
22  << "EgammaL1TkIsolation: etaBoundaries parameter's entries should be in increasing value";
23  }
24 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::vector< double > etaBoundaries_
std::vector< TrkCuts > trkCuts_

Member Function Documentation

◆ calIsol() [1/2]

std::pair< int, double > EgammaL1TkIsolation::calIsol ( const reco::TrackBase trk,
const L1TrackCollection l1Tks 
) const

Definition at line 32 of file EgammaL1TkIsolation.cc.

References reco::TrackBase::eta(), reco::TrackBase::phi(), pwdgSkimBPark_cfi::tracks, and reco::TrackBase::vz().

Referenced by calIsolPt(), and EgammaHLTEleL1TrackIsolProducer::produce().

32  {
33  return calIsol(trk.eta(), trk.phi(), trk.vz(), tracks);
34 }
double vz() const
z coordinate of the reference point on track
Definition: TrackBase.h:661
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:649
std::pair< int, double > calIsol(const reco::TrackBase &trk, const L1TrackCollection &l1Tks) const
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:652

◆ calIsol() [2/2]

std::pair< int, double > EgammaL1TkIsolation::calIsol ( const double  objEta,
const double  objPhi,
const double  objZ,
const L1TrackCollection l1Tks 
) const

Definition at line 36 of file EgammaL1TkIsolation.cc.

References etaBinNr(), passTrkSel(), pwdgSkimBPark_cfi::tracks, and trkCuts_.

39  {
40  double ptSum = 0.;
41  int nrTrks = 0;
42 
43  const TrkCuts& cuts = trkCuts_[etaBinNr(objEta)];
44 
45  for (const auto& trk : tracks) {
46  const float trkPt = trk.momentum().perp();
47  if (passTrkSel(trk, trkPt, cuts, objEta, objPhi, objZ)) {
48  ptSum += trkPt;
49  nrTrks++;
50  }
51  }
52  return {nrTrks, ptSum};
53 }
static bool passTrkSel(const L1Track &trk, const double trkPt, const TrkCuts &cuts, const double objEta, const double objPhi, const double objZ)
std::vector< TrkCuts > trkCuts_
size_t etaBinNr(double eta) const

◆ calIsolPt()

template<typename... Args>
double EgammaL1TkIsolation::calIsolPt ( Args &&...  args) const
inline

Definition at line 33 of file EgammaL1TkIsolation.h.

References writedatasetfile::args, and calIsol().

33  {
34  return calIsol(std::forward<Args>(args)...).second;
35  }
std::pair< int, double > calIsol(const reco::TrackBase &trk, const L1TrackCollection &l1Tks) const

◆ etaBinNr()

size_t EgammaL1TkIsolation::etaBinNr ( double  eta) const
private

Definition at line 76 of file EgammaL1TkIsolation.cc.

References funct::abs(), HLT_2022v15_cff::distance, PVValHelper::eta, etaBoundaries_, pfDeepBoostedJetPreprocessParams_cfi::upper_bound, and useAbsEta_.

Referenced by calIsol().

76  {
77  if (useAbsEta_) {
78  eta = std::abs(eta);
79  }
80  auto res = std::upper_bound(etaBoundaries_.begin(), etaBoundaries_.end(), eta);
81  size_t binNr = std::distance(etaBoundaries_.begin(), res);
82  return binNr;
83 }
std::vector< double > etaBoundaries_
Definition: Electron.h:6
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ fillPSetDescription()

void EgammaL1TkIsolation::fillPSetDescription ( edm::ParameterSetDescription desc)
static

Definition at line 26 of file EgammaL1TkIsolation.cc.

References submitPVResolutionJobs::desc, EgammaL1TkIsolation::TrkCuts::makePSetDescription(), and trackerHitRTTI::vector.

Referenced by makePSetDescription().

26  {
27  desc.add("useAbsEta", true);
28  desc.add("etaBoundaries", std::vector{1.5});
30 }
static edm::ParameterSetDescription makePSetDescription()

◆ makePSetDescription()

static edm::ParameterSetDescription EgammaL1TkIsolation::makePSetDescription ( )
inlinestatic

◆ passTrkSel()

bool EgammaL1TkIsolation::passTrkSel ( const L1Track trk,
const double  trkPt,
const TrkCuts cuts,
const double  objEta,
const double  objPhi,
const double  objZ 
)
staticprivate

Definition at line 85 of file EgammaL1TkIsolation.cc.

References funct::abs(), reco::deltaR2(), and HLT_2022v15_cff::dEta.

Referenced by calIsol().

90  {
91  if (trkPt > cuts.minPt && std::abs(objZ - trk.z0()) < cuts.maxDZ) {
92  const float trkEta = trk.eta();
93  const float dEta = trkEta - objEta;
94  const float dR2 = reco::deltaR2(objEta, objPhi, trkEta, trk.phi());
95  return dR2 >= cuts.minDR2 && dR2 <= cuts.maxDR2 && std::abs(dEta) >= cuts.minDEta;
96  }
97 
98  return false;
99 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16

Member Data Documentation

◆ etaBoundaries_

std::vector<double> EgammaL1TkIsolation::etaBoundaries_
private

Definition at line 57 of file EgammaL1TkIsolation.h.

Referenced by EgammaL1TkIsolation(), and etaBinNr().

◆ trkCuts_

std::vector<TrkCuts> EgammaL1TkIsolation::trkCuts_
private

Definition at line 58 of file EgammaL1TkIsolation.h.

Referenced by calIsol(), and EgammaL1TkIsolation().

◆ useAbsEta_

bool EgammaL1TkIsolation::useAbsEta_
private

Definition at line 56 of file EgammaL1TkIsolation.h.

Referenced by etaBinNr().