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 12 of file PrimaryVertexSorting.h.

Member Enumeration Documentation

◆ Quality

Constructor & Destructor Documentation

◆ PrimaryVertexSorting()

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

Definition at line 16 of file PrimaryVertexSorting.h.

18  {}

◆ ~PrimaryVertexSorting()

PrimaryVertexSorting::~PrimaryVertexSorting ( )
inline

Definition at line 20 of file PrimaryVertexSorting.h.

20 {}

Member Function Documentation

◆ score()

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

Definition at line 18 of file PrimaryVertexSorting.cc.

References funct::abs(), DummyCfis::c, HLT_2024v14_cff::cands, mps_fire::i, edm::isNotFinite(), PDWG_EXODelayedJetMET_cff::jets, BTaggingMonitor_cfi::met, or, DiDispStaMuonMonitor_cfi::pt, l1tEGammaCrystalsEmulatorProducer_cfi::scale, mathSSE::sqrt(), objects.METAnalyzer::sumEt, and hotlineDQM_cfi::useMet.

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

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