CMS 3D CMS Logo

CSCEventData.h
Go to the documentation of this file.
1 #ifndef CSCEventData_h
2 #define CSCEventData_h
3 
4 class CSCCFEBData;
5 class CSCTMBHeader;
6 class CSCCLCTData;
7 class CSCWireDigi;
8 class CSCStripDigi;
9 #include <map>
10 #include <vector>
11 #ifndef LOCAL_UNPACK
12 #include <atomic>
13 #endif
23 #include <boost/dynamic_bitset.hpp>
24 
26 #define MAX_CFEB 7
27 
28 class CSCEventData {
29 public:
30  explicit CSCEventData(int chamberType, uint16_t format_version = 2005);
32  CSCEventData(const uint16_t *buf, uint16_t format_version = 2005);
36  ~CSCEventData();
39 
41  unsigned short size() const { return size_; }
42 
44  static void setDebug(const bool value) { debug = value; }
45 
47  bool isALCT(const uint16_t *buf);
48 
50  bool isTMB(const uint16_t *buf);
51 
53  const CSCCFEBData *cfebData(unsigned icfeb) const;
54 
56  std::vector<CSCStripDigi> stripDigis(const CSCDetId &idlayer) const;
57 
59  std::vector<CSCStripDigi> stripDigis(unsigned idlayer, unsigned icfeb) const;
60 
62  std::vector<std::vector<CSCStripDigi> > stripDigis() const;
63 
64  std::vector<CSCWireDigi> wireDigis(unsigned ilayer) const;
66  std::vector<std::vector<CSCWireDigi> > wireDigis() const;
67 
69  int nalct() const { return theDMBHeader.nalct(); }
70 
72  int nclct() const { return theDMBHeader.nclct(); }
73 
75  const CSCDMBHeader *dmbHeader() const { return &theDMBHeader; }
77 
79  CSCALCTHeader *alctHeader() const;
80 
82  CSCALCTTrailer *alctTrailer() const;
83 
85  CSCAnodeData *alctData() const;
86 
88  CSCTMBData *tmbData() const;
89 
91  CSCTMBHeader *tmbHeader() const;
92 
94  CSCCLCTData *clctData() const;
95 
97  const CSCDMBTrailer *dmbTrailer() const { return &theDMBTrailer; }
99  void add(const CSCStripDigi &, int layer);
100  void add(const CSCWireDigi &, int layer);
101  void add(const CSCComparatorDigi &, int layer);
102  void add(const CSCComparatorDigi &, const CSCDetId &);
104  void add(const std::vector<CSCALCTDigi> &);
105  void add(const std::vector<CSCCLCTDigi> &);
106  void add(const std::vector<CSCCorrelatedLCTDigi> &);
107 
110  void setEventInformation(int bxnum, int lvl1num);
111 
113  boost::dynamic_bitset<> pack();
114 
116  void addALCTStructures();
117 
119  int chamberType() const { return theChamberType; }
120 
121  uint16_t getFormatVersion() const { return theFormatVersion; }
122 
123  unsigned int calcALCTcrc(std::vector<std::pair<unsigned int, unsigned short *> > &vec);
124 
125 #ifdef LOCAL_UNPACK
126  static bool debug;
127 #else
128  static std::atomic<bool> debug;
129 #endif
130  //uint16_t dataPresent; // 7 bit word which will tell if alct, clct, and 5 cfebs are present
131  static void selfTest();
132 
133 private:
136  void init();
137  void unpack_data(const uint16_t *buf);
138  void copy(const CSCEventData &);
139  void destroy();
140 
142  void checkALCTClasses();
144  void checkTMBClasses();
145 
147  void addComparatorInformation(std::vector<CSCStripDigi> &, int layer) const;
148 
150  //these are empty data objects unless filled in CSCEventData.cc
158 
161 
163 
164  int size_;
168 
170  unsigned short *alctZSErecovered;
172 
175 };
176 
177 std::ostream &operator<<(std::ostream &os, const CSCEventData &evt);
178 #endif
CSCALCTTrailer.h
CSCEventData::size
unsigned short size() const
size of the data buffer used, in bytes
Definition: CSCEventData.h:41
MAX_CFEB
#define MAX_CFEB
Maximum available CFEBs per chamber (for old system 5, for new ME11 should be 7)
Definition: CSCEventData.h:26
CSCEventData::destroy
void destroy()
Definition: CSCEventData.cc:304
CSCEventData::checkTMBClasses
void checkTMBClasses()
makes new TMB classes, if needed
Definition: CSCEventData.cc:449
CSCEventData::pack
boost::dynamic_bitset pack()
returns the packed event data.
Definition: CSCEventData.cc:526
CSCALCTHeader.h
CSCEventData::theChamberType
int theChamberType
Definition: CSCEventData.h:167
CSCEventData
Definition: CSCEventData.h:28
CSCEventData::alctHeader
CSCALCTHeader * alctHeader() const
user must check if nalct > 0
Definition: CSCEventData.cc:369
CSCEventData::tmbData
CSCTMBData * tmbData() const
user must check in nclct > 0
Definition: CSCEventData.cc:387
CSCEventData::cfebData
const CSCCFEBData * cfebData(unsigned icfeb) const
unpacked in long mode: has overflow and error bits decoded
Definition: CSCEventData.cc:367
CSCDMBTrailer
Definition: CSCDMBTrailer.h:16
CSCEventData::setDebug
static void setDebug(const bool value)
Definition: CSCEventData.h:44
CSCEventData::clctData
CSCCLCTData * clctData() const
user must check if nclct > 0
Definition: CSCEventData.cc:399
CSCDMBTrailer.h
CSCEventData::selfTest
static void selfTest()
Definition: CSCEventData.cc:593
CSCEventData::tmbHeader
CSCTMBHeader * tmbHeader() const
user must check if nclct > 0
Definition: CSCEventData.cc:393
CSCEventData::theDMBHeader
CSCDMBHeader theDMBHeader
Definition: CSCEventData.h:149
CSCCFEBData
Definition: CSCCFEBData.h:13
CSCEventData::isALCT
bool isALCT(const uint16_t *buf)
if dealing with ALCT data
Definition: CSCEventData.cc:251
CSCEventData::unpack_data
void unpack_data(const uint16_t *buf)
Definition: CSCEventData.cc:38
CSCEventData::calcALCTcrc
unsigned int calcALCTcrc(std::vector< std::pair< unsigned int, unsigned short * > > &vec)
Definition: CSCEventData.cc:569
CSCEventData::alctZSErecovered
unsigned short * alctZSErecovered
Auxiliary bufer to recove the ALCT raw payload from zero suppression.
Definition: CSCEventData.h:170
CSCEventData::theALCTHeader
CSCALCTHeader * theALCTHeader
Definition: CSCEventData.h:154
CSCEventData::dmbHeader
const CSCDMBHeader * dmbHeader() const
the DAQ motherboard header. A good place for event and chamber info
Definition: CSCEventData.h:75
CSCALCTTrailer
Definition: CSCALCTTrailer.h:53
CSCEventData::size_
int size_
Definition: CSCEventData.h:164
CSCEventData::init
void init()
Definition: CSCEventData.cc:269
CSCDetId.h
CSCEventData::addComparatorInformation
void addComparatorInformation(std::vector< CSCStripDigi > &, int layer) const
adds the comparators to the strip digis
CSCALCTHeader
Definition: CSCALCTHeader.h:21
CSCAnodeData.h
CSCEventData::dmbHeader
CSCDMBHeader * dmbHeader()
Definition: CSCEventData.h:76
CSCEventData::dmbTrailer
const CSCDMBTrailer * dmbTrailer() const
DMB trailer.
Definition: CSCEventData.h:97
CSCTMBData.h
CSCRPCDigi.h
CSCEventData::addALCTStructures
void addALCTStructures()
adds an empty ALCTHeader, trailer, and anode data
CSCEventData::operator=
CSCEventData operator=(const CSCEventData &data)
Definition: CSCEventData.cc:261
operator<<
std::ostream & operator<<(std::ostream &os, const CSCEventData &evt)
Definition: CSCEventData.cc:515
CSCEventData::alctData
CSCAnodeData * alctData() const
user must check if nalct > 0
Definition: CSCEventData.cc:381
CSCDMBHeader.h
CSCComparatorDigi
Definition: CSCComparatorDigi.h:16
CSCEventData::CSCEventData
CSCEventData()
Definition: CSCEventData.h:33
CSCEventData::alctTrailer
CSCALCTTrailer * alctTrailer() const
user must check if nalct > 0
Definition: CSCEventData.cc:375
CSCEventData::theTMBData
CSCTMBData * theTMBData
Definition: CSCEventData.h:157
CSCEventData::nalct
int nalct() const
the flag for existence of ALCT data
Definition: CSCEventData.h:69
CSCWireDigi
Definition: CSCWireDigi.h:14
CSCDetId
Definition: CSCDetId.h:26
CSCDMBHeader::nalct
unsigned nalct() const
Definition: CSCDMBHeader.h:42
CSCEventData::add
void add(const CSCStripDigi &, int layer)
routines to add digis to the data
Definition: CSCEventData.cc:467
value
Definition: value.py:1
CSCEventData::nclct
int nclct() const
the number of CLCTs
Definition: CSCEventData.h:72
CSCTMBData
Definition: CSCTMBData.h:24
CSCEventData::debug
static std::atomic< bool > debug
Definition: CSCEventData.h:128
visDQMUpload.buf
buf
Definition: visDQMUpload.py:154
CSCEventData::wireDigis
std::vector< std::vector< CSCWireDigi > > wireDigis() const
deprecated. Use the above method instead.
Definition: CSCEventData.cc:359
CSCTMBHeader
Definition: CSCTMBHeader.h:25
CSCEventData::zseEnable
int zseEnable
Definition: CSCEventData.h:171
CSCEventData::getFormatVersion
uint16_t getFormatVersion() const
Definition: CSCEventData.h:121
CSCDMBHeader
Definition: CSCDMBHeader.h:15
CSCStripDigi
Definition: CSCStripDigi.h:17
CSCEventData::theDMBTrailer
CSCDMBTrailer theDMBTrailer
Definition: CSCEventData.h:162
CSCEventData::chamberType
int chamberType() const
might not be set in real data
Definition: CSCEventData.h:119
CSCEventData::theCFEBData
CSCCFEBData * theCFEBData[7]
for up to MAX_CFEB CFEB boards
Definition: CSCEventData.h:160
relativeConstraints.value
value
Definition: relativeConstraints.py:53
CSCAnodeData
Definition: CSCAnodeData.h:10
CSCEventData::theAnodeData
CSCAnodeData * theAnodeData
Definition: CSCEventData.h:155
CSCEventData::copy
void copy(const CSCEventData &)
Definition: CSCEventData.cc:282
CSCEventData::theALCTTrailer
CSCALCTTrailer * theALCTTrailer
Definition: CSCEventData.h:156
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
CSCEventData::setEventInformation
void setEventInformation(int bxnum, int lvl1num)
Definition: CSCEventData.cc:405
CSCDMBHeader::nclct
unsigned nclct() const
Definition: CSCDMBHeader.h:43
CSCEventData::theFormatVersion
uint16_t theFormatVersion
Output Format Version (2005, 2013)
Definition: CSCEventData.h:174
CSCEventData::checkALCTClasses
void checkALCTClasses()
makes new ALCT classes, if needed
Definition: CSCEventData.cc:436
CSCEventData::stripDigis
std::vector< std::vector< CSCStripDigi > > stripDigis() const
deprecated. Use the above methods instead
Definition: CSCEventData.cc:350
CSCCLCTData
Definition: CSCCLCTData.h:24
CSCEventData::~CSCEventData
~CSCEventData()
Definition: CSCEventData.cc:259
CSCEventData::isTMB
bool isTMB(const uint16_t *buf)
if dealing with TMB data
Definition: CSCEventData.cc:255