File indexing completed on 2024-04-06 12:31:27
0001 #ifndef DetLayers_NavigationSchool_H
0002 #define DetLayers_NavigationSchool_H
0003
0004 #include <vector>
0005
0006 #include "NavigableLayer.h"
0007 #include "DetLayer.h"
0008
0009 #include <iostream>
0010 #include <typeinfo>
0011
0012
0013
0014
0015
0016
0017
0018 class NavigationSchool {
0019 public:
0020 NavigationSchool() : theAllDetLayersInSystem(nullptr) {
0021
0022 }
0023
0024 virtual ~NavigationSchool() {}
0025
0026 typedef std::vector<NavigableLayer*> StateType;
0027
0028 virtual StateType navigableLayers() = 0;
0029
0030
0031
0032 template <typename... Args>
0033 std::vector<const DetLayer*> nextLayers(const DetLayer& detLayer, Args&&... args) const {
0034 assert(detLayer.seqNum() >= 0);
0035 auto nl = theAllNavigableLayer[detLayer.seqNum()];
0036 return nl ? nl->nextLayers(std::forward<Args>(args)...) : std::vector<const DetLayer*>();
0037 }
0038
0039
0040 template <typename... Args>
0041 std::vector<const DetLayer*> compatibleLayers(const DetLayer& detLayer, Args&&... args) const {
0042 auto nl = theAllNavigableLayer[detLayer.seqNum()];
0043 return nl ? nl->compatibleLayers(std::forward<Args>(args)...) : std::vector<const DetLayer*>();
0044 }
0045
0046 protected:
0047 void setState(const StateType& state) {
0048
0049
0050
0051 for (auto nl : state) {
0052 if (!nl)
0053 continue;
0054 theAllNavigableLayer[nl->detLayer()->seqNum()] = nl;
0055 nl->setSchool(this);
0056 }
0057 }
0058
0059
0060 StateType theAllNavigableLayer;
0061
0062
0063 public:
0064 const std::vector<const DetLayer*>& allLayersInSystem() const { return *theAllDetLayersInSystem; }
0065
0066 protected:
0067 const std::vector<const DetLayer*>* theAllDetLayersInSystem;
0068 };
0069
0070 #endif