CMS 3D CMS Logo

CSCTMBHeader.h
Go to the documentation of this file.
1 #ifndef EventFilter_CSCRawToDigi_CSCTMBHeader_h
2 #define EventFilter_CSCRawToDigi_CSCTMBHeader_h
3 
5 
6 #include <iosfwd>
7 #include <vector>
8 #include <memory>
17 
18 #ifndef LOCAL_UNPACK
19 #include <atomic>
20 #endif
21 class CSCDMBHeader;
22 struct CSCTMBHeader2006;
23 struct CSCTMBHeader2007;
25 struct CSCTMBHeader2013;
26 
27 class CSCTMBHeader {
28 public:
29  CSCTMBHeader(int firmwareVersion, int firmwareRevision);
30  CSCTMBHeader(const CSCTMBStatusDigi& digi);
31  CSCTMBHeader(const unsigned short* buf);
32 
34  void setEventInformation(const CSCDMBHeader& dmbHeader) { theHeaderFormat->setEventInformation(dmbHeader); }
35 
36  int FirmwareVersion() const { return theFirmwareVersion; }
37  int FirmwareRevision() const { return theHeaderFormat->firmwareRevision(); }
38 
39  uint16_t BXNCount() const { return theHeaderFormat->BXNCount(); }
40  uint16_t ALCTMatchTime() const { return theHeaderFormat->ALCTMatchTime(); }
41  uint16_t CLCTOnly() const { return theHeaderFormat->CLCTOnly(); }
42  uint16_t ALCTOnly() const { return theHeaderFormat->ALCTOnly(); }
43  uint16_t TMBMatch() const { return theHeaderFormat->TMBMatch(); }
44 
45  uint16_t Bxn0Diff() const { return theHeaderFormat->Bxn0Diff(); }
46  uint16_t Bxn1Diff() const { return theHeaderFormat->Bxn1Diff(); }
47 
48  uint16_t L1ANumber() const { return theHeaderFormat->L1ANumber(); }
49 
50  uint16_t sizeInBytes() const { return theHeaderFormat->sizeInWords() * 2; }
51 
57 
58  uint16_t NTBins() const { return theHeaderFormat->NTBins(); }
59  uint16_t NCFEBs() const { return theHeaderFormat->NCFEBs(); }
60 
61  uint16_t syncError() const { return theHeaderFormat->syncError(); }
62  uint16_t syncErrorCLCT() const { return theHeaderFormat->syncErrorCLCT(); }
63  uint16_t syncErrorMPC0() const { return theHeaderFormat->syncErrorMPC0(); }
64  uint16_t syncErrorMPC1() const { return theHeaderFormat->syncErrorMPC1(); }
65 
66  void setNCFEBs(uint16_t ncfebs) { theHeaderFormat->setNCFEBs(ncfebs); }
67 
69  std::vector<CSCCLCTDigi> CLCTDigis(uint32_t idlayer) { return theHeaderFormat->CLCTDigis(idlayer); }
70 
72  std::vector<CSCCorrelatedLCTDigi> CorrelatedLCTDigis(uint32_t idlayer) const {
73  return theHeaderFormat->CorrelatedLCTDigis(idlayer);
74  }
75 
78  unsigned short int sizeInWords() const { return theHeaderFormat->sizeInWords(); }
79 
80  unsigned short int NHeaderFrames() const { return theHeaderFormat->NHeaderFrames(); }
81 
82  unsigned short* data() { return theHeaderFormat->data(); }
83 
85  static void setDebug(const bool value) { debug = value; }
86 
87  bool check() const { return theHeaderFormat->check(); }
88 
90  //void setChamberId(const CSCDetId & detId) {theChamberId = detId;}
91 
93  void addCLCT0(const CSCCLCTDigi& digi) { theHeaderFormat->addCLCT0(digi); }
94  void addCLCT1(const CSCCLCTDigi& digi) { theHeaderFormat->addCLCT1(digi); }
95  void addALCT0(const CSCALCTDigi& digi) { theHeaderFormat->addALCT0(digi); }
96  void addALCT1(const CSCALCTDigi& digi) { theHeaderFormat->addALCT1(digi); }
97  void addCorrelatedLCT0(const CSCCorrelatedLCTDigi& digi) { theHeaderFormat->addCorrelatedLCT0(digi); }
98  void addCorrelatedLCT1(const CSCCorrelatedLCTDigi& digi) { theHeaderFormat->addCorrelatedLCT1(digi); }
99 
101  void add(const std::vector<CSCCLCTDigi>& digis);
102  void add(const std::vector<CSCCorrelatedLCTDigi>& digis);
103  void add(const std::vector<CSCShowerDigi>& digis);
104 
106  static void selfTest(int firmwwareVersion, int firmwareRevision);
107 
108  friend std::ostream& operator<<(std::ostream& os, const CSCTMBHeader& hdr);
109 
110 private:
111  //void swapCLCTs(CSCCLCTDigi& digi1, CSCCLCTDigi& digi2);
112 
113 #ifdef LOCAL_UNPACK
114  static bool debug;
115 #else
116  static std::atomic<bool> debug;
117 #endif
118 
119  std::shared_ptr<CSCVTMBHeaderFormat> theHeaderFormat;
121 };
122 
123 #endif
CSCTMBHeader::sizeInBytes
uint16_t sizeInBytes() const
Definition: CSCTMBHeader.h:50
CSCShowerDigi.h
CSCTMBHeader::addALCT1
void addALCT1(const CSCALCTDigi &digi)
Definition: CSCTMBHeader.h:96
CSCTMBHeader::operator<<
friend std::ostream & operator<<(std::ostream &os, const CSCTMBHeader &hdr)
Definition: CSCTMBHeader.cc:224
CSCTMBHeader::FirmwareVersion
int FirmwareVersion() const
Definition: CSCTMBHeader.h:36
CSCTMBHeader::CorrelatedLCTDigis
std::vector< CSCCorrelatedLCTDigi > CorrelatedLCTDigis(uint32_t idlayer) const
returns CorrelatedLCT digis
Definition: CSCTMBHeader.h:72
CSCTMBHeader::debug
static std::atomic< bool > debug
Definition: CSCTMBHeader.h:116
CSCTMBHeader::NHeaderFrames
unsigned short int NHeaderFrames() const
Definition: CSCTMBHeader.h:80
CSCVTMBHeaderFormat.h
CSCTMBStatusDigi
Definition: CSCTMBStatusDigi.h:15
CSCTMBHeader::tmbHeader2013
CSCTMBHeader2013 tmbHeader2013() const
Definition: CSCTMBHeader.cc:152
CSCTMBHeader::addALCT0
void addALCT0(const CSCALCTDigi &digi)
Definition: CSCTMBHeader.h:95
CSCTMBHeader::setEventInformation
void setEventInformation(const CSCDMBHeader &dmbHeader)
fills fields like bxn and l1a
Definition: CSCTMBHeader.h:34
CSCTMBHeader2007_rev0x50c3
Definition: CSCTMBHeader2007_rev0x50c3.h:6
CSCTMBHeader::tmbHeader2006
CSCTMBHeader2006 tmbHeader2006() const
Definition: CSCTMBHeader.cc:160
CSCCorrelatedLCTDigi.h
CSCTMBHeader::CLCTDigis
std::vector< CSCCLCTDigi > CLCTDigis(uint32_t idlayer)
returns CLCT digis
Definition: CSCTMBHeader.h:69
CSCCLCTDigi
Definition: CSCCLCTDigi.h:17
CSCTMBHeader::CSCTMBHeader
CSCTMBHeader(int firmwareVersion, int firmwareRevision)
Definition: CSCTMBHeader.cc:20
CSCTMBHeader::Bxn1Diff
uint16_t Bxn1Diff() const
Definition: CSCTMBHeader.h:46
CSCTMBHeader2007
Definition: CSCTMBHeader2007.h:6
simCaloStage2Layer1Digis_cfi.firmwareVersion
firmwareVersion
Definition: simCaloStage2Layer1Digis_cfi.py:21
CSCTMBHeader::syncErrorMPC1
uint16_t syncErrorMPC1() const
Definition: CSCTMBHeader.h:64
CSCALCTDigi.h
CSCTMBHeader::FirmwareRevision
int FirmwareRevision() const
Definition: CSCTMBHeader.h:37
CSCTMBHeader::tmbHeader2007
CSCTMBHeader2007 tmbHeader2007() const
will throw if the cast fails
Definition: CSCTMBHeader.cc:136
CSCTMBHeader::addCorrelatedLCT0
void addCorrelatedLCT0(const CSCCorrelatedLCTDigi &digi)
Definition: CSCTMBHeader.h:97
CSCTMBHeader::NTBins
uint16_t NTBins() const
Definition: CSCTMBHeader.h:58
GEMPadDigiCluster.h
CSCTMBHeader::tmbHeader2007_rev0x50c3
CSCTMBHeader2007_rev0x50c3 tmbHeader2007_rev0x50c3() const
Definition: CSCTMBHeader.cc:144
CSCTMBHeader::NCFEBs
uint16_t NCFEBs() const
Definition: CSCTMBHeader.h:59
CSCTMBHeader::addCorrelatedLCT1
void addCorrelatedLCT1(const CSCCorrelatedLCTDigi &digi)
Definition: CSCTMBHeader.h:98
CSCTMBHeader::addCLCT1
void addCLCT1(const CSCCLCTDigi &digi)
Definition: CSCTMBHeader.h:94
CSCTMBHeader::addCLCT0
void addCLCT0(const CSCCLCTDigi &digi)
Needed before data packing.
Definition: CSCTMBHeader.h:93
CSCTMBHeader::syncError
uint16_t syncError() const
Definition: CSCTMBHeader.h:61
CSCTMBHeader::TMBMatch
uint16_t TMBMatch() const
Definition: CSCTMBHeader.h:43
CSCTMBHeader::CLCTOnly
uint16_t CLCTOnly() const
Definition: CSCTMBHeader.h:41
CSCTMBStatusDigi.h
value
Definition: value.py:1
CSCTMBHeader::syncErrorCLCT
uint16_t syncErrorCLCT() const
Definition: CSCTMBHeader.h:62
CSCTMBHeader2006
Definition: CSCTMBHeader2006.h:6
CSCTMBHeader::check
bool check() const
Definition: CSCTMBHeader.h:87
visDQMUpload.buf
buf
Definition: visDQMUpload.py:160
CSCTMBHeader
Definition: CSCTMBHeader.h:27
CSCTMBHeader::syncErrorMPC0
uint16_t syncErrorMPC0() const
Definition: CSCTMBHeader.h:63
CSCTMBHeader::Bxn0Diff
uint16_t Bxn0Diff() const
Definition: CSCTMBHeader.h:45
CSCDMBHeader
Definition: CSCDMBHeader.h:15
CSCTMBHeader::theHeaderFormat
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:119
relativeConstraints.value
value
Definition: relativeConstraints.py:53
CSCALCTDigi
Definition: CSCALCTDigi.h:17
CSCTMBHeader2013
Definition: CSCTMBHeader2013.h:6
CSCCLCTDigi.h
CSCTMBHeader::setNCFEBs
void setNCFEBs(uint16_t ncfebs)
Definition: CSCTMBHeader.h:66
Exception.h
CSCTMBHeader::BXNCount
uint16_t BXNCount() const
Definition: CSCTMBHeader.h:39
CSCTMBHeader::add
void add(const std::vector< CSCCLCTDigi > &digis)
these methods need more brains to figure which one goes first
Definition: CSCTMBHeader.cc:114
CSCTMBHeader::ALCTOnly
uint16_t ALCTOnly() const
Definition: CSCTMBHeader.h:42
CSCTMBHeader::ALCTMatchTime
uint16_t ALCTMatchTime() const
Definition: CSCTMBHeader.h:40
CSCTMBHeader::L1ANumber
uint16_t L1ANumber() const
Definition: CSCTMBHeader.h:48
CSCTMBHeader::sizeInWords
unsigned short int sizeInWords() const
Definition: CSCTMBHeader.h:78
CSCTMBHeader::data
unsigned short * data()
Definition: CSCTMBHeader.h:82
CSCTMBHeader::theFirmwareVersion
int theFirmwareVersion
Definition: CSCTMBHeader.h:120
CSCCorrelatedLCTDigi
Definition: CSCCorrelatedLCTDigi.h:19
CSCTMBHeader::setDebug
static void setDebug(const bool value)
Definition: CSCTMBHeader.h:85
CSCTMBHeader::selfTest
static void selfTest(int firmwwareVersion, int firmwareRevision)
tests that packing and unpacking give same results
Definition: CSCTMBHeader.cc:168