Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 
0002 // This Class Header
0003 #include "RecoMuon/TrackingTools/interface/MuonPatternRecoDumper.h"
0004 
0005 // Collaborating Class Header
0006 #include "DataFormats/GeometrySurface/interface/BoundCylinder.h"
0007 #include "DataFormats/GeometrySurface/interface/BoundDisk.h"
0008 #include "TrackingTools/DetLayers/interface/DetLayer.h"
0009 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
0010 
0011 #include "DataFormats/MuonDetId/interface/MuonSubdetId.h"
0012 #include "DataFormats/MuonDetId/interface/DTWireId.h"
0013 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
0014 #include "DataFormats/MuonDetId/interface/RPCDetId.h"
0015 #include "DataFormats/MuonDetId/interface/GEMDetId.h"
0016 #include "DataFormats/MuonDetId/interface/ME0DetId.h"
0017 
0018 #include <sstream>
0019 
0020 using namespace std;
0021 
0022 // Constructor
0023 MuonPatternRecoDumper::MuonPatternRecoDumper() {}
0024 
0025 // Destructor
0026 MuonPatternRecoDumper::~MuonPatternRecoDumper() {}
0027 
0028 // Operations
0029 
0030 string MuonPatternRecoDumper::dumpLayer(const DetLayer* layer) const {
0031   stringstream output;
0032 
0033   const BoundSurface* sur = nullptr;
0034   const BoundCylinder* bc = nullptr;
0035   const BoundDisk* bd = nullptr;
0036 
0037   sur = &(layer->surface());
0038   if ((bc = dynamic_cast<const BoundCylinder*>(sur))) {
0039     output << "  Cylinder of radius: " << bc->radius() << endl;
0040   } else if ((bd = dynamic_cast<const BoundDisk*>(sur))) {
0041     output << "  Disk at: " << bd->position().z() << endl;
0042   }
0043   return output.str();
0044 }
0045 
0046 string MuonPatternRecoDumper::dumpFTS(const FreeTrajectoryState& fts) const {
0047   stringstream output;
0048 
0049   output << " pos: " << fts.position() << " radius: " << fts.position().perp() << endl
0050          << " charge*pt: " << fts.momentum().perp() * fts.parameters().charge() << " eta: " << fts.momentum().eta()
0051          << " phi: " << fts.momentum().phi() << endl;
0052 
0053   return output.str();
0054 }
0055 
0056 string MuonPatternRecoDumper::dumpTSOS(const TrajectoryStateOnSurface& tsos) const {
0057   stringstream output;
0058 
0059   output << tsos << endl;
0060   output << "dir: " << tsos.globalDirection() << endl;
0061   output << dumpFTS(*tsos.freeTrajectoryState());
0062 
0063   return output.str();
0064 }
0065 
0066 string MuonPatternRecoDumper::dumpMuonId(const DetId& id) const {
0067   stringstream output;
0068 
0069   if (id.subdetId() == MuonSubdetId::DT) {
0070     DTWireId wireId(id.rawId());
0071 
0072     output << "(DT): " << wireId << endl;
0073   } else if (id.subdetId() == MuonSubdetId::CSC) {
0074     CSCDetId chamberId(id.rawId());
0075     output << "(CSC): " << chamberId << endl;
0076   } else if (id.subdetId() == MuonSubdetId::GEM) {
0077     GEMDetId chamberId(id.rawId());
0078     output << "(GEM): " << chamberId << endl;
0079   } else if (id.subdetId() == MuonSubdetId::ME0) {
0080     ME0DetId chamberId(id.rawId());
0081     output << "(ME0): " << chamberId << endl;
0082   } else if (id.subdetId() == MuonSubdetId::RPC) {
0083     RPCDetId chamberId(id.rawId());
0084     output << "(RPC): " << chamberId << endl;
0085   } else
0086     output << "The DetLayer is not a valid Muon DetLayer. ";
0087 
0088   return output.str();
0089 }