CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
GapClusterizerInZ Class Reference

#include <GapClusterizerInZ.h>

Inheritance diagram for GapClusterizerInZ:
TrackClusterizerInZ

Public Member Functions

std::vector< std::vector< reco::TransientTrack > > clusterize (const std::vector< reco::TransientTrack > &tracks) const override
 
 GapClusterizerInZ (const edm::ParameterSet &conf)
 
std::vector< TransientVertexvertices (const std::vector< reco::TransientTrack > &tracks) const
 
float zSeparation () const
 
 ~GapClusterizerInZ () override
 
- Public Member Functions inherited from TrackClusterizerInZ
 TrackClusterizerInZ ()
 
 TrackClusterizerInZ (const edm::ParameterSet &conf)
 
virtual ~TrackClusterizerInZ ()
 

Private Attributes

bool verbose_
 
float zSep
 

Detailed Description

Description: separates event tracks into clusters along the beam line

Definition at line 17 of file GapClusterizerInZ.h.

Constructor & Destructor Documentation

GapClusterizerInZ::GapClusterizerInZ ( const edm::ParameterSet conf)

Definition at line 21 of file GapClusterizerInZ.cc.

References gather_cfg::cout, edm::ParameterSet::getParameter(), and edm::ParameterSet::getUntrackedParameter().

22 {
23  // some defaults to avoid uninitialized variables
24  verbose_= conf.getUntrackedParameter<bool>("verbose", false);
25  zSep = conf.getParameter<double>("zSeparation");
26  if(verbose_) {std::cout << "TrackClusterizerInZ: algorithm=gap, zSeparation="<< zSep << std::endl;}
27 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
GapClusterizerInZ::~GapClusterizerInZ ( )
inlineoverride

Definition at line 31 of file GapClusterizerInZ.h.

References zSep.

31 {};

Member Function Documentation

vector< vector< reco::TransientTrack > > GapClusterizerInZ::clusterize ( const std::vector< reco::TransientTrack > &  tracks) const
overridevirtual

Implements TrackClusterizerInZ.

Definition at line 40 of file GapClusterizerInZ.cc.

References funct::abs(), fastPrimaryVertexProducer_cfi::clusters, l1t::tracks, and HIPixelAdaptiveVertex_cfi::zSeparation.

42 {
43 
44  vector<reco::TransientTrack> tks = tracks; // copy to be sorted
45 
46  vector< vector<reco::TransientTrack> > clusters;
47  if (tks.empty()) return clusters;
48 
49  // sort in increasing order of z
50  stable_sort(tks.begin(), tks.end(), recTrackLessZ);
51 
52  // init first cluster
53  vector<reco::TransientTrack>::const_iterator it = tks.begin();
54  vector <reco::TransientTrack> currentCluster; currentCluster.push_back(*it);
55 
56  it++;
57  for ( ; it != tks.end(); it++) {
58 
59  double zPrev = currentCluster.back().stateAtBeamLine().trackStateAtPCA().position().z();
60  double zCurr = (*it).stateAtBeamLine().trackStateAtPCA().position().z();
61 
62  if ( abs(zCurr - zPrev) < zSeparation() ) {
63  // close enough ? cluster together
64  currentCluster.push_back(*it);
65  }
66  else {
67  // store current cluster, start new one
68  clusters.push_back(currentCluster);
69  currentCluster.clear();
70  currentCluster.push_back(*it);
71  }
72  }
73 
74  // store last cluster
75  clusters.push_back(currentCluster);
76 
77  return clusters;
78 
79 }
float zSeparation() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< TransientVertex > GapClusterizerInZ::vertices ( const std::vector< reco::TransientTrack > &  tracks) const
float GapClusterizerInZ::zSeparation ( ) const

Definition at line 31 of file GapClusterizerInZ.cc.

32 {
33  return zSep;
34 }

Member Data Documentation

bool GapClusterizerInZ::verbose_
private

Definition at line 35 of file GapClusterizerInZ.h.

float GapClusterizerInZ::zSep
private

Definition at line 31 of file GapClusterizerInZ.h.

Referenced by ~GapClusterizerInZ().