test
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 class CSCTMBHeader2013;
19 
20 
21 class CSCTMBHeader {
22 
23  public:
24  CSCTMBHeader(int firmwareVersion, int firmwareRevision);
25  CSCTMBHeader(const CSCTMBStatusDigi & digi);
26  CSCTMBHeader(const unsigned short * buf);
27 
29  void setEventInformation(const CSCDMBHeader & dmbHeader)
30  {
31  theHeaderFormat->setEventInformation(dmbHeader);
32  }
33 
34  int FirmwareVersion() const {return theFirmwareVersion;}
35  int FirmwareRevision() const {return theHeaderFormat->firmwareRevision();}
36 
37 
38  uint16_t BXNCount() const {
39  return theHeaderFormat->BXNCount();
40  }
41  uint16_t ALCTMatchTime() const {
42  return theHeaderFormat->ALCTMatchTime();
43  }
44  uint16_t CLCTOnly() const {
45  return theHeaderFormat->CLCTOnly();
46  }
47  uint16_t ALCTOnly() const {
48  return theHeaderFormat->ALCTOnly();
49  }
50  uint16_t TMBMatch() const {
51  return theHeaderFormat->TMBMatch();
52  }
53 
54  uint16_t Bxn0Diff() const {
55  return theHeaderFormat->Bxn0Diff();
56  }
57  uint16_t Bxn1Diff() const {
58  return theHeaderFormat->Bxn1Diff();
59  }
60 
61  uint16_t L1ANumber() const {
62  return theHeaderFormat->L1ANumber();
63  }
64 
65  uint16_t sizeInBytes() const {
66  return theHeaderFormat->sizeInWords()*2;
67  }
68 
73 
74  uint16_t NTBins() const {
75  return theHeaderFormat->NTBins();
76  }
77  uint16_t NCFEBs() const {
78  return theHeaderFormat->NCFEBs();
79  }
80 
81  void setNCFEBs(uint16_t ncfebs) {
82  theHeaderFormat->setNCFEBs(ncfebs);
83  }
84 
85 
87  std::vector<CSCCLCTDigi> CLCTDigis(uint32_t idlayer)
88  {
89  return theHeaderFormat->CLCTDigis(idlayer);
90  }
91 
93  std::vector<CSCCorrelatedLCTDigi> CorrelatedLCTDigis(uint32_t idlayer) const
94  {
95  return theHeaderFormat->CorrelatedLCTDigis(idlayer);
96  }
97 
100  unsigned short int sizeInWords() const {return theHeaderFormat->sizeInWords();}
101 
102  unsigned short int NHeaderFrames() const {
103  return theHeaderFormat->NHeaderFrames();
104  }
105 
106  unsigned short * data() {
107  return theHeaderFormat->data();
108  }
109 
111  static void setDebug(const bool value) {debug = value;}
112 
113  bool check() const {
114  return theHeaderFormat->check();
115  }
116 
118  //void setChamberId(const CSCDetId & detId) {theChamberId = detId;}
119 
121  void addCLCT0(const CSCCLCTDigi & digi) {theHeaderFormat->addCLCT0(digi);}
122  void addCLCT1(const CSCCLCTDigi & digi) {theHeaderFormat->addCLCT1(digi);}
123  void addALCT0(const CSCALCTDigi & digi) {theHeaderFormat->addALCT0(digi);}
124  void addALCT1(const CSCALCTDigi & digi) {theHeaderFormat->addALCT1(digi);}
126  theHeaderFormat->addCorrelatedLCT0(digi);
127  }
129  theHeaderFormat->addCorrelatedLCT1(digi);
130  }
131 
133  void add(const std::vector<CSCCLCTDigi> & digis);
134  void add(const std::vector<CSCCorrelatedLCTDigi> & digis);
135 
136 
138  static void selfTest();
139 
140  friend std::ostream & operator<<(std::ostream & os, const CSCTMBHeader & hdr);
141 
142 private:
143 
144  //void swapCLCTs(CSCCLCTDigi& digi1, CSCCLCTDigi& digi2);
145 
146  static bool debug;
147 
148  boost::shared_ptr<CSCVTMBHeaderFormat> theHeaderFormat;
150 
151 };
152 
153 #endif
154 
uint16_t BXNCount() const
Definition: CSCTMBHeader.h:38
void setEventInformation(const CSCDMBHeader &dmbHeader)
fills fields like bxn and l1a
Definition: CSCTMBHeader.h:29
CSCTMBHeader2007 tmbHeader2007() const
will throw if the cast fails
uint16_t NTBins() const
Definition: CSCTMBHeader.h:74
int FirmwareRevision() const
Definition: CSCTMBHeader.h:35
unsigned short int NHeaderFrames() const
Definition: CSCTMBHeader.h:102
int theFirmwareVersion
Definition: CSCTMBHeader.h:149
uint16_t CLCTOnly() const
Definition: CSCTMBHeader.h:44
uint16_t L1ANumber() const
Definition: CSCTMBHeader.h:61
std::vector< CSCCorrelatedLCTDigi > CorrelatedLCTDigis(uint32_t idlayer) const
returns CorrelatedLCT digis
Definition: CSCTMBHeader.h:93
uint16_t Bxn1Diff() const
Definition: CSCTMBHeader.h:57
void addCorrelatedLCT0(const CSCCorrelatedLCTDigi &digi)
Definition: CSCTMBHeader.h:125
void add(const std::vector< CSCCLCTDigi > &digis)
these methods need more brains to figure which one goes first
void addCorrelatedLCT1(const CSCCorrelatedLCTDigi &digi)
Definition: CSCTMBHeader.h:128
uint16_t NCFEBs() const
Definition: CSCTMBHeader.h:77
void addCLCT1(const CSCCLCTDigi &digi)
Definition: CSCTMBHeader.h:122
boost::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:148
void setNCFEBs(uint16_t ncfebs)
Definition: CSCTMBHeader.h:81
static void setDebug(const bool value)
Definition: CSCTMBHeader.h:111
static bool debug
Definition: CSCTMBHeader.h:146
static void selfTest()
tests that packing and unpacking give same results
unsigned short * data()
Definition: CSCTMBHeader.h:106
uint16_t ALCTOnly() const
Definition: CSCTMBHeader.h:47
uint16_t Bxn0Diff() const
Definition: CSCTMBHeader.h:54
friend std::ostream & operator<<(std::ostream &os, const CSCTMBHeader &hdr)
uint16_t ALCTMatchTime() const
Definition: CSCTMBHeader.h:41
unsigned short int sizeInWords() const
Definition: CSCTMBHeader.h:100
uint16_t sizeInBytes() const
Definition: CSCTMBHeader.h:65
std::vector< CSCCLCTDigi > CLCTDigis(uint32_t idlayer)
returns CLCT digis
Definition: CSCTMBHeader.h:87
CSCTMBHeader2006 tmbHeader2006() const
void addCLCT0(const CSCCLCTDigi &digi)
Needed before data packing.
Definition: CSCTMBHeader.h:121
bool check() const
Definition: CSCTMBHeader.h:113
uint16_t TMBMatch() const
Definition: CSCTMBHeader.h:50
int FirmwareVersion() const
Definition: CSCTMBHeader.h:34
void addALCT1(const CSCALCTDigi &digi)
Definition: CSCTMBHeader.h:124
CSCTMBHeader(int firmwareVersion, int firmwareRevision)
Definition: CSCTMBHeader.cc:16
CSCTMBHeader2013 tmbHeader2013() const
void addALCT0(const CSCALCTDigi &digi)
Definition: CSCTMBHeader.h:123