Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-08-27 01:27:33

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 edm::Ref<l1t::RegionalMuonCandBxCollection>& 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 edm::Ref<l1t::RegionalMuonCandBxCollection>& p) { muRef_ = p; }
0045     void setHwIsoSum(int isoSum) { hwIsoSum_ = isoSum; }
0046     void setHwIsoSumAp(int isoSum) { hwIsoSumAp_ = isoSum; }
0047 
0048     // For HLT
0049     const double phZ0() const { return Phase2L1GMT::LSBGTz0 * hwZ0(); }
0050     const double phD0() const { return Phase2L1GMT::LSBGTd0 * hwD0(); }
0051     const double phPt() const { return Phase2L1GMT::LSBpt * hwPt(); }
0052     const double phEta() const { return Phase2L1GMT::LSBeta * hwEta(); }
0053     const double phPhi() const { return Phase2L1GMT::LSBphi * hwPhi(); }
0054     const int phCharge() const { return pow(-1, hwCharge()); }
0055 
0056     const std::array<uint64_t, 2> word() const { return word_; }
0057     void setWord(std::array<uint64_t, 2> word) { word_ = word; }
0058     void print() const;
0059     const MuonStubRefVector stubs() const { return stubs_; }
0060     void addStub(const MuonStubRef& stub) { stubs_.push_back(stub); }
0061 
0062     bool operator<(const TrackerMuon& other) const { return (hwPt() < other.hwPt()); }
0063     bool operator>(const TrackerMuon& other) const { return (hwPt() > other.hwPt()); }
0064 
0065   private:
0066     // used for the Naive producer
0067     edm::Ptr<L1TTTrackType> trkPtr_;
0068     bool hwCharge_;
0069     int hwZ0_;
0070     int hwD0_;
0071     uint hwBeta_;
0072     // The tracker muon is encoded in 96 bits as a 2-element array of uint64_t
0073     std::array<uint64_t, 2> word_ = {{0, 0}};
0074     //Store the eneryg sum for isolation
0075     int hwIsoSum_;
0076     //Store the eneryg sum for isolation with ap_type
0077     int hwIsoSumAp_;
0078 
0079     edm::Ref<l1t::RegionalMuonCandBxCollection> muRef_;
0080     MuonStubRefVector stubs_;
0081   };
0082 }  // namespace l1t
0083 
0084 #endif