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>
10 #include <atomic>
17 #include <boost/dynamic_bitset.hpp>
18 
20  public:
21  explicit CSCALCTHeader(int chamberType);
22 
23  explicit CSCALCTHeader(const unsigned short * buf);
24 
25  CSCALCTHeader(const CSCALCTStatusDigi & digi);
26 
28  static void setDebug(bool value){debug = value;};
29 
30  void setEventInformation(const CSCDMBHeader &);
31  unsigned short int nLCTChipRead() const;
32 
33  std::vector<CSCALCTDigi> ALCTDigis() const;
34 
37 
39  unsigned short int FIFOMode() const {return header2006.fifoMode;}
40  unsigned short int NTBins() const {
41  switch (firmwareVersion.load())
42  {
43  case 2006:
44  return header2006.nTBins;
45  case 2007:
46  return header2007.rawBins;
47  default:
48  edm::LogError("CSCALCTHeader|CSCRawToDigi")
49  <<"trying to access NTBINs: ALCT firmware version is bad/not defined!";
50  return 0;
51  }
52  }
53  unsigned short int BoardID() const {return header2006.boardID;}
54  unsigned short int ExtTrig() const {return header2006.extTrig;}
55  unsigned short int CSCID() const {return header2006.cscID;}
56  unsigned short int BXNCount() const {
57  switch (firmwareVersion.load())
58  {
59  case 2006:
60  return header2006.bxnCount;
61  case 2007:
62  return header2007.bxnCount;
63  default:
64  edm::LogError("CSCALCTHeader|CSCRawToDigi")
65  <<"trying to access BXNcount: ALCT firmware version is bad/not defined!";
66  return 0;
67  }
68  }
69  unsigned short int L1Acc() const {
70  switch (firmwareVersion.load())
71  {
72  case 2006:
73  return header2006.l1Acc;
74  case 2007:
75  return header2007.l1aCounter;
76  default:
77  edm::LogError("CSCALCTHeader|CSCRawToDigi")
78  <<"trying to access L1Acc: ALCT firmware version is bad/not defined!";
79  return 0;
80  }
81  }
82  unsigned short int L1AMatch() const {return header2006.l1aMatch;}
83  unsigned short int ActiveFEBs() const {return header2006.activeFEBs;}
84  unsigned short int Promote1() const {return header2006.promote1;}
85  unsigned short int Promote2() const {return header2006.promote2;}
86  unsigned short int LCTChipRead() const {return header2006.lctChipRead;}
87  unsigned short int alctFirmwareVersion() const {return firmwareVersion;}
88  void setDAVForChannel(int wireGroup) {
89  if(firmwareVersion == 2006) {
90  header2006.setDAV((wireGroup-1)/16);
91  }
92  }
95 
96  unsigned short int * data() {return theOriginalBuffer;}
97 
99  int sizeInWords() {
100  switch (firmwareVersion.load())
101  {
102  case 2006:
103  return 8;
104  case 2007:
105  return sizeInWords2007_;
106  default:
107  edm::LogError("CSCALCTHeader|CSCRawToDigi")
108  <<"SizeInWords(): ALCT firmware version is bad/not defined!";
109  return 0;
110  }
111  }
112 
113  bool check() const {
114  switch (firmwareVersion.load())
115  {
116  case 2006:
117  return header2006.flag_0 == 0xC;
118  case 2007:
119  return header2007.flag1 == 0xDB0A;
120  default:
121  edm::LogError("CSCALCTHeader|CSCRawToDigi")
122  <<"check(): ALCT firmware version is bad/not defined!";
123  return 0;
124  }
125  }
126 
127  void add(const std::vector<CSCALCTDigi> & digis);
128 
129  boost::dynamic_bitset<> pack();
130 
132  static void selfTest(int firmware);
133 
134  private:
137  std::vector<CSCALCT> theALCTs;
141  std::vector<CSCCollisionMask> collisionMasks;
142  std::vector<CSCHotChannelMask> hotChannelMasks;
143 
144  //raw data also stored in this buffer
145  //maximum header size is 116 words
146  unsigned short int theOriginalBuffer[116];
147 
148  static std::atomic<bool> debug;
149  static std::atomic<unsigned short int> firmwareVersion;
150 
152  unsigned short int sizeInWords2007_, bxn0, bxn1;
153 };
154 
155 std::ostream & operator<<(std::ostream & os, const CSCALCTHeader & header);
156 
157 #endif
158 
unsigned short int L1AMatch() const
Definition: CSCALCTHeader.h:82
unsigned bxnCount
full bunch crossing number
unsigned fifoMode
see the FIFO_MODE enum
unsigned short int LCTChipRead() const
Definition: CSCALCTHeader.h:86
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
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 std::atomic< unsigned short int > firmwareVersion
static void selfTest(int firmware)
tests that we unpack what we packed
unsigned extTrig
trigger source was external
CSCALCTHeader2007 alctHeader2007() const
Definition: CSCALCTHeader.h:93
unsigned short int CSCID() const
Definition: CSCALCTHeader.h:55
unsigned short int theOriginalBuffer[116]
unsigned short int ActiveFEBs() const
Definition: CSCALCTHeader.h:83
CSCALCTHeader2006 header2006
unsigned short int ExtTrig() const
Definition: CSCALCTHeader.h:54
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:85
int sizeInWords()
in 16-bit words
Definition: CSCALCTHeader.h:99
std::vector< CSCALCTDigi > ALCTDigis() const
unsigned short int Promote1() const
Definition: CSCALCTHeader.h:84
unsigned short int alctFirmwareVersion() const
Definition: CSCALCTHeader.h:87
unsigned short int bxn0
static void setDebug(bool value)
to access data by via status digis
Definition: CSCALCTHeader.h:28
unsigned short int L1Acc() const
Definition: CSCALCTHeader.h:69
unsigned l1Acc
l1 accept counter
unsigned promote2
promotion bit for 2nd LCT pattern
unsigned short int FIFOMode() const
Definition: CSCALCTHeader.h:39
unsigned boardID
ALCT2000 board ID.
unsigned short int NTBins() const
Definition: CSCALCTHeader.h:40
unsigned lctChipRead
LCT chips read out in raw hit dump.
unsigned activeFEBs
LCT chips with ADB hits.
CSCALCTHeader2006 alctHeader2006() const
Definition: CSCALCTHeader.h:94
unsigned cscID
chamber ID number
void setDAV(int afebBoard)
for packing
unsigned short int BXNCount() const
Definition: CSCALCTHeader.h:56
unsigned l1aMatch
exteran L1A arrived in L1A window
unsigned short int BoardID() const
Definition: CSCALCTHeader.h:53
void setDAVForChannel(int wireGroup)
Definition: CSCALCTHeader.h:88
static std::atomic< bool > debug
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:96