CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
MuonBarrelNavigableLayer.cc
Go to the documentation of this file.
1 
17 
18 /* Collaborating Class Header */
25 /* C++ Headers */
26 #include <algorithm>
27 
28 using namespace std;
29 std::vector<const DetLayer*> MuonBarrelNavigableLayer::nextLayers(NavigationDirection dir) const {
30  std::vector<const DetLayer*> result;
31 
32  if (dir == insideOut) {
33  pushResult(result, theOuterBarrelLayers);
34  pushResult(result, theOuterBackwardLayers);
35  pushResult(result, theOuterForwardLayers);
36  } else {
37  pushResult(result, theInnerBarrelLayers);
38  reverse(result.begin(), result.end());
39  pushResult(result, theInnerBackwardLayers);
40  pushResult(result, theInnerForwardLayers);
41  }
42 
43  result.reserve(result.size());
44  return result;
45 }
46 
47 std::vector<const DetLayer*> MuonBarrelNavigableLayer::nextLayers(const FreeTrajectoryState& fts,
48  PropagationDirection dir) const {
49  std::vector<const DetLayer*> result;
50 
51  if ((isInsideOut(fts) && dir == alongMomentum) || (!isInsideOut(fts) && dir == oppositeToMomentum)) {
52  pushResult(result, theOuterBarrelLayers, fts);
53  pushResult(result, theOuterBackwardLayers, fts);
54  pushResult(result, theOuterForwardLayers, fts);
55  } else {
56  pushResult(result, theInnerBarrelLayers, fts);
57  reverse(result.begin(), result.end());
58  pushResult(result, theInnerBackwardLayers, fts);
59  pushResult(result, theInnerForwardLayers, fts);
60  }
61  result.reserve(result.size());
62  return result;
63 }
64 
66  std::vector<const DetLayer*> result;
67 
68  if (dir == insideOut) {
69  pushResult(result, theAllOuterBarrelLayers);
70  pushResult(result, theAllOuterBackwardLayers);
71  pushResult(result, theAllOuterForwardLayers);
72  } else {
73  pushResult(result, theAllInnerBarrelLayers);
74  reverse(result.begin(), result.end());
75  pushResult(result, theAllInnerBackwardLayers);
76  pushResult(result, theAllInnerForwardLayers);
77  }
78 
79  result.reserve(result.size());
80  return result;
81 }
82 
83 std::vector<const DetLayer*> MuonBarrelNavigableLayer::compatibleLayers(const FreeTrajectoryState& fts,
84  PropagationDirection dir) const {
85  std::vector<const DetLayer*> result;
86 
87  if ((isInsideOut(fts) && dir == alongMomentum) || (!isInsideOut(fts) && dir == oppositeToMomentum)) {
88  pushCompatibleResult(result, theAllOuterBarrelLayers, fts);
89  pushCompatibleResult(result, theAllOuterBackwardLayers, fts);
90  pushCompatibleResult(result, theAllOuterForwardLayers, fts);
91  } else {
92  pushCompatibleResult(result, theAllInnerBarrelLayers, fts);
93  reverse(result.begin(), result.end());
94  pushCompatibleResult(result, theAllInnerBackwardLayers, fts);
95  pushCompatibleResult(result, theAllInnerForwardLayers, fts);
96  }
97  result.reserve(result.size());
98  return result;
99 }
100 
101 void MuonBarrelNavigableLayer::pushResult(std::vector<const DetLayer*>& result, const MapB& map) const {
102  for (MapBI i = map.begin(); i != map.end(); i++)
103  result.push_back((*i).first);
104 }
105 
106 void MuonBarrelNavigableLayer::pushResult(std::vector<const DetLayer*>& result, const MapE& map) const {
107  for (MapEI i = map.begin(); i != map.end(); i++)
108  result.push_back((*i).first);
109 }
110 
111 void MuonBarrelNavigableLayer::pushResult(std::vector<const DetLayer*>& result,
112  const MapB& map,
113  const FreeTrajectoryState& fts) const {
114  for (MapBI i = map.begin(); i != map.end(); i++)
115  if ((*i).second.isInside(fts.position().eta()))
116  result.push_back((*i).first);
117 }
118 
119 void MuonBarrelNavigableLayer::pushResult(std::vector<const DetLayer*>& result,
120  const MapE& map,
121  const FreeTrajectoryState& fts) const {
122  for (MapEI i = map.begin(); i != map.end(); i++)
123  if ((*i).second.isInside(fts.position().eta()))
124  result.push_back((*i).first);
125 }
126 
127 void MuonBarrelNavigableLayer::pushCompatibleResult(std::vector<const DetLayer*>& result,
128  const MapB& map,
129  const FreeTrajectoryState& fts) const {
130  MuonEtaRange range = trackingRange(fts);
131  for (MapBI i = map.begin(); i != map.end(); i++)
132  if ((*i).second.isCompatible(range))
133  result.push_back((*i).first);
134 }
135 
136 void MuonBarrelNavigableLayer::pushCompatibleResult(std::vector<const DetLayer*>& result,
137  const MapE& map,
138  const FreeTrajectoryState& fts) const {
139  MuonEtaRange range = trackingRange(fts);
140  for (MapEI i = map.begin(); i != map.end(); i++)
141  if ((*i).second.isCompatible(range))
142  result.push_back((*i).first);
143 }
144 
145 const DetLayer* MuonBarrelNavigableLayer::detLayer() const { return theDetLayer; }
146 
148  edm::LogError("MuonBarrelNavigableLayer") << "MuonBarrelNavigableLayer::setDetLayer called!! " << endl;
149 }
150 
151 void MuonBarrelNavigableLayer::setInwardLinks(const MapB& innerBL) { theInnerBarrelLayers = innerBL; }
152 void MuonBarrelNavigableLayer::setInwardCompatibleLinks(const MapB& innerCBL) { theAllInnerBarrelLayers = innerCBL; }
std::vector< const DetLayer * > compatibleLayers(NavigationDirection dir) const override
void pushResult(std::vector< const DetLayer * > &result, const MapB &map) const
std::vector< const DetLayer * > nextLayers(NavigationDirection dir) const override
NavigableLayer interface.
MapB::const_iterator MapBI
std::map< const BarrelDetLayer *, MuonEtaRange, MuonDetLayerComp > MapB
PropagationDirection
Log< level::Error, false > LogError
const uint16_t range(const Frame &aFrame)
tuple result
Definition: mps_fire.py:311
void setDetLayer(const DetLayer *) override
set DetLayer
void setInwardCompatibleLinks(const MapB &)
MapE::const_iterator MapEI
const DetLayer * detLayer() const override
return DetLayer
std::map< const ForwardDetLayer *, MuonEtaRange, MuonDetLayerComp > MapE
GlobalPoint position() const
T eta() const
Definition: PV3DBase.h:73
void setInwardLinks(const MapB &)
set inward links
void pushCompatibleResult(std::vector< const DetLayer * > &result, const MapB &map, const FreeTrajectoryState &fts) const