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 &&)=default
 
SeedingLayerSetsHitsoperator= (SeedingLayerSetsHits const &)=delete
 
SeedingLayerSet operator[] (LayerSetIndex index) const
 Get the SeedingLayerSet at a given index. More...
 
void print () const
 
 SeedingLayerSetsHits ()=default
 
 SeedingLayerSetsHits (SeedingLayerSetsHits &&)=default
 
 SeedingLayerSetsHits (SeedingLayerSetsHits const &)=delete
 
 SeedingLayerSetsHits (unsigned short nlayers, const std::vector< LayerSetIndex > *layerSetIndices, const std::vector< std::string > *layerNames, const std::vector< const DetLayer * > *layerDets)
 
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

◆ ConstRecHitPointer

Definition at line 25 of file SeedingLayerSetsHits.h.

◆ HitIndex

typedef unsigned int SeedingLayerSetsHits::HitIndex

Definition at line 30 of file SeedingLayerSetsHits.h.

◆ HitPointer

Definition at line 22 of file SeedingLayerSetsHits.h.

◆ Hits

Definition at line 26 of file SeedingLayerSetsHits.h.

◆ LayerIndex

typedef unsigned short SeedingLayerSetsHits::LayerIndex

Definition at line 29 of file SeedingLayerSetsHits.h.

◆ LayerSetIndex

typedef unsigned short SeedingLayerSetsHits::LayerSetIndex

Definition at line 28 of file SeedingLayerSetsHits.h.

◆ OwnedHits

Definition at line 23 of file SeedingLayerSetsHits.h.

◆ TkHit

Definition at line 20 of file SeedingLayerSetsHits.h.

◆ TkHitRef

Definition at line 21 of file SeedingLayerSetsHits.h.

Constructor & Destructor Documentation

◆ SeedingLayerSetsHits() [1/4]

SeedingLayerSetsHits::SeedingLayerSetsHits ( )
default

◆ SeedingLayerSetsHits() [2/4]

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.

13  : nlayers_(nlayers), layerSetIndices_(layerSetIndices), layerNames_(layerNames), layerDets_(layerDets) {
14  layerHitIndices_.reserve(layerNames->size());
15 }

References layerHitIndices_.

◆ ~SeedingLayerSetsHits()

SeedingLayerSetsHits::~SeedingLayerSetsHits ( )
default

◆ SeedingLayerSetsHits() [3/4]

SeedingLayerSetsHits::SeedingLayerSetsHits ( SeedingLayerSetsHits const &  )
delete

◆ SeedingLayerSetsHits() [4/4]

SeedingLayerSetsHits::SeedingLayerSetsHits ( SeedingLayerSetsHits &&  )
default

Member Function Documentation

◆ addHits()

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

Definition at line 19 of file SeedingLayerSetsHits.cc.

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 }

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

◆ begin()

const_iterator SeedingLayerSetsHits::begin ( void  ) const
inline

Definition at line 209 of file SeedingLayerSetsHits.h.

209 { return const_iterator(this, layerSetIndices_->begin()); }

References layerSetIndices_.

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

◆ cbegin()

const_iterator SeedingLayerSetsHits::cbegin ( ) const
inline

Definition at line 210 of file SeedingLayerSetsHits.h.

210 { return begin(); }

References begin().

◆ cend()

const_iterator SeedingLayerSetsHits::cend ( ) const
inline

Definition at line 212 of file SeedingLayerSetsHits.h.

212 { return end(); }

References end().

◆ end()

const_iterator SeedingLayerSetsHits::end ( void  ) const
inline

Definition at line 211 of file SeedingLayerSetsHits.h.

211 { return const_iterator(this, layerSetIndices_->end()); }

References layerSetIndices_.

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

◆ hits()

SeedingLayerSetsHits::Hits SeedingLayerSetsHits::hits ( LayerIndex  layerIndex) const
private

Definition at line 30 of file SeedingLayerSetsHits.cc.

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 }

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

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

◆ numberOfLayersInSet()

unsigned short SeedingLayerSetsHits::numberOfLayersInSet ( ) const
inline

◆ operator=() [1/2]

SeedingLayerSetsHits& SeedingLayerSetsHits::operator= ( SeedingLayerSetsHits &&  )
default

◆ operator=() [2/2]

SeedingLayerSetsHits& SeedingLayerSetsHits::operator= ( SeedingLayerSetsHits const &  )
delete

◆ operator[]()

SeedingLayerSet SeedingLayerSetsHits::operator[] ( LayerSetIndex  index) const
inline

Get the SeedingLayerSet at a given index.

Definition at line 202 of file SeedingLayerSetsHits.h.

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  }

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

Referenced by print().

◆ print()

void SeedingLayerSetsHits::print ( void  ) const

Definition at line 43 of file SeedingLayerSetsHits.cc.

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 }

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

◆ shrink_to_fit()

void SeedingLayerSetsHits::shrink_to_fit ( )

Definition at line 17 of file SeedingLayerSetsHits.cc.

17 { rechits_.shrink_to_fit(); }

References rechits_.

◆ size()

unsigned short SeedingLayerSetsHits::size ( void  ) const
inline

◆ swap()

void SeedingLayerSetsHits::swap ( SeedingLayerSetsHits other)
inline

Definition at line 215 of file SeedingLayerSetsHits.h.

215  {
216  std::swap(nlayers_, other.nlayers_);
217  std::swap(layerSetIndices_, other.layerSetIndices_);
218  layerHitIndices_.swap(other.layerHitIndices_);
219  std::swap(layerNames_, other.layerNames_);
220  std::swap(layerDets_, other.layerDets_);
221  rechits_.swap(other.rechits_);
222  }

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

Member Data Documentation

◆ layerDets_

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

Definition at line 242 of file SeedingLayerSetsHits.h.

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

◆ layerHitIndices_

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

Definition at line 240 of file SeedingLayerSetsHits.h.

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

◆ layerNames_

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

Definition at line 241 of file SeedingLayerSetsHits.h.

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

◆ layerSetIndices_

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().

◆ nlayers_

unsigned short SeedingLayerSetsHits::nlayers_ = 0
private

◆ rechits_

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().

runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:367
SeedingLayerSetsHits::layerHitIndices_
std::vector< HitIndex > layerHitIndices_
Definition: SeedingLayerSetsHits.h:240
SeedingLayerSetsHits::size
unsigned short size() const
Get the number of SeedingLayerSets.
Definition: SeedingLayerSetsHits.h:199
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
SeedingLayerSetsHits::HitPointer
mayown_ptr< BaseTrackerRecHit > HitPointer
Definition: SeedingLayerSetsHits.h:22
SeedingLayerSetsHits::LayerSetIndex
unsigned short LayerSetIndex
Definition: SeedingLayerSetsHits.h:28
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
std::swap
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition: DataFrameContainer.h:209
trackingPlots.other
other
Definition: trackingPlots.py:1467
HcalDetIdTransform::transform
unsigned transform(const HcalDetId &id, unsigned transformCode)
Definition: HcalDetIdTransform.cc:7
SeedingLayerSetsHits::numberOfLayersInSet
unsigned short numberOfLayersInSet() const
Get number of layers in each SeedingLayerSets.
Definition: SeedingLayerSetsHits.h:197
SeedingLayerSetsHits::rechits_
OwnedHits rechits_
Definition: SeedingLayerSetsHits.h:248
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
SeedingLayerSetsHits::layerSetIndices_
const std::vector< LayerSetIndex > * layerSetIndices_
Definition: SeedingLayerSetsHits.h:237
SeedingLayerSetsHits::layerDets_
const std::vector< const DetLayer * > * layerDets_
Definition: SeedingLayerSetsHits.h:242
eostools.move
def move(src, dest)
Definition: eostools.py:511
SeedingLayerSetsHits::layerNames_
const std::vector< std::string > * layerNames_
Definition: SeedingLayerSetsHits.h:241
SeedingLayerSetsHits::Hits
std::vector< ConstRecHitPointer > Hits
Definition: SeedingLayerSetsHits.h:26
SeedingLayerSetsHits::end
const_iterator end() const
Definition: SeedingLayerSetsHits.h:211
Exception
Definition: hltDiff.cc:246
SeedingLayerSetsHits::hits
Hits hits(LayerIndex layerIndex) const
Definition: SeedingLayerSetsHits.cc:30
SeedingLayerSetsHits::HitIndex
unsigned int HitIndex
Definition: SeedingLayerSetsHits.h:30
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
SeedingLayerSetsHits::operator[]
SeedingLayerSet operator[](LayerSetIndex index) const
Get the SeedingLayerSet at a given index.
Definition: SeedingLayerSetsHits.h:202
hgcalTopologyTester_cfi.layers
layers
Definition: hgcalTopologyTester_cfi.py:8
nlayers
Definition: HIMultiTrackSelector.h:48
SeedingLayerSetsHits::begin
const_iterator begin() const
Definition: SeedingLayerSetsHits.h:209
SeedingLayerSetsHits::nlayers_
unsigned short nlayers_
Number of layers in a SeedingLayerSet.
Definition: SeedingLayerSetsHits.h:230