CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSCTMBHeader.h
Go to the documentation of this file.
1 #ifndef CSCTMBHeader_h
2 #define CSCTMBHeader_h
3 
5 
6 #include <iosfwd>
7 #include <vector>
14 #include <boost/shared_ptr.hpp>
15 class CSCDMBHeader;
16 class CSCTMBHeader2006;
17 class CSCTMBHeader2007;
18 
19 
20 class CSCTMBHeader {
21 
22  public:
23  CSCTMBHeader(int firmwareVersion, int firmwareRevision);
24  CSCTMBHeader(const CSCTMBStatusDigi & digi);
25  CSCTMBHeader(const unsigned short * buf);
26 
28  void setEventInformation(const CSCDMBHeader & dmbHeader)
29  {
30  theHeaderFormat->setEventInformation(dmbHeader);
31  }
32 
33  int FirmwareVersion() const {return theFirmwareVersion;}
34 
35 
36  uint16_t BXNCount() const {
37  return theHeaderFormat->BXNCount();
38  }
39  uint16_t ALCTMatchTime() const {
40  return theHeaderFormat->ALCTMatchTime();
41  }
42  uint16_t CLCTOnly() const {
43  return theHeaderFormat->CLCTOnly();
44  }
45  uint16_t ALCTOnly() const {
46  return theHeaderFormat->ALCTOnly();
47  }
48  uint16_t TMBMatch() const {
49  return theHeaderFormat->TMBMatch();
50  }
51 
52  uint16_t Bxn0Diff() const {
53  return theHeaderFormat->Bxn0Diff();
54  }
55  uint16_t Bxn1Diff() const {
56  return theHeaderFormat->Bxn1Diff();
57  }
58 
59  uint16_t L1ANumber() const {
60  return theHeaderFormat->L1ANumber();
61  }
62 
63  uint16_t sizeInBytes() const {
64  return theHeaderFormat->sizeInWords()*2;
65  }
66 
70 
71  uint16_t NTBins() const {
72  return theHeaderFormat->NTBins();
73  }
74  uint16_t NCFEBs() const {
75  return theHeaderFormat->NCFEBs();
76  }
77 
78 
80  std::vector<CSCCLCTDigi> CLCTDigis(uint32_t idlayer)
81  {
82  return theHeaderFormat->CLCTDigis(idlayer);
83  }
84 
86  std::vector<CSCCorrelatedLCTDigi> CorrelatedLCTDigis(uint32_t idlayer) const
87  {
88  return theHeaderFormat->CorrelatedLCTDigis(idlayer);
89  }
90 
93  unsigned short int sizeInWords() const {return theHeaderFormat->sizeInWords();}
94 
95  unsigned short int NHeaderFrames() const {
96  return theHeaderFormat->NHeaderFrames();
97  }
98 
99  unsigned short * data() {
100  return theHeaderFormat->data();
101  }
102 
104  static void setDebug(const bool value) {debug = value;}
105 
106  bool check() const {
107  return theHeaderFormat->check();
108  }
109 
111  //void setChamberId(const CSCDetId & detId) {theChamberId = detId;}
112 
114  void addCLCT0(const CSCCLCTDigi & digi) {theHeaderFormat->addCLCT0(digi);}
115  void addCLCT1(const CSCCLCTDigi & digi) {theHeaderFormat->addCLCT1(digi);}
116  void addALCT0(const CSCALCTDigi & digi) {theHeaderFormat->addALCT0(digi);}
117  void addALCT1(const CSCALCTDigi & digi) {theHeaderFormat->addALCT1(digi);}
119  theHeaderFormat->addCorrelatedLCT0(digi);
120  }
122  theHeaderFormat->addCorrelatedLCT1(digi);
123  }
124 
126  void add(const std::vector<CSCCLCTDigi> & digis);
127  void add(const std::vector<CSCCorrelatedLCTDigi> & digis);
128 
129 
131  static void selfTest();
132 
133  friend std::ostream & operator<<(std::ostream & os, const CSCTMBHeader & hdr);
134 
135 private:
136 
137  //void swapCLCTs(CSCCLCTDigi& digi1, CSCCLCTDigi& digi2);
138 
139  static bool debug;
140 
141  boost::shared_ptr<CSCVTMBHeaderFormat> theHeaderFormat;
143 
144 };
145 
146 #endif
147 
uint16_t BXNCount() const
Definition: CSCTMBHeader.h:36
void setEventInformation(const CSCDMBHeader &dmbHeader)
fills fields like bxn and l1a
Definition: CSCTMBHeader.h:28
CSCTMBHeader2007 tmbHeader2007() const
will throw if the cast fails
uint16_t NTBins() const
Definition: CSCTMBHeader.h:71
unsigned short int NHeaderFrames() const
Definition: CSCTMBHeader.h:95
int theFirmwareVersion
Definition: CSCTMBHeader.h:142
uint16_t CLCTOnly() const
Definition: CSCTMBHeader.h:42
uint16_t L1ANumber() const
Definition: CSCTMBHeader.h:59
std::vector< CSCCorrelatedLCTDigi > CorrelatedLCTDigis(uint32_t idlayer) const
returns CorrelatedLCT digis
Definition: CSCTMBHeader.h:86
uint16_t Bxn1Diff() const
Definition: CSCTMBHeader.h:55
void addCorrelatedLCT0(const CSCCorrelatedLCTDigi &digi)
Definition: CSCTMBHeader.h:118
void add(const std::vector< CSCCLCTDigi > &digis)
these methods need more brains to figure which one goes first
Definition: CSCTMBHeader.cc:99
void addCorrelatedLCT1(const CSCCorrelatedLCTDigi &digi)
Definition: CSCTMBHeader.h:121
uint16_t NCFEBs() const
Definition: CSCTMBHeader.h:74
void addCLCT1(const CSCCLCTDigi &digi)
Definition: CSCTMBHeader.h:115
boost::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:141
static void setDebug(const bool value)
Definition: CSCTMBHeader.h:104
static bool debug
Definition: CSCTMBHeader.h:139
static void selfTest()
tests that packing and unpacking give same results
unsigned short * data()
Definition: CSCTMBHeader.h:99
uint16_t ALCTOnly() const
Definition: CSCTMBHeader.h:45
uint16_t Bxn0Diff() const
Definition: CSCTMBHeader.h:52
friend std::ostream & operator<<(std::ostream &os, const CSCTMBHeader &hdr)
uint16_t ALCTMatchTime() const
Definition: CSCTMBHeader.h:39
unsigned short int sizeInWords() const
Definition: CSCTMBHeader.h:93
uint16_t sizeInBytes() const
Definition: CSCTMBHeader.h:63
std::vector< CSCCLCTDigi > CLCTDigis(uint32_t idlayer)
returns CLCT digis
Definition: CSCTMBHeader.h:80
CSCTMBHeader2006 tmbHeader2006() const
void addCLCT0(const CSCCLCTDigi &digi)
Needed before data packing.
Definition: CSCTMBHeader.h:114
bool check() const
Definition: CSCTMBHeader.h:106
uint16_t TMBMatch() const
Definition: CSCTMBHeader.h:48
int FirmwareVersion() const
Definition: CSCTMBHeader.h:33
void addALCT1(const CSCALCTDigi &digi)
Definition: CSCTMBHeader.h:117
CSCTMBHeader(int firmwareVersion, int firmwareRevision)
Definition: CSCTMBHeader.cc:15
void addALCT0(const CSCALCTDigi &digi)
Definition: CSCTMBHeader.h:116