CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/RecoMuon/Navigation/src/MuonForwardNavigableLayer.cc

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