CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions
PrimaryVertexSorting Class Reference

#include <PrimaryVertexSorting.h>

Public Types

enum  Quality {
  UsedInFit = 0, PrimaryDz, BTrack, OtherDz,
  NotReconstructedPrimary, Unassigned = 99
}
 

Public Member Functions

 PrimaryVertexSorting (const edm::ParameterSet &iConfig)
 
float score (const reco::Vertex &pv, const std::vector< const reco::Candidate * > &candidates, bool useMet) const
 
 ~PrimaryVertexSorting ()
 

Detailed Description

Definition at line 15 of file PrimaryVertexSorting.h.

Member Enumeration Documentation

◆ Quality

Enumerator
UsedInFit 
PrimaryDz 
BTrack 
OtherDz 
NotReconstructedPrimary 
Unassigned 

Definition at line 17 of file PrimaryVertexSorting.h.

Constructor & Destructor Documentation

◆ PrimaryVertexSorting()

PrimaryVertexSorting::PrimaryVertexSorting ( const edm::ParameterSet iConfig)
inline

Definition at line 19 of file PrimaryVertexSorting.h.

21  {}

◆ ~PrimaryVertexSorting()

PrimaryVertexSorting::~PrimaryVertexSorting ( )
inline

Definition at line 23 of file PrimaryVertexSorting.h.

23 {}

Member Function Documentation

◆ score()

float PrimaryVertexSorting::score ( const reco::Vertex pv,
const std::vector< const reco::Candidate * > &  candidates,
bool  useMet 
) const

Definition at line 17 of file PrimaryVertexSorting.cc.

19  {
21  float sumPt2 = 0;
22  float sumEt = 0;
24  std::vector<fastjet::PseudoJet> fjInputs_;
25  fjInputs_.clear();
26  size_t countScale0 = 0;
27  for (size_t i = 0; i < cands.size(); i++) {
28  const reco::Candidate *c = cands[i];
29  float scale = 1.;
30  if (c->bestTrack() != nullptr) {
31  if (c->pt() != 0) {
32  scale = (c->pt() - c->bestTrack()->ptError()) / c->pt();
33  }
34  if (edm::isNotFinite(scale)) {
35  edm::LogWarning("PrimaryVertexSorting") << "Scaling is NAN ignoring this candidate/track" << std::endl;
36  scale = 0;
37  }
38  if (scale < 0) {
39  scale = 0;
40  countScale0++;
41  }
42  }
43 
44  int absId = abs(c->pdgId());
45  if (absId == 13 or absId == 11) {
46  float pt = c->pt() * scale;
47  sumPt2 += pt * pt;
48  met += c->p4() * scale;
49  sumEt += c->pt() * scale;
50  } else {
51  if (scale != 0) { // otherwise, what is the point to cluster zeroes
52  fjInputs_.push_back(fastjet::PseudoJet(c->px() * scale, c->py() * scale, c->pz() * scale, c->p4().E() * scale));
53  // fjInputs_.back().set_user_index(i);
54  }
55  }
56  }
57  fastjet::ClusterSequence sequence(fjInputs_, JetDefinition(antikt_algorithm, 0.4));
58  auto jets = fastjet::sorted_by_pt(sequence.inclusive_jets(0));
59  for (const auto &pj : jets) {
60  auto p4 = LorentzVector(pj.px(), pj.py(), pj.pz(), pj.e());
61  sumPt2 += (p4.pt() * p4.pt()) * 0.8 * 0.8;
62  met += p4;
63  sumEt += p4.pt();
64  }
65  float metAbove = met.pt() - 2 * sqrt(sumEt);
66  if (metAbove > 0 and useMet) {
67  sumPt2 += metAbove * metAbove;
68  }
69  if (countScale0 == cands.size())
70  sumPt2 = countScale0 * 0.01; //leave some epsilon value to sort vertices with unknown pt
71  return sumPt2;
72 }

References funct::abs(), HltBtagPostValidation_cff::c, HLT_2018_cff::cands, mps_fire::i, edm::isNotFinite(), singleTopDQM_cfi::jets, BTaggingMonitor_cfi::met, or, p4, DiDispStaMuonMonitor_cfi::pt, Scenarios_cff::scale, mathSSE::sqrt(), objects.METAnalyzer::sumEt, and hotlineDQM_cfi::useMet.

Referenced by PrimaryVertexSorter< ParticlesCollection >::produce().

mps_fire.i
i
Definition: mps_fire.py:355
edm::isNotFinite
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
objects.METAnalyzer.sumEt
sumEt
Definition: METAnalyzer.py:97
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
PrimaryVertexSorting::BTrack
Definition: PrimaryVertexSorting.h:17
BTaggingMonitor_cfi.met
met
Definition: BTaggingMonitor_cfi.py:84
PrimaryVertexSorting::Unassigned
Definition: PrimaryVertexSorting.h:17
PrimaryVertexSorting::OtherDz
Definition: PrimaryVertexSorting.h:17
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
PrimaryVertexSorting::UsedInFit
Definition: PrimaryVertexSorting.h:17
edm::LogWarning
Definition: MessageLogger.h:141
Scenarios_cff.scale
scale
Definition: Scenarios_cff.py:2186
p4
double p4[4]
Definition: TauolaWrapper.h:92
hotlineDQM_cfi.useMet
useMet
Definition: hotlineDQM_cfi.py:81
PrimaryVertexSorting::PrimaryDz
Definition: PrimaryVertexSorting.h:17
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
reco::Candidate
Definition: Candidate.h:27
reco::JetExtendedAssociation::LorentzVector
math::PtEtaPhiELorentzVectorF LorentzVector
Definition: JetExtendedAssociation.h:25
math::XYZTLorentzVector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
LorentzVector
math::XYZTLorentzVector LorentzVector
Definition: HLTMuonMatchAndPlot.h:49
HLT_2018_cff.cands
cands
Definition: HLT_2018_cff.py:13762
or
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
PrimaryVertexSorting::NotReconstructedPrimary
Definition: PrimaryVertexSorting.h:17