CMS 3D CMS Logo

SeedingLayerSetsHits.cc
Go to the documentation of this file.
4 
5 #include <algorithm>
6 #include <limits>
7 #include <sstream>
8 
10  const std::vector<LayerSetIndex> *layerSetIndices,
11  const std::vector<std::string> *layerNames,
12  const std::vector<const DetLayer *> *layerDets)
13  : nlayers_(nlayers), layerSetIndices_(layerSetIndices), layerNames_(layerNames), layerDets_(layerDets) {
14  layerHitIndices_.reserve(layerNames->size());
15 }
16 
17 void SeedingLayerSetsHits::shrink_to_fit() { rechits_.shrink_to_fit(); }
18 
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 }
29 
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 }
42 
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 << ": ";
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 }
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:543
SeedingLayerSetsHits::layerHitIndices_
std::vector< HitIndex > layerHitIndices_
Definition: SeedingLayerSetsHits.h:240
MessageLogger.h
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
SeedingLayerSetsHits::SeedingLayerSetsHits
SeedingLayerSetsHits()=default
SeedingLayerSetsHits::size
unsigned short size() const
Get the number of SeedingLayerSets.
Definition: SeedingLayerSetsHits.h:199
mayown_ptr
Definition: mayown_ptr.h:13
SeedingLayerSetsHits::LayerSetIndex
unsigned short LayerSetIndex
Definition: SeedingLayerSetsHits.h:28
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
SeedingLayerSetsHits::print
void print() const
Definition: SeedingLayerSetsHits.cc:43
SeedingLayerSetsHits.h
SeedingLayerSetsHits::shrink_to_fit
void shrink_to_fit()
Definition: SeedingLayerSetsHits.cc:17
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
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
SeedingLayerSetsHits::rechits_
OwnedHits rechits_
Definition: SeedingLayerSetsHits.h:248
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
SeedingLayerSetsHits::LayerIndex
unsigned short LayerIndex
Definition: SeedingLayerSetsHits.h:29
SeedingLayerSetsHits::SeedingLayer
Definition: SeedingLayerSetsHits.h:37
SeedingLayerSetsHits::OwnedHits
std::vector< HitPointer > OwnedHits
Definition: SeedingLayerSetsHits.h:23
eostools.move
def move(src, dest)
Definition: eostools.py:511
SeedingLayerSetsHits::Hits
std::vector< ConstRecHitPointer > Hits
Definition: SeedingLayerSetsHits.h:26
SeedingLayerSetsHits::end
const_iterator end() const
Definition: SeedingLayerSetsHits.h:211
Exception
Definition: hltDiff.cc:245
SeedingLayerSetsHits::hits
Hits hits(LayerIndex layerIndex) const
Definition: SeedingLayerSetsHits.cc:30
SeedingLayerSetsHits::SeedingLayerSet
Definition: SeedingLayerSetsHits.h:65
SeedingLayerSetsHits::HitIndex
unsigned int HitIndex
Definition: SeedingLayerSetsHits.h:30
Exception.h
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
SeedingLayerSetsHits::addHits
void addHits(LayerIndex layerIndex, OwnedHits &&hits)
Definition: SeedingLayerSetsHits.cc:19
nlayers
Definition: HIMultiTrackSelector.h:48
SeedingLayerSetsHits::begin
const_iterator begin() const
Definition: SeedingLayerSetsHits.h:209