CSCCFEBStatusDigi

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
#ifndef CSCCFEBStatusDigi_CSCCFEBStatusDigi_h
#define CSCCFEBStatusDigi_CSCCFEBStatusDigi_h

/** \class CSCCFEBStatusDigi
 *
 * Digi for CSC CFEB status.
 *  
 *
 * \author N. Terentiev, CMU
 *
 */

#include <vector>
#include <iosfwd>
#include <cstdint>

class CSCCFEBStatusDigi {
public:
  /// Construct from the CFEB number (1-5).
  CSCCFEBStatusDigi(int cfebnmb) { cfebnmb_ = cfebnmb; }

  /// Constructor for all variables
  CSCCFEBStatusDigi(int cfebnmb,
                    const std::vector<uint16_t>& crcWords,
                    const std::vector<uint16_t>& contrWords,
                    const std::vector<uint16_t>& bWords) {
    cfebnmb_ = cfebnmb;
    crcWords_ = crcWords;
    contrWords_ = contrWords;
    bWords_ = bWords;
  }

  /// Default construction.
  CSCCFEBStatusDigi() {}

  /// Set CRC vector
  void setCRC(const std::vector<uint16_t>& crc) { crcWords_ = crc; }

  /// Set SCAC (SCA Controller) vector
  void setSCAC(const std::vector<uint16_t>& scac) { contrWords_ = scac; }

  /// Get the  CFEB number
  int getCFEBNmb() const { return cfebnmb_; }

  /// Get SCA Full Condition
  std::vector<uint16_t> getSCAFullCond() const;

  /// Get CRC per each time sample
  std::vector<uint16_t> getCRC() const { return crcWords_; }

  /// Shift and select
  int ShiftSel(int nmb, int nshift, int nsel) const;

  /// Get TS_FLAG bit from SCA Controller data  per each time slice
  std::vector<int> getTS_FLAG() const;

  /// Get SCA_FULL bit from SCA Controller data  per each time slice
  std::vector<int> getSCA_FULL() const;

  /// Get LCT_PHASE bit from SCA Controller data  per each time slice
  std::vector<int> getLCT_PHASE() const;

  /// Get L1A_PHASE bit from SCA Controller data  per each time slice
  std::vector<int> getL1A_PHASE() const;

  /// Get SCA_BLK 4 bit word from SCA Controller data  per each time slice
  std::vector<int> getSCA_BLK() const;

  /// Get TRIG_TIME 8 bit word from SCA Controller data  per each time slice
  std::vector<int> getTRIG_TIME() const;

  /// Print content of digi
  void print() const;

private:
  uint16_t cfebnmb_;
  std::vector<uint16_t> crcWords_;
  std::vector<uint16_t> contrWords_;
  std::vector<uint16_t> bWords_;
};

std::ostream& operator<<(std::ostream& o, const CSCCFEBStatusDigi& digi);

#endif