CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2_patch1/src/RecoMuon/Navigation/src/MuonNavigationPrinter.cc

Go to the documentation of this file.
00001 
00018 #include "RecoMuon/Navigation/interface/MuonNavigationPrinter.h"
00019 
00020 #include "TrackingTools/DetLayers/interface/BarrelDetLayer.h" 
00021 #include "TrackingTools/DetLayers/interface/ForwardDetLayer.h"
00022 #include "DataFormats/GeometrySurface/interface/BoundCylinder.h"
00023 #include "DataFormats/GeometrySurface/interface/BoundDisk.h"
00024 #include "RecoMuon/DetLayers/interface/MuonDetLayerGeometry.h"
00025 #include "RecoTracker/TkDetLayers/interface/GeometricSearchTracker.h"
00026 
00027 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00028 
00029 #include <iostream>
00030 #include <iomanip>
00031 using namespace std;
00032 
00033 MuonNavigationPrinter::MuonNavigationPrinter(const MuonDetLayerGeometry * muonLayout, bool enableRPC) {
00034 
00035   edm::LogInfo ("MuonNavigationPrinter")<< "MuonNavigationPrinter::MuonNavigationPrinter" ;
00036   vector<DetLayer*>::const_iterator iter;
00037   edm::LogInfo ("MuonNavigationPrinter")<<"================================";
00038   edm::LogInfo ("MuonNavigationPrinter")<< "BARREL:";
00039   vector<DetLayer*> barrel;
00040   if ( enableRPC ) barrel = muonLayout->allBarrelLayers();
00041   else barrel = muonLayout->allDTLayers();
00042 
00043   edm::LogInfo ("MuonNavigationPrinter")<<"There are "<<barrel.size()<<" Barrel DetLayers";
00044   for ( iter = barrel.begin(); iter != barrel.end(); iter++ ) printLayer(*iter);
00045   edm::LogInfo ("MuonNavigationPrinter")<<"================================";
00046   edm::LogInfo ("MuonNavigationPrinter")  << "BACKWARD:";
00047 
00048   vector<DetLayer*> backward;
00049   if ( enableRPC ) backward = muonLayout->allBackwardLayers();
00050   else backward = muonLayout->backwardCSCLayers();
00051 
00052   edm::LogInfo ("MuonNavigationPrinter")<<"There are "<<backward.size()<<" Backward DetLayers";
00053   for ( iter = backward.begin(); iter != backward.end(); iter++ ) printLayer(*iter);
00054   edm::LogInfo ("MuonNavigationPrinter") << "==============================";
00055   edm::LogInfo ("MuonNavigationPrinter") << "FORWARD:";
00056   vector<DetLayer*> forward;
00057   if ( enableRPC ) forward = muonLayout->allForwardLayers();
00058   else forward = muonLayout->forwardCSCLayers();
00059 
00060   edm::LogInfo ("MuonNavigationPrinter")<<"There are "<<forward.size()<<" Forward DetLayers";
00061   for ( iter = forward.begin(); iter != forward.end(); iter++ ) printLayer(*iter);
00062 
00063 }
00064 
00065 MuonNavigationPrinter::MuonNavigationPrinter(const MuonDetLayerGeometry * muonLayout, const GeometricSearchTracker * tracker) {
00066 
00067   edm::LogInfo ("MuonNavigationPrinter")<< "MuonNavigationPrinter::MuonNavigationPrinter" ;
00068   vector<DetLayer*>::const_iterator iter;
00069 //  vector<BarrelDetLayer*>::const_iterator tkiter;
00070 //  vector<ForwardDetLayer*>::const_iterator tkfiter;
00071   edm::LogInfo ("MuonNavigationPrinter")<<"================================";
00072   edm::LogInfo ("MuonNavigationPrinter")<< "BARREL:";
00073   vector<BarrelDetLayer*> tkbarrel = tracker->barrelLayers();
00074   edm::LogInfo ("MuonNavigationPrinter")<<"There are "<<tkbarrel.size()<<" Tk Barrel DetLayers";
00075 //  for ( tkiter = tkbarrel.begin(); tkiter != tkbarrel.end(); tkiter++ ) printLayer(*tkiter);
00076   vector<DetLayer*> barrel = muonLayout->allBarrelLayers();
00077   edm::LogInfo ("MuonNavigationPrinter")<<"There are "<<barrel.size()<<" Mu Barrel DetLayers";
00078   for ( iter = barrel.begin(); iter != barrel.end(); iter++ ) printLayer(*iter);
00079   edm::LogInfo ("MuonNavigationPrinter")<<"================================";
00080   edm::LogInfo ("MuonNavigationPrinter")  << "BACKWARD:";
00081   vector<ForwardDetLayer*> tkbackward = tracker->negForwardLayers();
00082   edm::LogInfo ("MuonNavigationPrinter")<<"There are "<<tkbackward.size()<<" Tk Backward DetLayers";
00084   vector<DetLayer*> backward = muonLayout->allBackwardLayers();
00085   edm::LogInfo ("MuonNavigationPrinter")<<"There are "<<backward.size()<<" Mu Backward DetLayers";
00086   for ( iter = backward.begin(); iter != backward.end(); iter++ ) printLayer(*iter);
00087   edm::LogInfo ("MuonNavigationPrinter") << "==============================";
00088   edm::LogInfo ("MuonNavigationPrinter") << "FORWARD:";
00089   vector<ForwardDetLayer*> tkforward =  tracker->posForwardLayers();
00090   edm::LogInfo ("MuonNavigationPrinter")<<"There are "<<tkforward.size()<<" Tk Forward DetLayers";
00091 //  for ( tkfiter = tkforward.begin(); tkfiter != tkforward.end(); tkfiter++ ) printLayer(*tkfiter);
00092 
00093   vector<DetLayer*> forward = muonLayout->allForwardLayers();
00094   edm::LogInfo ("MuonNavigationPrinter")<<"There are "<<forward.size()<<" Mu Forward DetLayers";
00095   for ( iter = forward.begin(); iter != forward.end(); iter++ ) printLayer(*iter);
00096 
00097 }
00098 
00100 void MuonNavigationPrinter::printLayer(DetLayer* layer) const {
00101   vector<const DetLayer*> nextLayers = layer->nextLayers(insideOut);
00102   vector<const DetLayer*> compatibleLayers = layer->compatibleLayers(insideOut);
00103   if (BarrelDetLayer* bdl = dynamic_cast<BarrelDetLayer*>(layer)) {
00104     edm::LogInfo ("MuonNavigationPrinter") 
00105          << layer->location() << " " << layer->subDetector() << " layer at R: "
00106          << setiosflags(ios::showpoint | ios::fixed)
00107          << setw(8) << setprecision(2)
00108          << bdl->specificSurface().radius() << "  length: "
00109          << setw(6) << setprecision(2)
00110          << layer->surface().bounds().length();
00111           
00112   }
00113   else if (ForwardDetLayer* fdl = dynamic_cast<ForwardDetLayer*>(layer)) {
00114     edm::LogInfo ("MuonNavigationPrinter") << endl
00115          << layer->location() << " " << layer->subDetector() << "layer at z: "
00116          << setiosflags(ios::showpoint | ios::fixed)
00117          << setw(8) << setprecision(2)
00118          << layer->surface().position().z() << "  inner r: "
00119          << setw(6) << setprecision(2)
00120          << fdl->specificSurface().innerRadius() << "  outer r: "
00121          << setw(6) << setprecision(2)
00122          << fdl->specificSurface().outerRadius();
00123   }
00124   edm::LogInfo ("MuonNavigationPrinter") << " has " << nextLayers.size() << " next layers in the direction inside-out: ";
00125   printLayers(nextLayers);
00126 
00127   nextLayers.clear();
00128   nextLayers = layer->nextLayers(outsideIn);
00129 
00130    edm::LogInfo ("MuonNavigationPrinter") << " has " << nextLayers.size() << " next layers in the direction outside-in: ";
00131   printLayers(nextLayers);
00132 
00133   edm::LogInfo ("MuonNavigationPrinter") << " has " << compatibleLayers.size() << " compatible layers in the direction inside-out:: ";
00134   printLayers(compatibleLayers);
00135   compatibleLayers.clear();
00136   compatibleLayers = layer->compatibleLayers(outsideIn);
00137   
00138   edm::LogInfo ("MuonNavigationPrinter") << " has " << compatibleLayers.size() << " compatible layers in the direction outside-in: ";
00139   printLayers(compatibleLayers);
00140 
00141 }
00142 
00144 void MuonNavigationPrinter::printLayers(vector<const DetLayer*> nextLayers) const {
00145 
00146   for ( vector<const DetLayer*>::const_iterator inext = nextLayers.begin();
00147       inext != nextLayers.end(); inext++ ) {
00148 
00149      edm::LogInfo ("MuonNavigationPrinter") << " --> "; 
00150      if ( (*inext)->location() == GeomDetEnumerators::barrel ) {
00151       const BarrelDetLayer* l = dynamic_cast<const BarrelDetLayer*>(&(**inext));
00152       edm::LogInfo ("MuonNavigationPrinter") << (*inext)->location() << " "
00153            << (*inext)->subDetector()
00154            << " layer at R: "
00155            << setiosflags(ios::showpoint | ios::fixed)
00156            << setw(8) << setprecision(2)
00157            << l->specificSurface().radius() << "   ";
00158     }
00159     else {
00160       const ForwardDetLayer* l = dynamic_cast<const ForwardDetLayer*>(&(**inext));
00161        edm::LogInfo ("MuonNavigationPrinter") << (*inext)->location() << " "
00162            << (*inext)->subDetector()
00163            << " layer at z: "
00164            << setiosflags(ios::showpoint | ios::fixed)
00165            << setw(8) << setprecision(2)
00166            << l->surface().position().z() << "   ";
00167     }
00168     edm::LogInfo ("MuonNavigationPrinter") << setiosflags(ios::showpoint | ios::fixed)
00169          << setprecision(1)
00170          << setw(6) << (*inext)->surface().bounds().length() << ", "
00171          << setw(6) << (*inext)->surface().bounds().width() << ", "
00172          << setw(4) <<(*inext)->surface().bounds().thickness() << " : " 
00173          << (*inext)->surface().position();
00174   }
00175 
00176 }
00177 
00178 
00180 
00181 // /// determine whether the layer is forward or backward 
00182 // string MuonNavigationPrinter::layerPart(const DetLayer* layer) const {
00183 
00184 //   string result = "unknown";
00185   
00186 //   if ( layer->part() == barrel ) return "barrel";
00187 //   if ( layer->part() == forward && layer->surface().position().z() < 0 ) {
00188 //     result = "backward"; 
00189 //   }
00190 //   if ( layer->part() == forward && layer->surface().position().z() >= 0 ) {
00191 //     result = "forward";
00192 //   }
00193   
00194 //   return result;    
00195 
00196 // }
00197 
00198 // /// determine the module (pixel, sililcon, msgc, dt, csc, rpc)
00199 // string MuonNavigationPrinter::layerModule(const DetLayer* layer) const {
00200 
00201 //   string result = "unknown";
00202 
00203 //   GeomDetEnumerators::SubDetector det = layer->subDetector();
00204 
00205 //   if ( det == Pixel ) return "Pixel";
00206 //   if ( det == TIB || det == TOB
00207 //        || det == TID || det == TEC ) return "silicon";
00208 //   if ( det == DT ) return "DT";
00209 //   if ( det == CSC ) return "CSC";
00210 //   if ( det == RPC ) return "RPC";
00211 
00212 //   return result;
00213 
00214 // }
00215