Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:27:13

0001 /** \class MuonBarrelNavigableLayer
0002  *
0003  *  Navigable layer for Barrel Muon 
0004  *
0005  *
0006  * \author : Stefano Lacaprara - INFN Padova <stefano.lacaprara@pd.infn.it>
0007  *
0008  * Modification:
0009  *
0010  * Chang Liu:
0011  * compatibleLayers(dir) and compatibleLayers(fts, dir) are added,
0012  * which returns ALL DetLayers that are compatible with a given DetLayer.
0013  *  
0014  */
0015 
0016 #include "RecoMuon/Navigation/interface/MuonBarrelNavigableLayer.h"
0017 
0018 /* Collaborating Class Header */
0019 #include "TrackingTools/DetLayers/interface/DetLayer.h"
0020 #include "TrackingTools/DetLayers/interface/BarrelDetLayer.h"
0021 #include "RecoMuon/Navigation/interface/MuonDetLayerMap.h"
0022 #include "RecoMuon/Navigation/interface/MuonEtaRange.h"
0023 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0024 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
0025 /* C++ Headers */
0026 #include <algorithm>
0027 
0028 using namespace std;
0029 std::vector<const DetLayer*> MuonBarrelNavigableLayer::nextLayers(NavigationDirection dir) const {
0030   std::vector<const DetLayer*> result;
0031 
0032   if (dir == insideOut) {
0033     pushResult(result, theOuterBarrelLayers);
0034     pushResult(result, theOuterBackwardLayers);
0035     pushResult(result, theOuterForwardLayers);
0036   } else {
0037     pushResult(result, theInnerBarrelLayers);
0038     reverse(result.begin(), result.end());
0039     pushResult(result, theInnerBackwardLayers);
0040     pushResult(result, theInnerForwardLayers);
0041   }
0042 
0043   result.reserve(result.size());
0044   return result;
0045 }
0046 
0047 std::vector<const DetLayer*> MuonBarrelNavigableLayer::nextLayers(const FreeTrajectoryState& fts,
0048                                                                   PropagationDirection dir) const {
0049   std::vector<const DetLayer*> result;
0050 
0051   if ((isInsideOut(fts) && dir == alongMomentum) || (!isInsideOut(fts) && dir == oppositeToMomentum)) {
0052     pushResult(result, theOuterBarrelLayers, fts);
0053     pushResult(result, theOuterBackwardLayers, fts);
0054     pushResult(result, theOuterForwardLayers, fts);
0055   } else {
0056     pushResult(result, theInnerBarrelLayers, fts);
0057     reverse(result.begin(), result.end());
0058     pushResult(result, theInnerBackwardLayers, fts);
0059     pushResult(result, theInnerForwardLayers, fts);
0060   }
0061   result.reserve(result.size());
0062   return result;
0063 }
0064 
0065 std::vector<const DetLayer*> MuonBarrelNavigableLayer::compatibleLayers(NavigationDirection dir) const {
0066   std::vector<const DetLayer*> result;
0067 
0068   if (dir == insideOut) {
0069     pushResult(result, theAllOuterBarrelLayers);
0070     pushResult(result, theAllOuterBackwardLayers);
0071     pushResult(result, theAllOuterForwardLayers);
0072   } else {
0073     pushResult(result, theAllInnerBarrelLayers);
0074     reverse(result.begin(), result.end());
0075     pushResult(result, theAllInnerBackwardLayers);
0076     pushResult(result, theAllInnerForwardLayers);
0077   }
0078 
0079   result.reserve(result.size());
0080   return result;
0081 }
0082 
0083 std::vector<const DetLayer*> MuonBarrelNavigableLayer::compatibleLayers(const FreeTrajectoryState& fts,
0084                                                                         PropagationDirection dir) const {
0085   std::vector<const DetLayer*> result;
0086 
0087   if ((isInsideOut(fts) && dir == alongMomentum) || (!isInsideOut(fts) && dir == oppositeToMomentum)) {
0088     pushCompatibleResult(result, theAllOuterBarrelLayers, fts);
0089     pushCompatibleResult(result, theAllOuterBackwardLayers, fts);
0090     pushCompatibleResult(result, theAllOuterForwardLayers, fts);
0091   } else {
0092     pushCompatibleResult(result, theAllInnerBarrelLayers, fts);
0093     reverse(result.begin(), result.end());
0094     pushCompatibleResult(result, theAllInnerBackwardLayers, fts);
0095     pushCompatibleResult(result, theAllInnerForwardLayers, fts);
0096   }
0097   result.reserve(result.size());
0098   return result;
0099 }
0100 
0101 void MuonBarrelNavigableLayer::pushResult(std::vector<const DetLayer*>& result, const MapB& map) const {
0102   for (MapBI i = map.begin(); i != map.end(); i++)
0103     result.push_back((*i).first);
0104 }
0105 
0106 void MuonBarrelNavigableLayer::pushResult(std::vector<const DetLayer*>& result, const MapE& map) const {
0107   for (MapEI i = map.begin(); i != map.end(); i++)
0108     result.push_back((*i).first);
0109 }
0110 
0111 void MuonBarrelNavigableLayer::pushResult(std::vector<const DetLayer*>& result,
0112                                           const MapB& map,
0113                                           const FreeTrajectoryState& fts) const {
0114   for (MapBI i = map.begin(); i != map.end(); i++)
0115     if ((*i).second.isInside(fts.position().eta()))
0116       result.push_back((*i).first);
0117 }
0118 
0119 void MuonBarrelNavigableLayer::pushResult(std::vector<const DetLayer*>& result,
0120                                           const MapE& map,
0121                                           const FreeTrajectoryState& fts) const {
0122   for (MapEI i = map.begin(); i != map.end(); i++)
0123     if ((*i).second.isInside(fts.position().eta()))
0124       result.push_back((*i).first);
0125 }
0126 
0127 void MuonBarrelNavigableLayer::pushCompatibleResult(std::vector<const DetLayer*>& result,
0128                                                     const MapB& map,
0129                                                     const FreeTrajectoryState& fts) const {
0130   MuonEtaRange range = trackingRange(fts);
0131   for (MapBI i = map.begin(); i != map.end(); i++)
0132     if ((*i).second.isCompatible(range))
0133       result.push_back((*i).first);
0134 }
0135 
0136 void MuonBarrelNavigableLayer::pushCompatibleResult(std::vector<const DetLayer*>& result,
0137                                                     const MapE& map,
0138                                                     const FreeTrajectoryState& fts) const {
0139   MuonEtaRange range = trackingRange(fts);
0140   for (MapEI i = map.begin(); i != map.end(); i++)
0141     if ((*i).second.isCompatible(range))
0142       result.push_back((*i).first);
0143 }
0144 
0145 const DetLayer* MuonBarrelNavigableLayer::detLayer() const { return theDetLayer; }
0146 
0147 void MuonBarrelNavigableLayer::setDetLayer(const DetLayer* dl) {
0148   edm::LogError("MuonBarrelNavigableLayer") << "MuonBarrelNavigableLayer::setDetLayer called!! " << endl;
0149 }
0150 
0151 void MuonBarrelNavigableLayer::setInwardLinks(const MapB& innerBL) { theInnerBarrelLayers = innerBL; }
0152 void MuonBarrelNavigableLayer::setInwardCompatibleLinks(const MapB& innerCBL) { theAllInnerBarrelLayers = innerCBL; }