CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2/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     template<typename P4>
00027     RecoCandidate( Charge q, const P4 & p4, const Point & vtx = Point( 0, 0, 0 ),
00028                    int pdgId = 0, int status = 0 ) : 
00029       LeafCandidate( q, p4, vtx, pdgId, status ) { }
00031     virtual ~RecoCandidate();
00033     virtual bool overlap( const Candidate & ) const = 0;
00035     virtual RecoCandidate * clone() const ;
00036 
00038     virtual reco::TrackRef track() const;
00040     virtual reco::TrackRef track( size_t ) const;
00042     virtual size_t numberOfTracks() const;
00044     virtual reco::GsfTrackRef gsfTrack() const;
00046     virtual reco::TrackRef standAloneMuon() const;
00048     virtual reco::TrackRef combinedMuon() const;
00050     virtual reco::SuperClusterRef superCluster() const;
00052     virtual CaloTowerRef caloTower() const;
00054     virtual const Track * bestTrack() const;
00056     virtual TrackBaseRef bestTrackRef() const;
00058     enum TrackType { noTrackType, recoTrackType, gsfTrackType };
00060     virtual TrackType bestTrackType() const;
00061   protected:
00063     template<typename R>
00064     bool checkOverlap( const R & r1, const R & r2 ) const {
00065       return( ! r1.isNull() && ! r2.isNull() && r1 == r2 );
00066     }
00067 
00068   private:
00069     template<typename, typename, typename> friend struct component; 
00070   };
00071 
00073   struct StandAloneMuonTag { };
00075   struct CombinedMuonTag { };
00076 
00078   GET_DEFAULT_CANDIDATE_COMPONENT( RecoCandidate, TrackRef, track );
00080   GET_DEFAULT_CANDIDATE_MULTIPLECOMPONENTS( RecoCandidate, TrackRef, track, numberOfTracks );
00082   GET_DEFAULT_CANDIDATE_COMPONENT( RecoCandidate, GsfTrackRef, gsfTrack );
00084   GET_CANDIDATE_COMPONENT( RecoCandidate, TrackRef, standAloneMuon, StandAloneMuonTag );
00086   GET_CANDIDATE_COMPONENT( RecoCandidate, TrackRef, combinedMuon, CombinedMuonTag );
00088   GET_DEFAULT_CANDIDATE_COMPONENT( RecoCandidate, SuperClusterRef, superCluster );
00090   GET_DEFAULT_CANDIDATE_COMPONENT( RecoCandidate, CaloTowerRef, caloTower );
00092   GET_DEFAULT_CANDIDATE_COMPONENT( RecoCandidate, const Track *, bestTrack );
00094   GET_DEFAULT_CANDIDATE_COMPONENT( RecoCandidate, RecoCandidate::TrackType, bestTrackType );
00095   
00096 }
00097 
00098 #endif