CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes
SeedingLayerSetsHits Class Reference

#include <SeedingLayerSetsHits.h>

Classes

class  const_iterator
 
class  SeedingLayer
 
class  SeedingLayerSet
 

Public Types

typedef
TransientTrackingRecHit::ConstRecHitPointer 
ConstRecHitPointer
 
typedef unsigned int HitIndex
 
typedef std::vector
< ConstRecHitPointer
Hits
 
typedef unsigned short LayerIndex
 
typedef unsigned short LayerSetIndex
 

Public Member Functions

const_iterator begin () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
const_iterator end () const
 
unsigned short numberOfLayersInSet () const
 Get number of layers in each SeedingLayerSets. More...
 
SeedingLayerSet operator[] (LayerSetIndex index) const
 Get the SeedingLayerSet at a given index. More...
 
void print () const
 
 SeedingLayerSetsHits ()
 
 SeedingLayerSetsHits (unsigned short nlayers, const std::vector< LayerSetIndex > *layerSetIndices, const std::vector< std::string > *layerNames, const std::vector< const DetLayer * > &layerDets)
 
unsigned short size () const
 Get the number of SeedingLayerSets. More...
 
void swap (SeedingLayerSetsHits &other)
 
void swapHits (std::vector< HitIndex > &layerHitIndices, Hits &hits)
 
 ~SeedingLayerSetsHits ()
 

Private Member Functions

Hits hits (LayerIndex layerIndex) const
 

Private Attributes

std::vector< const DetLayer * > layerDets_
 
std::vector< HitIndexlayerHitIndices_
 
const std::vector< std::string > * layerNames_
 
const std::vector
< LayerSetIndex > * 
layerSetIndices_
 
unsigned short nlayers_
 Number of layers in a SeedingLayerSet. More...
 
std::vector< ConstRecHitPointerrechits_
 

Detailed Description

Class to store TransientTrackingRecHits, names, and DetLayer pointers of each ctfseeding::SeedingLayer as they come from SeedingLayerSetsBuilder.

In contrast to ctfseeding::SeedingLayerSets, this class requires that all contained SeedingLayerSets have the same number of layers in each set.

This class was created in part for SeedingLayer getByToken migration, and in part as a performance improvement.

Definition at line 24 of file SeedingLayerSetsHits.h.

Member Typedef Documentation

Definition at line 26 of file SeedingLayerSetsHits.h.

typedef unsigned int SeedingLayerSetsHits::HitIndex

Definition at line 31 of file SeedingLayerSetsHits.h.

Definition at line 27 of file SeedingLayerSetsHits.h.

typedef unsigned short SeedingLayerSetsHits::LayerIndex

Definition at line 30 of file SeedingLayerSetsHits.h.

typedef unsigned short SeedingLayerSetsHits::LayerSetIndex

Definition at line 29 of file SeedingLayerSetsHits.h.

Constructor & Destructor Documentation

SeedingLayerSetsHits::SeedingLayerSetsHits ( )

Definition at line 9 of file SeedingLayerSetsHits.cc.

9 : nlayers_(0), layerSetIndices_(nullptr), layerNames_(nullptr) {}
const std::vector< LayerSetIndex > * layerSetIndices_
unsigned short nlayers_
Number of layers in a SeedingLayerSet.
const std::vector< std::string > * layerNames_
SeedingLayerSetsHits::SeedingLayerSetsHits ( unsigned short  nlayers,
const std::vector< LayerSetIndex > *  layerSetIndices,
const std::vector< std::string > *  layerNames,
const std::vector< const DetLayer * > &  layerDets 
)

Constructor.

Parameters
nlayersNumber of layers in each SeedingLayerSet
layerSetIndicesPointer to a vector holding the indices of layer sets (pointer to vector is stored)
layerNamesPointer to a vector holding the layer names (pointer to vector is stored)
layerDetsVector of pointers to layer DetLayer objects (vector is copied, i.e. DetLayer pointers are stored)

Definition at line 10 of file SeedingLayerSetsHits.cc.

13  :
14  nlayers_(nlayers),
15  layerSetIndices_(layerSetIndices),
16  layerNames_(layerNames),
17  layerDets_(layerDets)
18 {}
const std::vector< LayerSetIndex > * layerSetIndices_
std::vector< const DetLayer * > layerDets_
unsigned short nlayers_
Number of layers in a SeedingLayerSet.
const std::vector< std::string > * layerNames_
SeedingLayerSetsHits::~SeedingLayerSetsHits ( )

Definition at line 19 of file SeedingLayerSetsHits.cc.

19 {}

Member Function Documentation

const_iterator SeedingLayerSetsHits::begin ( void  ) const
inline

Definition at line 179 of file SeedingLayerSetsHits.h.

References layerSetIndices_.

Referenced by cbegin(), hits(), and operator[]().

179 { return const_iterator(this, layerSetIndices_->begin()); }
const std::vector< LayerSetIndex > * layerSetIndices_
const_iterator SeedingLayerSetsHits::cbegin ( ) const
inline

Definition at line 180 of file SeedingLayerSetsHits.h.

References begin().

180 { return begin(); }
const_iterator begin() const
const_iterator SeedingLayerSetsHits::cend ( ) const
inline

Definition at line 182 of file SeedingLayerSetsHits.h.

References end().

182 { return end(); }
const_iterator end() const
const_iterator SeedingLayerSetsHits::end ( void  ) const
inline

Definition at line 181 of file SeedingLayerSetsHits.h.

References layerSetIndices_.

Referenced by cend(), hits(), and operator[]().

181 { return const_iterator(this, layerSetIndices_->end()); }
const std::vector< LayerSetIndex > * layerSetIndices_
SeedingLayerSetsHits::Hits SeedingLayerSetsHits::hits ( LayerIndex  layerIndex) const
private

Definition at line 28 of file SeedingLayerSetsHits.cc.

References begin(), filterCSVwithJSON::copy, end(), layerHitIndices_, rechits_, and run_regression::ret.

Referenced by SeedingLayerSetsHits::SeedingLayer::hits().

28  {
29  HitIndex begin = layerHitIndices_[layerIndex];
30  ++layerIndex;
31  HitIndex end = layerIndex < layerHitIndices_.size() ? layerHitIndices_[layerIndex] : rechits_.size();
32 
33  Hits ret;
34  ret.reserve(end-begin);
35  std::copy(rechits_.begin()+begin, rechits_.begin()+end, std::back_inserter(ret));
36  return ret;
37 }
const_iterator end() const
std::vector< ConstRecHitPointer > rechits_
const_iterator begin() const
std::vector< ConstRecHitPointer > Hits
std::vector< HitIndex > layerHitIndices_
unsigned short SeedingLayerSetsHits::numberOfLayersInSet ( ) const
inline

Get number of layers in each SeedingLayerSets.

Definition at line 167 of file SeedingLayerSetsHits.h.

References nlayers_.

Referenced by CombinedHitPairGenerator::hitPairs(), CombinedMultiHitGenerator::hitSets(), CombinedHitTripletGenerator::hitTriplets(), LayerTriplets::layers(), and print().

167 { return nlayers_; }
unsigned short nlayers_
Number of layers in a SeedingLayerSet.
SeedingLayerSet SeedingLayerSetsHits::operator[] ( LayerSetIndex  index) const
inline

Get the SeedingLayerSet at a given index.

Definition at line 172 of file SeedingLayerSetsHits.h.

References begin(), end(), getHLTprescales::index, layerSetIndices_, and nlayers_.

Referenced by print().

172  {
173  std::vector<LayerSetIndex>::const_iterator begin = layerSetIndices_->begin()+nlayers_*index;
174  std::vector<LayerSetIndex>::const_iterator end = begin+nlayers_;
175  return SeedingLayerSet(this, begin, end);
176  }
const_iterator end() const
const_iterator begin() const
const std::vector< LayerSetIndex > * layerSetIndices_
unsigned short nlayers_
Number of layers in a SeedingLayerSet.
void SeedingLayerSetsHits::print ( void  ) const

Definition at line 40 of file SeedingLayerSetsHits.cc.

References SeedingLayerSetsHits::SeedingLayer::hits(), SeedingLayerSetsHits::SeedingLayer::index(), LayerTriplets::layers(), LogDebug, SeedingLayerSetsHits::SeedingLayer::name(), numberOfLayersInSet(), operator[](), SeedingLayerSetsHits::SeedingLayerSet::size(), and size().

40  {
41  std::stringstream ss;
42  ss << "SeedingLayerSetsHits with " << numberOfLayersInSet() << " layers in each LayerSets, LayerSets has " << size() << " items\n";
43  for(LayerSetIndex iLayers=0; iLayers<size(); ++iLayers) {
44  ss << " " << iLayers << ": ";
45  SeedingLayerSet layers = operator[](iLayers);
46  for(unsigned iLayer=0; iLayer<layers.size(); ++iLayer) {
47  SeedingLayer layer = layers[iLayer];
48  ss << layer.name() << " (" << layer.index() << ", nhits " << layer.hits().size() << ") ";
49  }
50  ss << "\n";
51  }
52  LogDebug("SeedingLayerSetsHits") << ss.str();
53 }
#define LogDebug(id)
unsigned short numberOfLayersInSet() const
Get number of layers in each SeedingLayerSets.
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
unsigned short LayerSetIndex
SeedingLayerSet operator[](LayerSetIndex index) const
Get the SeedingLayerSet at a given index.
unsigned short size() const
Get the number of SeedingLayerSets.
unsigned short SeedingLayerSetsHits::size ( void  ) const
inline

Get the number of SeedingLayerSets.

Definition at line 169 of file SeedingLayerSetsHits.h.

References layerSetIndices_, and nlayers_.

Referenced by print().

169 { return nlayers_ > 0 ? layerSetIndices_->size() / nlayers_ : 0; }
const std::vector< LayerSetIndex > * layerSetIndices_
unsigned short nlayers_
Number of layers in a SeedingLayerSet.
void SeedingLayerSetsHits::swap ( SeedingLayerSetsHits other)
inline

Definition at line 185 of file SeedingLayerSetsHits.h.

References layerDets_, layerHitIndices_, layerNames_, layerSetIndices_, nlayers_, rechits_, and std::swap().

185  {
186  std::swap(nlayers_, other.nlayers_);
190  layerDets_.swap(other.layerDets_);
191  rechits_.swap(other.rechits_);
192  }
std::vector< ConstRecHitPointer > rechits_
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
const std::vector< LayerSetIndex > * layerSetIndices_
std::vector< HitIndex > layerHitIndices_
std::vector< const DetLayer * > layerDets_
unsigned short nlayers_
Number of layers in a SeedingLayerSet.
const std::vector< std::string > * layerNames_
void SeedingLayerSetsHits::swapHits ( std::vector< HitIndex > &  layerHitIndices,
Hits hits 
)

Definition at line 23 of file SeedingLayerSetsHits.cc.

References layerHitIndices_, and rechits_.

23  {
24  layerHitIndices_.swap(layerHitIndices);
25  rechits_.swap(hits);
26 }
std::vector< ConstRecHitPointer > rechits_
Hits hits(LayerIndex layerIndex) const
std::vector< HitIndex > layerHitIndices_

Member Data Documentation

std::vector<const DetLayer *> SeedingLayerSetsHits::layerDets_
private

Definition at line 212 of file SeedingLayerSetsHits.h.

Referenced by SeedingLayerSetsHits::SeedingLayer::detLayer(), and swap().

std::vector<HitIndex> SeedingLayerSetsHits::layerHitIndices_
private

Definition at line 210 of file SeedingLayerSetsHits.h.

Referenced by hits(), swap(), and swapHits().

const std::vector<std::string>* SeedingLayerSetsHits::layerNames_
private

Definition at line 211 of file SeedingLayerSetsHits.h.

Referenced by SeedingLayerSetsHits::SeedingLayer::name(), and swap().

const std::vector<LayerSetIndex>* SeedingLayerSetsHits::layerSetIndices_
private

Stores SeedingLayerSets as nlayers_ consecutive layer indices. Layer indices point to layerHitRanges_, layerNames_, and layerDets_. Hence layerSetIndices.size() == nlayers_*"number of layer sets"

Definition at line 207 of file SeedingLayerSetsHits.h.

Referenced by begin(), end(), operator[](), size(), and swap().

unsigned short SeedingLayerSetsHits::nlayers_
private
std::vector<ConstRecHitPointer> SeedingLayerSetsHits::rechits_
private

List of RecHits of all SeedingLayers. Hits of each layer are identified by the begin indices in layerHitIndices_.

Definition at line 218 of file SeedingLayerSetsHits.h.

Referenced by hits(), swap(), and swapHits().