00001 #ifndef MuonReco_Muon_h
00002 #define MuonReco_Muon_h
00003
00016 #include "DataFormats/RecoCandidate/interface/RecoCandidate.h"
00017 #include "DataFormats/MuonReco/interface/MuonChamberMatch.h"
00018 #include "DataFormats/MuonReco/interface/MuonIsolation.h"
00019 #include "DataFormats/MuonReco/interface/MuonEnergy.h"
00020 #include "DataFormats/MuonReco/interface/MuonTime.h"
00021 #include "DataFormats/MuonReco/interface/MuonQuality.h"
00022
00023 namespace reco {
00024
00025 class Muon : public RecoCandidate {
00026 public:
00027 Muon();
00029 Muon( Charge, const LorentzVector &, const Point & = Point( 0, 0, 0 ) );
00031 Muon * clone() const;
00032
00037 using reco::RecoCandidate::track;
00038 virtual TrackRef innerTrack() const { return innerTrack_; }
00039 virtual TrackRef track() const { return innerTrack(); }
00041 virtual TrackRef outerTrack() const { return outerTrack_; }
00042 virtual TrackRef standAloneMuon() const { return outerTrack(); }
00044 virtual TrackRef globalTrack() const { return globalTrack_; }
00045 virtual TrackRef combinedMuon() const { return globalTrack(); }
00047 virtual void setInnerTrack( const TrackRef & t );
00048 virtual void setTrack( const TrackRef & t );
00050 virtual void setOuterTrack( const TrackRef & t );
00051 virtual void setStandAlone( const TrackRef & t );
00053 virtual void setGlobalTrack( const TrackRef & t );
00054 virtual void setCombined( const TrackRef & t );
00055
00060 bool isEnergyValid() const { return energyValid_; }
00062 MuonEnergy calEnergy() const { return calEnergy_; }
00064 void setCalEnergy( const MuonEnergy& calEnergy ) { calEnergy_ = calEnergy; energyValid_ = true; }
00065
00070 bool isQualityValid() const { return qualityValid_; }
00072 MuonQuality combinedQuality() const { return combinedQuality_; }
00074 void setCombinedQuality( const MuonQuality& combinedQuality ) { combinedQuality_ = combinedQuality; qualityValid_ = true; }
00075
00080 bool isTimeValid() const { return (time_.nDof>0); }
00082 MuonTime time() const { return time_; }
00084 void setTime( const MuonTime& time ) { time_ = time; }
00085
00089 bool isMatchesValid() const { return matchesValid_; }
00091 std::vector<MuonChamberMatch>& matches() { return muMatches_;}
00092 const std::vector<MuonChamberMatch>& matches() const { return muMatches_; }
00094 void setMatches( const std::vector<MuonChamberMatch>& matches ) { muMatches_ = matches; matchesValid_ = true; }
00095
00101 float caloCompatibility() const { return caloCompatibility_; }
00102 void setCaloCompatibility(float input){ caloCompatibility_ = input; }
00103 bool isCaloCompatibilityValid() const { return caloCompatibility_>=0; }
00104
00109 const MuonIsolation& isolationR03() const { return isolationR03_; }
00110 const MuonIsolation& isolationR05() const { return isolationR05_; }
00111 void setIsolation( const MuonIsolation& isoR03, const MuonIsolation& isoR05 );
00112 bool isIsolationValid() const { return isolationValid_; }
00113
00115 enum ArbitrationType { NoArbitration, SegmentArbitration, SegmentAndTrackArbitration, SegmentAndTrackArbitrationCleaned };
00116
00121 int numberOfChambers() const { return muMatches_.size(); }
00123 int numberOfMatches( ArbitrationType type = SegmentAndTrackArbitration ) const;
00126 int numberOfMatchedStations( ArbitrationType type = SegmentAndTrackArbitration ) const;
00130 unsigned int stationMask( ArbitrationType type = SegmentAndTrackArbitration ) const;
00134 unsigned int stationGapMaskDistance( float distanceCut = 10. ) const;
00136 unsigned int stationGapMaskPull( float sigmaCut = 3. ) const;
00137
00140 static const unsigned int GlobalMuon = 1<<1;
00141 static const unsigned int TrackerMuon = 1<<2;
00142 static const unsigned int StandAloneMuon = 1<<3;
00143 static const unsigned int CaloMuon = 1<<4;
00144 void setType( unsigned int type ) { type_ = type; }
00145 unsigned int type() const { return type_; }
00146
00147 bool isMuon() const { return true; }
00148 bool isGlobalMuon() const { return type_ & GlobalMuon; }
00149 bool isTrackerMuon() const { return type_ & TrackerMuon; }
00150 bool isStandAloneMuon() const { return type_ & StandAloneMuon; }
00151 bool isCaloMuon() const { return type_ & CaloMuon; }
00152
00153 private:
00155 virtual bool overlap( const Candidate & ) const;
00157 TrackRef innerTrack_;
00159 TrackRef outerTrack_;
00161 TrackRef globalTrack_;
00163 MuonEnergy calEnergy_;
00165 MuonQuality combinedQuality_;
00167 std::vector<MuonChamberMatch> muMatches_;
00169 MuonTime time_;
00170
00171 bool energyValid_;
00172 bool matchesValid_;
00173 bool isolationValid_;
00174 bool qualityValid_;
00176 float caloCompatibility_;
00178 MuonIsolation isolationR03_;
00179 MuonIsolation isolationR05_;
00181 unsigned int type_;
00182
00183
00184
00186 const std::vector<const MuonChamberMatch*> chambers( int station, int muonSubdetId ) const;
00188 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> pair( const std::vector<const MuonChamberMatch*> &,
00189 ArbitrationType type = SegmentAndTrackArbitration ) const;
00190
00191 public:
00193 int numberOfSegments( int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration ) const;
00196 float dX ( int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration ) const;
00197 float dY ( int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration ) const;
00198 float dDxDz ( int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration ) const;
00199 float dDyDz ( int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration ) const;
00200 float pullX ( int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration, bool includeSegmentError = true ) const;
00201 float pullY ( int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration, bool includeSegmentError = true ) const;
00202 float pullDxDz ( int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration, bool includeSegmentError = true ) const;
00203 float pullDyDz ( int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration, bool includeSegmentError = true ) const;
00206 float segmentX ( int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration ) const;
00207 float segmentY ( int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration ) const;
00208 float segmentDxDz ( int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration ) const;
00209 float segmentDyDz ( int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration ) const;
00210 float segmentXErr ( int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration ) const;
00211 float segmentYErr ( int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration ) const;
00212 float segmentDxDzErr ( int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration ) const;
00213 float segmentDyDzErr ( int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration ) const;
00218 float trackEdgeX ( int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration ) const;
00219 float trackEdgeY ( int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration ) const;
00220 float trackX ( int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration ) const;
00221 float trackY ( int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration ) const;
00222 float trackDxDz ( int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration ) const;
00223 float trackDyDz ( int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration ) const;
00224 float trackXErr ( int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration ) const;
00225 float trackYErr ( int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration ) const;
00226 float trackDxDzErr ( int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration ) const;
00227 float trackDyDzErr ( int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration ) const;
00228 float trackDist ( int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration ) const;
00229 float trackDistErr ( int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration ) const;
00230
00231 float t0(int n=0) {
00232 int i = 0;
00233 for( std::vector<MuonChamberMatch>::const_iterator chamber = muMatches_.begin();
00234 chamber != muMatches_.end(); ++chamber )
00235 for ( std::vector<reco::MuonSegmentMatch>::const_iterator segment = chamber->segmentMatches.begin();
00236 segment != chamber->segmentMatches.end(); ++segment )
00237 {
00238 if (i==n) return segment->t0;
00239 ++i;
00240 }
00241 return 0;
00242 }
00243 };
00244
00245 }
00246
00247
00248 #endif