CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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::PVClusterComparer ( )

Constructor does nothing, no data members.

Definition at line 7 of file PVClusterComparer.cc.

References setChisquareQuantile().

8  : track_pT_min_ ( 2.5)
9  , track_pT_max_ (10.)
10  , track_chi2_max_(9999999.)
11  , track_prob_min_(-1.)
12 {
14 }
const double track_pT_min_
const double track_pT_max_
const double track_prob_min_
const double track_chi2_max_
PVClusterComparer::PVClusterComparer ( double  track_pt_min,
double  track_pt_max,
double  track_chi2_max,
double  track_prob_min 
)

Definition at line 16 of file PVClusterComparer.cc.

References setChisquareQuantile().

17  : track_pT_min_ (track_pt_min)
18  , track_pT_max_ (track_pt_max)
19  , track_chi2_max_(track_chi2_max)
20  , track_prob_min_(track_prob_min)
21 {
23 }
const double track_pT_min_
const double track_pT_max_
const double track_prob_min_
const double track_chi2_max_

Member Function Documentation

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.

References pTSquaredSum().

97  {
98  return ( pTSquaredSum(v1) > pTSquaredSum(v2) );
99 }
double pTSquaredSum(const PVCluster &v)
Calculate sum of square of the pT&#39;s of the tracks in the vertex.
bool PVClusterComparer::operator() ( const reco::Vertex v1,
const reco::Vertex v2 
)

Definition at line 100 of file PVClusterComparer.cc.

References pTSquaredSum().

100  {
101  return ( pTSquaredSum(v1) > pTSquaredSum(v2) );
102 }
double pTSquaredSum(const PVCluster &v)
Calculate sum of square of the pT&#39;s of the tracks in the vertex.
double PVClusterComparer::pTSquaredSum ( const PVCluster v)

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

Definition at line 25 of file PVClusterComparer.cc.

References i, maxChi2_, RecoTauCleanerPlugins::pt, track_chi2_max_, track_prob_min_, track_pT_max_, track_pT_min_, and updateChisquareQuantile().

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

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

Definition at line 49 of file PVClusterComparer.cc.

References i, maxChi2_, RecoTauCleanerPlugins::pt, track_chi2_max_, track_prob_min_, track_pT_max_, track_pT_min_, reco::Vertex::tracks_begin(), reco::Vertex::tracks_end(), and updateChisquareQuantile().

49  {
50  double sum=0;
52  i!=ie; ++i) {
53 
54  double pt = (*i)->pt();
55  if (pt < track_pT_min_) 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] ) continue ;
66  }
67  if ((*i)->normalizedChi2() > track_chi2_max_) continue;
68 
69  if (pt > track_pT_max_) pt = track_pT_max_;
70  sum += pt*pt;
71  }
72  return sum;
73 }
int i
Definition: DBlmapReader.cc:9
const double track_pT_min_
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.cc:44
std::vector< double > maxChi2_
void updateChisquareQuantile(size_t ndof)
const double track_pT_max_
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector&lt;TrackRef&gt;
Definition: Vertex.h:37
const double track_prob_min_
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.cc:39
const double track_chi2_max_
void PVClusterComparer::setChisquareQuantile ( )

Definition at line 75 of file PVClusterComparer.cc.

References maxChi2_, and track_prob_min_.

Referenced by PVClusterComparer().

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

Definition at line 86 of file PVClusterComparer.cc.

References i, maxChi2_, and track_prob_min_.

Referenced by pTSquaredSum().

86  {
87 
88  size_t oldsize = maxChi2_.size();
89  // maxChi2_.resize(ndof+1);
90  for (size_t i = oldsize; i <= ndof; ++i) {
91  double chi2 = TMath::ChisquareQuantile(1- track_prob_min_, i);
92  maxChi2_.push_back(chi2);
93  }
94 }
int i
Definition: DBlmapReader.cc:9
std::vector< double > maxChi2_
const double track_prob_min_

Member Data Documentation

std::vector<double> PVClusterComparer::maxChi2_

Definition at line 32 of file PVClusterComparer.h.

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

const double PVClusterComparer::track_chi2_max_

Definition at line 36 of file PVClusterComparer.h.

Referenced by pTSquaredSum().

const double PVClusterComparer::track_prob_min_

Definition at line 37 of file PVClusterComparer.h.

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

const double PVClusterComparer::track_pT_max_

Definition at line 35 of file PVClusterComparer.h.

Referenced by pTSquaredSum().

const double PVClusterComparer::track_pT_min_

Definition at line 34 of file PVClusterComparer.h.

Referenced by pTSquaredSum().