Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-05-15 04:21:50

0001 #ifndef L1T_OmtfP1_AlgoMuon_H
0002 #define L1T_OmtfP1_AlgoMuon_H
0003 
0004 #include "L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/GoldenPatternBase.h"
0005 #include "L1Trigger/L1TMuonOverlapPhase1/interface/Omtf/GoldenPatternResult.h"
0006 #include <ostream>
0007 
0008 class AlgoMuon {
0009 public:
0010   AlgoMuon() {}
0011 
0012   AlgoMuon(const GoldenPatternResult& gpResult, GoldenPatternBase* gp, unsigned int refHitNumber, int bx = 0)
0013       : gpResultConstr(gpResult),
0014         goldenPaternConstr(gp),
0015         //m_q(gpResult.getFiredLayerCnt()),  //initial value of quality, can be altered later
0016         m_bx(bx),
0017         m_rhitNumb(refHitNumber) {}
0018 
0019   GoldenPatternBase* getGoldenPatern() const { return goldenPaternConstr; }
0020 
0021   ~AlgoMuon() {}
0022 
0023   //vertex-constrained golden pattern result
0024   const GoldenPatternResult& getGpResultConstr() const { return gpResultConstr; }
0025 
0026   const GoldenPatternResult& getGpResultUnconstr() const { return gpResultUnconstr; }
0027 
0028   void setGpResultUnconstr(const GoldenPatternResult& gpResultUnconstr) { this->gpResultUnconstr = gpResultUnconstr; }
0029 
0030   void setEta(int eta) { gpResultConstr.setEta(eta); }
0031 
0032   int getEtaHw() const { return gpResultConstr.getEta(); }
0033 
0034   unsigned int getRefHitNumber() const { return m_rhitNumb; }
0035 
0036   void setRefHitNumber(unsigned int aRefHitNum) { m_rhitNumb = aRefHitNum; }
0037 
0038   int getRefLayer() const { return gpResultConstr.getRefLayer(); }
0039 
0040   int getBx() const { return m_bx; }
0041 
0042   //hardware pt
0043   int getPtConstr() const { return goldenPaternConstr == nullptr ? 0 : goldenPaternConstr->key().thePt; }
0044 
0045   //hardware upt, in the phase1 the upt scale unit is 1 GeV, while for the pt the unit is 0.5GeV
0046   int getPtUnconstr() const {
0047     return goldenPaternUnconstr == nullptr ? 0 : (goldenPaternUnconstr->key().thePt - 1) / 2 + 1;
0048   }
0049 
0050   int getChargeConstr() const { return goldenPaternConstr == nullptr ? -1 : goldenPaternConstr->key().theCharge; }
0051 
0052   int getPhiRHit() const { return gpResultConstr.getRefHitPhi(); }
0053 
0054   unsigned int getPatternNum() const;
0055 
0056   unsigned int getPatternNumConstr() const {
0057     return goldenPaternConstr == nullptr ? 0 : goldenPaternConstr->key().theNumber;
0058   }
0059 
0060   unsigned int getPatternNumUnconstr() const {
0061     return goldenPaternUnconstr == nullptr ? 0 : goldenPaternUnconstr->key().theNumber;
0062   }
0063 
0064   unsigned int getHwPatternNumConstr() const {
0065     return goldenPaternConstr == nullptr ? 0 : goldenPaternConstr->key().getHwPatternNumber();
0066   }
0067 
0068   unsigned int getHwPatternNumUnconstr() const {
0069     return goldenPaternUnconstr == nullptr ? 0 : goldenPaternUnconstr->key().getHwPatternNumber();
0070   }
0071 
0072   bool isValid() const {
0073     return (getPtConstr() > 0) || (getPtUnconstr() > 0);  //PtConstr == 0 denotes empty candidate
0074   }
0075 
0076   double getPdfSumConstr() const { return gpResultConstr.getPdfSum(); }
0077 
0078   double getPdfSum() const {
0079     return (gpResultUnconstr.getPdfSumUnconstr() > gpResultConstr.getPdfSum() ? gpResultUnconstr.getPdfSumUnconstr()
0080                                                                               : gpResultConstr.getPdfSum());
0081   }
0082 
0083   PdfValueType getDisc() const {
0084     return (gpResultUnconstr.getPdfSumUnconstr() > gpResultConstr.getPdfSum() ? gpResultUnconstr.getPdfSumUnconstr()
0085                                                                               : gpResultConstr.getPdfSum());
0086   }
0087 
0088   int getPhi() const {
0089     return (gpResultUnconstr.getPdfSumUnconstr() > gpResultConstr.getPdfSum() ? gpResultUnconstr.getPhi()
0090                                                                               : gpResultConstr.getPhi());
0091   }
0092 
0093   unsigned int getFiredLayerCnt() const {
0094     return (gpResultUnconstr.getPdfSumUnconstr() > gpResultConstr.getPdfSum() ? gpResultUnconstr.getFiredLayerCnt()
0095                                                                               : gpResultConstr.getFiredLayerCnt());
0096   }
0097 
0098   unsigned int getFiredLayerCntConstr() const { return gpResultConstr.getFiredLayerCnt(); }
0099 
0100   unsigned int getFiredLayerBits() const {
0101     return (gpResultUnconstr.getPdfSumUnconstr() > gpResultConstr.getPdfSum() ? gpResultUnconstr.getFiredLayerBits()
0102                                                                               : gpResultConstr.getFiredLayerBits());
0103   }
0104 
0105   int getQ() const {
0106     return (gpResultUnconstr.getPdfSumUnconstr() > gpResultConstr.getPdfSum() ? gpResultUnconstr.getFiredLayerCnt()
0107                                                                               : gpResultConstr.getFiredLayerCnt());
0108   }
0109 
0110   const StubResult& getStubResult(unsigned int iLayer) const { return gpResultConstr.getStubResults().at(iLayer); }
0111 
0112   const StubResults& getStubResultsConstr() const { return gpResultConstr.getStubResults(); }
0113 
0114   const bool isKilled() const { return killed; }
0115 
0116   void kill() { killed = true; }
0117 
0118   friend std::ostream& operator<<(std::ostream& out, const AlgoMuon& o);
0119 
0120   std::vector<std::shared_ptr<AlgoMuon>>& getKilledMuons() { return killedMuons; }
0121 
0122   GoldenPatternBase* getGoldenPaternUnconstr() const { return goldenPaternUnconstr; }
0123 
0124   void setGoldenPaternUnconstr(GoldenPatternBase* goldenPaternUnconstr) {
0125     this->goldenPaternUnconstr = goldenPaternUnconstr;
0126   }
0127 
0128   int getChargeNNConstr() const { return chargeNNConstr; }
0129 
0130   void setChargeNNConstr(int chargeNn = 0) { chargeNNConstr = chargeNn; }
0131 
0132   int getPtNNConstr() const { return ptNNConstr; }
0133 
0134   void setPtNNConstr(int ptNn = 0) { ptNNConstr = ptNn; }
0135 
0136   int getChargeNNUnconstr() const { return chargeNNUnconstr; }
0137 
0138   void setChargeNNUnconstr(int chargeNnUnconstr = 0) { chargeNNUnconstr = chargeNnUnconstr; }
0139 
0140   int getPtNNUnconstr() const { return ptNNUnconstr; }
0141 
0142   void setPtNNUnconstr(int ptNnUnconstr = 0) { ptNNUnconstr = ptNnUnconstr; }
0143 
0144 private:
0145   ///FIXME maybe the gpResult cannot be a reference or pointer, ad not a copy
0146   GoldenPatternResult gpResultConstr;
0147 
0148   //GoldenPatternResult without vertex constraint (unconstrained pt)
0149   //TODO make it pointer
0150   GoldenPatternResult gpResultUnconstr;
0151 
0152   GoldenPatternBase* goldenPaternConstr = nullptr;
0153 
0154   //GoldenPattern without vertex constraint (unconstrained pt)
0155   GoldenPatternBase* goldenPaternUnconstr = nullptr;
0156 
0157   //int m_q = -1;
0158   int m_bx = 0;
0159 
0160   unsigned int m_rhitNumb = 0;
0161 
0162   bool killed = false;
0163 
0164   unsigned int index = 0;
0165 
0166   std::vector<std::shared_ptr<AlgoMuon>> killedMuons;
0167 
0168   int ptNNConstr = 0;
0169   int chargeNNConstr = 0;
0170 
0171   int ptNNUnconstr = 0;
0172   int chargeNNUnconstr = 0;
0173 };
0174 
0175 typedef std::shared_ptr<AlgoMuon> AlgoMuonPtr;
0176 typedef std::vector<AlgoMuonPtr> AlgoMuons;
0177 
0178 #endif  //L1T_OmtfP1_AlgoMuon_H