CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/DataFormats/RecoCandidate/interface/RecoCandidate.h

Go to the documentation of this file.
00001 #ifndef RecoCandidate_RecoCandidate_h
00002 #define RecoCandidate_RecoCandidate_h
00003 
00012 #include "DataFormats/Candidate/interface/LeafCandidate.h"
00013 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00014 #include "DataFormats/GsfTrackReco/interface/GsfTrackFwd.h"
00015 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
00016 #include "DataFormats/CaloTowers/interface/CaloTowerCollection.h"
00017 #include "DataFormats/CaloTowers/interface/CaloTowerFwd.h"
00018 
00019 namespace reco {
00020 
00021   class RecoCandidate : public LeafCandidate {
00022   public:
00024     RecoCandidate() : LeafCandidate() { }
00026     RecoCandidate( Charge q, const LorentzVector & p4, const Point & vtx = Point( 0, 0, 0 ),
00027                    int pdgId = 0, int status = 0 ) : 
00028       LeafCandidate( q, p4, vtx, pdgId, status ) { }
00030     RecoCandidate( Charge q, const PolarLorentzVector & p4, const Point & vtx = Point( 0, 0, 0 ),
00031                    int pdgId = 0, int status = 0 ) : 
00032       LeafCandidate( q, p4, vtx, pdgId, status ) { }
00034     virtual ~RecoCandidate();
00036     virtual bool overlap( const Candidate & ) const = 0;
00038     virtual RecoCandidate * clone() const ;
00039 
00041     virtual reco::TrackRef track() const;
00043     virtual reco::TrackRef track( size_t ) const;
00045     virtual size_t numberOfTracks() const;
00047     virtual reco::GsfTrackRef gsfTrack() const;
00049     virtual reco::TrackRef standAloneMuon() const;
00051     virtual reco::TrackRef combinedMuon() const;
00053     virtual reco::SuperClusterRef superCluster() const;
00055     virtual CaloTowerRef caloTower() const;
00057     const Track * bestTrack() const;
00059     TrackBaseRef bestTrackRef() const;
00061     enum TrackType { noTrackType, recoTrackType, gsfTrackType };
00063     TrackType bestTrackType() const;
00064   protected:
00066     template<typename R>
00067     bool checkOverlap( const R & r1, const R & r2 ) const {
00068       return( ! r1.isNull() && ! r2.isNull() && r1 == r2 );
00069     }
00070 
00071   private:
00072     template<typename, typename, typename> friend struct component; 
00073   };
00074 
00076   struct StandAloneMuonTag { };
00078   struct CombinedMuonTag { };
00079 
00081   GET_DEFAULT_CANDIDATE_COMPONENT( RecoCandidate, TrackRef, track );
00083   GET_DEFAULT_CANDIDATE_MULTIPLECOMPONENTS( RecoCandidate, TrackRef, track, numberOfTracks );
00085   GET_DEFAULT_CANDIDATE_COMPONENT( RecoCandidate, GsfTrackRef, gsfTrack );
00087   GET_CANDIDATE_COMPONENT( RecoCandidate, TrackRef, standAloneMuon, StandAloneMuonTag );
00089   GET_CANDIDATE_COMPONENT( RecoCandidate, TrackRef, combinedMuon, CombinedMuonTag );
00091   GET_DEFAULT_CANDIDATE_COMPONENT( RecoCandidate, SuperClusterRef, superCluster );
00093   GET_DEFAULT_CANDIDATE_COMPONENT( RecoCandidate, CaloTowerRef, caloTower );
00095   GET_DEFAULT_CANDIDATE_COMPONENT( RecoCandidate, const Track *, bestTrack );
00097   GET_DEFAULT_CANDIDATE_COMPONENT( RecoCandidate, RecoCandidate::TrackType, bestTrackType );
00098   
00099 }
00100 
00101 #endif