Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:31:03

0001 //-------------------------------------------------
0002 //
0003 /**  \class DTConfigTSPhi
0004  *
0005  *   Configurable parameters and constants 
0006  *   for Level-1 Muon DT Trigger - TS Phi
0007  *
0008  *
0009  *   \author C. Battilana
0010  *
0011  */
0012 //
0013 //--------------------------------------------------
0014 #ifndef DT_CONFIG_TSPHI_H
0015 #define DT_CONFIG_TSPHI_H
0016 
0017 //---------------
0018 // C++ Headers --
0019 //---------------
0020 
0021 //----------------------
0022 // Base Class Headers --
0023 //----------------------
0024 
0025 //------------------------------------
0026 // Collaborating Class Declarations --
0027 //------------------------------------
0028 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0029 #include "L1TriggerConfig/DTTPGConfig/interface/BitArray.h"
0030 #include "L1TriggerConfig/DTTPGConfig/interface/DTConfig.h"
0031 
0032 //              ---------------------
0033 //              -- Class Interface --
0034 //              ---------------------
0035 
0036 class DTConfigTSPhi : public DTConfig {
0037 public:
0038   //! Constant: maximum number of TSS in input to the TSM
0039   static const int NTSSTSM = 7;
0040 
0041   //! Constant: number of TSMD
0042   static const int NTSMD = 2;
0043 
0044   //! Constant: maximum number of TSS in input to a single TSMD
0045   static const int NTSSTSMD = 3;
0046 
0047   //! Constructor
0048   DTConfigTSPhi(const edm::ParameterSet& ps);
0049 
0050   //! Constructor
0051   DTConfigTSPhi(){};
0052 
0053   //! Constructor
0054   DTConfigTSPhi(bool debug, unsigned short int tss_buffer[7][31], int ntss, unsigned short int tsm_buffer[9]);
0055 
0056   //! Destructor
0057   ~DTConfigTSPhi() override;
0058 
0059   //! Return the debug flag
0060   inline bool debug() const { return m_debug; }
0061 
0062   //! Order of quality bits in TSS for sort1/2
0063   inline int TssMasking(int i) const { return (int)m_tssmsk[i]; }
0064 
0065   //! Enable Htrig checking in TSS for sort1/2
0066   inline bool TssHtrigEna(int i) const { return m_tsshte[i]; }
0067 
0068   //! Enable Htrig checking in TSS for carry
0069   inline bool TssHtrigEnaCarry() const { return m_tsshte[2]; }
0070 
0071   //! Enable Inner SL checking in TSS for sort1/2
0072   inline bool TssInOutEna(int i) const { return m_tssnoe[i]; }
0073 
0074   //! Enable Inner SL checking in TSS for carry
0075   inline bool TssInOutEnaCarry() const { return m_tssnoe[2]; }
0076 
0077   //! Enable Correlation checking in TSS for sort1/2
0078   inline bool TssCorrEna(int i) const { return m_tsscce[i]; }
0079 
0080   //! Enable Correlation checking in TSS for carry
0081   inline bool TssCorrEnaCarry() const { return m_tsscce[2]; }
0082 
0083   //! Order of quality bits in TSM for sort1/2
0084   inline int TsmMasking(int i) const { return (int)m_tsmmsk[i]; }
0085 
0086   //! Enable Htrig checking in TSM for sort1/2
0087   inline bool TsmHtrigEna(int i) const { return m_tsmhte[i]; }
0088 
0089   //! Enable Htrig checking in TSM for carry
0090   inline bool TsmHtrigEnaCarry() const { return m_tsmhte[2]; }
0091 
0092   //! Enable Inner SL checking in TSM for sort1/2
0093   inline bool TsmInOutEna(int i) const { return m_tsmnoe[i]; }
0094 
0095   //! Enable Inner SL checking in TSM for carry
0096   inline bool TsmInOutEnaCarry() const { return m_tsmnoe[2]; }
0097 
0098   //! Enable Correlation checking in TSM  for sort1/2
0099   inline bool TsmCorrEna(int i) const { return m_tsmcce[i]; }
0100 
0101   //! Enable Correlation checking in TSM  for carry
0102   inline bool TsmCorrEnaCarry() const { return m_tsmcce[2]; }
0103 
0104   //! Ghost 1 suppression option in TSS
0105   inline int TssGhost1Flag() const { return (int)m_tssgs1; }
0106 
0107   //! Ghost 2 suppression option in TSS
0108   inline int TssGhost2Flag() const { return (int)m_tssgs2; }
0109 
0110   //! Ghost 1 suppression option in TSM
0111   inline int TsmGhost1Flag() const { return (int)m_tsmgs1; }
0112 
0113   //! Ghost 2 suppression option in TSM
0114   inline int TsmGhost2Flag() const { return (int)m_tsmgs2; }
0115 
0116   //! Correlated ghost 1 suppression option in TSS
0117   inline bool TssGhost1Corr() const { return m_tsscgs1; }
0118 
0119   //! Correlated ghost 2 suppression option in TSS
0120   inline bool TssGhost2Corr() const { return m_tsscgs2; }
0121 
0122   //! Correlated ghost 1 suppression option in TSM
0123   inline bool TsmGhost1Corr() const { return m_tsmcgs1; }
0124 
0125   //! Correlated ghost 2 suppression option in TSM
0126   inline bool TsmGhost2Corr() const { return m_tsmcgs2; }
0127 
0128   //! Handling of second track (carry) in case of pile-up, in TSM
0129   inline int TsmGetCarryFlag() const { return (int)m_tsmhsp; }
0130 
0131   //! Enabled TRACOs in TS
0132   inline bool usedTraco(int i) const { return (bool)m_tstren.element(i - 1); }
0133 
0134   //! TSM status
0135   inline BitArray<8> TsmStatus() const { return m_tsmword; };
0136 
0137   // DBSM-doubleTSM
0138   //! Return the max nb. of TSSs in input to a single TSMD (called ONLY in back-up mode)
0139   int TSSinTSMD(int stat, int sect) const;
0140 
0141   // Set Methods
0142   //! Set debug flag
0143   inline void setDebug(bool debug) { m_debug = debug; }
0144 
0145   //! Order of quality bits in TSS for sort1/2
0146   void setTssMasking(unsigned short int tssmsk, int i) { m_tssmsk[i - 1] = tssmsk; }
0147 
0148   //! Enable Htrig checking in TSS for sort1/2
0149   inline void setTssHtrigEna(bool tsshte, int i) { m_tsshte[i - 1] = tsshte; }
0150 
0151   //! Enable Htrig checking in TSS for carry
0152   inline void setTssHtrigEnaCarry(bool tsshte) { m_tsshte[2] = tsshte; }
0153 
0154   //! Enable Inner SL checking in TSS for sort1/2
0155   inline void setTssInOutEna(bool tssnoe, int i) { m_tssnoe[i - 1] = tssnoe; }
0156 
0157   //! Enable Inner SL checking in TSS for carry
0158   inline void setTssInOutEnaCarry(bool tssnoe) { m_tssnoe[2] = tssnoe; }
0159 
0160   //! Enable Correlation checking in TSS for sort1/2
0161   inline void setTssCorrEna(bool tsscce, int i) { m_tsscce[i - 1] = tsscce; }
0162 
0163   //! Enable Correlation checking in TSS for
0164   inline void setTssCorrEnaCarry(bool tsscce) { m_tsscce[2] = tsscce; }
0165 
0166   //! Order of quality bits in TSM for sort1/2
0167   void setTsmMasking(unsigned short int tsmmsk, int i) { m_tsmmsk[i - 1] = tsmmsk; }
0168 
0169   //! Enable Htrig checking in TSM for sort1/2
0170   inline void setTsmHtrigEna(bool tsmhte, int i) { m_tsmhte[i - 1] = tsmhte; }
0171 
0172   //! Enable Htrig checking in TSM for carry
0173   inline void setTsmHtrigEnaCarry(bool tsmhte) { m_tsmhte[2] = tsmhte; }
0174 
0175   //! Enable Inner SL checking in TSM for sort1/2
0176   inline void setTsmInOutEna(bool tsmnoe, int i) { m_tsmnoe[i - 1] = tsmnoe; }
0177 
0178   //! Enable Inner SL checking in TSM for carry
0179   inline void setTsmInOutEnaCarry(bool tsmnoe) { m_tsmnoe[2] = tsmnoe; }
0180 
0181   //! Enable Correlation checking in TSM  for sort1/2
0182   inline void setTsmCorrEna(bool tsmcce, int i) { m_tsmcce[i - 1] = tsmcce; }
0183 
0184   //! Enable Correlation checking in TSM  for carry
0185   inline void setTsmCorrEnaCarry(bool tsmcce) { m_tsmcce[2] = tsmcce; }
0186 
0187   //! Ghost 1 suppression option in TSS
0188   inline void setTssGhost1Flag(unsigned short tssgs1) { m_tssgs1 = tssgs1; }
0189 
0190   //! Ghost 2 suppression option in TSS
0191   inline void setTssGhost2Flag(unsigned short tssgs2) { m_tssgs2 = tssgs2; }
0192 
0193   //! Ghost 1 suppression option in TSM
0194   inline void setTsmGhost1Flag(unsigned short tsmgs1) { m_tsmgs1 = tsmgs1; }
0195 
0196   //! Ghost 2 suppression option in TSM
0197   inline void setTsmGhost2Flag(unsigned short tsmgs2) { m_tsmgs2 = tsmgs2; }
0198 
0199   //! Correlated ghost 1 suppression option in TSS
0200   inline void setTssGhost1Corr(bool tsscgs1) { m_tsscgs1 = tsscgs1; }
0201 
0202   //! Correlated ghost 2 suppression option in TSS
0203   inline void setTssGhost2Corr(bool tsscgs2) { m_tsscgs2 = tsscgs2; }
0204 
0205   //! Correlated ghost 1 suppression option in TSM
0206   inline void setTsmGhost1Corr(bool tsmcgs1) { m_tsmcgs1 = tsmcgs1; }
0207 
0208   //! Correlated ghost 2 suppression option in TSM
0209   inline void setTsmGhost2Corr(bool tsmcgs2) { m_tsmcgs2 = tsmcgs2; }
0210 
0211   //! Handling of second track (carry) in case of pile-up, in TSM
0212   inline void setTsmCarryFlag(unsigned short tsmhsp) { m_tsmhsp = tsmhsp; }
0213 
0214   //! Enabled TRACOs in TS
0215   inline void setUsedTraco(int i, int val) { m_tstren.set(i, val); }
0216 
0217   //! TSM status
0218   inline void setTsmStatus(int i, int val) { m_tsmword.set(i, val); };
0219 
0220   //! Number of correctly configured TSS
0221   int nValidTSS() const;
0222 
0223   //! Number of correctly configured TSS
0224   int nValidTSM() const;
0225 
0226   //! Print the setup
0227   void print() const;
0228 
0229 private:
0230   //! Check mask correctness
0231   bool checkMask(unsigned short) const;
0232 
0233   //! Load pset values into class variables
0234   void setDefaults(const edm::ParameterSet& ps);
0235 
0236   bool m_debug;
0237 
0238   // TSS Parameters
0239   unsigned short int m_tssmsk[2];  // [0]=1st [1]=2nd
0240   bool m_tsshte[3];                // [0]=1st [1]=2nd [2]=carry
0241   bool m_tssnoe[3];                // [0]=1st [1]=2nd [2]=carry
0242   bool m_tsscce[3];                // [0]=1st [1]=2nd [2]=carry
0243   unsigned short int m_tssgs1;
0244   unsigned short int m_tssgs2;
0245   bool m_tsscgs1;
0246   bool m_tsscgs2;
0247 
0248   //TSM Parameters
0249   unsigned short int m_tsmmsk[2];  // [0]=1st [1]=2nd
0250   bool m_tsmhte[3];                // [0]=1st [1]=2nd [2]=carry
0251   bool m_tsmnoe[3];                // [0]=1st [1]=2nd [2]=carry
0252   bool m_tsmcce[3];                // [0]=1st [1]=2nd [2]=carry
0253   unsigned short int m_tsmgs1;
0254   unsigned short int m_tsmgs2;
0255   bool m_tsmcgs1;
0256   bool m_tsmcgs2;
0257   unsigned short int m_tsmhsp;
0258 
0259   BitArray<24> m_tstren;  // Enabled TRACOs
0260   BitArray<8> m_tsmword;  // TSM backup mode word
0261   //unsigned short int m_ntsstsmd;        // nb tss to one of the tsmd (only if back-up mode)
0262 
0263   short int m_ntss;
0264   short int m_ntsm;
0265 };
0266 
0267 #endif