Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-10-06 02:54:06

0001 #ifndef L1T_OmtfP1_AlgoMuon_H
0002 #define L1T_OmtfP1_AlgoMuon_H
0003 
0004 #include "L1Trigger/L1TMuonOverlapPhase1/interface/AlgoMuonBase.h"
0005 #include "L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/GoldenPatternBase.h"
0006 #include "L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/GoldenPatternResult.h"
0007 #include <ostream>
0008 
0009 class AlgoMuon : public AlgoMuonBase {
0010 public:
0011   AlgoMuon() : AlgoMuonBase() {}
0012 
0013   AlgoMuon(const GoldenPatternResult& gpResult, GoldenPatternBase* gp, unsigned int refHitNumber, int bx = 0)
0014       : AlgoMuonBase(gp->getConfig()),
0015         gpResult(gpResult),
0016         goldenPatern(gp),
0017         m_q(gpResult.getFiredLayerCnt()),  //initial value of quality, can be altered later
0018         m_bx(bx),
0019         m_rhitNumb(refHitNumber) {}
0020 
0021   GoldenPatternBase* getGoldenPatern() const { return goldenPatern; }
0022 
0023   ~AlgoMuon() override {}
0024 
0025   const GoldenPatternResult& getGpResult() const { return gpResult; }
0026 
0027   PdfValueType getDisc() const { return gpResult.getPdfSum(); }
0028   int getPhi() const { return gpResult.getPhi(); }
0029   int getEtaHw() const override { return gpResult.getEta(); }
0030   int getRefLayer() const { return gpResult.getRefLayer(); }
0031   unsigned int getFiredLayerBits() const { return gpResult.getFiredLayerBits(); }
0032   int getQ() const { return m_q; }
0033   int getBx() const { return m_bx; }
0034 
0035   int getPt() const {
0036     if (goldenPatern == nullptr)
0037       return -1;
0038     return goldenPatern->key().thePt;
0039   }
0040 
0041   int getCharge() const {
0042     if (goldenPatern == nullptr)
0043       return 0;
0044     return goldenPatern->key().theCharge;
0045   }
0046   int getPhiRHit() const { return gpResult.getRefHitPhi(); }
0047 
0048   unsigned int getPatternNumber() const {
0049     if (goldenPatern == nullptr)
0050       return 0;
0051     return goldenPatern->key().theNumber;
0052   }
0053 
0054   unsigned int getHwPatternNumber() const {
0055     if (goldenPatern == nullptr)
0056       return 0;
0057     return goldenPatern->key().getHwPatternNumber();
0058   }
0059 
0060   unsigned int getRefHitNumber() const { return m_rhitNumb; }
0061 
0062   void setQ(int q) { m_q = q; }
0063   void setEta(int eta) { gpResult.setEta(eta); }
0064 
0065   void setRefHitNumber(unsigned int aRefHitNum) { m_rhitNumb = aRefHitNum; }
0066 
0067   bool isValid() const override;
0068 
0069   unsigned int getFiredLayerCnt() const override { return gpResult.getFiredLayerCnt(); }
0070 
0071   double getPdfSum() const override { return gpResult.getPdfSum(); }
0072 
0073   const StubResult& getStubResult(unsigned int iLayer) const override { return gpResult.getStubResults().at(iLayer); }
0074 
0075   const StubResults& getStubResults() const override { return gpResult.getStubResults(); }
0076 
0077   const bool isKilled() const { return killed; }
0078 
0079   void kill() { killed = true; }
0080 
0081   bool operator<(const AlgoMuon& o) const;
0082 
0083   friend std::ostream& operator<<(std::ostream& out, const AlgoMuon& o);
0084 
0085 private:
0086   ///FIXME maybe the gpResult cannot be a reference or pointer, ad not a copy
0087   GoldenPatternResult gpResult;
0088 
0089   GoldenPatternBase* goldenPatern = nullptr;
0090 
0091   int m_q = -1;
0092   int m_bx = 0;
0093 
0094   unsigned int m_rhitNumb = 0;
0095 
0096   bool killed = false;
0097 
0098   unsigned int index = 0;
0099 };
0100 
0101 typedef std::shared_ptr<AlgoMuon> AlgoMuonPtr;
0102 typedef std::vector<AlgoMuonPtr> AlgoMuons;
0103 
0104 #endif  //L1T_OmtfP1_AlgoMuon_H