CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SeedingLayerSetsHits.cc
Go to the documentation of this file.
4 
5 #include <algorithm>
6 #include <limits>
7 #include <sstream>
8 
9 SeedingLayerSetsHits::SeedingLayerSetsHits(): nlayers_(0), layerSetIndices_(nullptr), layerNames_(nullptr) {}
11  const std::vector<LayerSetIndex> *layerSetIndices,
12  const std::vector<std::string> *layerNames,
13  const std::vector<const DetLayer *>& layerDets):
14  nlayers_(nlayers),
15  layerSetIndices_(layerSetIndices),
16  layerNames_(layerNames),
17  layerDets_(layerDets)
18 {}
20 
21 
22 
23 void SeedingLayerSetsHits::swapHits(std::vector<HitIndex>& layerHitIndices, Hits& hits) {
24  layerHitIndices_.swap(layerHitIndices);
25  rechits_.swap(hits);
26 }
27 
29  HitIndex begin = layerHitIndices_[layerIndex];
30  ++layerIndex;
31  HitIndex end = layerIndex < layerHitIndices_.size() ? layerHitIndices_[layerIndex] : rechits_.size();
32 
33  Hits ret;
34  ret.reserve(end-begin);
35  std::copy(rechits_.begin()+begin, rechits_.begin()+end, std::back_inserter(ret));
36  return ret;
37 }
38 
39 
41  std::stringstream ss;
42  ss << "SeedingLayerSetsHits with " << numberOfLayersInSet() << " layers in each LayerSets, LayerSets has " << size() << " items\n";
43  for(LayerSetIndex iLayers=0; iLayers<size(); ++iLayers) {
44  ss << " " << iLayers << ": ";
46  for(unsigned iLayer=0; iLayer<layers.size(); ++iLayer) {
47  SeedingLayer layer = layers[iLayer];
48  ss << layer.name() << " (" << layer.index() << ", nhits " << layer.hits().size() << ") ";
49  }
50  ss << "\n";
51  }
52  LogDebug("SeedingLayerSetsHits") << ss.str();
53 }
#define LogDebug(id)
const_iterator end() const
LayerSetIndex size() const
Number of layers in this set.
unsigned short numberOfLayersInSet() const
Get number of layers in each SeedingLayerSets.
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
std::vector< ConstRecHitPointer > rechits_
unsigned short LayerSetIndex
const_iterator begin() const
#define nullptr
void swapHits(std::vector< HitIndex > &layerHitIndices, Hits &hits)
Hits hits(LayerIndex layerIndex) const
SeedingLayerSet operator[](LayerSetIndex index) const
Get the SeedingLayerSet at a given index.
const std::string & name() const
std::vector< ConstRecHitPointer > Hits
std::vector< HitIndex > layerHitIndices_
unsigned short size() const
Get the number of SeedingLayerSets.