00001 #ifndef Alignment_MuonAlignmentAlgorithms_MuonResidualsFromTrack_H 00002 #define Alignment_MuonAlignmentAlgorithms_MuonResidualsFromTrack_H 00003 00010 #include "FWCore/Framework/interface/ESHandle.h" 00011 #include "FWCore/Utilities/interface/Exception.h" 00012 #include "Alignment/CommonAlignment/interface/AlignableNavigator.h" 00013 #include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h" 00014 #include "TrackingTools/PatternTools/interface/Trajectory.h" 00015 #include "TrackingTools/TrackFitters/interface/TrajectoryStateCombiner.h" 00016 #include "DataFormats/DetId/interface/DetId.h" 00017 #include "DataFormats/MuonDetId/interface/DTChamberId.h" 00018 #include "DataFormats/MuonDetId/interface/DTSuperLayerId.h" 00019 #include "DataFormats/MuonDetId/interface/CSCDetId.h" 00020 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h" 00021 #include <vector> 00022 #include <map> 00023 00024 #include "Alignment/MuonAlignmentAlgorithms/interface/MuonChamberResidual.h" 00025 #include "Alignment/MuonAlignmentAlgorithms/interface/MuonDT13ChamberResidual.h" 00026 #include "Alignment/MuonAlignmentAlgorithms/interface/MuonDT2ChamberResidual.h" 00027 #include "Alignment/MuonAlignmentAlgorithms/interface/MuonCSCChamberResidual.h" 00028 00029 class MuonResidualsFromTrack { 00030 public: 00031 MuonResidualsFromTrack(edm::ESHandle<GlobalTrackingGeometry> globalGeometry, const Trajectory *traj, AlignableNavigator *navigator, double maxResidual); 00032 ~MuonResidualsFromTrack(); 00033 00034 int trackerNumHits() const { return m_tracker_numHits; }; 00035 double trackerChi2() const { return m_tracker_chi2; }; 00036 double trackerRedChi2() const { 00037 if (m_tracker_numHits > 5) return m_tracker_chi2 / double(m_tracker_numHits - 5); 00038 else return -1.; 00039 }; 00040 00041 bool contains_TIDTEC() const { return m_contains_TIDTEC; }; 00042 00043 const std::vector<DetId> chamberIds() const { return m_chamberIds; }; 00044 00045 MuonChamberResidual *chamberResidual(DetId chamberId, int type) { 00046 if (type == MuonChamberResidual::kDT13) { 00047 if (m_dt13.find(chamberId) == m_dt13.end()) return NULL; 00048 return m_dt13[chamberId]; 00049 } 00050 else if (type == MuonChamberResidual::kDT2) { 00051 if (m_dt2.find(chamberId) == m_dt2.end()) return NULL; 00052 return m_dt2[chamberId]; 00053 } 00054 else if (type == MuonChamberResidual::kCSC) { 00055 if (m_csc.find(chamberId) == m_csc.end()) return NULL; 00056 return m_csc[chamberId]; 00057 } 00058 else return NULL; 00059 }; 00060 00061 private: 00062 TrajectoryStateCombiner m_tsoscomb; 00063 00064 int m_tracker_numHits; 00065 double m_tracker_chi2; 00066 bool m_contains_TIDTEC; 00067 00068 std::vector<DetId> m_chamberIds; 00069 std::map<DetId,MuonChamberResidual*> m_dt13, m_dt2, m_csc; 00070 }; 00071 00072 #endif // Alignment_MuonAlignmentAlgorithms_MuonResidualsFromTrack_H