File indexing completed on 2024-04-06 12:27:13
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #include "RecoMuon/Navigation/interface/MuonForwardNavigableLayer.h"
0015
0016
0017 #include "TrackingTools/DetLayers/interface/DetLayer.h"
0018 #include "TrackingTools/DetLayers/interface/ForwardDetLayer.h"
0019 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0020 #include <algorithm>
0021
0022 using namespace std;
0023 using namespace edm;
0024
0025 vector<const DetLayer*> MuonForwardNavigableLayer::nextLayers(NavigationDirection dir) const {
0026 vector<const DetLayer*> result;
0027 vector<const DetLayer*> barrel;
0028
0029 if (dir == insideOut) {
0030 pushResult(result, theOuterEndcapLayers);
0031 } else {
0032 pushResult(result, theInnerEndcapLayers);
0033 reverse(result.begin(), result.end());
0034 pushResult(barrel, theInnerBarrelLayers);
0035 reverse(barrel.begin(), barrel.end());
0036 result.insert(result.end(), barrel.begin(), barrel.end());
0037 }
0038
0039 result.reserve(result.size());
0040 return result;
0041 }
0042
0043 vector<const DetLayer*> MuonForwardNavigableLayer::nextLayers(const FreeTrajectoryState& fts,
0044 PropagationDirection dir) const {
0045 vector<const DetLayer*> result;
0046 vector<const DetLayer*> barrel;
0047
0048 if ((isInsideOut(fts) && dir == alongMomentum) || (!isInsideOut(fts) && dir == oppositeToMomentum)) {
0049 pushResult(result, theOuterEndcapLayers, fts);
0050 } else {
0051 pushResult(result, theInnerEndcapLayers, fts);
0052 reverse(result.begin(), result.end());
0053 pushResult(barrel, theInnerBarrelLayers, fts);
0054 reverse(barrel.begin(), barrel.end());
0055 result.insert(result.end(), barrel.begin(), barrel.end());
0056 }
0057
0058 result.reserve(result.size());
0059 return result;
0060 }
0061
0062 vector<const DetLayer*> MuonForwardNavigableLayer::compatibleLayers(NavigationDirection dir) const {
0063 vector<const DetLayer*> result;
0064 vector<const DetLayer*> barrel;
0065
0066 if (dir == insideOut) {
0067 pushResult(result, theAllOuterEndcapLayers);
0068 } else {
0069 pushResult(result, theAllInnerEndcapLayers);
0070 reverse(result.begin(), result.end());
0071 pushResult(barrel, theAllInnerBarrelLayers);
0072 reverse(barrel.begin(), barrel.end());
0073 result.insert(result.end(), barrel.begin(), barrel.end());
0074 }
0075
0076 result.reserve(result.size());
0077 return result;
0078 }
0079 vector<const DetLayer*> MuonForwardNavigableLayer::compatibleLayers(const FreeTrajectoryState& fts,
0080 PropagationDirection dir) const {
0081 vector<const DetLayer*> result;
0082 vector<const DetLayer*> barrel;
0083
0084 if ((isInsideOut(fts) && dir == alongMomentum) || (!isInsideOut(fts) && dir == oppositeToMomentum)) {
0085 pushCompatibleResult(result, theAllOuterEndcapLayers, fts);
0086 } else {
0087 pushCompatibleResult(result, theAllInnerEndcapLayers, fts);
0088 reverse(result.begin(), result.end());
0089 pushCompatibleResult(barrel, theAllInnerBarrelLayers, fts);
0090 reverse(barrel.begin(), barrel.end());
0091 result.insert(result.end(), barrel.begin(), barrel.end());
0092 }
0093 result.reserve(result.size());
0094 return result;
0095 }
0096
0097 void MuonForwardNavigableLayer::pushResult(vector<const DetLayer*>& result, const MapB& map) const {
0098 for (MapBI i = map.begin(); i != map.end(); i++)
0099 result.push_back((*i).first);
0100 }
0101
0102 void MuonForwardNavigableLayer::pushResult(vector<const DetLayer*>& result, const MapE& map) const {
0103 for (MapEI i = map.begin(); i != map.end(); i++)
0104 result.push_back((*i).first);
0105 }
0106
0107 void MuonForwardNavigableLayer::pushResult(vector<const DetLayer*>& result,
0108 const MapE& map,
0109 const FreeTrajectoryState& fts) const {
0110 for (MapEI i = map.begin(); i != map.end(); i++)
0111 if ((*i).second.isInside(fts.position().eta()))
0112 result.push_back((*i).first);
0113 }
0114
0115 void MuonForwardNavigableLayer::pushResult(vector<const DetLayer*>& result,
0116 const MapB& map,
0117 const FreeTrajectoryState& fts) const {
0118 for (MapBI i = map.begin(); i != map.end(); i++)
0119 if ((*i).second.isInside(fts.position().eta()))
0120 result.push_back((*i).first);
0121 }
0122
0123 void MuonForwardNavigableLayer::pushCompatibleResult(vector<const DetLayer*>& result,
0124 const MapB& map,
0125 const FreeTrajectoryState& fts) const {
0126 MuonEtaRange range = trackingRange(fts);
0127 for (MapBI i = map.begin(); i != map.end(); i++)
0128 if ((*i).second.isCompatible(range))
0129 result.push_back((*i).first);
0130 }
0131
0132 void MuonForwardNavigableLayer::pushCompatibleResult(vector<const DetLayer*>& result,
0133 const MapE& map,
0134 const FreeTrajectoryState& fts) const {
0135 MuonEtaRange range = trackingRange(fts);
0136 for (MapEI i = map.begin(); i != map.end(); i++)
0137 if ((*i).second.isCompatible(range))
0138 result.push_back((*i).first);
0139 }
0140
0141 const DetLayer* MuonForwardNavigableLayer::detLayer() const { return theDetLayer; }
0142
0143 void MuonForwardNavigableLayer::setDetLayer(const DetLayer* dl) {
0144 edm::LogError("MuonForwardNavigablaLayer") << "MuonForwardNavigableLayer::setDetLayer called!! " << endl;
0145 }
0146
0147 void MuonForwardNavigableLayer::setInwardLinks(const MapB& innerBL, const MapE& innerEL) {
0148 theInnerBarrelLayers = innerBL;
0149 theInnerEndcapLayers = innerEL;
0150 }
0151 void MuonForwardNavigableLayer::setInwardCompatibleLinks(const MapB& innerCBL, const MapE& innerCEL) {
0152 theAllInnerBarrelLayers = innerCBL;
0153 theAllInnerEndcapLayers = innerCEL;
0154 }