Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:05:07

0001 #ifndef RecoCandidate_RecoCandidate_h
0002 #define RecoCandidate_RecoCandidate_h
0003 /** \class reco::RecoCandidate
0004  *
0005  * base class for all Reco Candidates
0006  *
0007  * \author Luca Lista, INFN
0008  *
0009  *
0010  */
0011 #include "DataFormats/Candidate/interface/LeafCandidate.h"
0012 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0013 #include "DataFormats/GsfTrackReco/interface/GsfTrackFwd.h"
0014 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
0015 #include "DataFormats/CaloTowers/interface/CaloTowerCollection.h"
0016 #include "DataFormats/CaloTowers/interface/CaloTowerDefs.h"
0017 
0018 namespace reco {
0019 
0020   class RecoCandidate : public LeafCandidate {
0021   public:
0022     /// default constructor
0023     RecoCandidate() : LeafCandidate() {}
0024     /// constructor from values
0025     template <typename P4>
0026     RecoCandidate(Charge q, const P4 &p4, const Point &vtx = Point(0, 0, 0), int pdgId = 0, int status = 0)
0027         : LeafCandidate(q, p4, vtx, pdgId, status) {}
0028     /// destructor
0029     ~RecoCandidate() override;
0030     /// check overlap with another candidate
0031     bool overlap(const Candidate &) const override = 0;
0032     /// returns a clone of the Candidate object
0033     RecoCandidate *clone() const override;
0034 
0035     /// reference to a Track
0036     virtual reco::TrackRef track() const;
0037     /// reference to one of multiple Tracks
0038     virtual reco::TrackRef track(size_t) const;
0039     /// number of multiple Tracks
0040     virtual size_t numberOfTracks() const;
0041     /// reference to a GsfTrack
0042     virtual reco::GsfTrackRef gsfTrack() const;
0043     /// reference to a stand-alone muon Track
0044     virtual reco::TrackRef standAloneMuon() const;
0045     /// reference to a stand-alone muon Track
0046     virtual reco::TrackRef combinedMuon() const;
0047     /// reference to a SuperCluster
0048     virtual reco::SuperClusterRef superCluster() const;
0049     /// reference to a CaloTower
0050     virtual CaloTowerRef caloTower() const;
0051     /// best track pointer
0052     const Track *bestTrack() const override;
0053     /// best track RefToBase
0054     virtual TrackBaseRef bestTrackRef() const;
0055     /// track type
0056     enum TrackType { noTrackType, recoTrackType, gsfTrackType };
0057     ///track type
0058     virtual TrackType bestTrackType() const;
0059     /// uncertainty on dz
0060     float dzError() const override;
0061     /// uncertainty on dxy
0062     float dxyError() const override;
0063 
0064   protected:
0065     /// check if two components overlap
0066     template <typename R>
0067     bool checkOverlap(const R &r1, const R &r2) const {
0068       return (!r1.isNull() && !r2.isNull() && r1 == r2);
0069     }
0070 
0071   private:
0072     template <typename, typename, typename>
0073     friend struct component;
0074   };
0075 
0076   /// stand alone muon component tag
0077   struct StandAloneMuonTag {};
0078   /// conbined muon component tag
0079   struct CombinedMuonTag {};
0080 
0081   /// get default Track component
0082   GET_DEFAULT_CANDIDATE_COMPONENT(RecoCandidate, TrackRef, track);
0083   /// get multuple tracks
0084   GET_DEFAULT_CANDIDATE_MULTIPLECOMPONENTS(RecoCandidate, TrackRef, track, numberOfTracks);
0085   /// get default GsfTrack component
0086   GET_DEFAULT_CANDIDATE_COMPONENT(RecoCandidate, GsfTrackRef, gsfTrack);
0087   /// get stand-alone muon Track component
0088   GET_CANDIDATE_COMPONENT(RecoCandidate, TrackRef, standAloneMuon, StandAloneMuonTag);
0089   /// get combined muon Track component
0090   GET_CANDIDATE_COMPONENT(RecoCandidate, TrackRef, combinedMuon, CombinedMuonTag);
0091   /// get default SuperCluster component
0092   GET_DEFAULT_CANDIDATE_COMPONENT(RecoCandidate, SuperClusterRef, superCluster);
0093   /// get default CaloTower component
0094   GET_DEFAULT_CANDIDATE_COMPONENT(RecoCandidate, CaloTowerRef, caloTower);
0095   /// get default CaloTower component
0096   GET_DEFAULT_CANDIDATE_COMPONENT(RecoCandidate, const Track *, bestTrack);
0097   /// get default CaloTower component
0098   GET_DEFAULT_CANDIDATE_COMPONENT(RecoCandidate, RecoCandidate::TrackType, bestTrackType);
0099 
0100 }  // namespace reco
0101 
0102 #endif