CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Protected Attributes
l1tpf_impl::PUAlgoBase Class Referenceabstract

#include <PUAlgoBase.h>

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

Public Types

enum  VertexAlgo { VertexAlgo::Old, VertexAlgo::TP, VertexAlgo::External }
 global operations More...
 

Public Member Functions

virtual void doPUGlobals (const std::vector< Region > &rs, float npu, std::vector< float > &globals) const =0
 
virtual void doVertexing (std::vector< Region > &rs, VertexAlgo algo, float &vz) const
 
 PUAlgoBase (const edm::ParameterSet &)
 
virtual const std::vector< std::string > & puGlobalNames () const
 
virtual void runChargedPV (Region &r, float z0) const
 
virtual void runNeutralsPU (Region &r, float npu, const std::vector< float > &globals) const =0
 
virtual ~PUAlgoBase ()
 

Protected Attributes

int debug_
 
float etaCharged_
 
bool vtxAdaptiveCut_
 
float vtxRes_
 

Detailed Description

Definition at line 9 of file PUAlgoBase.h.

Member Enumeration Documentation

◆ VertexAlgo

global operations

Enumerator
Old 
TP 
External 

Definition at line 15 of file PUAlgoBase.h.

15 { Old, TP, External };

Constructor & Destructor Documentation

◆ PUAlgoBase()

PUAlgoBase::PUAlgoBase ( const edm::ParameterSet iConfig)

Definition at line 7 of file PUAlgoBase.cc.

8  : debug_(iConfig.getUntrackedParameter<int>("debug", 0)),
9  etaCharged_(iConfig.getParameter<double>("etaCharged")),
10  vtxRes_(iConfig.getParameter<double>("vtxRes")),
11  vtxAdaptiveCut_(iConfig.getParameter<bool>("vtxAdaptiveCut")) {}
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
T getUntrackedParameter(std::string const &, T const &) const

◆ ~PUAlgoBase()

PUAlgoBase::~PUAlgoBase ( )
virtual

Definition at line 13 of file PUAlgoBase.cc.

13 {}

Member Function Documentation

◆ doPUGlobals()

virtual void l1tpf_impl::PUAlgoBase::doPUGlobals ( const std::vector< Region > &  rs,
float  npu,
std::vector< float > &  globals 
) const
pure virtual

◆ doVertexing()

void PUAlgoBase::doVertexing ( std::vector< Region > &  rs,
VertexAlgo  algo,
float &  vz 
) const
virtual

Definition at line 28 of file PUAlgoBase.cc.

References funct::abs(), b, ReggeGribovPartonMC_AdvancedParameters_cfi::bmax, central, External, createfilelist::int, SiStripPI::max, SiStripPI::min, Old, AlCaHLTBitMon_ParallelJobs::p, alignCSCRings::r, TP, vtxAdaptiveCut_, and vtxRes_.

28  {
29  int lNBins = int(40. / vtxRes_);
30  if (algo == VertexAlgo::TP)
31  lNBins *= 3;
32  std::unique_ptr<TH1F> h_dz(new TH1F("h_dz", "h_dz", lNBins, -20, 20));
33  if (algo != VertexAlgo::External) {
34  for (const Region &r : rs) {
35  for (const PropagatedTrack &p : r.track) {
36  if (rs.size() > 1) {
37  if (!r.fiducialLocal(p.floatVtxEta(), p.floatVtxPhi()))
38  continue; // skip duplicates
39  }
40  h_dz->Fill(p.floatDZ(), std::min(p.floatPt(), 50.f));
41  }
42  }
43  }
44  switch (algo) {
46  break;
47  case VertexAlgo::Old: {
48  int imaxbin = h_dz->GetMaximumBin();
49  pvdz = h_dz->GetXaxis()->GetBinCenter(imaxbin);
50  }; break;
51  case VertexAlgo::TP: {
52  float max = 0;
53  int bmax = -1;
54  for (int b = 1; b <= lNBins; ++b) {
55  float sum3 = h_dz->GetBinContent(b) + h_dz->GetBinContent(b + 1) + h_dz->GetBinContent(b - 1);
56  if (bmax == -1 || sum3 > max) {
57  max = sum3;
58  bmax = b;
59  }
60  }
61  pvdz = h_dz->GetXaxis()->GetBinCenter(bmax);
62  }; break;
63  }
64  int16_t iZ0 = round(pvdz * InputTrack::Z0_SCALE);
65  int16_t iDZ = round(1.5 * vtxRes_ * InputTrack::Z0_SCALE);
66  int16_t iDZ2 = vtxAdaptiveCut_ ? round(4.0 * vtxRes_ * InputTrack::Z0_SCALE) : iDZ;
67  for (Region &r : rs) {
68  for (PropagatedTrack &p : r.track) {
69  bool central = std::abs(p.hwVtxEta) < InputTrack::VTX_ETA_1p3;
70  if (r.relativeCoordinates)
71  central =
72  (std::abs(r.globalAbsEta(p.floatVtxEta())) < 1.3); // FIXME could make a better integer implementation
73  p.fromPV = (std::abs(p.hwZ0 - iZ0) < (central ? iDZ : iDZ2));
74  }
75  }
76 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double b
Definition: hdecay.h:118

◆ puGlobalNames()

const std::vector< std::string > & PUAlgoBase::puGlobalNames ( ) const
virtual

Reimplemented in l1tpf_impl::LinearizedPuppiAlgo, and l1tpf_impl::PuppiAlgo.

Definition at line 78 of file PUAlgoBase.cc.

78  {
79  static const std::vector<std::string> empty_;
80  return empty_;
81 }

◆ runChargedPV()

void PUAlgoBase::runChargedPV ( Region r,
float  z0 
) const
virtual

Definition at line 15 of file PUAlgoBase.cc.

References funct::abs(), Reference_intrackfit_cff::barrel, AlCaHLTBitMon_ParallelJobs::p, alignCSCRings::r, vtxAdaptiveCut_, vtxRes_, and HLTMuonOfflineAnalyzer_cfi::z0.

15  {
16  int16_t iZ0 = round(z0 * InputTrack::Z0_SCALE);
17  int16_t iDZ = round(1.5 * vtxRes_ * InputTrack::Z0_SCALE);
18  int16_t iDZ2 = vtxAdaptiveCut_ ? round(4.0 * vtxRes_ * InputTrack::Z0_SCALE) : iDZ;
19  for (PFParticle &p : r.pf) {
20  bool barrel = std::abs(p.track.hwVtxEta) < InputTrack::VTX_ETA_1p3;
21  if (r.relativeCoordinates)
22  barrel =
23  (std::abs(r.globalAbsEta(p.track.floatVtxEta())) < 1.3); // FIXME could make a better integer implementation
24  p.chargedPV = (p.hwId <= 1 && std::abs(p.track.hwZ0 - iZ0) < (barrel ? iDZ : iDZ2));
25  }
26 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ runNeutralsPU()

virtual void l1tpf_impl::PUAlgoBase::runNeutralsPU ( Region r,
float  npu,
const std::vector< float > &  globals 
) const
pure virtual

Member Data Documentation

◆ debug_

int l1tpf_impl::PUAlgoBase::debug_
protected

◆ etaCharged_

float l1tpf_impl::PUAlgoBase::etaCharged_
protected

◆ vtxAdaptiveCut_

bool l1tpf_impl::PUAlgoBase::vtxAdaptiveCut_
protected

Definition at line 29 of file PUAlgoBase.h.

Referenced by doVertexing(), and runChargedPV().

◆ vtxRes_

float l1tpf_impl::PUAlgoBase::vtxRes_
protected

Definition at line 28 of file PUAlgoBase.h.

Referenced by doVertexing(), and runChargedPV().