Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:39:23

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 "FWCore/MessageLogger/interface/MessageLogger.h"
0012 #include "DataFormats/L1TMuonPhase2/interface/Constants.h"
0013 
0014 namespace l1t {
0015 
0016   class TrackerMuon;
0017 
0018   typedef std::vector<TrackerMuon> TrackerMuonCollection;
0019   typedef edm::Ref<TrackerMuonCollection> TrackerMuonRef;
0020   typedef std::vector<edm::Ref<TrackerMuonCollection> > TrackerMuonRefVector;
0021 
0022   class TrackerMuon : public L1Candidate {
0023   public:
0024     typedef TTTrack<Ref_Phase2TrackerDigi_> L1TTTrackType;
0025     typedef std::vector<L1TTTrackType> L1TTTrackCollection;
0026 
0027     TrackerMuon();
0028 
0029     TrackerMuon(
0030         const edm::Ptr<L1TTTrackType>& trk, bool charge, uint pt, int eta, int phi, int z0, int d0, uint quality);
0031 
0032     ~TrackerMuon() override;
0033 
0034     const edm::Ptr<L1TTTrackType>& trkPtr() const { return trkPtr_; }
0035     const std::vector<l1t::RegionalMuonCandRef>& muonRef() const { return muRef_; }
0036 
0037     const bool hwCharge() const { return hwCharge_; }
0038     const int hwZ0() const { return hwZ0_; }
0039     const int hwD0() const { return hwD0_; }
0040     const int hwIsoSum() const { return hwIsoSum_; }
0041     const int hwIsoSumAp() const { return hwIsoSumAp_; }
0042     const uint hwBeta() const { return hwBeta_; }
0043     void setBeta(uint beta) { hwBeta_ = beta; }
0044     void setMuonRef(const std::vector<l1t::RegionalMuonCandRef>& p) { muRef_ = p; }
0045     void setHwIsoSum(int isoSum) { hwIsoSum_ = isoSum; }
0046     void setHwIsoSumAp(int isoSum) { hwIsoSumAp_ = isoSum; }
0047 
0048     // For GT, returning ap_ type
0049     const Phase2L1GMT::valid_gt_t apValid() const { return Phase2L1GMT::valid_gt_t(hwPt() > 0); };
0050     const Phase2L1GMT::pt_gt_t apPt() const { return Phase2L1GMT::pt_gt_t(hwPt()); };
0051     const Phase2L1GMT::phi_gt_t apPhi() const { return Phase2L1GMT::phi_gt_t(hwPhi()); };
0052     const Phase2L1GMT::eta_gt_t apEta() const { return Phase2L1GMT::eta_gt_t(hwEta()); };
0053     const Phase2L1GMT::z0_gt_t apZ0() const { return Phase2L1GMT::z0_gt_t(hwZ0()); };
0054     const Phase2L1GMT::d0_gt_t apD0() const { return Phase2L1GMT::d0_gt_t(hwD0()); };
0055     const Phase2L1GMT::q_gt_t apCharge() const { return Phase2L1GMT::q_gt_t(hwCharge()); };
0056     const Phase2L1GMT::qual_gt_t apQual() const { return Phase2L1GMT::qual_gt_t(hwQual()); };
0057     const Phase2L1GMT::iso_gt_t apIso() const { return Phase2L1GMT::iso_gt_t(hwIso()); };
0058     const Phase2L1GMT::beta_gt_t apBeta() const { return Phase2L1GMT::beta_gt_t(hwBeta()); };
0059 
0060     // For HLT
0061     const double phZ0() const { return Phase2L1GMT::LSBGTz0 * hwZ0(); }
0062     const double phD0() const { return Phase2L1GMT::LSBGTd0 * hwD0(); }
0063     const double phPt() const { return Phase2L1GMT::LSBpt * hwPt(); }
0064     const double phEta() const { return Phase2L1GMT::LSBeta * hwEta(); }
0065     const double phPhi() const { return Phase2L1GMT::LSBphi * hwPhi(); }
0066     const int phCharge() const { return pow(-1, hwCharge()); }
0067 
0068     const std::array<uint64_t, 2> word() const { return word_; }
0069     void setWord(std::array<uint64_t, 2> word) { word_ = word; }
0070     void print() const;
0071     const MuonStubRefVector stubs() const { return stubs_; }
0072     void addStub(const MuonStubRef& stub) { stubs_.push_back(stub); }
0073 
0074     bool operator<(const TrackerMuon& other) const { return (hwPt() < other.hwPt()); }
0075     bool operator>(const TrackerMuon& other) const { return (hwPt() > other.hwPt()); }
0076 
0077   private:
0078     // used for the Naive producer
0079     edm::Ptr<L1TTTrackType> trkPtr_;
0080     bool hwCharge_;
0081     int hwZ0_;
0082     int hwD0_;
0083     uint hwBeta_;
0084     // The tracker muon is encoded in 96 bits as a 2-element array of uint64_t
0085     std::array<uint64_t, 2> word_ = {{0, 0}};
0086     //Store the eneryg sum for isolation
0087     int hwIsoSum_;
0088     //Store the eneryg sum for isolation with ap_type
0089     int hwIsoSumAp_;
0090 
0091     std::vector<l1t::RegionalMuonCandRef> muRef_;
0092     MuonStubRefVector stubs_;
0093   };
0094 }  // namespace l1t
0095 
0096 #endif