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 // std::cout << "deleting eedingLayerSetsHits " << rechits_.size() << std::endl;
21 }
22 
23 
24 
25 void SeedingLayerSetsHits::swapHits(std::vector<HitIndex>& layerHitIndices, OwnedHits& hits) {
26  layerHitIndices_.swap(layerHitIndices);
27  rechits_.swap(hits);
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){return p.get();});
38  return ret;
39 }
40 
41 
43  std::stringstream ss;
44  ss << "SeedingLayerSetsHits with " << numberOfLayersInSet() << " layers in each LayerSets, LayerSets has " << size() << " items\n";
45  for(LayerSetIndex iLayers=0; iLayers<size(); ++iLayers) {
46  ss << " " << iLayers << ": ";
48  for(unsigned iLayer=0; iLayer<layers.size(); ++iLayer) {
49  SeedingLayer layer = layers[iLayer];
50  ss << layer.name() << " (" << layer.index() << ", nhits " << layer.hits().size() << ") ";
51  }
52  ss << "\n";
53  }
54  LogDebug("SeedingLayerSetsHits") << ss.str();
55 }
#define LogDebug(id)
void swapHits(std::vector< HitIndex > &layerHitIndices, OwnedHits &hits)
const_iterator end() const
LayerSetIndex size() const
Number of layers in this set.
tuple ret
prodAgent to be discontinued
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
const_iterator begin() const
#define nullptr
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_
std::vector< HitPointer > OwnedHits
unsigned short size() const
Get the number of SeedingLayerSets.