CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
l1tpf_impl::LinearizedPuppiAlgo Class Reference

#include <LinearizedPuppiAlgo.h>

Inheritance diagram for l1tpf_impl::LinearizedPuppiAlgo:
l1tpf_impl::PuppiAlgo l1tpf_impl::PUAlgoBase

Public Member Functions

void doPUGlobals (const std::vector< Region > &rs, float npu, std::vector< float > &globals) const override
 
 LinearizedPuppiAlgo (const edm::ParameterSet &)
 
const std::vector< std::string > & puGlobalNames () const override
 
void runNeutralsPU (Region &r, float npu, const std::vector< float > &globals) const override
 
 ~LinearizedPuppiAlgo () override
 
- Public Member Functions inherited from l1tpf_impl::PuppiAlgo
void doPUGlobals (const std::vector< Region > &rs, float npu, std::vector< float > &globals) const override
 
const std::vector< std::string > & puGlobalNames () const override
 
 PuppiAlgo (const edm::ParameterSet &)
 
void runNeutralsPU (Region &r, float npu, const std::vector< float > &globals) const override
 
 ~PuppiAlgo () override
 
- Public Member Functions inherited from l1tpf_impl::PUAlgoBase
virtual void doVertexing (std::vector< Region > &rs, VertexAlgo algo, float &vz) const
 
 PUAlgoBase (const edm::ParameterSet &)
 
virtual void runChargedPV (Region &r, float z0) const
 
virtual ~PUAlgoBase ()
 

Protected Member Functions

void computePuppiWeights (Region &r, float npu, const std::vector< float > &alphaC, const std::vector< float > &alphaF) const
 
- Protected Member Functions inherited from l1tpf_impl::PuppiAlgo
virtual void computePuppiAlphas (const Region &r, std::vector< float > &alphaC, std::vector< float > &alphaF) const
 
virtual void computePuppiMedRMS (const std::vector< Region > &rs, float &alphaCMed, float &alphaCRms, float &alphaFMed, float &alphaFRms) const
 
void computePuppiWeights (Region &r, const std::vector< float > &alphaC, const std::vector< float > &alphaF, float alphaCMed, float alphaCRms, float alphaFMed, float alphaFRms) const
 
virtual void fillPuppi (Region &r) const
 

Protected Attributes

std::vector< float > puppiAlphaCrops_
 
std::vector< float > puppiAlphaCropsPhotons_
 
std::vector< float > puppiAlphaSlopes_
 
std::vector< float > puppiAlphaSlopesPhotons_
 
std::vector< float > puppiAlphaZeros_
 
std::vector< float > puppiAlphaZerosPhotons_
 
std::vector< float > puppiPriors_
 
std::vector< float > puppiPriorsPhotons_
 
std::vector< float > puppiPtSlopes_
 
std::vector< float > puppiPtSlopesPhotons_
 
std::vector< float > puppiPtZeros_
 
std::vector< float > puppiPtZerosPhotons_
 
- Protected Attributes inherited from l1tpf_impl::PuppiAlgo
std::vector< int16_t > intPuppiEtaCuts_
 
std::vector< int16_t > intPuppiPtCuts_
 
std::vector< int16_t > intPuppiPtCutsPhotons_
 
float puppiDr_
 
float puppiDrMin_
 
std::vector< float > puppiEtaCuts_
 
std::vector< float > puppiPtCuts_
 
std::vector< float > puppiPtCutsPhotons_
 
float puppiPtMax_
 
bool puppiUsingBareTracks_
 
- Protected Attributes inherited from l1tpf_impl::PUAlgoBase
int debug_
 
float etaCharged_
 
bool vtxAdaptiveCut_
 
float vtxRes_
 

Additional Inherited Members

- Public Types inherited from l1tpf_impl::PUAlgoBase
enum  VertexAlgo { VertexAlgo::Old, VertexAlgo::TP, VertexAlgo::External }
 global operations More...
 

Detailed Description

Definition at line 8 of file LinearizedPuppiAlgo.h.

Constructor & Destructor Documentation

◆ LinearizedPuppiAlgo()

LinearizedPuppiAlgo::LinearizedPuppiAlgo ( const edm::ParameterSet iConfig)

Definition at line 19 of file LinearizedPuppiAlgo.cc.

20  : PuppiAlgo(iConfig),
21  puppiPriors_(vd2vf(iConfig.getParameter<std::vector<double>>("puppiPriors"))),
22  puppiPriorsPhotons_(vd2vf(iConfig.getParameter<std::vector<double>>("puppiPriorsPhotons"))),
23  puppiPtSlopes_(vd2vf(iConfig.getParameter<std::vector<double>>("puppiPtSlopes"))),
24  puppiPtSlopesPhotons_(vd2vf(iConfig.getParameter<std::vector<double>>("puppiPtSlopesPhotons"))),
25  puppiPtZeros_(vd2vf(iConfig.getParameter<std::vector<double>>("puppiPtZeros"))),
26  puppiPtZerosPhotons_(vd2vf(iConfig.getParameter<std::vector<double>>("puppiPtZerosPhotons"))),
27  puppiAlphaSlopes_(vd2vf(iConfig.getParameter<std::vector<double>>("puppiAlphaSlopes"))),
28  puppiAlphaSlopesPhotons_(vd2vf(iConfig.getParameter<std::vector<double>>("puppiAlphaSlopesPhotons"))),
29  puppiAlphaZeros_(vd2vf(iConfig.getParameter<std::vector<double>>("puppiAlphaZeros"))),
30  puppiAlphaZerosPhotons_(vd2vf(iConfig.getParameter<std::vector<double>>("puppiAlphaZerosPhotons"))),
31  puppiAlphaCrops_(vd2vf(iConfig.getParameter<std::vector<double>>("puppiAlphaCrops"))),
32  puppiAlphaCropsPhotons_(vd2vf(iConfig.getParameter<std::vector<double>>("puppiAlphaCropsPhotons"))) {
33  if (puppiPriors_.size() != puppiEtaCuts_.size())
34  throw cms::Exception("Configuration", "Mismatched lenght for puppiPriors\n");
35  if (puppiPtSlopes_.size() != puppiEtaCuts_.size())
36  throw cms::Exception("Configuration", "Mismatched lenght for puppiPtSlopes\n");
37  if (puppiPtZeros_.size() != puppiEtaCuts_.size())
38  throw cms::Exception("Configuration", "Mismatched lenght for puppiPtZeros\n");
39  if (puppiAlphaSlopes_.size() != puppiEtaCuts_.size())
40  throw cms::Exception("Configuration", "Mismatched lenght for puppiAlphaSlopes\n");
41  if (puppiAlphaZeros_.size() != puppiEtaCuts_.size())
42  throw cms::Exception("Configuration", "Mismatched lenght for puppiAlphaZeros\n");
43  if (puppiAlphaCrops_.size() != puppiEtaCuts_.size())
44  throw cms::Exception("Configuration", "Mismatched lenght for puppiAlphaCrops\n");
45  if (puppiPriorsPhotons_.size() != puppiEtaCuts_.size())
46  throw cms::Exception("Configuration", "Mismatched lenght for puppiPriorsPhotons\n");
47  if (puppiPtSlopesPhotons_.size() != puppiEtaCuts_.size())
48  throw cms::Exception("Configuration", "Mismatched lenght for puppiPtSlopesPhotons\n");
49  if (puppiPtZerosPhotons_.size() != puppiEtaCuts_.size())
50  throw cms::Exception("Configuration", "Mismatched lenght for puppiPtZerosPhotons\n");
51  if (puppiAlphaSlopesPhotons_.size() != puppiEtaCuts_.size())
52  throw cms::Exception("Configuration", "Mismatched lenght for puppiAlphaSlopesPhotons\n");
53  if (puppiAlphaZerosPhotons_.size() != puppiEtaCuts_.size())
54  throw cms::Exception("Configuration", "Mismatched lenght for puppiAlphaZerosPhotons\n");
55  if (puppiAlphaCropsPhotons_.size() != puppiEtaCuts_.size())
56  throw cms::Exception("Configuration", "Mismatched lenght for puppiAlphaCropsPhotons\n");
57 }

References puppiAlphaCrops_, puppiAlphaCropsPhotons_, puppiAlphaSlopes_, puppiAlphaSlopesPhotons_, puppiAlphaZeros_, puppiAlphaZerosPhotons_, l1tpf_impl::PuppiAlgo::puppiEtaCuts_, puppiPriors_, puppiPriorsPhotons_, puppiPtSlopes_, puppiPtSlopesPhotons_, puppiPtZeros_, and puppiPtZerosPhotons_.

◆ ~LinearizedPuppiAlgo()

LinearizedPuppiAlgo::~LinearizedPuppiAlgo ( )
override

Definition at line 59 of file LinearizedPuppiAlgo.cc.

59 {}

Member Function Documentation

◆ computePuppiWeights()

void LinearizedPuppiAlgo::computePuppiWeights ( Region r,
float  npu,
const std::vector< float > &  alphaC,
const std::vector< float > &  alphaF 
) const
protected

Definition at line 75 of file LinearizedPuppiAlgo.cc.

78  {
79  if (debug_ && npu > 0)
80  dbgPrintf("LinPup\t npu estimate %7.2f --> log(npu/200) = %+6.2f \n", npu, std::log(npu / 200.f));
81  for (unsigned int ip = 0, np = r.pf.size(); ip < np; ++ip) {
82  PFParticle &p = r.pf[ip];
83  // charged
85  p.hwId == l1t::PFCandidate::Muon) {
86  p.setPuppiW(p.chargedPV || p.hwId == l1t::PFCandidate::Muon ? 1.0 : 0);
87  if (debug_ == 2)
88  dbgPrintf(
89  "LinPup\t charged id %1d pt %7.2f eta %+5.2f phi %+5.2f fromPV %1d "
90  " --> puppi weight %.3f puppi pt %7.2f \n",
91  p.hwId,
92  p.floatPt(),
93  p.floatEta(),
94  p.floatPhi(),
95  p.chargedPV,
96  p.floatPuppiW(),
97  p.floatPt() * p.floatPuppiW());
98  continue;
99  }
100  // neutral
101  float absEta = r.relativeCoordinates ? r.globalAbsEta(p.floatEta()) : std::abs(p.floatEta());
102  bool central = absEta < etaCharged_; // FIXME could make a better integer implementation
103  bool photon = (p.hwId == l1t::PFCandidate::Photon);
104  // get alpha
105  float alpha = central ? alphaC[ip] : alphaF[ip];
106  alpha = (alpha > 0 ? std::log(alpha) : 0);
107  // get eta bin
108  unsigned int ietaBin = 0, lastBin = puppiEtaCuts_.size() - 1;
109  while (ietaBin < lastBin && absEta > puppiEtaCuts_[ietaBin]) {
110  ietaBin++;
111  }
112  float alphaZero = (photon ? puppiAlphaZerosPhotons_ : puppiAlphaZeros_)[ietaBin];
113  float alphaSlope = (photon ? puppiAlphaSlopesPhotons_ : puppiAlphaSlopes_)[ietaBin];
114  float alphaCrop = (photon ? puppiAlphaCropsPhotons_ : puppiAlphaCrops_)[ietaBin];
115  float x2a = std::clamp(alphaSlope * (alpha - alphaZero), -alphaCrop, alphaCrop);
116  // weight by pT
117  float ptZero = (photon ? puppiPtZerosPhotons_ : puppiPtZeros_)[ietaBin];
118  float ptSlope = (photon ? puppiPtSlopesPhotons_ : puppiPtSlopes_)[ietaBin];
119  float x2pt = ptSlope * (p.floatPt() - ptZero);
120  // weight by prior
121  float prior = (photon ? puppiPriorsPhotons_ : puppiPriors_)[ietaBin];
122  float x2prior = (npu > 0 ? std::log(npu / 200.f) : 0) + prior;
123  // total
124  float x2 = x2a + x2pt - x2prior;
125  p.setPuppiW(1.0 / (1.0 + std::exp(-x2)));
126  if (debug_ == 1 || debug_ == 2 || debug_ == int(10 + ietaBin))
127  dbgPrintf(
128  "LinPup\t neutral id %1d pt %7.2f eta %+5.2f phi %+5.2f alpha %+6.2f x2a %+5.2f x2pt %+6.2f x2prior "
129  "%+6.2f --> x2 %+6.2f --> puppi weight %.3f puppi pt %7.2f \n",
130  p.hwId,
131  p.floatPt(),
132  p.floatEta(),
133  p.floatPhi(),
134  alpha,
135  x2a,
136  x2pt,
137  -x2prior,
138  x2,
139  p.floatPuppiW(),
140  p.floatPt() * p.floatPuppiW());
141  }
142 }

References funct::abs(), zMuMuMuonUserData::alpha, central, l1t::PFCandidate::ChargedHadron, dbgPrintf(), l1tpf_impl::PUAlgoBase::debug_, l1t::PFCandidate::Electron, l1tpf_impl::PUAlgoBase::etaCharged_, JetChargeProducer_cfi::exp, f, dqm-mbProfile::log, l1t::PFCandidate::Muon, np, AlCaHLTBitMon_ParallelJobs::p, l1t::PFCandidate::Photon, muons2muons_cfi::photon, bookConverter::prior, puppiAlphaCrops_, puppiAlphaCropsPhotons_, puppiAlphaSlopes_, puppiAlphaSlopesPhotons_, puppiAlphaZeros_, puppiAlphaZerosPhotons_, l1tpf_impl::PuppiAlgo::puppiEtaCuts_, puppiPriors_, puppiPriorsPhotons_, puppiPtSlopes_, puppiPtSlopesPhotons_, puppiPtZeros_, puppiPtZerosPhotons_, alignCSCRings::r, and testProducerWithPsetDescEmpty_cfi::x2.

Referenced by runNeutralsPU().

◆ doPUGlobals()

void LinearizedPuppiAlgo::doPUGlobals ( const std::vector< Region > &  rs,
float  npu,
std::vector< float > &  globals 
) const
overridevirtual

Implements l1tpf_impl::PUAlgoBase.

Definition at line 65 of file LinearizedPuppiAlgo.cc.

65  {
66  globals.clear();
67 }

◆ puGlobalNames()

const std::vector< std::string > & LinearizedPuppiAlgo::puGlobalNames ( ) const
overridevirtual

Reimplemented from l1tpf_impl::PUAlgoBase.

Definition at line 61 of file LinearizedPuppiAlgo.cc.

61  {
62  static const std::vector<std::string> names_{};
63  return names_;
64 }

◆ runNeutralsPU()

void LinearizedPuppiAlgo::runNeutralsPU ( Region r,
float  npu,
const std::vector< float > &  globals 
) const
overridevirtual

Implements l1tpf_impl::PUAlgoBase.

Definition at line 68 of file LinearizedPuppiAlgo.cc.

68  {
69  std::vector<float> alphaC, alphaF;
70  PuppiAlgo::computePuppiAlphas(r, alphaC, alphaF);
71  computePuppiWeights(r, npu, alphaC, alphaF);
73 }

References l1tpf_impl::PuppiAlgo::computePuppiAlphas(), computePuppiWeights(), l1tpf_impl::PuppiAlgo::fillPuppi(), and alignCSCRings::r.

Member Data Documentation

◆ puppiAlphaCrops_

std::vector<float> l1tpf_impl::LinearizedPuppiAlgo::puppiAlphaCrops_
protected

Definition at line 28 of file LinearizedPuppiAlgo.h.

Referenced by computePuppiWeights(), and LinearizedPuppiAlgo().

◆ puppiAlphaCropsPhotons_

std::vector<float> l1tpf_impl::LinearizedPuppiAlgo::puppiAlphaCropsPhotons_
protected

Definition at line 28 of file LinearizedPuppiAlgo.h.

Referenced by computePuppiWeights(), and LinearizedPuppiAlgo().

◆ puppiAlphaSlopes_

std::vector<float> l1tpf_impl::LinearizedPuppiAlgo::puppiAlphaSlopes_
protected

Definition at line 26 of file LinearizedPuppiAlgo.h.

Referenced by computePuppiWeights(), and LinearizedPuppiAlgo().

◆ puppiAlphaSlopesPhotons_

std::vector<float> l1tpf_impl::LinearizedPuppiAlgo::puppiAlphaSlopesPhotons_
protected

Definition at line 26 of file LinearizedPuppiAlgo.h.

Referenced by computePuppiWeights(), and LinearizedPuppiAlgo().

◆ puppiAlphaZeros_

std::vector<float> l1tpf_impl::LinearizedPuppiAlgo::puppiAlphaZeros_
protected

Definition at line 27 of file LinearizedPuppiAlgo.h.

Referenced by computePuppiWeights(), and LinearizedPuppiAlgo().

◆ puppiAlphaZerosPhotons_

std::vector<float> l1tpf_impl::LinearizedPuppiAlgo::puppiAlphaZerosPhotons_
protected

Definition at line 27 of file LinearizedPuppiAlgo.h.

Referenced by computePuppiWeights(), and LinearizedPuppiAlgo().

◆ puppiPriors_

std::vector<float> l1tpf_impl::LinearizedPuppiAlgo::puppiPriors_
protected

Definition at line 23 of file LinearizedPuppiAlgo.h.

Referenced by computePuppiWeights(), and LinearizedPuppiAlgo().

◆ puppiPriorsPhotons_

std::vector<float> l1tpf_impl::LinearizedPuppiAlgo::puppiPriorsPhotons_
protected

Definition at line 23 of file LinearizedPuppiAlgo.h.

Referenced by computePuppiWeights(), and LinearizedPuppiAlgo().

◆ puppiPtSlopes_

std::vector<float> l1tpf_impl::LinearizedPuppiAlgo::puppiPtSlopes_
protected

Definition at line 24 of file LinearizedPuppiAlgo.h.

Referenced by computePuppiWeights(), and LinearizedPuppiAlgo().

◆ puppiPtSlopesPhotons_

std::vector<float> l1tpf_impl::LinearizedPuppiAlgo::puppiPtSlopesPhotons_
protected

Definition at line 24 of file LinearizedPuppiAlgo.h.

Referenced by computePuppiWeights(), and LinearizedPuppiAlgo().

◆ puppiPtZeros_

std::vector<float> l1tpf_impl::LinearizedPuppiAlgo::puppiPtZeros_
protected

Definition at line 25 of file LinearizedPuppiAlgo.h.

Referenced by computePuppiWeights(), and LinearizedPuppiAlgo().

◆ puppiPtZerosPhotons_

std::vector<float> l1tpf_impl::LinearizedPuppiAlgo::puppiPtZerosPhotons_
protected

Definition at line 25 of file LinearizedPuppiAlgo.h.

Referenced by computePuppiWeights(), and LinearizedPuppiAlgo().

l1t::PFCandidate::Photon
Definition: PFCandidate.h:15
muons2muons_cfi.photon
photon
Definition: muons2muons_cfi.py:28
l1tpf_impl::PUAlgoBase::debug_
int debug_
Definition: PUAlgoBase.h:27
l1tpf_impl::LinearizedPuppiAlgo::puppiAlphaSlopesPhotons_
std::vector< float > puppiAlphaSlopesPhotons_
Definition: LinearizedPuppiAlgo.h:26
l1tpf_impl::PuppiAlgo::fillPuppi
virtual void fillPuppi(Region &r) const
Definition: PuppiAlgo.cc:236
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
zMuMuMuonUserData.alpha
alpha
zGenParticlesMatch = cms.InputTag(""),
Definition: zMuMuMuonUserData.py:9
l1tpf_impl::LinearizedPuppiAlgo::puppiAlphaCropsPhotons_
std::vector< float > puppiAlphaCropsPhotons_
Definition: LinearizedPuppiAlgo.h:28
testProducerWithPsetDescEmpty_cfi.x2
x2
Definition: testProducerWithPsetDescEmpty_cfi.py:28
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
np
int np
Definition: AMPTWrapper.h:43
central
Definition: L1ECALPrefiringWeightProducer.cc:36
l1tpf_impl::LinearizedPuppiAlgo::puppiPriorsPhotons_
std::vector< float > puppiPriorsPhotons_
Definition: LinearizedPuppiAlgo.h:23
l1t::PFCandidate::Electron
Definition: PFCandidate.h:15
l1tpf_impl::LinearizedPuppiAlgo::puppiAlphaCrops_
std::vector< float > puppiAlphaCrops_
Definition: LinearizedPuppiAlgo.h:28
l1tpf_impl::LinearizedPuppiAlgo::puppiAlphaZerosPhotons_
std::vector< float > puppiAlphaZerosPhotons_
Definition: LinearizedPuppiAlgo.h:27
l1tpf_impl::PFParticle
Definition: DiscretePFInputs.h:184
l1tpf_impl::LinearizedPuppiAlgo::puppiPtZeros_
std::vector< float > puppiPtZeros_
Definition: LinearizedPuppiAlgo.h:25
l1tpf_impl::LinearizedPuppiAlgo::puppiAlphaSlopes_
std::vector< float > puppiAlphaSlopes_
Definition: LinearizedPuppiAlgo.h:26
l1tpf_impl::LinearizedPuppiAlgo::puppiPtZerosPhotons_
std::vector< float > puppiPtZerosPhotons_
Definition: LinearizedPuppiAlgo.h:25
l1tpf_impl::PUAlgoBase::etaCharged_
float etaCharged_
Definition: PUAlgoBase.h:28
l1t::PFCandidate::ChargedHadron
Definition: PFCandidate.h:15
l1tpf_impl::LinearizedPuppiAlgo::puppiPriors_
std::vector< float > puppiPriors_
Definition: LinearizedPuppiAlgo.h:23
l1tpf_impl::PuppiAlgo::PuppiAlgo
PuppiAlgo(const edm::ParameterSet &)
Definition: PuppiAlgo.cc:19
alignCSCRings.r
r
Definition: alignCSCRings.py:93
l1tpf_impl::PuppiAlgo::puppiEtaCuts_
std::vector< float > puppiEtaCuts_
Definition: PuppiAlgo.h:31
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
dbgPrintf
void dbgPrintf(const char *formatString, Args &&... args)
Definition: dbgPrintf.h:5
l1t::PFCandidate::Muon
Definition: PFCandidate.h:15
l1tpf_impl::PuppiAlgo::computePuppiAlphas
virtual void computePuppiAlphas(const Region &r, std::vector< float > &alphaC, std::vector< float > &alphaF) const
Definition: PuppiAlgo.cc:57
l1tpf_impl::LinearizedPuppiAlgo::puppiPtSlopesPhotons_
std::vector< float > puppiPtSlopesPhotons_
Definition: LinearizedPuppiAlgo.h:24
l1tpf_impl::LinearizedPuppiAlgo::puppiPtSlopes_
std::vector< float > puppiPtSlopes_
Definition: LinearizedPuppiAlgo.h:24
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
bookConverter.prior
prior
Definition: bookConverter.py:146
cms::Exception
Definition: Exception.h:70
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
l1tpf_impl::LinearizedPuppiAlgo::computePuppiWeights
void computePuppiWeights(Region &r, float npu, const std::vector< float > &alphaC, const std::vector< float > &alphaF) const
Definition: LinearizedPuppiAlgo.cc:75
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
l1tpf_impl::LinearizedPuppiAlgo::puppiAlphaZeros_
std::vector< float > puppiAlphaZeros_
Definition: LinearizedPuppiAlgo.h:27