CSCALCT

CSCALCTHeader2007

CSCCollisionMask

CSCConfigurationRegister

CSCHotChannelMask

CSCVirtexID

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 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
#ifndef EventFilter_CSCRawToDigi_CSCRawToDigi_CSCALCTHeader2007_h
#define EventFilter_CSCRawToDigi_CSCRawToDigi_CSCALCTHeader2007_h

/** documented in  flags
  http://www.phys.ufl.edu/~madorsky/alctv/alct2000_spec.PDF
// see http://www.phys.ufl.edu/cms/emu/dqm/data_formats/ALCT_v2p9_2008.03.28.pdf

*/
#include <bitset>
#include <vector>
#include "DataFormats/CSCDigi/interface/CSCALCTDigi.h"
#include <boost/dynamic_bitset.hpp>
#include <cstring>

class CSCDMBHeader;

struct CSCALCT {
  CSCALCT();
  CSCALCT(const CSCALCTDigi& alctDigi);

  void setFromBuffer(unsigned short const* buf) { memcpy(this, buf, sizeInWords() * 2); }

  static short unsigned int sizeInWords() { return 1; }

  unsigned valid : 1;
  unsigned quality : 2;
  unsigned accel : 1;
  unsigned pattern : 1;
  unsigned keyWire : 7;
  unsigned reserved : 4;
};

struct CSCALCTHeader2007 {
  CSCALCTHeader2007();
  explicit CSCALCTHeader2007(int chamberType);

  void setFromBuffer(unsigned short const* buf) { memcpy(this, buf, sizeInWords() * 2); }

  void setEventInformation(const CSCDMBHeader&);  ///for packing

  short unsigned int sizeInWords() const {  ///size of ALCT2007 Header
    return 8;
  }

  unsigned flag1 : 16;  ///=0xDB0A

  unsigned bxnL1A : 12;
  unsigned reserved1 : 4;

  unsigned l1aCounter : 12;
  unsigned reserved2 : 4;

  unsigned readoutCounter : 12;
  unsigned reserved3 : 4;

  unsigned bxnCount : 12;
  unsigned rawOverflow : 1;
  unsigned lctOverflow : 1;
  unsigned configPresent : 1;
  unsigned flag3 : 1;

  unsigned bxnBeforeReset : 12;
  unsigned flag2 : 4;

  unsigned boardType : 3;
  unsigned backwardForward : 1;
  unsigned negativePositive : 1;
  unsigned mirrored : 1;
  unsigned qualityCancell : 1;
  unsigned latencyClocks : 1;
  unsigned patternB : 1;
  unsigned widePattern : 1;
  unsigned reserved0 : 2;
  unsigned flag0 : 4;

  unsigned rawBins : 5;
  unsigned lctBins : 4;
  unsigned firmwareVersion : 6;
  unsigned flag4 : 1;
};

struct CSCVirtexID {
  CSCVirtexID() {
    bzero(this, sizeInWords() * 2);  ///size of virtex ID bits = 6 bytes
  }

  void setFromBuffer(unsigned short const* buf) { memcpy(this, buf, sizeInWords() * 2); }

  short unsigned int sizeInWords() const {  ///size of VirtexID
    return 3;
  }

  unsigned virtexIDLow : 15;
  unsigned flag0 : 1;  ///==0

  unsigned virtexIDMed : 15;
  unsigned flag1 : 1;  ///==0

  unsigned virtexIDHigh : 10;
  unsigned trReg : 3;
  unsigned reserved : 2;
  unsigned flag2 : 1;  ///==0
};

struct CSCConfigurationRegister {
  CSCConfigurationRegister() { bzero(this, sizeInWords() * 2); }

  void setFromBuffer(unsigned short const* buf) { memcpy(this, buf, sizeInWords() * 2); }

  short unsigned int sizeInWords() const {  ///size of ConfigReg
    return 5;
  }

  unsigned configRegister0 : 15;
  unsigned flag0 : 1;  ///==0

  unsigned configRegister1 : 15;
  unsigned flag1 : 1;  ///==0

  unsigned configRegister2 : 15;
  unsigned flag2 : 1;  ///==0

  unsigned configRegister3 : 15;
  unsigned flag3 : 1;  ///==0

  unsigned configRegister4 : 9;
  unsigned reserved : 6;
  unsigned flag4 : 1;  ///==0
};

struct CSCCollisionMask {
  CSCCollisionMask() { bzero(this, sizeInWords() * 2); }

  void setFromBuffer(unsigned short const* buf) { memcpy(this, buf, sizeInWords() * 2); }

  short unsigned int sizeInWords() const {  ///size of one CollMask word
    return 1;
  }

  unsigned collisionMaskRegister : 14;
  unsigned reserved : 1;
  unsigned flag : 1;  ///==0
};

struct CSCHotChannelMask {
  CSCHotChannelMask() { bzero(this, sizeInWords() * 2); }

  void setFromBuffer(unsigned short const* buf) { memcpy(this, buf, sizeInWords() * 2); }

  short unsigned int sizeInWords() const {  ///size of one HotChannMask word
    return 1;
  }

  unsigned hotChannelMask : 12;
  unsigned reserved : 3;
  unsigned flag : 1;  ///==0
};

#endif