Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:13

0001 //-------------------------------------------------
0002 //
0003 /**  \class DTuROSControlData
0004  *
0005  *   DT uROS Control Data
0006  *
0007  *
0008  *
0009  *
0010  *   J. Troconiz  - UAM Madrid
0011  */
0012 //
0013 //--------------------------------------------------
0014 #ifndef DTDigi_DTuROSControlData_h
0015 #define DTDigi_DTuROSControlData_h
0016 
0017 #include <vector>
0018 
0019 static const int DOCESLOTS = 12;
0020 static const int SEISXOK = 12;
0021 
0022 class DTuROSROSData {
0023 public:
0024   /// Constructor
0025   DTuROSROSData() : slot_(-1), header1_(0), header2_(0), trailer_(0), okword1_(0), okword2_(0) {
0026     for (int i = 0; i < SEISXOK; i++)
0027       okxword_[i] = 0;
0028   }
0029 
0030   /// Destructor
0031   ~DTuROSROSData(){};
0032 
0033   void setslot(int slot) { slot_ = slot; }
0034 
0035   void setheader1(long dword) { header1_ = dword; }
0036 
0037   void setheader2(long dword) { header2_ = dword; }
0038 
0039   void settrailer(long dword) { trailer_ = dword; }
0040 
0041   void setokword1(long okword) { okword1_ = okword; }
0042 
0043   void setokword2(long okword) { okword2_ = okword; }
0044 
0045   void setokxword(int i, long okxword) { okxword_[i] = okxword; }
0046 
0047   void setexword(long exword) { exword_.push_back(exword); }
0048 
0049   void seterror(int error) { error_.push_back(error); }
0050 
0051   int getslot() const { return slot_; }
0052 
0053   long getheader1() const { return header1_; }
0054 
0055   long getheader2() const { return header2_; }
0056 
0057   long gettrailer() const { return trailer_; }
0058 
0059   long getokword1() const { return okword1_; }
0060 
0061   long getokword2() const { return okword2_; }
0062 
0063   int getokflag(int i) const {
0064     if (i < 60)
0065       return ((okword1_ >> i) & 0x1);
0066     return ((okword2_ >> (i - 60)) & 0x1);
0067   }
0068 
0069   long getokxword(int i) const { return okxword_[i]; }
0070 
0071   int getokxflag(int i) const { return ((okxword_[i / 12] >> (5 * (i % 12))) & 0x1F); }
0072 
0073   std::vector<long> getexwords() const { return exword_; }
0074 
0075   long getexword(int i) const { return exword_.at(i); }
0076 
0077   std::vector<int> geterrors() const { return error_; }
0078 
0079   int geterror(int i) const { return error_.at(i); }
0080 
0081   int geterrorROBID(int i) const { return (error_.at(i) >> 21) & 0x7F; }
0082 
0083   int geterrorTDCID(int i) const { return (error_.at(i) >> 19) & 0x3; }
0084 
0085   int geterrorFlag(int i) const { return (error_.at(i)) & 0x7FFF; }
0086 
0087   int getboardId() const { return (getheader2()) & 0xFFFF; }
0088 
0089   int getuserWord() const { return (getheader2() >> 32) & 0xFFFFFFFF; }
0090 
0091 private:
0092   int slot_;
0093 
0094   long header1_, header2_, trailer_;
0095 
0096   long okword1_, okword2_, okxword_[SEISXOK];
0097 
0098   std::vector<long> exword_;
0099 
0100   std::vector<int> error_;
0101 };
0102 
0103 class DTuROSFEDData {
0104 public:
0105   /// Constructor
0106   DTuROSFEDData() : header1_(0), header2_(0), trailer_(0), fed_(-1), nslots_(0), evtLgth_(0) {
0107     for (int i = 0; i < DOCESLOTS; i++)
0108       rsize_[i] = 0;
0109   }
0110 
0111   /// Destructor
0112   ~DTuROSFEDData(){};
0113 
0114   void setfed(int fed) { fed_ = fed; }
0115 
0116   void setheader1(long dword) { header1_ = dword; }
0117 
0118   void setheader2(long dword) { header2_ = dword; }
0119 
0120   void settrailer(long dword) { trailer_ = dword; }
0121 
0122   void setnslots(int nslots) { nslots_ = nslots; }
0123 
0124   void setevtlgth(int evtLgth) { evtLgth_ = evtLgth; }
0125 
0126   void setslotsize(int slot, int size) { rsize_[slot - 1] = size; }
0127 
0128   void setuROS(int slot, DTuROSROSData rwords) { rdata_[slot - 1] = rwords; }
0129 
0130   int getfed() const { return fed_; }
0131 
0132   long getheader1() const { return header1_; }
0133 
0134   long getheader2() const { return header2_; }
0135 
0136   long gettrailer() const { return trailer_; }
0137 
0138   int getnslots() const { return nslots_; }
0139 
0140   int getevtlgth() const { return evtLgth_; }
0141 
0142   int getslotsize(int slot) const { return rsize_[slot - 1]; }
0143 
0144   int getBXId() const { return (getheader1() >> 20) & 0xFFF; }
0145 
0146   int getTTS() const { return (gettrailer() >> 4) & 0xF; }
0147 
0148   DTuROSROSData getuROS(int slot) const { return rdata_[slot - 1]; }
0149 
0150 private:
0151   long header1_, header2_, trailer_;
0152 
0153   int fed_, nslots_, evtLgth_, rsize_[DOCESLOTS];
0154 
0155   DTuROSROSData rdata_[DOCESLOTS];
0156 };
0157 
0158 typedef std::vector<DTuROSFEDData> DTuROSFEDDataCollection;
0159 #endif