File indexing completed on 2024-07-16 02:42:43
0001 #ifndef DataFormatsL1TMuonPhase2_TrackerMuon_h
0002 #define DataFormatsL1TMuonPhase2_TrackerMuon_h
0003
0004 #include "DataFormats/L1Trigger/interface/L1Candidate.h"
0005 #include "DataFormats/Common/interface/Ref.h"
0006 #include "DataFormats/Common/interface/Ptr.h"
0007 #include "DataFormats/L1TrackTrigger/interface/TTTypes.h"
0008 #include "DataFormats/L1TMuon/interface/RegionalMuonCand.h"
0009 #include "DataFormats/L1TMuon/interface/RegionalMuonCandFwd.h"
0010 #include "DataFormats/L1TMuonPhase2/interface/MuonStub.h"
0011 #include "DataFormats/L1TMuonPhase2/interface/SAMuon.h"
0012 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0013 #include "DataFormats/L1TMuonPhase2/interface/Constants.h"
0014
0015 namespace l1t {
0016
0017 class TrackerMuon;
0018
0019 typedef std::vector<TrackerMuon> TrackerMuonCollection;
0020 typedef edm::Ref<TrackerMuonCollection> TrackerMuonRef;
0021 typedef std::vector<edm::Ref<TrackerMuonCollection> > TrackerMuonRefVector;
0022
0023 class TrackerMuon : public L1Candidate {
0024 public:
0025 typedef TTTrack<Ref_Phase2TrackerDigi_> L1TTTrackType;
0026 typedef std::vector<L1TTTrackType> L1TTTrackCollection;
0027
0028 TrackerMuon();
0029
0030 TrackerMuon(
0031 const edm::Ptr<L1TTTrackType>& trk, bool charge, uint pt, int eta, int phi, int z0, int d0, uint quality);
0032
0033 ~TrackerMuon() override;
0034
0035 const edm::Ptr<L1TTTrackType>& trkPtr() const { return trkPtr_; }
0036 const SAMuonRefVector muonRef() const { return muRef_; }
0037
0038 const bool hwCharge() const { return hwCharge_; }
0039 const int hwZ0() const { return hwZ0_; }
0040 const int hwD0() const { return hwD0_; }
0041 const int hwIsoSum() const { return hwIsoSum_; }
0042 const int hwIsoSumAp() const { return hwIsoSumAp_; }
0043 const uint hwBeta() const { return hwBeta_; }
0044 void setBeta(uint beta) { hwBeta_ = beta; }
0045 void setMuonRef(const l1t::SAMuonRefVector& p) { muRef_ = p; }
0046 void setHwIsoSum(int isoSum) { hwIsoSum_ = isoSum; }
0047 void setHwIsoSumAp(int isoSum) { hwIsoSumAp_ = isoSum; }
0048
0049
0050 const Phase2L1GMT::valid_gt_t apValid() const { return Phase2L1GMT::valid_gt_t(hwPt() > 0); };
0051 const Phase2L1GMT::pt_gt_t apPt() const { return Phase2L1GMT::pt_gt_t(hwPt()); };
0052 const Phase2L1GMT::phi_gt_t apPhi() const { return Phase2L1GMT::phi_gt_t(hwPhi()); };
0053 const Phase2L1GMT::eta_gt_t apEta() const { return Phase2L1GMT::eta_gt_t(hwEta()); };
0054 const Phase2L1GMT::z0_gt_t apZ0() const { return Phase2L1GMT::z0_gt_t(hwZ0()); };
0055 const Phase2L1GMT::d0_gt_t apD0() const { return Phase2L1GMT::d0_gt_t(hwD0()); };
0056 const Phase2L1GMT::q_gt_t apCharge() const { return Phase2L1GMT::q_gt_t(hwCharge()); };
0057 const Phase2L1GMT::qual_gt_t apQualFlags() const { return Phase2L1GMT::qual_gt_t(hwQual()); };
0058 const Phase2L1GMT::iso_gt_t apIso() const { return Phase2L1GMT::iso_gt_t(hwIsoSumAp()); };
0059 const Phase2L1GMT::beta_gt_t apBeta() const { return Phase2L1GMT::beta_gt_t(hwBeta()); };
0060
0061
0062 const double phZ0() const { return Phase2L1GMT::LSBGTz0 * hwZ0(); }
0063 const double phD0() const { return Phase2L1GMT::LSBGTd0 * hwD0(); }
0064 const double phPt() const { return Phase2L1GMT::LSBpt * hwPt(); }
0065 const double phEta() const { return Phase2L1GMT::LSBeta * hwEta(); }
0066 const double phPhi() const { return Phase2L1GMT::LSBphi * hwPhi(); }
0067 const double phIso() const { return Phase2L1GMT::LSBGTiso * hwIsoSumAp(); }
0068 const int phCharge() const { return pow(-1, hwCharge()); }
0069 const uint numberOfMatches() const { return numberOfMatches_; }
0070 const uint numberOfStations() const { return stubs_.size(); }
0071 const std::array<uint64_t, 2> word() const { return word_; }
0072 void setWord(std::array<uint64_t, 2> word) { word_ = word; }
0073 void print() const;
0074 const MuonStubRefVector stubs() const { return stubs_; }
0075 void addStub(const MuonStubRef& stub) { stubs_.push_back(stub); }
0076 void setNumberOfMatches(uint matches) { numberOfMatches_ = matches; }
0077 bool operator<(const TrackerMuon& other) const { return (hwPt() < other.hwPt()); }
0078 bool operator>(const TrackerMuon& other) const { return (hwPt() > other.hwPt()); }
0079
0080 private:
0081
0082 edm::Ptr<L1TTTrackType> trkPtr_;
0083 bool hwCharge_;
0084 int hwZ0_;
0085 int hwD0_;
0086 uint hwBeta_;
0087
0088 std::array<uint64_t, 2> word_ = {{0, 0}};
0089
0090 int hwIsoSum_;
0091
0092 int hwIsoSumAp_;
0093 uint numberOfMatches_;
0094 uint numberOfStations_;
0095 SAMuonRefVector muRef_;
0096 MuonStubRefVector stubs_;
0097 };
0098 }
0099
0100 #endif