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 
20 public:
21 
23 // std::cout << "NVSH: C "<< this << std::endl;
24  }
25 
26  virtual ~NavigationSchool() {}
27 
28  typedef std::vector<NavigableLayer*> StateType;
29 
30  virtual StateType navigableLayers() = 0;
31 
32 
35  template<typename... Args>
36  std::vector<const DetLayer*>
37  nextLayers(const DetLayer & detLayer, Args && ...args) const {
38  assert( detLayer.seqNum()>=0);
39  auto nl = theAllNavigableLayer[detLayer.seqNum()];
40  return nl
41  ? nl->nextLayers(std::forward<Args>(args)...)
42  : std::vector<const DetLayer*>();
43  }
44 
46  template<typename... Args>
47  std::vector<const DetLayer*>
48  compatibleLayers(const DetLayer & detLayer, Args && ...args) const {
49  auto nl = theAllNavigableLayer[detLayer.seqNum()];
50  return nl
51  ? nl->compatibleLayers(std::forward<Args>(args)...)
52  : std::vector<const DetLayer*>();
53  }
54 
55 protected:
56 
57  void setState( const StateType& state) {
58  // std::cout << "NVSH: set "<< this << ' ' << typeid(*this).name()
59  // << ' ' << state.size() << ' ' << theAllNavigableLayer.size() << std::endl;
60 
61  for (auto nl : state) {
62  if (!nl) continue;
63  theAllNavigableLayer[nl->detLayer()->seqNum()]=nl;
64  nl->setSchool(this);
65  }
66  }
67 
68  // index correspond to seqNum of DetLayers
70 
71 
72  // will be obsoleted together with NAvigationSetter
73 public:
74  const std::vector<const DetLayer*> & allLayersInSystem() const {return *theAllDetLayersInSystem;}
75  protected:
76  const std::vector<const DetLayer*> * theAllDetLayersInSystem;
77 };
78 
79 #endif // NavigationSchool_H
const std::vector< const DetLayer * > & allLayersInSystem() const
#define nullptr
int seqNum() const
Definition: DetLayer.h:36
StateType theAllNavigableLayer
std::vector< const DetLayer * > compatibleLayers(const DetLayer &detLayer, Args &&...args) const
Returns all layers compatible.
std::vector< NavigableLayer * > StateType
virtual ~NavigationSchool()
const std::vector< const DetLayer * > * theAllDetLayersInSystem
virtual StateType navigableLayers()=0
std::vector< const DetLayer * > nextLayers(const DetLayer &detLayer, Args &&...args) const
NavigationDirection.
void setState(const StateType &state)