CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2_patch1/src/RecoMuon/TrackingTools/src/MuonPatternRecoDumper.cc

Go to the documentation of this file.
00001 
00002 // This Class Header 
00003 #include "RecoMuon/TrackingTools/interface/MuonPatternRecoDumper.h"
00004 
00005 // Collaborating Class Header
00006 #include "DataFormats/GeometrySurface/interface/BoundCylinder.h"
00007 #include "DataFormats/GeometrySurface/interface/BoundDisk.h"
00008 #include "TrackingTools/DetLayers/interface/DetLayer.h"
00009 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
00010 
00011 #include "DataFormats/MuonDetId/interface/MuonSubdetId.h"
00012 #include "DataFormats/MuonDetId/interface/DTWireId.h"
00013 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
00014 #include "DataFormats/MuonDetId/interface/RPCDetId.h"
00015 
00016 #include <sstream>
00017 
00018 using namespace std;
00019 
00020 // Constructor 
00021 MuonPatternRecoDumper::MuonPatternRecoDumper() {
00022 }
00023 
00024 // Destructor
00025 MuonPatternRecoDumper::~MuonPatternRecoDumper() {
00026 }
00027 
00028 // Operations
00029 
00030 string MuonPatternRecoDumper::dumpLayer(const DetLayer* layer) const {
00031   stringstream output;
00032   
00033   const BoundSurface* sur=0;
00034   const BoundCylinder* bc=0;
00035   const BoundDisk* bd=0;
00036 
00037   sur = &(layer->surface());
00038   if ( (bc = dynamic_cast<const BoundCylinder*>(sur)) ) {
00039     output << "  Cylinder of radius: " << bc->radius() << endl;
00040   }
00041   else if ( (bd = dynamic_cast<const BoundDisk*>(sur)) ) {
00042     output << "  Disk at: " <<  bd->position().z() << endl;
00043   }
00044   return output.str();
00045 }
00046 
00047 string MuonPatternRecoDumper::dumpFTS(const FreeTrajectoryState& fts) const {
00048   stringstream output;
00049   
00050   output  << 
00051     " pos: " << fts.position() << 
00052     " radius: " << fts.position().perp() << endl << 
00053     " charge*pt: " << fts.momentum().perp()*fts.parameters().charge() <<
00054     " eta: " << fts.momentum().eta() <<
00055     " phi: " << fts.momentum().phi() << endl;
00056 
00057   return output.str();
00058 }
00059 
00060 string MuonPatternRecoDumper::dumpTSOS(const TrajectoryStateOnSurface& tsos) const{
00061   stringstream output;
00062   
00063   output<<tsos<<endl;
00064   output<<"dir: "<<tsos.globalDirection()<<endl;
00065   output<<dumpFTS(*tsos.freeTrajectoryState());
00066 
00067   return output.str();
00068 }
00069 
00070 string MuonPatternRecoDumper::dumpMuonId(const DetId &id) const{
00071   stringstream output;
00072   
00073   if(id.subdetId() == MuonSubdetId::DT ){
00074     DTWireId wireId(id.rawId());
00075 
00076     output<<"(DT): "<<wireId<<endl;  
00077   }
00078   else if(id.subdetId() == MuonSubdetId::CSC){
00079     CSCDetId chamberId(id.rawId());
00080     output<<"(CSC): "<<chamberId<<endl;  
00081   }
00082   else if(id.subdetId() == MuonSubdetId::RPC){
00083     RPCDetId chamberId(id.rawId());
00084     output<<"(RPC): "<<chamberId<<endl;  
00085   }
00086   else output<<"The DetLayer is not a valid Muon DetLayer. ";
00087 
00088   return output.str();
00089 }