CMS 3D CMS Logo

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

using ConstRecHitPointer = BaseTrackerRecHit const *
 
typedef unsigned int HitIndex
 
using HitPointer = mayown_ptr< BaseTrackerRecHit >
 
using Hits = std::vector< ConstRecHitPointer >
 
typedef unsigned short LayerIndex
 
typedef unsigned short LayerSetIndex
 
using OwnedHits = std::vector< HitPointer >
 
using TkHit = BaseTrackerRecHit
 
using TkHitRef = BaseTrackerRecHit const &
 

Public Member Functions

void addHits (LayerIndex layerIndex, OwnedHits &&hits)
 
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...
 
SeedingLayerSetsHitsoperator= (SeedingLayerSetsHits const &)=delete
 
SeedingLayerSetsHitsoperator= (SeedingLayerSetsHits &&)=default
 
SeedingLayerSet operator[] (LayerSetIndex index) const
 Get the SeedingLayerSet at a given index. More...
 
void print () const
 
 SeedingLayerSetsHits ()=default
 
 SeedingLayerSetsHits (unsigned short nlayers, const std::vector< LayerSetIndex > *layerSetIndices, const std::vector< std::string > *layerNames, const std::vector< const DetLayer * > *layerDets)
 
 SeedingLayerSetsHits (SeedingLayerSetsHits const &)=delete
 
 SeedingLayerSetsHits (SeedingLayerSetsHits &&)=default
 
void shrink_to_fit ()
 
unsigned short size () const
 Get the number of SeedingLayerSets. More...
 
void swap (SeedingLayerSetsHits &other)
 
 ~SeedingLayerSetsHits ()=default
 

Private Member Functions

Hits hits (LayerIndex layerIndex) const
 

Private Attributes

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

Detailed Description

Class to store TransientTrackingRecHits, names, and DetLayer pointers of each seeding layer. It is required that all contained SeedingLayerSets have the same number of layers in each set.

Definition at line 19 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 23 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.

Definition at line 24 of file SeedingLayerSetsHits.h.

Definition at line 21 of file SeedingLayerSetsHits.h.

Definition at line 22 of file SeedingLayerSetsHits.h.

Constructor & Destructor Documentation

SeedingLayerSetsHits::SeedingLayerSetsHits ( )
default
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)
layerDetsPointer to a vector of pointers to layer DetLayer objects (pointer to vector is stored)

Definition at line 9 of file SeedingLayerSetsHits.cc.

References layerHitIndices_.

12  :
14  layerSetIndices_(layerSetIndices),
15  layerNames_(layerNames),
16  layerDets_(layerDets)
17 {
18  layerHitIndices_.reserve(layerNames->size());
19 }
const std::vector< const DetLayer * > * layerDets_
const std::vector< LayerSetIndex > * layerSetIndices_
std::vector< HitIndex > layerHitIndices_
unsigned short nlayers_
Number of layers in a SeedingLayerSet.
const std::vector< std::string > * layerNames_
SeedingLayerSetsHits::~SeedingLayerSetsHits ( )
default
SeedingLayerSetsHits::SeedingLayerSetsHits ( SeedingLayerSetsHits const &  )
delete
SeedingLayerSetsHits::SeedingLayerSetsHits ( SeedingLayerSetsHits &&  )
default

Member Function Documentation

void SeedingLayerSetsHits::addHits ( LayerIndex  layerIndex,
OwnedHits &&  hits 
)

Definition at line 25 of file SeedingLayerSetsHits.cc.

References Exception, hits(), layerHitIndices_, eostools::move(), and rechits_.

25  {
26  if(layerIndex != layerHitIndices_.size()) {
27  throw cms::Exception("Assert") << "SeedingLayerSetsHits::addHits() must be called in the order of the layers, got layer " << layerIndex << " while was expecting " << layerHitIndices_.size();
28  }
29 
30  layerHitIndices_.push_back(rechits_.size());
31  std::move(hits.begin(), hits.end(), std::back_inserter(rechits_));
32 }
Hits hits(LayerIndex layerIndex) const
std::vector< HitIndex > layerHitIndices_
def move(src, dest)
Definition: eostools.py:510
const_iterator SeedingLayerSetsHits::begin ( void  ) const
inline

Definition at line 204 of file SeedingLayerSetsHits.h.

References layerSetIndices_.

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

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

Definition at line 205 of file SeedingLayerSetsHits.h.

References begin().

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

Definition at line 207 of file SeedingLayerSetsHits.h.

References end().

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

Definition at line 206 of file SeedingLayerSetsHits.h.

References layerSetIndices_.

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

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

Definition at line 34 of file SeedingLayerSetsHits.cc.

References begin(), end(), layerHitIndices_, AlCaHLTBitMon_ParallelJobs::p, rechits_, and create_public_lumi_plots::transform.

Referenced by addHits(), and SeedingLayerSetsHits::SeedingLayer::hits().

34  {
35  HitIndex begin = layerHitIndices_[layerIndex];
36  ++layerIndex;
37  HitIndex end = layerIndex < layerHitIndices_.size() ? layerHitIndices_[layerIndex] : rechits_.size();
38 
39  Hits ret;
40  ret.reserve(end-begin);
41  std::transform(rechits_.begin()+begin, rechits_.begin()+end, std::back_inserter(ret),[](HitPointer const &p){return p.get();});
42  return ret;
43 }
const_iterator end() const
const_iterator begin() const
mayown_ptr< BaseTrackerRecHit > HitPointer
std::vector< ConstRecHitPointer > Hits
std::vector< HitIndex > layerHitIndices_
unsigned short SeedingLayerSetsHits::numberOfLayersInSet ( ) const
inline
SeedingLayerSetsHits& SeedingLayerSetsHits::operator= ( SeedingLayerSetsHits const &  )
delete
SeedingLayerSetsHits& SeedingLayerSetsHits::operator= ( SeedingLayerSetsHits &&  )
default
SeedingLayerSet SeedingLayerSetsHits::operator[] ( LayerSetIndex  index) const
inline

Get the SeedingLayerSet at a given index.

Definition at line 197 of file SeedingLayerSetsHits.h.

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

Referenced by print().

197  {
198  std::vector<LayerSetIndex>::const_iterator begin = layerSetIndices_->begin()+nlayers_*index;
199  std::vector<LayerSetIndex>::const_iterator end = begin+nlayers_;
200  return SeedingLayerSet(this, begin, end);
201  }
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 46 of file SeedingLayerSetsHits.cc.

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

Referenced by swap().

46  {
47  std::stringstream ss;
48  ss << "SeedingLayerSetsHits with " << numberOfLayersInSet() << " layers in each LayerSets, LayerSets has " << size() << " items\n";
49  for(LayerSetIndex iLayers=0; iLayers<size(); ++iLayers) {
50  ss << " " << iLayers << ": ";
51  SeedingLayerSet layers = operator[](iLayers);
52  for(unsigned iLayer=0; iLayer<layers.size(); ++iLayer) {
53  SeedingLayer layer = layers[iLayer];
54  ss << layer.name() << " (" << layer.index() << ", nhits " << layer.hits().size() << ") ";
55  }
56  ss << "\n";
57  }
58  LogDebug("SeedingLayerSetsHits") << ss.str();
59 }
#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.
void SeedingLayerSetsHits::shrink_to_fit ( )

Definition at line 21 of file SeedingLayerSetsHits.cc.

References rechits_.

21  {
22  rechits_.shrink_to_fit();
23 }
unsigned short SeedingLayerSetsHits::size ( void  ) const
inline
void SeedingLayerSetsHits::swap ( SeedingLayerSetsHits other)
inline

Definition at line 210 of file SeedingLayerSetsHits.h.

References SeedingLayerSetsHits::SeedingLayer::hits(), layerDets_, layerHitIndices_, layerNames_, layerSetIndices_, nlayers_, print(), rechits_, and std::swap().

210  {
211  std::swap(nlayers_, other.nlayers_);
216  rechits_.swap(other.rechits_);
217  }
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
const std::vector< const DetLayer * > * layerDets_
const std::vector< LayerSetIndex > * layerSetIndices_
std::vector< HitIndex > layerHitIndices_
unsigned short nlayers_
Number of layers in a SeedingLayerSet.
const std::vector< std::string > * layerNames_

Member Data Documentation

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

Definition at line 237 of file SeedingLayerSetsHits.h.

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

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

Definition at line 235 of file SeedingLayerSetsHits.h.

Referenced by addHits(), hits(), SeedingLayerSetsHits(), and swap().

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

Definition at line 236 of file SeedingLayerSetsHits.h.

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

const std::vector<LayerSetIndex>* SeedingLayerSetsHits::layerSetIndices_ = 0
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 232 of file SeedingLayerSetsHits.h.

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

unsigned short SeedingLayerSetsHits::nlayers_ = 0
private
OwnedHits SeedingLayerSetsHits::rechits_
private

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

Definition at line 243 of file SeedingLayerSetsHits.h.

Referenced by addHits(), hits(), shrink_to_fit(), and swap().