File indexing completed on 2024-07-16 02:42:43
0001 #ifndef DataFormatsL1TMuonPhase2_SAMuon_h
0002 #define DataFormatsL1TMuonPhase2_SAMuon_h
0003
0004 #include "DataFormats/L1Trigger/interface/L1Candidate.h"
0005 #include "DataFormats/L1Trigger/interface/Muon.h"
0006 #include "DataFormats/Common/interface/Ref.h"
0007 #include "DataFormats/Common/interface/Ptr.h"
0008 #include "DataFormats/L1TMuon/interface/RegionalMuonCand.h"
0009 #include "DataFormats/L1TMuon/interface/RegionalMuonCandFwd.h"
0010 #include "DataFormats/L1TMuonPhase2/interface/Constants.h"
0011 #include "DataFormats/L1TMuonPhase2/interface/MuonStub.h"
0012
0013 namespace l1t {
0014
0015 class SAMuon;
0016
0017 typedef std::vector<SAMuon> SAMuonCollection;
0018 typedef edm::Ref<SAMuonCollection> SAMuonRef;
0019 typedef std::vector<edm::Ref<SAMuonCollection> > SAMuonRefVector;
0020
0021 class SAMuon : public L1Candidate {
0022 public:
0023 SAMuon();
0024
0025 SAMuon(const l1t::Muon& mu, bool charge, uint pt, int eta, int phi, int z0, int d0, uint quality);
0026
0027 ~SAMuon() override;
0028
0029 const bool hwCharge() const { return hwCharge_; }
0030 const int hwZ0() const { return hwZ0_; }
0031 const int hwD0() const { return hwD0_; }
0032 const uint hwBeta() const { return hwBeta_; }
0033 void setBeta(uint beta) { hwBeta_ = beta; }
0034 void setTF(tftype tf) { tf_ = tf; }
0035 unsigned int trackID() const { return trackID_; }
0036
0037 void setTrackID(unsigned int ID) { trackID_ = ID; }
0038
0039 const tftype tfType() const { return tf_; }
0040
0041 const Phase2L1GMT::valid_sa_t apValid() const { return Phase2L1GMT::valid_sa_t(hwPt() > 0); };
0042 const Phase2L1GMT::pt_sa_t apPt() const { return Phase2L1GMT::pt_sa_t(hwPt()); };
0043 const Phase2L1GMT::phi_sa_t apPhi() const { return Phase2L1GMT::phi_sa_t(hwPhi()); };
0044 const Phase2L1GMT::eta_sa_t apEta() const { return Phase2L1GMT::eta_sa_t(hwEta()); };
0045 const Phase2L1GMT::z0_sa_t apZ0() const { return Phase2L1GMT::z0_sa_t(hwZ0()); };
0046 const Phase2L1GMT::d0_sa_t apD0() const { return Phase2L1GMT::d0_sa_t(hwD0()); };
0047 const Phase2L1GMT::q_sa_t apCharge() const { return Phase2L1GMT::q_sa_t(hwCharge()); };
0048 const Phase2L1GMT::qual_sa_t apQualFlags() const { return Phase2L1GMT::qual_sa_t(hwQual()); };
0049
0050
0051 const double phZ0() const { return Phase2L1GMT::LSBSAz0 * hwZ0(); }
0052 const double phD0() const { return Phase2L1GMT::LSBSAd0 * hwD0(); }
0053 const double phPt() const { return Phase2L1GMT::LSBpt * hwPt(); }
0054 const double phEta() const { return Phase2L1GMT::LSBeta * hwEta(); }
0055 const double phPhi() const { return Phase2L1GMT::LSBphi * hwPhi(); }
0056 const int phCharge() const { return pow(-1, hwCharge()); }
0057
0058 const uint64_t word() const { return word_; }
0059 void setWord(uint64_t word) { word_ = word; }
0060 void print() const;
0061
0062 bool operator<(const SAMuon& other) const {
0063 if (hwPt() == other.hwPt())
0064 return (hwEta() < other.hwEta());
0065 else
0066 return (hwPt() < other.hwPt());
0067 }
0068 bool operator>(const SAMuon& other) const {
0069 if (hwPt() == other.hwPt())
0070 return (hwEta() > other.hwEta());
0071 else
0072 return (hwPt() > other.hwPt());
0073 }
0074
0075 void addStub(const MuonStubRef& stub) { stubs_.push_back(stub); }
0076 void setStubs(const MuonStubRefVector& stubs) { stubs_ = stubs; }
0077 const MuonStubRefVector stubs() const { return stubs_; }
0078
0079 private:
0080 bool hwCharge_;
0081 int hwZ0_;
0082 int hwD0_;
0083 uint hwBeta_;
0084 uint64_t word_;
0085 MuonStubRefVector stubs_;
0086 unsigned int trackID_;
0087 tftype tf_;
0088 };
0089 }
0090
0091 #endif