Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:22:01

0001 //-------------------------------------------------
0002 //
0003 /**  \class DTTracoTrigData
0004  *
0005  *   DTTracoChip Trigger Data
0006  *
0007  *
0008  *
0009  *   \author  C. Grandi
0010  */
0011 //
0012 //--------------------------------------------------
0013 #ifndef DT_TRACO_TRIG_DATA_H
0014 #define DT_TRACO_TRIG_DATA_H
0015 
0016 //------------------------------------
0017 // Collaborating Class Declarations --
0018 //------------------------------------
0019 #include "DataFormats/MuonDetId/interface/DTTracoId.h"
0020 #include "L1TriggerConfig/DTTPGConfig/interface/DTConfig.h"
0021 
0022 //----------------------
0023 // Base Class Headers --
0024 //----------------------
0025 #include "L1Trigger/DTUtilities/interface/DTTrigData.h"
0026 
0027 //---------------
0028 // C++ Headers --
0029 //---------------
0030 
0031 //              ---------------------
0032 //              -- Class Interface --
0033 //              ---------------------
0034 
0035 typedef unsigned char myint8;
0036 
0037 class DTTracoTrigData : public DTTrigData {
0038 public:
0039   // public methods
0040 
0041   //!  Constructor
0042   DTTracoTrigData() {}
0043 
0044   //!  Constructor
0045   DTTracoTrigData(DTTracoId, int);
0046 
0047   //!  Destructor
0048   ~DTTracoTrigData() override {}
0049 
0050   // Non-const methods
0051 
0052   //! Set the parent TRACO Identifier
0053   inline void setParent(DTTracoId tracoid) { _tracoid = tracoid; }
0054 
0055   //! Set trigger step
0056   inline void setStep(int step) { _step = step; }
0057 
0058   //! Set trigger preview parameters
0059   inline void setPV(int first, int code, int K, int ioflag) {
0060     _pvfirst = first;
0061     _pvcode = code;
0062     _pvKval = K;
0063     _pvIOflag = ioflag;
0064     /*
0065         cout<<"setPV called, stored:"<<
0066         "  first=" << first <<
0067         "  code=" << code <<
0068         "  K=" << K <<
0069         " ioflag=" << ioflag << endl;
0070     */
0071   }
0072 
0073   //! Set trigger preview correlation bit
0074   inline void setPVCorr(int ic) { _pvCorr = ic; }
0075 
0076   //! Set trigger code inner layer
0077   inline void setCodeIn(int code) { _codeIn = code; }
0078   //! Set trigger code outer layer
0079   inline void setCodeOut(int code) { _codeOut = code; }
0080 
0081   //! Set position of segment, inner layer
0082   inline void setPosIn(int pos) { _posIn = pos; }
0083 
0084   //! Set position of segment, outer layer
0085   inline void setPosOut(int pos) { _posOut = pos; }
0086 
0087   //! Set bti trigger equation of segment, inner layer
0088   inline void setEqIn(int eq) { _eqIn = eq; }
0089 
0090   //! Set bti trigger equation of segment, outer layer
0091   inline void setEqOut(int eq) { _eqOut = eq; }
0092 
0093   //! Set trigger K parameter
0094   inline void setK(int k) { _Kval = k; }
0095 
0096   //! Set trigger X parameter
0097   inline void setX(int x) { _Xval = x; }
0098 
0099   //! Set trigger angles
0100   inline void setAngles(int psi, int psir, int dpsir) {
0101     if (psi & 0x200)
0102       psi |= 0xFFFFFC00;
0103     if (psir & 0x800)
0104       psir |= 0xFFFFF000;
0105     if (dpsir & 0x200)
0106       dpsir |= 0xFFFFFC00;
0107 
0108     _psi = psi;
0109     _psiR = psir;
0110     _dPsiR = dpsir;
0111   }
0112 
0113   //! Reset all variables but preview
0114   void resetVar() {
0115     _codeIn = 0;
0116     _codeOut = 0;
0117     _posIn = 0;
0118     _posOut = 0;
0119     _eqIn = 0;
0120     _eqOut = 0;
0121     _Kval = 255;
0122     _Xval = 0;
0123     /*
0124     _psi = -DTConfig::RESOLPSI;
0125     _psiR = -DTConfig::RESOLPSIR/2;
0126     _dPsiR = -DTConfig::RESOLPSI;
0127     */
0128     // SV notazione complemento a due:
0129     _psi = 0x1FF;
0130     _psiR = 0xFFF;
0131     _dPsiR = 0x1FF;
0132   }
0133 
0134   //! Reset preview variables
0135   void resetPV() {
0136     _pvfirst = 0;
0137     _pvcode = 0;
0138     _pvKval = 9999;
0139     _pvCorr = 0;
0140     _pvIOflag = 0;
0141   }
0142 
0143   //! Clear
0144   void clear() {
0145     resetVar();
0146     resetPV();
0147   }
0148 
0149   //! Return chamber identifier
0150   DTChamberId ChamberId() const override { return _tracoid.ChamberId(); }
0151 
0152   //! print
0153   void print() const override;
0154 
0155   //! Return parent TRACO identifier
0156   inline DTTracoId parentId() const { return _tracoid; }
0157 
0158   //! Return parent TRACO number
0159   inline int tracoNumber() const { return _tracoid.traco(); }
0160 
0161   //! Return step
0162   inline int step() const { return _step; }
0163 
0164   //! Return trigger code
0165   inline int code() const { return _codeIn * 10 + _codeOut; }
0166 
0167   //! Return correlator output code (position of segments)
0168   inline int posMask() const { return _posOut * 1000 + _posIn; }
0169 
0170   //! Return the position of inner segment
0171   inline int posIn() const { return _posIn; }
0172 
0173   //! Return the position of outer segment
0174   inline int posOut() const { return _posOut; }
0175 
0176   //! Return bti trigger equation of inner segment
0177   inline int eqIn() const { return _eqIn; }
0178 
0179   //! Return bti trigger equation of outer segment
0180   inline int eqOut() const { return _eqOut; }
0181 
0182   //! Return non 0 if the track is a first track
0183   inline int isFirst() const { return _pvfirst; }
0184 
0185   //! Return the preview code
0186   inline int pvCode() const { return _pvcode; }
0187 
0188   //! Return the preview K
0189   inline int pvK() const { return _pvKval; }
0190 
0191   //! Return the preview correaltion bit
0192   inline int pvCorr() const { return _pvCorr; }
0193 
0194   //! Return the preview i/o bit
0195   inline int pvIO() const { return _pvIOflag; }
0196 
0197   //! Return trigger K parameter
0198   inline int K() const { return _Kval; }
0199 
0200   //! Return trigger X parameter
0201   inline int X() const { return _Xval; }
0202 
0203   //! Return trigger K parameter converted to angle
0204   int psi() const { return _psi; }
0205 
0206   //! Return trigger X parameter converted to angle
0207   int psiR() const { return _psiR; }
0208 
0209   //! Return DeltaPsiR
0210   int DeltaPsiR() const { return _dPsiR; }
0211 
0212   //! Return the trigger code in new format
0213   int qdec() const;
0214 
0215 private:
0216   // parent TRACO
0217   DTTracoId _tracoid;  // this is 4 bytes
0218 
0219   // step number
0220   myint8 _step;
0221 
0222   // inner segment position
0223   myint8 _posIn;
0224   // outer segment position
0225   myint8 _posOut;
0226   // inner segment bti trigger equation
0227   myint8 _eqIn;
0228   // outer segment bti trigger equation
0229   myint8 _eqOut;
0230 
0231   // inner segment code
0232   myint8 _codeIn;
0233   // outer segment code
0234   myint8 _codeOut;
0235 
0236   // preview first/second track
0237   myint8 _pvfirst;
0238 
0239   // preview code for TS
0240   myint8 _pvcode;
0241   // preview K variable for TS
0242   int _pvKval;
0243   // preview correlation bit
0244   myint8 _pvCorr;
0245   // preview io bit
0246   myint8 _pvIOflag;
0247 
0248   // K variable value
0249   int _Kval;
0250   // X variable value
0251   int _Xval;
0252 
0253   // K converted to angle (psi)
0254   long int _psi;
0255   // X converted to angle (psi_r, phi)
0256   long int _psiR;
0257   // bending angle (delta(psi_r), phiB)
0258   long int _dPsiR;
0259 };
0260 
0261 #endif