CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/RecoMuon/Navigation/src/MuonBarrelNavigableLayer.cc

Go to the documentation of this file.
00001 
00018 #include "RecoMuon/Navigation/interface/MuonBarrelNavigableLayer.h"
00019 
00020 /* Collaborating Class Header */
00021 #include "TrackingTools/DetLayers/interface/DetLayer.h"
00022 #include "TrackingTools/DetLayers/interface/BarrelDetLayer.h"
00023 #include "RecoMuon/Navigation/interface/MuonDetLayerMap.h"
00024 #include "RecoMuon/Navigation/interface/MuonEtaRange.h"
00025 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00026 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
00027 /* C++ Headers */
00028 #include <algorithm>
00029 
00030 using namespace std;
00031 std::vector<const DetLayer*> 
00032 MuonBarrelNavigableLayer::nextLayers(NavigationDirection dir) const {
00033   
00034   std::vector<const DetLayer*> result;
00035   
00036   if ( dir == insideOut ) {
00037     pushResult(result, theOuterBarrelLayers);
00038     pushResult(result, theOuterBackwardLayers);
00039     pushResult(result, theOuterForwardLayers);
00040   }
00041   else {
00042     pushResult(result, theInnerBarrelLayers);
00043     reverse(result.begin(),result.end());
00044     pushResult(result, theInnerBackwardLayers);
00045     pushResult(result, theInnerForwardLayers);
00046   }
00047   
00048   result.reserve(result.size());
00049   return result;
00050 
00051 }
00052 
00053 
00054 std::vector<const DetLayer*> 
00055 MuonBarrelNavigableLayer::nextLayers(const FreeTrajectoryState& fts,
00056                                      PropagationDirection dir) const {
00057 
00058   std::vector<const DetLayer*> result;
00059 
00060   if ( (isInsideOut(fts) && dir == alongMomentum) || ( !isInsideOut(fts) && dir == oppositeToMomentum)) {
00061     pushResult(result, theOuterBarrelLayers, fts);
00062     pushResult(result, theOuterBackwardLayers, fts);
00063     pushResult(result, theOuterForwardLayers, fts);
00064   }
00065   else {
00066     pushResult(result, theInnerBarrelLayers, fts);
00067     reverse(result.begin(),result.end());
00068     pushResult(result, theInnerBackwardLayers, fts);
00069     pushResult(result, theInnerForwardLayers, fts);
00070   }
00071   result.reserve(result.size());
00072   return result;
00073 }
00074 
00075 std::vector<const DetLayer*>
00076 MuonBarrelNavigableLayer::compatibleLayers(NavigationDirection dir) const {
00077 
00078   std::vector<const DetLayer*> result;
00079 
00080   if ( dir == insideOut ) {
00081     pushResult(result, theAllOuterBarrelLayers);
00082     pushResult(result, theAllOuterBackwardLayers);
00083     pushResult(result, theAllOuterForwardLayers);
00084   }
00085   else {
00086     pushResult(result, theAllInnerBarrelLayers);
00087     reverse(result.begin(),result.end());
00088     pushResult(result, theAllInnerBackwardLayers);
00089     pushResult(result, theAllInnerForwardLayers);
00090   }
00091 
00092   result.reserve(result.size());
00093   return result;
00094 }
00095 
00096 std::vector<const DetLayer*>
00097 MuonBarrelNavigableLayer::compatibleLayers(const FreeTrajectoryState& fts,
00098                                      PropagationDirection dir) const {
00099   std::vector<const DetLayer*> result;
00100 
00101   if ( (isInsideOut(fts) && dir == alongMomentum) || ( !isInsideOut(fts) && dir == oppositeToMomentum)) {
00102     pushCompatibleResult(result, theAllOuterBarrelLayers, fts);
00103     pushCompatibleResult(result, theAllOuterBackwardLayers, fts);
00104     pushCompatibleResult(result, theAllOuterForwardLayers, fts);
00105   }
00106   else {
00107     pushCompatibleResult(result, theAllInnerBarrelLayers, fts);
00108     reverse(result.begin(),result.end());
00109     pushCompatibleResult(result, theAllInnerBackwardLayers, fts);
00110     pushCompatibleResult(result, theAllInnerForwardLayers, fts);
00111   }
00112   result.reserve(result.size());
00113   return result;
00114 
00115 }
00116 
00117 
00118 void MuonBarrelNavigableLayer::pushResult(std::vector<const DetLayer*>& result,
00119                                           const MapB& map) const {
00120 
00121   for ( MapBI i = map.begin(); i != map.end(); i++ ) result.push_back((*i).first); 
00122 
00123 }
00124 
00125 void MuonBarrelNavigableLayer::pushResult(std::vector<const DetLayer*>& result,
00126                                           const MapE& map) const {
00127 
00128   for ( MapEI i = map.begin(); i != map.end(); i++ ) result.push_back((*i).first);  
00129 }
00130 
00131 
00132 void MuonBarrelNavigableLayer::pushResult(std::vector<const DetLayer*>& result,
00133                                           const MapB& map, 
00134                                           const FreeTrajectoryState& fts) const {
00135   for ( MapBI i = map.begin(); i != map.end(); i++ ) 
00136     if ((*i).second.isInside(fts.position().eta())) result.push_back((*i).first); 
00137 }
00138 
00139 void MuonBarrelNavigableLayer::pushResult(std::vector<const DetLayer*>& result,
00140                                           const MapE& map, 
00141                                           const FreeTrajectoryState& fts) const {
00142 
00143   for (MapEI i = map.begin(); i != map.end(); i++)
00144     if ((*i).second.isInside(fts.position().eta())) result.push_back((*i).first); 
00145 
00146 }
00147 
00148 void MuonBarrelNavigableLayer::pushCompatibleResult(std::vector<const DetLayer*>& result,
00149                                           const MapB& map,
00150                                           const FreeTrajectoryState& fts) const {
00151   MuonEtaRange range= trackingRange(fts);
00152   for ( MapBI i = map.begin(); i != map.end(); i++ )
00153     if ((*i).second.isCompatible(range)) result.push_back((*i).first);
00154 }
00155 
00156 void MuonBarrelNavigableLayer::pushCompatibleResult(std::vector<const DetLayer*>& result,
00157                                           const MapE& map,
00158                                           const FreeTrajectoryState& fts) const {
00159   MuonEtaRange range= trackingRange(fts);
00160   for (MapEI i = map.begin(); i != map.end(); i++)
00161     if ((*i).second.isCompatible(range)) result.push_back((*i).first);
00162 
00163 }
00164 
00165 DetLayer* MuonBarrelNavigableLayer::detLayer() const {
00166   return theDetLayer;
00167 }
00168 
00169 
00170 void MuonBarrelNavigableLayer::setDetLayer(DetLayer* dl) {
00171   edm::LogError("MuonBarrelNavigableLayer") << "MuonBarrelNavigableLayer::setDetLayer called!! " << endl;
00172 }
00173 
00174 
00175 void MuonBarrelNavigableLayer::setInwardLinks(const MapB& innerBL) {
00176   theInnerBarrelLayers = innerBL;
00177 }
00178 void MuonBarrelNavigableLayer::setInwardCompatibleLinks(const MapB& innerCBL) {
00179 
00180   theAllInnerBarrelLayers = innerCBL;
00181 
00182 }
00183