CSCCLCTPreTriggerDigi

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 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
#ifndef CSCDigi_CSCCLCTPreTriggerDigi_h
#define CSCDigi_CSCCLCTPreTriggerDigi_h

/**\class CSCCLCTPreTriggerDigi
 *
 * Digi for CLCT pre-trigger primitives.
 *
 *
 * \author Tao Huang (TAMU)
 */

#include <cstdint>
#include <iosfwd>

class CSCCLCTPreTriggerDigi {
public:
  /// Constructors
  CSCCLCTPreTriggerDigi(const int valid,
                        const int quality,
                        const int pattern,
                        const int striptype,
                        const int bend,
                        const int strip,
                        const int cfeb,
                        const int bx,
                        const int trknmb = 0,
                        const int fullbx = 0);
  /// default
  CSCCLCTPreTriggerDigi();

  /// clear this CLCT
  void clear();

  /// check CLCT validity (1 - valid CLCT)
  bool isValid() const { return valid_; }

  /// return quality of a pattern (number of layers hit!)
  int getQuality() const { return quality_; }

  /// return pattern
  int getPattern() const { return pattern_; }

  /// return striptype
  int getStripType() const { return striptype_; }

  /// return bend
  int getBend() const { return bend_; }

  /// return halfstrip that goes from 0 to 31
  int getStrip() const { return strip_; }

  /// return Key CFEB ID
  int getCFEB() const { return cfeb_; }

  /// return BX
  int getBX() const { return bx_; }

  /// return track number (1,2)
  int getTrknmb() const { return trknmb_; }

  /// Convert strip_ and cfeb_ to keyStrip. Each CFEB has up to 16 strips
  /// (32 halfstrips). There are 5 cfebs.  The "strip_" variable is one
  /// of 32 halfstrips on the keylayer of a single CFEB, so that
  /// Distrip   = (cfeb*32 + strip)/4.
  /// Halfstrip = (cfeb*32 + strip).
  /// Always return halfstrip number since this is what is stored in
  /// the correlated LCT digi.  For distrip patterns, the convention is
  /// the same as for persistent strip numbers: low halfstrip of a distrip.
  /// SV, June 15th, 2006.
  int getKeyStrip() const {
    int keyStrip = cfeb_ * 32 + strip_;
    return keyStrip;
  }

  /// Set track number (1,2) after sorting CLCTs.
  void setTrknmb(const uint16_t number) { trknmb_ = number; }

  /// return 12-bit full BX.
  int getFullBX() const { return fullbx_; }

  /// Set 12-bit full BX.
  void setFullBX(const uint16_t fullbx) { fullbx_ = fullbx; }

  /// True if the left-hand side has a larger "quality".  Full definition
  /// of "quality" depends on quality word itself, pattern type, and strip
  /// number.
  bool operator>(const CSCCLCTPreTriggerDigi&) const;

  /// True if the two LCTs have exactly the same members (except the number).
  bool operator==(const CSCCLCTPreTriggerDigi&) const;

  /// True if the preceding one is false.
  bool operator!=(const CSCCLCTPreTriggerDigi&) const;

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

private:
  uint16_t valid_;
  uint16_t quality_;
  uint16_t pattern_;
  uint16_t striptype_;  // not used since mid-2008
  uint16_t bend_;
  uint16_t strip_;
  uint16_t cfeb_;
  uint16_t bx_;
  uint16_t trknmb_;
  uint16_t fullbx_;
};

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

#endif