CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static 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 ()
 

Static Public Member Functions

static void fillPSetDescription (edm::ParameterSetDescription &desc)
 

Private Attributes

bool verbose_
 
float zSep
 

Detailed Description

Description: separates event tracks into clusters along the beam line

Definition at line 15 of file GapClusterizerInZ.h.

Constructor & Destructor Documentation

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

Definition at line 16 of file GapClusterizerInZ.cc.

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

16  {
17  // some defaults to avoid uninitialized variables
18  verbose_ = conf.getUntrackedParameter<bool>("verbose", false);
19  zSep = conf.getParameter<double>("zSeparation");
20  if (verbose_) {
21  std::cout << "TrackClusterizerInZ: algorithm=gap, zSeparation=" << zSep << std::endl;
22  }
23 }
T getUntrackedParameter(std::string const &, T const &) const
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
tuple cout
Definition: gather_cfg.py:144
GapClusterizerInZ::~GapClusterizerInZ ( )
inlineoverride

Definition at line 28 of file GapClusterizerInZ.h.

28 {};

Member Function Documentation

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

Implements TrackClusterizerInZ.

Definition at line 27 of file GapClusterizerInZ.cc.

References funct::abs(), HLT_FULL_cff::clusters, and tracks.

27  {
28  vector<reco::TransientTrack> tks = tracks; // copy to be sorted
29 
30  vector<vector<reco::TransientTrack> > clusters;
31  if (tks.empty())
32  return clusters;
33 
34  // sort in increasing order of z
35  stable_sort(tks.begin(), tks.end(), recTrackLessZ);
36 
37  // init first cluster
38  vector<reco::TransientTrack>::const_iterator it = tks.begin();
39  vector<reco::TransientTrack> currentCluster;
40  currentCluster.push_back(*it);
41 
42  it++;
43  for (; it != tks.end(); it++) {
44  double zPrev = currentCluster.back().stateAtBeamLine().trackStateAtPCA().position().z();
45  double zCurr = (*it).stateAtBeamLine().trackStateAtPCA().position().z();
46 
47  if (abs(zCurr - zPrev) < zSeparation()) {
48  // close enough ? cluster together
49  currentCluster.push_back(*it);
50  } else {
51  // store current cluster, start new one
52  clusters.push_back(currentCluster);
53  currentCluster.clear();
54  currentCluster.push_back(*it);
55  }
56  }
57 
58  // store last cluster
59  clusters.push_back(currentCluster);
60 
61  return clusters;
62 }
auto const & tracks
cannot be loose
float zSeparation() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void GapClusterizerInZ::fillPSetDescription ( edm::ParameterSetDescription desc)
static

Definition at line 64 of file GapClusterizerInZ.cc.

References edm::ParameterSetDescription::add(), and edm::ParameterSetDescription::addUntracked().

Referenced by PrimaryVertexProducer::fillDescriptions(), and PrimaryVertexValidation::fillDescriptions().

64  {
65  desc.add<double>("zSeparation", 1.0);
66  desc.addUntracked<bool>("verbose", false);
67 }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::vector<TransientVertex> GapClusterizerInZ::vertices ( const std::vector< reco::TransientTrack > &  tracks) const
float GapClusterizerInZ::zSeparation ( ) const

Definition at line 25 of file GapClusterizerInZ.cc.

25 { return zSep; }

Member Data Documentation

bool GapClusterizerInZ::verbose_
private

Definition at line 32 of file GapClusterizerInZ.h.

float GapClusterizerInZ::zSep
private

Definition at line 28 of file GapClusterizerInZ.h.