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>
16 
17 #ifndef LOCAL_UNPACK
18 #include <atomic>
19 #endif
20 class CSCDMBHeader;
21 struct CSCTMBHeader2006;
22 struct CSCTMBHeader2007;
24 struct CSCTMBHeader2013;
25 
26 class CSCTMBHeader {
27 public:
28  CSCTMBHeader(int firmwareVersion, int firmwareRevision);
29  CSCTMBHeader(const CSCTMBStatusDigi& digi);
30  CSCTMBHeader(const unsigned short* buf);
31 
33  void setEventInformation(const CSCDMBHeader& dmbHeader) { theHeaderFormat->setEventInformation(dmbHeader); }
34 
35  int FirmwareVersion() const { return theFirmwareVersion; }
36  int FirmwareRevision() const { return theHeaderFormat->firmwareRevision(); }
37 
38  uint16_t BXNCount() const { return theHeaderFormat->BXNCount(); }
39  uint16_t ALCTMatchTime() const { return theHeaderFormat->ALCTMatchTime(); }
40  uint16_t CLCTOnly() const { return theHeaderFormat->CLCTOnly(); }
41  uint16_t ALCTOnly() const { return theHeaderFormat->ALCTOnly(); }
42  uint16_t TMBMatch() const { return theHeaderFormat->TMBMatch(); }
43 
44  uint16_t Bxn0Diff() const { return theHeaderFormat->Bxn0Diff(); }
45  uint16_t Bxn1Diff() const { return theHeaderFormat->Bxn1Diff(); }
46 
47  uint16_t L1ANumber() const { return theHeaderFormat->L1ANumber(); }
48 
49  uint16_t sizeInBytes() const { return theHeaderFormat->sizeInWords() * 2; }
50 
56 
57  uint16_t NTBins() const { return theHeaderFormat->NTBins(); }
58  uint16_t NCFEBs() const { return theHeaderFormat->NCFEBs(); }
59 
60  uint16_t syncError() const { return theHeaderFormat->syncError(); }
61  uint16_t syncErrorCLCT() const { return theHeaderFormat->syncErrorCLCT(); }
62  uint16_t syncErrorMPC0() const { return theHeaderFormat->syncErrorMPC0(); }
63  uint16_t syncErrorMPC1() const { return theHeaderFormat->syncErrorMPC1(); }
64 
65  void setNCFEBs(uint16_t ncfebs) { theHeaderFormat->setNCFEBs(ncfebs); }
66 
68  std::vector<CSCCLCTDigi> CLCTDigis(uint32_t idlayer) { return theHeaderFormat->CLCTDigis(idlayer); }
69 
71  std::vector<CSCCorrelatedLCTDigi> CorrelatedLCTDigis(uint32_t idlayer) const {
72  return theHeaderFormat->CorrelatedLCTDigis(idlayer);
73  }
74 
77  unsigned short int sizeInWords() const { return theHeaderFormat->sizeInWords(); }
78 
79  unsigned short int NHeaderFrames() const { return theHeaderFormat->NHeaderFrames(); }
80 
81  unsigned short* data() { return theHeaderFormat->data(); }
82 
84  static void setDebug(const bool value) { debug = value; }
85 
86  bool check() const { return theHeaderFormat->check(); }
87 
89  //void setChamberId(const CSCDetId & detId) {theChamberId = detId;}
90 
92  void addCLCT0(const CSCCLCTDigi& digi) { theHeaderFormat->addCLCT0(digi); }
93  void addCLCT1(const CSCCLCTDigi& digi) { theHeaderFormat->addCLCT1(digi); }
94  void addALCT0(const CSCALCTDigi& digi) { theHeaderFormat->addALCT0(digi); }
95  void addALCT1(const CSCALCTDigi& digi) { theHeaderFormat->addALCT1(digi); }
96  void addCorrelatedLCT0(const CSCCorrelatedLCTDigi& digi) { theHeaderFormat->addCorrelatedLCT0(digi); }
97  void addCorrelatedLCT1(const CSCCorrelatedLCTDigi& digi) { theHeaderFormat->addCorrelatedLCT1(digi); }
98 
100  void add(const std::vector<CSCCLCTDigi>& digis);
101  void add(const std::vector<CSCCorrelatedLCTDigi>& digis);
102 
104  static void selfTest(int firmwwareVersion, int firmwareRevision);
105 
106  friend std::ostream& operator<<(std::ostream& os, const CSCTMBHeader& hdr);
107 
108 private:
109  //void swapCLCTs(CSCCLCTDigi& digi1, CSCCLCTDigi& digi2);
110 
111 #ifdef LOCAL_UNPACK
112  static bool debug;
113 #else
114  static std::atomic<bool> debug;
115 #endif
116 
117  std::shared_ptr<CSCVTMBHeaderFormat> theHeaderFormat;
119 };
120 
121 #endif
CSCTMBHeader::sizeInBytes
uint16_t sizeInBytes() const
Definition: CSCTMBHeader.h:49
CSCTMBHeader::addALCT1
void addALCT1(const CSCALCTDigi &digi)
Definition: CSCTMBHeader.h:95
CSCTMBHeader::operator<<
friend std::ostream & operator<<(std::ostream &os, const CSCTMBHeader &hdr)
Definition: CSCTMBHeader.cc:219
CSCTMBHeader::FirmwareVersion
int FirmwareVersion() const
Definition: CSCTMBHeader.h:35
CSCTMBHeader::CorrelatedLCTDigis
std::vector< CSCCorrelatedLCTDigi > CorrelatedLCTDigis(uint32_t idlayer) const
returns CorrelatedLCT digis
Definition: CSCTMBHeader.h:71
CSCTMBHeader::debug
static std::atomic< bool > debug
Definition: CSCTMBHeader.h:114
CSCTMBHeader::NHeaderFrames
unsigned short int NHeaderFrames() const
Definition: CSCTMBHeader.h:79
CSCVTMBHeaderFormat.h
CSCTMBStatusDigi
Definition: CSCTMBStatusDigi.h:15
CSCTMBHeader::tmbHeader2013
CSCTMBHeader2013 tmbHeader2013() const
Definition: CSCTMBHeader.cc:147
CSCTMBHeader::addALCT0
void addALCT0(const CSCALCTDigi &digi)
Definition: CSCTMBHeader.h:94
CSCTMBHeader::setEventInformation
void setEventInformation(const CSCDMBHeader &dmbHeader)
fills fields like bxn and l1a
Definition: CSCTMBHeader.h:33
CSCTMBHeader2007_rev0x50c3
Definition: CSCTMBHeader2007_rev0x50c3.h:6
CSCTMBHeader::tmbHeader2006
CSCTMBHeader2006 tmbHeader2006() const
Definition: CSCTMBHeader.cc:155
CSCCorrelatedLCTDigi.h
CSCTMBHeader::CLCTDigis
std::vector< CSCCLCTDigi > CLCTDigis(uint32_t idlayer)
returns CLCT digis
Definition: CSCTMBHeader.h:68
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:45
CSCTMBHeader2007
Definition: CSCTMBHeader2007.h:6
simCaloStage2Layer1Digis_cfi.firmwareVersion
firmwareVersion
Definition: simCaloStage2Layer1Digis_cfi.py:21
CSCTMBHeader::syncErrorMPC1
uint16_t syncErrorMPC1() const
Definition: CSCTMBHeader.h:63
CSCALCTDigi.h
CSCTMBHeader::FirmwareRevision
int FirmwareRevision() const
Definition: CSCTMBHeader.h:36
CSCTMBHeader::tmbHeader2007
CSCTMBHeader2007 tmbHeader2007() const
will throw if the cast fails
Definition: CSCTMBHeader.cc:131
CSCTMBHeader::addCorrelatedLCT0
void addCorrelatedLCT0(const CSCCorrelatedLCTDigi &digi)
Definition: CSCTMBHeader.h:96
CSCTMBHeader::NTBins
uint16_t NTBins() const
Definition: CSCTMBHeader.h:57
GEMPadDigiCluster.h
CSCTMBHeader::tmbHeader2007_rev0x50c3
CSCTMBHeader2007_rev0x50c3 tmbHeader2007_rev0x50c3() const
Definition: CSCTMBHeader.cc:139
CSCTMBHeader::NCFEBs
uint16_t NCFEBs() const
Definition: CSCTMBHeader.h:58
CSCTMBHeader::addCorrelatedLCT1
void addCorrelatedLCT1(const CSCCorrelatedLCTDigi &digi)
Definition: CSCTMBHeader.h:97
CSCTMBHeader::addCLCT1
void addCLCT1(const CSCCLCTDigi &digi)
Definition: CSCTMBHeader.h:93
CSCTMBHeader::addCLCT0
void addCLCT0(const CSCCLCTDigi &digi)
Needed before data packing.
Definition: CSCTMBHeader.h:92
CSCTMBHeader::syncError
uint16_t syncError() const
Definition: CSCTMBHeader.h:60
CSCTMBHeader::TMBMatch
uint16_t TMBMatch() const
Definition: CSCTMBHeader.h:42
CSCTMBHeader::CLCTOnly
uint16_t CLCTOnly() const
Definition: CSCTMBHeader.h:40
CSCTMBStatusDigi.h
value
Definition: value.py:1
CSCTMBHeader::syncErrorCLCT
uint16_t syncErrorCLCT() const
Definition: CSCTMBHeader.h:61
CSCTMBHeader2006
Definition: CSCTMBHeader2006.h:6
CSCTMBHeader::check
bool check() const
Definition: CSCTMBHeader.h:86
visDQMUpload.buf
buf
Definition: visDQMUpload.py:154
CSCTMBHeader
Definition: CSCTMBHeader.h:26
CSCTMBHeader::syncErrorMPC0
uint16_t syncErrorMPC0() const
Definition: CSCTMBHeader.h:62
CSCTMBHeader::Bxn0Diff
uint16_t Bxn0Diff() const
Definition: CSCTMBHeader.h:44
CSCDMBHeader
Definition: CSCDMBHeader.h:15
CSCTMBHeader::theHeaderFormat
std::shared_ptr< CSCVTMBHeaderFormat > theHeaderFormat
Definition: CSCTMBHeader.h:117
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:65
Exception.h
CSCTMBHeader::BXNCount
uint16_t BXNCount() const
Definition: CSCTMBHeader.h:38
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:41
CSCTMBHeader::ALCTMatchTime
uint16_t ALCTMatchTime() const
Definition: CSCTMBHeader.h:39
CSCTMBHeader::L1ANumber
uint16_t L1ANumber() const
Definition: CSCTMBHeader.h:47
CSCTMBHeader::sizeInWords
unsigned short int sizeInWords() const
Definition: CSCTMBHeader.h:77
CSCTMBHeader::data
unsigned short * data()
Definition: CSCTMBHeader.h:81
CSCTMBHeader::theFirmwareVersion
int theFirmwareVersion
Definition: CSCTMBHeader.h:118
CSCCorrelatedLCTDigi
Definition: CSCCorrelatedLCTDigi.h:19
CSCTMBHeader::setDebug
static void setDebug(const bool value)
Definition: CSCTMBHeader.h:84
CSCTMBHeader::selfTest
static void selfTest(int firmwwareVersion, int firmwareRevision)
tests that packing and unpacking give same results
Definition: CSCTMBHeader.cc:163