CMS 3D CMS Logo

NavigationSchool.h
Go to the documentation of this file.
1 #ifndef DetLayers_NavigationSchool_H
2 #define DetLayers_NavigationSchool_H
3 
4 #include <vector>
5 
6 #include "NavigableLayer.h"
7 #include "DetLayer.h"
8 
9 #include <iostream>
10 #include <typeinfo>
11 
19 public:
21  // std::cout << "NVSH: C "<< this << std::endl;
22  }
23 
24  virtual ~NavigationSchool() {}
25 
26  typedef std::vector<NavigableLayer*> StateType;
27 
28  virtual StateType navigableLayers() = 0;
29 
32  template <typename... Args>
33  std::vector<const DetLayer*> nextLayers(const DetLayer& detLayer, Args&&... args) const {
34  assert(detLayer.seqNum() >= 0);
35  auto nl = theAllNavigableLayer[detLayer.seqNum()];
36  return nl ? nl->nextLayers(std::forward<Args>(args)...) : std::vector<const DetLayer*>();
37  }
38 
40  template <typename... Args>
41  std::vector<const DetLayer*> compatibleLayers(const DetLayer& detLayer, Args&&... args) const {
42  auto nl = theAllNavigableLayer[detLayer.seqNum()];
43  return nl ? nl->compatibleLayers(std::forward<Args>(args)...) : std::vector<const DetLayer*>();
44  }
45 
46 protected:
47  void setState(const StateType& state) {
48  // std::cout << "NVSH: set "<< this << ' ' << typeid(*this).name()
49  // << ' ' << state.size() << ' ' << theAllNavigableLayer.size() << std::endl;
50 
51  for (auto nl : state) {
52  if (!nl)
53  continue;
54  theAllNavigableLayer[nl->detLayer()->seqNum()] = nl;
55  nl->setSchool(this);
56  }
57  }
58 
59  // index correspond to seqNum of DetLayers
61 
62  // will be obsoleted together with NAvigationSetter
63 public:
64  const std::vector<const DetLayer*>& allLayersInSystem() const { return *theAllDetLayersInSystem; }
65 
66 protected:
67  const std::vector<const DetLayer*>* theAllDetLayersInSystem;
68 };
69 
70 #endif // NavigationSchool_H
writedatasetfile.args
args
Definition: writedatasetfile.py:18
DetLayer
Definition: DetLayer.h:21
cms::cuda::assert
assert(be >=bs)
NavigationSchool
Definition: NavigationSchool.h:18
NavigableLayer.h
NavigationSchool::NavigationSchool
NavigationSchool()
Definition: NavigationSchool.h:20
NavigationSchool::nextLayers
std::vector< const DetLayer * > nextLayers(const DetLayer &detLayer, Args &&... args) const
Definition: NavigationSchool.h:33
NavigationSchool::theAllNavigableLayer
StateType theAllNavigableLayer
Definition: NavigationSchool.h:60
NavigationSchool::StateType
std::vector< NavigableLayer * > StateType
Definition: NavigationSchool.h:26
NavigationSchool::~NavigationSchool
virtual ~NavigationSchool()
Definition: NavigationSchool.h:24
DetLayer::seqNum
int seqNum() const
Definition: DetLayer.h:35
NavigationSchool::navigableLayers
virtual StateType navigableLayers()=0
NavigationSchool::theAllDetLayersInSystem
const std::vector< const DetLayer * > * theAllDetLayersInSystem
Definition: NavigationSchool.h:67
NavigationSchool::compatibleLayers
std::vector< const DetLayer * > compatibleLayers(const DetLayer &detLayer, Args &&... args) const
Returns all layers compatible.
Definition: NavigationSchool.h:41
DetLayer.h
NavigationSchool::setState
void setState(const StateType &state)
Definition: NavigationSchool.h:47
NavigationSchool::allLayersInSystem
const std::vector< const DetLayer * > & allLayersInSystem() const
Definition: NavigationSchool.h:64