CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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

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_ = nullptr
 
std::vector< HitIndexlayerHitIndices_
 
const std::vector< std::string > * layerNames_ = nullptr
 
const std::vector
< LayerSetIndex > * 
layerSetIndices_ = nullptr
 
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 18 of file SeedingLayerSetsHits.h.

Member Typedef Documentation

Definition at line 25 of file SeedingLayerSetsHits.h.

typedef unsigned int SeedingLayerSetsHits::HitIndex

Definition at line 30 of file SeedingLayerSetsHits.h.

Definition at line 22 of file SeedingLayerSetsHits.h.

Definition at line 26 of file SeedingLayerSetsHits.h.

typedef unsigned short SeedingLayerSetsHits::LayerIndex

Definition at line 29 of file SeedingLayerSetsHits.h.

typedef unsigned short SeedingLayerSetsHits::LayerSetIndex

Definition at line 28 of file SeedingLayerSetsHits.h.

Definition at line 23 of file SeedingLayerSetsHits.h.

Definition at line 20 of file SeedingLayerSetsHits.h.

Definition at line 21 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_.

13  : nlayers_(nlayers), layerSetIndices_(layerSetIndices), layerNames_(layerNames), layerDets_(layerDets) {
14  layerHitIndices_.reserve(layerNames->size());
15 }
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 19 of file SeedingLayerSetsHits.cc.

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

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

Definition at line 209 of file SeedingLayerSetsHits.h.

References layerSetIndices_.

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

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

Definition at line 210 of file SeedingLayerSetsHits.h.

References begin().

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

Definition at line 212 of file SeedingLayerSetsHits.h.

References end().

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

Definition at line 211 of file SeedingLayerSetsHits.h.

References layerSetIndices_.

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

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

Definition at line 30 of file SeedingLayerSetsHits.cc.

References begin(), end(), layerHitIndices_, AlCaHLTBitMon_ParallelJobs::p, rechits_, runTheMatrix::ret, and HcalDetIdTransform::transform().

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

30  {
31  HitIndex begin = layerHitIndices_[layerIndex];
32  ++layerIndex;
33  HitIndex end = layerIndex < layerHitIndices_.size() ? layerHitIndices_[layerIndex] : rechits_.size();
34 
35  Hits ret;
36  ret.reserve(end - begin);
37  std::transform(rechits_.begin() + begin, rechits_.begin() + end, std::back_inserter(ret), [](HitPointer const &p) {
38  return p.get();
39  });
40  return ret;
41 }
const_iterator end() const
tuple ret
prodAgent to be discontinued
const_iterator begin() const
mayown_ptr< BaseTrackerRecHit > HitPointer
std::vector< ConstRecHitPointer > Hits
std::vector< HitIndex > layerHitIndices_
unsigned transform(const HcalDetId &id, unsigned transformCode)
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 202 of file SeedingLayerSetsHits.h.

References begin(), end(), layerSetIndices_, and nlayers_.

Referenced by print().

202  {
203  std::vector<LayerSetIndex>::const_iterator begin = layerSetIndices_->begin() + nlayers_ * index;
204  std::vector<LayerSetIndex>::const_iterator end = begin + nlayers_;
205  return SeedingLayerSet(this, begin, end);
206  }
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 43 of file SeedingLayerSetsHits.cc.

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

43  {
44  std::stringstream ss;
45  ss << "SeedingLayerSetsHits with " << numberOfLayersInSet() << " layers in each LayerSets, LayerSets has " << size()
46  << " items\n";
47  for (LayerSetIndex iLayers = 0; iLayers < size(); ++iLayers) {
48  ss << " " << iLayers << ": ";
49  SeedingLayerSet layers = operator[](iLayers);
50  for (unsigned iLayer = 0; iLayer < layers.size(); ++iLayer) {
51  SeedingLayer layer = layers[iLayer];
52  ss << layer.name() << " (" << layer.index() << ", nhits " << layer.hits().size() << ") ";
53  }
54  ss << "\n";
55  }
56  LogDebug("SeedingLayerSetsHits") << ss.str();
57 }
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
constexpr std::array< uint8_t, layerIndexSize > layer
SeedingLayerSet operator[](LayerSetIndex index) const
Get the SeedingLayerSet at a given index.
unsigned short size() const
Get the number of SeedingLayerSets.
#define LogDebug(id)
void SeedingLayerSetsHits::shrink_to_fit ( )

Definition at line 17 of file SeedingLayerSetsHits.cc.

References rechits_.

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

Definition at line 215 of file SeedingLayerSetsHits.h.

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

215  {
216  std::swap(nlayers_, other.nlayers_);
221  rechits_.swap(other.rechits_);
222  }
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_ = nullptr
private

Definition at line 242 of file SeedingLayerSetsHits.h.

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

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

Definition at line 240 of file SeedingLayerSetsHits.h.

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

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

Definition at line 241 of file SeedingLayerSetsHits.h.

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

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

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