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_ = 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.

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::~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.

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 }
std::vector< HitIndex > layerHitIndices_
Hits hits(LayerIndex layerIndex) const
def move(src, dest)
Definition: eostools.py:511

◆ begin()

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_

◆ cbegin()

const_iterator SeedingLayerSetsHits::cbegin ( ) const
inline

Definition at line 210 of file SeedingLayerSetsHits.h.

References begin().

210 { return begin(); }
const_iterator begin() const

◆ cend()

const_iterator SeedingLayerSetsHits::cend ( ) const
inline

Definition at line 212 of file SeedingLayerSetsHits.h.

References end().

212 { return end(); }
const_iterator end() const

◆ end()

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_

◆ hits()

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 begin() const
ret
prodAgent to be discontinued
mayown_ptr< BaseTrackerRecHit > HitPointer
std::vector< ConstRecHitPointer > Hits
const_iterator end() const
std::vector< HitIndex > layerHitIndices_
unsigned transform(const HcalDetId &id, unsigned transformCode)

◆ numberOfLayersInSet()

unsigned short SeedingLayerSetsHits::numberOfLayersInSet ( ) const
inline

Get number of layers in each SeedingLayerSets.

Definition at line 197 of file SeedingLayerSetsHits.h.

References nlayers_.

Referenced by LayerTriplets::layers(), print(), MultiHitFromChi2EDProducer::produce(), CAHitNtupletEDProducerT< T_Generator >::produce(), and HitTripletEDProducerT< T_HitTripletGenerator >::produce().

197 { return nlayers_; }
unsigned short nlayers_
Number of layers in a SeedingLayerSet.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ operator[]()

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 begin() const
const std::vector< LayerSetIndex > * layerSetIndices_
const_iterator end() const
unsigned short nlayers_
Number of layers in a SeedingLayerSet.

◆ print()

void SeedingLayerSetsHits::print ( void  ) const

Definition at line 43 of file SeedingLayerSetsHits.cc.

References nano_mu_digi_cff::layer, hgcalTBTopologyTester_cfi::layers, LogDebug, numberOfLayersInSet(), operator[](), 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 LayerSetIndex
unsigned short size() const
Get the number of SeedingLayerSets.
unsigned short numberOfLayersInSet() const
Get number of layers in each SeedingLayerSets.
SeedingLayerSet operator[](LayerSetIndex index) const
Get the SeedingLayerSet at a given index.
#define LogDebug(id)

◆ shrink_to_fit()

void SeedingLayerSetsHits::shrink_to_fit ( )

Definition at line 17 of file SeedingLayerSetsHits.cc.

References rechits_.

17 { rechits_.shrink_to_fit(); }

◆ size()

unsigned short SeedingLayerSetsHits::size ( void  ) const
inline

Get the number of SeedingLayerSets.

Definition at line 199 of file SeedingLayerSetsHits.h.

References layerSetIndices_, and nlayers_.

Referenced by ntupleDataFormat._Collection::__iter__(), ntupleDataFormat._Collection::__len__(), CombinedHitQuadrupletGeneratorForPhotonConversion::hitPairs(), print(), hitTripletEDProducerT::ImplIntermediateHitTriplets::reserve(), and IsoTrig::studyTiming().

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

◆ swap()

void SeedingLayerSetsHits::swap ( SeedingLayerSetsHits other)
inline

Definition at line 215 of file SeedingLayerSetsHits.h.

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

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  }
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

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