CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSCALCTHeader.h
Go to the documentation of this file.
1 #ifndef CSCALCTHeader_h
2 #define CSCALCTHeader_h
3 
7 #include <bitset>
8 #include <vector>
9 #include <iosfwd>
16 #include <boost/dynamic_bitset.hpp>
17 
19  public:
20  explicit CSCALCTHeader(int chamberType);
21 
22  explicit CSCALCTHeader(const unsigned short * buf);
23 
24  CSCALCTHeader(const CSCALCTStatusDigi & digi);
25 
27  static void setDebug(bool value){debug = value;};
28 
29  void setEventInformation(const CSCDMBHeader &);
30  unsigned short int nLCTChipRead() const;
31 
32  std::vector<CSCALCTDigi> ALCTDigis() const;
33 
36 
38  unsigned short int FIFOMode() const {return header2006.fifoMode;}
39  unsigned short int NTBins() const {
40  switch (firmwareVersion)
41  {
42  case 2006:
43  return header2006.nTBins;
44  case 2007:
45  return header2007.rawBins;
46  default:
47  edm::LogError("CSCALCTHeader|CSCRawToDigi")
48  <<"trying to access NTBINs: ALCT firmware version is bad/not defined!";
49  return 0;
50  }
51  }
52  unsigned short int BoardID() const {return header2006.boardID;}
53  unsigned short int ExtTrig() const {return header2006.extTrig;}
54  unsigned short int CSCID() const {return header2006.cscID;}
55  unsigned short int BXNCount() const {
56  switch (firmwareVersion)
57  {
58  case 2006:
59  return header2006.bxnCount;
60  case 2007:
61  return header2007.bxnCount;
62  default:
63  edm::LogError("CSCALCTHeader|CSCRawToDigi")
64  <<"trying to access BXNcount: ALCT firmware version is bad/not defined!";
65  return 0;
66  }
67  }
68  unsigned short int L1Acc() const {
69  switch (firmwareVersion)
70  {
71  case 2006:
72  return header2006.l1Acc;
73  case 2007:
74  return header2007.l1aCounter;
75  default:
76  edm::LogError("CSCALCTHeader|CSCRawToDigi")
77  <<"trying to access L1Acc: ALCT firmware version is bad/not defined!";
78  return 0;
79  }
80  }
81  unsigned short int L1AMatch() const {return header2006.l1aMatch;}
82  unsigned short int ActiveFEBs() const {return header2006.activeFEBs;}
83  unsigned short int Promote1() const {return header2006.promote1;}
84  unsigned short int Promote2() const {return header2006.promote2;}
85  unsigned short int LCTChipRead() const {return header2006.lctChipRead;}
86  unsigned short int alctFirmwareVersion() const {return firmwareVersion;}
87  void setDAVForChannel(int wireGroup) {
88  if(firmwareVersion == 2006) {
89  header2006.setDAV((wireGroup-1)/16);
90  }
91  }
94 
95  unsigned short int * data() {return theOriginalBuffer;}
96 
98  int sizeInWords() {
99  switch (firmwareVersion)
100  {
101  case 2006:
102  return 8;
103  case 2007:
104  return sizeInWords2007_;
105  default:
106  edm::LogError("CSCALCTHeader|CSCRawToDigi")
107  <<"SizeInWords(): ALCT firmware version is bad/not defined!";
108  return 0;
109  }
110  }
111 
112  bool check() const {
113  switch (firmwareVersion)
114  {
115  case 2006:
116  return header2006.flag_0 == 0xC;
117  case 2007:
118  return header2007.flag1 == 0xDB0A;
119  default:
120  edm::LogError("CSCALCTHeader|CSCRawToDigi")
121  <<"check(): ALCT firmware version is bad/not defined!";
122  return 0;
123  }
124  }
125 
126  void add(const std::vector<CSCALCTDigi> & digis);
127 
128  boost::dynamic_bitset<> pack();
129 
131  static void selfTest(int firmware);
132 
133  private:
136  std::vector<CSCALCT> theALCTs;
140  std::vector<CSCCollisionMask> collisionMasks;
141  std::vector<CSCHotChannelMask> hotChannelMasks;
142 
143  //raw data also stored in this buffer
144  //maximum header size is 116 words
145  unsigned short int theOriginalBuffer[116];
146 
147  static bool debug;
148  static unsigned short int firmwareVersion;
149 
151  unsigned short int sizeInWords2007_, bxn0, bxn1;
152 };
153 
154 std::ostream & operator<<(std::ostream & os, const CSCALCTHeader & header);
155 
156 #endif
157 
unsigned short int L1AMatch() const
Definition: CSCALCTHeader.h:81
unsigned bxnCount
full bunch crossing number
unsigned fifoMode
see the FIFO_MODE enum
unsigned short int LCTChipRead() const
Definition: CSCALCTHeader.h:85
std::vector< CSCHotChannelMask > hotChannelMasks
std::vector< CSCCollisionMask > collisionMasks
unsigned promote1
promotion bit for 1st LCT pattern
CSCVirtexID virtexID
unsigned short int bxn1
unsigned short int nLCTChipRead() const
for packing
static unsigned short int firmwareVersion
CSCConfigurationRegister configRegister
CSCALCTHeader(int chamberType)
bool check() const
CSCALCTs2006 alcts2006
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
void setEventInformation(const CSCDMBHeader &)
static void selfTest(int firmware)
tests that we unpack what we packed
unsigned extTrig
trigger source was external
CSCALCTHeader2007 alctHeader2007() const
Definition: CSCALCTHeader.h:92
unsigned short int CSCID() const
Definition: CSCALCTHeader.h:54
unsigned short int theOriginalBuffer[116]
unsigned short int ActiveFEBs() const
Definition: CSCALCTHeader.h:82
CSCALCTHeader2006 header2006
unsigned short int ExtTrig() const
Definition: CSCALCTHeader.h:53
static bool debug
ALCT Header consists of several modular units that are defined as structs below.
std::vector< CSCALCT > theALCTs
void add(const std::vector< CSCALCTDigi > &digis)
CSCALCTHeader2007 header2007
boost::dynamic_bitset pack()
unsigned nTBins
of 25 ns time bins in the raw dump
unsigned short int sizeInWords2007_
size of the 2007 header in words
unsigned short int Promote2() const
Definition: CSCALCTHeader.h:84
int sizeInWords()
in 16-bit words
Definition: CSCALCTHeader.h:98
std::vector< CSCALCTDigi > ALCTDigis() const
unsigned short int Promote1() const
Definition: CSCALCTHeader.h:83
unsigned short int alctFirmwareVersion() const
Definition: CSCALCTHeader.h:86
unsigned short int bxn0
static void setDebug(bool value)
to access data by via status digis
Definition: CSCALCTHeader.h:27
unsigned short int L1Acc() const
Definition: CSCALCTHeader.h:68
unsigned l1Acc
l1 accept counter
unsigned promote2
promotion bit for 2nd LCT pattern
unsigned short int FIFOMode() const
Definition: CSCALCTHeader.h:38
unsigned boardID
ALCT2000 board ID.
unsigned short int NTBins() const
Definition: CSCALCTHeader.h:39
unsigned lctChipRead
LCT chips read out in raw hit dump.
unsigned activeFEBs
LCT chips with ADB hits.
CSCALCTHeader2006 alctHeader2006() const
Definition: CSCALCTHeader.h:93
unsigned cscID
chamber ID number
void setDAV(int afebBoard)
for packing
unsigned short int BXNCount() const
Definition: CSCALCTHeader.h:55
unsigned l1aMatch
exteran L1A arrived in L1A window
unsigned short int BoardID() const
Definition: CSCALCTHeader.h:52
void setDAVForChannel(int wireGroup)
Definition: CSCALCTHeader.h:87
unsigned flag_0
should be &#39;01100&#39;, so it&#39;ll be a 6xxx in the ASCII dump
unsigned short int * data()
Definition: CSCALCTHeader.h:95