CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1TMuonGlobalParamsHelper.h
Go to the documentation of this file.
1 
11 #ifndef L1TMuonGlobalParamsHelper_h
12 #define L1TMuonGlobalParamsHelper_h
13 
14 #include <memory>
15 #include <iostream>
16 #include <vector>
17 
18 //this is temp hack to avoid ALCA/DB signoff requirement for now:
20 
22 
23 public:
24  enum {absIsoCheckMem=0,
47  };
48 
49  // string parameters indices
50  enum spIdx {fname=0};
51 
52  // unsigned parameters indices
54 
55  // double parameters indices
56  enum dpIdx {maxdr=0, maxdrEtaFine=1};
57 
58  // input enable indices
59  enum linkNr {CALOLINK1=8, EMTFPLINK1=36, OMTFPLINK1=42, BMTFLINK1=48, OMTFNLINK1=60, EMTFNLINK1=66}; // link numbers start at 0
60 
64 
65  // FW version
66  unsigned fwVersion() const { return pnodes_[FWVERSION].uparams_.size() > FWVERSION_IDX ? pnodes_[FWVERSION].uparams_[FWVERSION_IDX] : 0; }
67  void setFwVersion(unsigned fwVersion);
68 
69  // Input disables
70  std::bitset<72> inputsToDisable() const { return inputFlags(INPUTS_TO_DISABLE); };
71  std::bitset<28> caloInputsToDisable() const { return caloInputFlags(INPUTS_TO_DISABLE); };
72  std::bitset<12> bmtfInputsToDisable() const { return tfInputFlags(INPUTS_TO_DISABLE, BMTFINPUTS); };
73  std::bitset<12> omtfInputsToDisable() const { return tfInputFlags(INPUTS_TO_DISABLE, OMTFINPUTS); };
74  std::bitset<12> emtfInputsToDisable() const { return tfInputFlags(INPUTS_TO_DISABLE, EMTFINPUTS); };
75  std::bitset<6> omtfpInputsToDisable() const { return eomtfInputFlags(INPUTS_TO_DISABLE, 0, OMTFINPUTS); };
76  std::bitset<6> omtfnInputsToDisable() const { return eomtfInputFlags(INPUTS_TO_DISABLE, 6, OMTFINPUTS); };
77  std::bitset<6> emtfpInputsToDisable() const { return eomtfInputFlags(INPUTS_TO_DISABLE, 0, EMTFINPUTS); };
78  std::bitset<6> emtfnInputsToDisable() const { return eomtfInputFlags(INPUTS_TO_DISABLE, 6, EMTFINPUTS); };
79  void setInputsToDisable(const std::bitset<72> &inputsToDisable) { setInputFlags(INPUTS_TO_DISABLE, inputsToDisable); };
80  void setCaloInputsToDisable(const std::bitset<28> &disables) { setCaloInputFlags(INPUTS_TO_DISABLE, disables); };
81  void setBmtfInputsToDisable(const std::bitset<12> &disables) { setTfInputFlags(INPUTS_TO_DISABLE, BMTFINPUTS, disables); };
82  void setOmtfpInputsToDisable(const std::bitset<6> &disables) { setEOmtfInputFlags(INPUTS_TO_DISABLE, 0, OMTFINPUTS, disables); };
83  void setOmtfnInputsToDisable(const std::bitset<6> &disables) { setEOmtfInputFlags(INPUTS_TO_DISABLE, 6, OMTFINPUTS, disables); };
84  void setEmtfpInputsToDisable(const std::bitset<6> &disables) { setEOmtfInputFlags(INPUTS_TO_DISABLE, 0, EMTFINPUTS, disables); };
85  void setEmtfnInputsToDisable(const std::bitset<6> &disables) { setEOmtfInputFlags(INPUTS_TO_DISABLE, 6, EMTFINPUTS, disables); };
86 
87  // masked inputs
88  std::bitset<72> maskedInputs() const { return inputFlags(MASKED_INPUTS); };
89  std::bitset<28> maskedCaloInputs() const { return caloInputFlags(MASKED_INPUTS); };
90  std::bitset<12> maskedBmtfInputs() const { return tfInputFlags(MASKED_INPUTS, BMTFINPUTS); };
91  std::bitset<12> maskedOmtfInputs() const { return tfInputFlags(MASKED_INPUTS, OMTFINPUTS); };
92  std::bitset<12> maskedEmtfInputs() const { return tfInputFlags(MASKED_INPUTS, EMTFINPUTS); };
93  std::bitset<6> maskedOmtfpInputs() const { return eomtfInputFlags(MASKED_INPUTS, 0, OMTFINPUTS); };
94  std::bitset<6> maskedOmtfnInputs() const { return eomtfInputFlags(MASKED_INPUTS, 6, OMTFINPUTS); };
95  std::bitset<6> maskedEmtfpInputs() const { return eomtfInputFlags(MASKED_INPUTS, 0, EMTFINPUTS); };
96  std::bitset<6> maskedEmtfnInputs() const { return eomtfInputFlags(MASKED_INPUTS, 6, EMTFINPUTS); };
97  void setMaskedInputs(const std::bitset<72> &masked) { setInputFlags(MASKED_INPUTS, masked); };
98  void setMaskedCaloInputs(const std::bitset<28> &masked) { setCaloInputFlags(MASKED_INPUTS, masked); };
99  void setMaskedBmtfInputs(const std::bitset<12> &masked) { setTfInputFlags(MASKED_INPUTS, BMTFINPUTS, masked); };
100  void setMaskedOmtfpInputs(const std::bitset<6> &masked) { setEOmtfInputFlags(MASKED_INPUTS, 0, OMTFINPUTS, masked); };
101  void setMaskedOmtfnInputs(const std::bitset<6> &masked) { setEOmtfInputFlags(MASKED_INPUTS, 6, OMTFINPUTS, masked); };
102  void setMaskedEmtfpInputs(const std::bitset<6> &masked) { setEOmtfInputFlags(MASKED_INPUTS, 0, EMTFINPUTS, masked); };
103  void setMaskedEmtfnInputs(const std::bitset<6> &masked) { setEOmtfInputFlags(MASKED_INPUTS, 6, EMTFINPUTS, masked); };
104 
105  // LUTs
124  l1t::LUT* sortRankLUT() { return &pnodes_[sortRank].LUT_; }
125  void setAbsIsoCheckMemLUT (const l1t::LUT & lut) { pnodes_[absIsoCheckMem].type_ = "LUT"; pnodes_[absIsoCheckMem].LUT_ = lut; }
126  void setRelIsoCheckMemLUT (const l1t::LUT & lut) { pnodes_[relIsoCheckMem].type_ = "LUT"; pnodes_[relIsoCheckMem].LUT_ = lut; }
127  void setIdxSelMemPhiLUT (const l1t::LUT & lut) { pnodes_[idxSelMemPhi].type_ = "LUT"; pnodes_[idxSelMemPhi].LUT_ = lut; }
128  void setIdxSelMemEtaLUT (const l1t::LUT & lut) { pnodes_[idxSelMemEta].type_ = "LUT"; pnodes_[idxSelMemEta].LUT_ = lut; }
133  void setBOPosMatchQualLUT (const l1t::LUT & lut) { pnodes_[bOPosMatchQual].type_ = "LUT"; pnodes_[bOPosMatchQual].LUT_ = lut; }
134  void setBONegMatchQualLUT (const l1t::LUT & lut) { pnodes_[bONegMatchQual].type_ = "LUT"; pnodes_[bONegMatchQual].LUT_ = lut; }
135  void setFOPosMatchQualLUT (const l1t::LUT & lut) { pnodes_[fOPosMatchQual].type_ = "LUT"; pnodes_[fOPosMatchQual].LUT_ = lut; }
136  void setFONegMatchQualLUT (const l1t::LUT & lut) { pnodes_[fONegMatchQual].type_ = "LUT"; pnodes_[fONegMatchQual].LUT_ = lut; }
143  void setSortRankLUT (const l1t::LUT & lut) { pnodes_[sortRank].type_ = "LUT"; pnodes_[sortRank].LUT_ = lut; }
144 
145  // LUT paths
148  std::string idxSelMemPhiLUTPath() const { return pnodes_[idxSelMemPhi].sparams_.size() > spIdx::fname ? pnodes_[idxSelMemPhi].sparams_[spIdx::fname] : ""; }
149  std::string idxSelMemEtaLUTPath() const { return pnodes_[idxSelMemEta].sparams_.size() > spIdx::fname ? pnodes_[idxSelMemEta].sparams_[spIdx::fname] : ""; }
164  std::string sortRankLUTPath() const { return pnodes_[sortRank].sparams_.size() > spIdx::fname ? pnodes_[sortRank].sparams_[spIdx::fname] : ""; }
165  void setAbsIsoCheckMemLUTPath (std::string path) { pnodes_[absIsoCheckMem].sparams_.push_back(path); }
166  void setRelIsoCheckMemLUTPath (std::string path) { pnodes_[relIsoCheckMem].sparams_.push_back(path); }
167  void setIdxSelMemPhiLUTPath (std::string path) { pnodes_[idxSelMemPhi].sparams_.push_back(path); }
168  void setIdxSelMemEtaLUTPath (std::string path) { pnodes_[idxSelMemEta].sparams_.push_back(path); }
173  void setBOPosMatchQualLUTPath (std::string path) { pnodes_[bOPosMatchQual].sparams_.push_back(path); }
174  void setBONegMatchQualLUTPath (std::string path) { pnodes_[bONegMatchQual].sparams_.push_back(path); }
175  void setFOPosMatchQualLUTPath (std::string path) { pnodes_[fOPosMatchQual].sparams_.push_back(path); }
176  void setFONegMatchQualLUTPath (std::string path) { pnodes_[fONegMatchQual].sparams_.push_back(path); }
183  void setSortRankLUTPath (std::string path) { pnodes_[sortRank].sparams_.push_back(path); }
184 
185  // Cancel out LUT max dR
186  double fwdPosSingleMatchQualLUTMaxDR() const { return pnodes_[fwdPosSingleMatchQual].dparams_.size() > dpIdx::maxdr ? pnodes_[fwdPosSingleMatchQual].dparams_[dpIdx::maxdr] : 0.; }
187  double fwdNegSingleMatchQualLUTMaxDR() const { return pnodes_[fwdNegSingleMatchQual].dparams_.size() > dpIdx::maxdr ? pnodes_[fwdNegSingleMatchQual].dparams_[dpIdx::maxdr] : 0.; }
188  double ovlPosSingleMatchQualLUTMaxDR() const { return pnodes_[ovlPosSingleMatchQual].dparams_.size() > dpIdx::maxdr ? pnodes_[ovlPosSingleMatchQual].dparams_[dpIdx::maxdr] : 0.; }
189  double ovlNegSingleMatchQualLUTMaxDR() const { return pnodes_[ovlNegSingleMatchQual].dparams_.size() > dpIdx::maxdr ? pnodes_[ovlNegSingleMatchQual].dparams_[dpIdx::maxdr] : 0.; }
190  double bOPosMatchQualLUTMaxDR() const { return pnodes_[bOPosMatchQual].dparams_.size() > dpIdx::maxdr ? pnodes_[bOPosMatchQual].dparams_[dpIdx::maxdr] : 0.; }
191  double bONegMatchQualLUTMaxDR() const { return pnodes_[bONegMatchQual].dparams_.size() > dpIdx::maxdr ? pnodes_[bONegMatchQual].dparams_[dpIdx::maxdr] : 0.; }
192  double bOPosMatchQualLUTMaxDREtaFine() const { return pnodes_[bOPosMatchQual].dparams_.size() > dpIdx::maxdrEtaFine ? pnodes_[bOPosMatchQual].dparams_[dpIdx::maxdrEtaFine] : 0.; }
193  double bONegMatchQualLUTMaxDREtaFine() const { return pnodes_[bONegMatchQual].dparams_.size() > dpIdx::maxdrEtaFine ? pnodes_[bONegMatchQual].dparams_[dpIdx::maxdrEtaFine] : 0.; }
194  double fOPosMatchQualLUTMaxDR() const { return pnodes_[fOPosMatchQual].dparams_.size() > dpIdx::maxdr ? pnodes_[fOPosMatchQual].dparams_[dpIdx::maxdr] : 0.; }
195  double fONegMatchQualLUTMaxDR() const { return pnodes_[fONegMatchQual].dparams_.size() > dpIdx::maxdr ? pnodes_[fONegMatchQual].dparams_[dpIdx::maxdr] : 0.; }
196  void setFwdPosSingleMatchQualLUTMaxDR (double maxDR) { pnodes_[fwdPosSingleMatchQual].dparams_.push_back(maxDR); }
197  void setFwdNegSingleMatchQualLUTMaxDR (double maxDR) { pnodes_[fwdNegSingleMatchQual].dparams_.push_back(maxDR); }
198  void setOvlPosSingleMatchQualLUTMaxDR (double maxDR) { pnodes_[ovlPosSingleMatchQual].dparams_.push_back(maxDR); }
199  void setOvlNegSingleMatchQualLUTMaxDR (double maxDR) { pnodes_[ovlNegSingleMatchQual].dparams_.push_back(maxDR); }
200  void setBOPosMatchQualLUTMaxDR (double maxDR, double maxDREtaFine) { pnodes_[bOPosMatchQual].dparams_.push_back(maxDR); pnodes_[bOPosMatchQual].dparams_.push_back(maxDREtaFine); }
201  void setBONegMatchQualLUTMaxDR (double maxDR, double maxDREtaFine) { pnodes_[bONegMatchQual].dparams_.push_back(maxDR); pnodes_[bONegMatchQual].dparams_.push_back(maxDREtaFine); }
202  void setFOPosMatchQualLUTMaxDR (double maxDR) { pnodes_[fOPosMatchQual].dparams_.push_back(maxDR); }
203  void setFONegMatchQualLUTMaxDR (double maxDR) { pnodes_[fONegMatchQual].dparams_.push_back(maxDR); }
204 
205  // Sort rank LUT factors for pT and quality
206  unsigned sortRankLUTPtFactor() const { return pnodes_[sortRank].uparams_.size() > upIdx::ptFactor ? pnodes_[sortRank].uparams_[upIdx::ptFactor] : 0; }
207  unsigned sortRankLUTQualFactor() const { return pnodes_[sortRank].uparams_.size() > upIdx::qualFactor ? pnodes_[sortRank].uparams_[upIdx::qualFactor] : 0; }
208  void setSortRankLUTFactors(unsigned ptFactor, unsigned qualFactor) { pnodes_[sortRank].uparams_.push_back(ptFactor); pnodes_[sortRank].uparams_.push_back(qualFactor); }
209 
210  // print parameters to stream:
211  void print(std::ostream&) const;
212  friend std::ostream& operator<<(std::ostream& o, const L1TMuonGlobalParamsHelper & p) { p.print(o); return o; }
213 
214 private:
215 
216  // Input disables
217  std::bitset<72> inputFlags(const int &nodeIdx) const;
218  std::bitset<28> caloInputFlags(const int &nodeIdx) const;
219  std::bitset<12> tfInputFlags(const int &nodeIdx, const int &tfIdx) const;
220  std::bitset<6> eomtfInputFlags(const int &nodeIdx, const size_t &startIdx, const int &tfIdx) const;
221  void setInputFlags(const int &nodeIdx, const std::bitset<72> &flags);
222  void setCaloInputFlags(const int &nodeIdx, const std::bitset<28> &flags);
223  void setTfInputFlags(const int &nodeIdx, const int &tfIdx, const std::bitset<12> &flags);
224  void setEOmtfInputFlags(const int &nodeIdx, const size_t &startIdx, const int &tfIdx, const std::bitset<6> &flags);
225 
226 };
227 #endif
void setFwdPosSingleMatchQualLUTMaxDR(double maxDR)
void setInputFlags(const int &nodeIdx, const std::bitset< 72 > &flags)
void setMaskedCaloInputs(const std::bitset< 28 > &masked)
void setBOPosMatchQualLUTPath(std::string path)
void setIdxSelMemEtaLUT(const l1t::LUT &lut)
void setOvlNegSingleMatchQualLUTMaxDR(double maxDR)
std::bitset< 12 > emtfInputsToDisable() const
std::string oEtaExtrapolationLUTPath() const
void setOPhiExtrapolationLUT(const l1t::LUT &lut)
void setBEtaExtrapolationLUT(const l1t::LUT &lut)
void setFwdPosSingleMatchQualLUT(const l1t::LUT &lut)
std::string fEtaExtrapolationLUTPath() const
void setBmtfInputsToDisable(const std::bitset< 12 > &disables)
std::bitset< 12 > bmtfInputsToDisable() const
std::string fONegMatchQualLUTPath() const
std::string idxSelMemPhiLUTPath() const
void setBONegMatchQualLUTPath(std::string path)
void setFEtaExtrapolationLUT(const l1t::LUT &lut)
std::bitset< 6 > emtfpInputsToDisable() const
std::string relIsoCheckMemLUTPath() const
std::bitset< 28 > caloInputsToDisable() const
void setIdxSelMemEtaLUTPath(std::string path)
std::bitset< 6 > eomtfInputFlags(const int &nodeIdx, const size_t &startIdx, const int &tfIdx) const
void setTfInputFlags(const int &nodeIdx, const int &tfIdx, const std::bitset< 12 > &flags)
void setFPhiExtrapolationLUT(const l1t::LUT &lut)
std::bitset< 6 > maskedOmtfpInputs() const
std::string fwdPosSingleMatchQualLUTPath() const
std::bitset< 6 > emtfnInputsToDisable() const
void setFONegMatchQualLUTPath(std::string path)
std::vector< Variable::Flags > flags
Definition: MVATrainer.cc:135
void setOmtfpInputsToDisable(const std::bitset< 6 > &disables)
void setOEtaExtrapolationLUT(const l1t::LUT &lut)
void setSortRankLUTFactors(unsigned ptFactor, unsigned qualFactor)
void setAbsIsoCheckMemLUTPath(std::string path)
void setFONegMatchQualLUTMaxDR(double maxDR)
void setMaskedInputs(const std::bitset< 72 > &masked)
void setEOmtfInputFlags(const int &nodeIdx, const size_t &startIdx, const int &tfIdx, const std::bitset< 6 > &flags)
void setIdxSelMemPhiLUT(const l1t::LUT &lut)
void setFwdNegSingleMatchQualLUTMaxDR(double maxDR)
std::bitset< 72 > inputsToDisable() const
std::string absIsoCheckMemLUTPath() const
std::string oPhiExtrapolationLUTPath() const
void setBPhiExtrapolationLUT(const l1t::LUT &lut)
std::string ovlPosSingleMatchQualLUTPath() const
std::string bPhiExtrapolationLUTPath() const
void setOPhiExtrapolationLUTPath(std::string path)
void setFwdPosSingleMatchQualLUTPath(std::string path)
void setBONegMatchQualLUTMaxDR(double maxDR, double maxDREtaFine)
void setFOPosMatchQualLUT(const l1t::LUT &lut)
void setBONegMatchQualLUT(const l1t::LUT &lut)
std::bitset< 6 > maskedEmtfpInputs() const
void setInputsToDisable(const std::bitset< 72 > &inputsToDisable)
void setSortRankLUTPath(std::string path)
void setFOPosMatchQualLUTPath(std::string path)
void setMaskedOmtfpInputs(const std::bitset< 6 > &masked)
void setRelIsoCheckMemLUTPath(std::string path)
void setCaloInputFlags(const int &nodeIdx, const std::bitset< 28 > &flags)
std::string bONegMatchQualLUTPath() const
void setFONegMatchQualLUT(const l1t::LUT &lut)
std::bitset< 12 > maskedOmtfInputs() const
void setOvlNegSingleMatchQualLUTPath(std::string path)
void setRelIsoCheckMemLUT(const l1t::LUT &lut)
std::bitset< 6 > omtfnInputsToDisable() const
std::bitset< 12 > maskedEmtfInputs() const
void setFPhiExtrapolationLUTPath(std::string path)
void setEmtfnInputsToDisable(const std::bitset< 6 > &disables)
std::string fOPosMatchQualLUTPath() const
std::string bEtaExtrapolationLUTPath() const
void setFEtaExtrapolationLUTPath(std::string path)
void setAbsIsoCheckMemLUT(const l1t::LUT &lut)
void setOvlPosSingleMatchQualLUT(const l1t::LUT &lut)
void setFwVersion(unsigned fwVersion)
tuple lut
Definition: lumiPlot.py:244
void setBEtaExtrapolationLUTPath(std::string path)
std::bitset< 6 > maskedEmtfnInputs() const
void setBOPosMatchQualLUT(const l1t::LUT &lut)
void setFwdNegSingleMatchQualLUTPath(std::string path)
void setFOPosMatchQualLUTMaxDR(double maxDR)
std::string fPhiExtrapolationLUTPath() const
void setMaskedOmtfnInputs(const std::bitset< 6 > &masked)
void setOEtaExtrapolationLUTPath(std::string path)
void setCaloInputsToDisable(const std::bitset< 28 > &disables)
std::bitset< 72 > maskedInputs() const
friend std::ostream & operator<<(std::ostream &o, const L1TMuonGlobalParamsHelper &p)
Definition: LUT.h:29
std::bitset< 12 > tfInputFlags(const int &nodeIdx, const int &tfIdx) const
void setBOPosMatchQualLUTMaxDR(double maxDR, double maxDREtaFine)
void setIdxSelMemPhiLUTPath(std::string path)
void setMaskedBmtfInputs(const std::bitset< 12 > &masked)
void print(std::ostream &) const
void setFwdNegSingleMatchQualLUT(const l1t::LUT &lut)
std::bitset< 6 > maskedOmtfnInputs() const
string fname
main script
void setSortRankLUT(const l1t::LUT &lut)
std::string idxSelMemEtaLUTPath() const
std::string bOPosMatchQualLUTPath() const
std::bitset< 28 > caloInputFlags(const int &nodeIdx) const
std::bitset< 12 > omtfInputsToDisable() const
void setMaskedEmtfpInputs(const std::bitset< 6 > &masked)
void setOvlPosSingleMatchQualLUTMaxDR(double maxDR)
void setMaskedEmtfnInputs(const std::bitset< 6 > &masked)
void setEmtfpInputsToDisable(const std::bitset< 6 > &disables)
void setBPhiExtrapolationLUTPath(std::string path)
void setOmtfnInputsToDisable(const std::bitset< 6 > &disables)
std::bitset< 12 > maskedBmtfInputs() const
std::bitset< 28 > maskedCaloInputs() const
void setOvlPosSingleMatchQualLUTPath(std::string path)
std::string fwdNegSingleMatchQualLUTPath() const
std::string ovlNegSingleMatchQualLUTPath() const
void setOvlNegSingleMatchQualLUT(const l1t::LUT &lut)
std::bitset< 72 > inputFlags(const int &nodeIdx) const
std::bitset< 6 > omtfpInputsToDisable() const