CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
PVClusterComparer Class Reference

#include <PVClusterComparer.h>

Public Member Functions

bool operator() (const PVCluster &v1, const PVCluster &v2)
 Use this operator in a std::sort to sort them in decreasing sumPt. More...
 
bool operator() (const reco::Vertex &v1, const reco::Vertex &v2)
 
double pTSquaredSum (const PVCluster &v)
 Calculate sum of square of the pT's of the tracks in the vertex. More...
 
double pTSquaredSum (const reco::Vertex &v)
 
 PVClusterComparer ()
 Constructor does nothing, no data members. More...
 
 PVClusterComparer (double track_pt_min, double track_pt_max, double track_chi2_max, double track_prob_min)
 
void setChisquareQuantile ()
 
void updateChisquareQuantile (size_t ndof)
 

Public Attributes

std::vector< double > maxChi2_
 
const double track_chi2_max_
 
const double track_prob_min_
 
const double track_pT_max_
 
const double track_pT_min_
 

Detailed Description

RecoPixelVertexing/PixelVertexFinding/PVClusterComparer.h
This helper class is used to sort the collection of vertexes by sumPt. It is used in DivisiveVertexFinder. The sum of the squares of the pT is only done for tracks with pT>2.5 GeV. If the pT>10 GeV, then the max value of 10 is used. (The pT of pixel tracks is not very precise.)

Author
Aaron Dominguez (UNL)

Definition at line 16 of file PVClusterComparer.h.

Constructor & Destructor Documentation

◆ PVClusterComparer() [1/2]

PVClusterComparer::PVClusterComparer ( )

Constructor does nothing, no data members.

Definition at line 7 of file PVClusterComparer.cc.

8  : track_pT_min_(2.5), track_pT_max_(10.), track_chi2_max_(9999999.), track_prob_min_(-1.) {
10 }

References setChisquareQuantile().

◆ PVClusterComparer() [2/2]

PVClusterComparer::PVClusterComparer ( double  track_pt_min,
double  track_pt_max,
double  track_chi2_max,
double  track_prob_min 
)

Member Function Documentation

◆ operator()() [1/2]

bool PVClusterComparer::operator() ( const PVCluster v1,
const PVCluster v2 
)

Use this operator in a std::sort to sort them in decreasing sumPt.

Definition at line 97 of file PVClusterComparer.cc.

97  {
98  return (pTSquaredSum(v1) > pTSquaredSum(v2));
99 }

References pTSquaredSum().

◆ operator()() [2/2]

bool PVClusterComparer::operator() ( const reco::Vertex v1,
const reco::Vertex v2 
)

Definition at line 100 of file PVClusterComparer.cc.

100  {
101  return (pTSquaredSum(v1) > pTSquaredSum(v2));
102 }

References pTSquaredSum().

◆ pTSquaredSum() [1/2]

double PVClusterComparer::pTSquaredSum ( const PVCluster v)

Calculate sum of square of the pT's of the tracks in the vertex.

Definition at line 23 of file PVClusterComparer.cc.

23  {
24  double sum = 0;
25  for (size_t i = 0; i < v.tracks().size(); ++i) {
26  double pt = v.tracks()[i]->pt();
27  if (pt < track_pT_min_)
28  continue; // Don't count tracks below track_pT_min_ (2.5 GeV)
29 
30  // RM : exclude badly reconstructed tracks from the sum
31  // if (track_prob_min_ >= 0. && track_prob_min_ <= 1.)
32  // if (TMath::Prob(v.tracks()[i]->chi2(),v.tracks()[i]->ndof()) < track_prob_min_) continue ;
33  if (track_prob_min_ >= 0. && track_prob_min_ <= 1.) {
34  size_t ndof = v.tracks()[i]->ndof();
35  if (ndof >= maxChi2_.size())
37  // cut on chi2 which corresponds to the configured probability
38  if (v.tracks()[i]->chi2() > maxChi2_[ndof])
39  continue;
40  }
41  if (v.tracks()[i]->normalizedChi2() > track_chi2_max_)
42  continue;
43  if (pt > track_pT_max_)
44  pt = track_pT_max_;
45  sum += pt * pt;
46  }
47  return sum;
48 }

References mps_fire::i, maxChi2_, ndof, DiDispStaMuonMonitor_cfi::pt, track_chi2_max_, track_prob_min_, track_pT_max_, track_pT_min_, updateChisquareQuantile(), and findQualityFiles::v.

Referenced by operator()(), and PixelVertexCollectionTrimmer::produce().

◆ pTSquaredSum() [2/2]

double PVClusterComparer::pTSquaredSum ( const reco::Vertex v)

Definition at line 50 of file PVClusterComparer.cc.

50  {
51  double sum = 0;
52  for (reco::Vertex::trackRef_iterator i = v.tracks_begin(), ie = v.tracks_end(); i != ie; ++i) {
53  double pt = (*i)->pt();
54  if (pt < track_pT_min_)
55  continue; // Don't count tracks below track_pT_min_ (2.5 GeV)
56 
57  // RM : exclude badly reconstructed tracks from the sum
58  // if (track_prob_min_ >= 0. && track_prob_min_ <= 1.)
59  // if (TMath::Prob((*i)->chi2(),(*i)->ndof()) < track_prob_min_) continue ;
60  if (track_prob_min_ >= 0. && track_prob_min_ <= 1.) {
61  unsigned int ndof = (*i)->ndof();
62  if (ndof >= maxChi2_.size())
64  // cut on chi2 which corresponds to the configured probability
65  if ((*i)->chi2() > maxChi2_[ndof])
66  continue;
67  }
68  if ((*i)->normalizedChi2() > track_chi2_max_)
69  continue;
70 
71  if (pt > track_pT_max_)
72  pt = track_pT_max_;
73  sum += pt * pt;
74  }
75  return sum;
76 }

References mps_fire::i, maxChi2_, ndof, DiDispStaMuonMonitor_cfi::pt, track_chi2_max_, track_prob_min_, track_pT_max_, track_pT_min_, updateChisquareQuantile(), and findQualityFiles::v.

◆ setChisquareQuantile()

void PVClusterComparer::setChisquareQuantile ( )

Definition at line 78 of file PVClusterComparer.cc.

78  {
79  std::vector<double> maxChi2(20, 0.);
80  if (track_prob_min_ >= 0. && track_prob_min_ <= 1.)
81  for (size_t ndof = 0; ndof < maxChi2_.size(); ++ndof)
82  // http://root.cern.ch/root/html/TMath.html#TMath:ChisquareQuantile
83  maxChi2[ndof] = TMath::ChisquareQuantile(1 - track_prob_min_, ndof);
84 
85  maxChi2_ = maxChi2;
86 }

References beam_dqm_sourceclient-live_cfg::maxChi2, maxChi2_, ndof, and track_prob_min_.

Referenced by PVClusterComparer().

◆ updateChisquareQuantile()

void PVClusterComparer::updateChisquareQuantile ( size_t  ndof)

Definition at line 88 of file PVClusterComparer.cc.

88  {
89  size_t oldsize = maxChi2_.size();
90  // maxChi2_.resize(ndof+1);
91  for (size_t i = oldsize; i <= ndof; ++i) {
92  double chi2 = TMath::ChisquareQuantile(1 - track_prob_min_, i);
93  maxChi2_.push_back(chi2);
94  }
95 }

References hltPixelTracks_cff::chi2, mps_fire::i, maxChi2_, ndof, and track_prob_min_.

Referenced by pTSquaredSum().

Member Data Documentation

◆ maxChi2_

std::vector<double> PVClusterComparer::maxChi2_

Definition at line 32 of file PVClusterComparer.h.

Referenced by pTSquaredSum(), setChisquareQuantile(), and updateChisquareQuantile().

◆ track_chi2_max_

const double PVClusterComparer::track_chi2_max_

Definition at line 36 of file PVClusterComparer.h.

Referenced by pTSquaredSum().

◆ track_prob_min_

const double PVClusterComparer::track_prob_min_

Definition at line 37 of file PVClusterComparer.h.

Referenced by pTSquaredSum(), setChisquareQuantile(), and updateChisquareQuantile().

◆ track_pT_max_

const double PVClusterComparer::track_pT_max_

Definition at line 35 of file PVClusterComparer.h.

Referenced by pTSquaredSum().

◆ track_pT_min_

const double PVClusterComparer::track_pT_min_

Definition at line 34 of file PVClusterComparer.h.

Referenced by pTSquaredSum().

reco::Vertex::trackRef_iterator
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
Definition: Vertex.h:38
PVClusterComparer::track_prob_min_
const double track_prob_min_
Definition: PVClusterComparer.h:37
mps_fire.i
i
Definition: mps_fire.py:355
PVClusterComparer::track_pT_min_
const double track_pT_min_
Definition: PVClusterComparer.h:34
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
HLT_2018_cff.track_pt_min
track_pt_min
Definition: HLT_2018_cff.py:256
HLT_2018_cff.track_prob_min
track_prob_min
Definition: HLT_2018_cff.py:255
PVClusterComparer::setChisquareQuantile
void setChisquareQuantile()
Definition: PVClusterComparer.cc:78
beam_dqm_sourceclient-live_cfg.maxChi2
maxChi2
Definition: beam_dqm_sourceclient-live_cfg.py:136
findQualityFiles.v
v
Definition: findQualityFiles.py:179
hltPixelTracks_cff.chi2
chi2
Definition: hltPixelTracks_cff.py:25
ndof
Definition: HIMultiTrackSelector.h:49
PVClusterComparer::pTSquaredSum
double pTSquaredSum(const PVCluster &v)
Calculate sum of square of the pT's of the tracks in the vertex.
Definition: PVClusterComparer.cc:23
PVClusterComparer::maxChi2_
std::vector< double > maxChi2_
Definition: PVClusterComparer.h:32
PVClusterComparer::track_pT_max_
const double track_pT_max_
Definition: PVClusterComparer.h:35
PVClusterComparer::updateChisquareQuantile
void updateChisquareQuantile(size_t ndof)
Definition: PVClusterComparer.cc:88
HLT_2018_cff.track_chi2_max
track_chi2_max
Definition: HLT_2018_cff.py:253
PVClusterComparer::track_chi2_max_
const double track_chi2_max_
Definition: PVClusterComparer.h:36
HLT_2018_cff.track_pt_max
track_pt_max
Definition: HLT_2018_cff.py:254