CMS 3D CMS Logo

CSCEventData.h
Go to the documentation of this file.
1 #ifndef EventFilter_CSCRawToDigi_CSCEventData_h
2 #define EventFilter_CSCRawToDigi_CSCEventData_h
3 
4 class CSCCFEBData;
5 class CSCTMBHeader;
7 class CSCWireDigi;
8 class CSCStripDigi;
9 #include <map>
10 #include <vector>
11 #ifndef LOCAL_UNPACK
12 #include <atomic>
13 #endif
24 #include <boost/dynamic_bitset.hpp>
25 
27 #define MAX_CFEB 7
28 
29 class CSCEventData {
30 public:
31  explicit CSCEventData(int chamberType, uint16_t format_version = 2005);
33  CSCEventData(const uint16_t *buf, uint16_t format_version = 2005);
37  ~CSCEventData();
40 
42  unsigned short size() const { return size_; }
43 
45  static void setDebug(const bool value) { debug = value; }
46 
48  bool isALCT(const uint16_t *buf);
49 
51  bool isTMB(const uint16_t *buf);
52 
54  const CSCCFEBData *cfebData(unsigned icfeb) const;
55 
57  std::vector<CSCStripDigi> stripDigis(const CSCDetId &idlayer) const;
58 
60  std::vector<CSCStripDigi> stripDigis(unsigned idlayer, unsigned icfeb) const;
61 
63  std::vector<std::vector<CSCStripDigi> > stripDigis() const;
64 
65  std::vector<CSCWireDigi> wireDigis(unsigned ilayer) const;
67  std::vector<std::vector<CSCWireDigi> > wireDigis() const;
68 
70  int nalct() const { return theDMBHeader.nalct(); }
71 
73  int nclct() const { return theDMBHeader.nclct(); }
74 
76  const CSCDMBHeader *dmbHeader() const { return &theDMBHeader; }
78 
80  CSCALCTHeader *alctHeader() const;
81 
83  CSCALCTTrailer *alctTrailer() const;
84 
86  CSCAnodeData *alctData() const;
87 
89  CSCTMBData *tmbData() const;
90 
92  CSCTMBHeader *tmbHeader() const;
93 
96 
98  const CSCDMBTrailer *dmbTrailer() const { return &theDMBTrailer; }
100  void add(const CSCStripDigi &, int layer);
101  void add(const CSCWireDigi &, int layer);
102  void add(const CSCComparatorDigi &, int layer);
103  void add(const CSCComparatorDigi &, const CSCDetId &);
105  void add(const std::vector<CSCALCTDigi> &);
106  void add(const std::vector<CSCCLCTDigi> &);
107  void add(const std::vector<CSCCorrelatedLCTDigi> &);
108  void add(const std::vector<GEMPadDigiCluster> &, const GEMDetId &);
109 
112  void setEventInformation(int bxnum, int lvl1num);
113 
115  boost::dynamic_bitset<> pack();
116 
118  void addALCTStructures();
119 
121  int chamberType() const { return theChamberType; }
122 
123  uint16_t getFormatVersion() const { return theFormatVersion; }
124 
125  unsigned int calcALCTcrc(std::vector<std::pair<unsigned int, unsigned short *> > &vec);
126 
127 #ifdef LOCAL_UNPACK
128  static bool debug;
129 #else
130  static std::atomic<bool> debug;
131 #endif
132  //uint16_t dataPresent; // 7 bit word which will tell if alct, clct, and 5 cfebs are present
133  static void selfTest();
134 
135 private:
138  void init();
139  void unpack_data(const uint16_t *buf);
140  void copy(const CSCEventData &);
141  void destroy();
142 
144  void checkALCTClasses();
146  void checkTMBClasses();
147 
149  void addComparatorInformation(std::vector<CSCStripDigi> &, int layer) const;
150 
152  //these are empty data objects unless filled in CSCEventData.cc
160 
163 
165 
166  int size_;
170 
172  unsigned short *alctZSErecovered;
174 
177 };
178 
179 std::ostream &operator<<(std::ostream &os, const CSCEventData &evt);
180 #endif
CSCALCTTrailer.h
CSCEventData::size
unsigned short size() const
size of the data buffer used, in bytes
Definition: CSCEventData.h:42
MAX_CFEB
#define MAX_CFEB
Maximum available CFEBs per chamber (for old system 5, for new ME11 should be 7)
Definition: CSCEventData.h:27
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:528
CSCALCTHeader.h
CSCEventData::theChamberType
int theChamberType
Definition: CSCEventData.h:169
CSCEventData
Definition: CSCEventData.h:29
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:45
CSCDMBTrailer.h
CSCEventData::selfTest
static void selfTest()
Definition: CSCEventData.cc:595
CSCEventData::tmbHeader
CSCTMBHeader * tmbHeader() const
user must check if nclct > 0
Definition: CSCEventData.cc:393
CSCEventData::theDMBHeader
CSCDMBHeader theDMBHeader
Definition: CSCEventData.h:151
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:571
CSCEventData::alctZSErecovered
unsigned short * alctZSErecovered
Auxiliary bufer to recove the ALCT raw payload from zero suppression.
Definition: CSCEventData.h:172
CSCEventData::theALCTHeader
CSCALCTHeader * theALCTHeader
Definition: CSCEventData.h:156
CSCEventData::dmbHeader
const CSCDMBHeader * dmbHeader() const
the DAQ motherboard header. A good place for event and chamber info
Definition: CSCEventData.h:76
CSCALCTTrailer
Definition: CSCALCTTrailer.h:53
CSCEventData::size_
int size_
Definition: CSCEventData.h:166
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:77
CSCEventData::dmbTrailer
const CSCDMBTrailer * dmbTrailer() const
DMB trailer.
Definition: CSCEventData.h:98
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:517
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:34
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
CSCEventData::comparatorData
CSCComparatorData * comparatorData() const
user must check if nclct > 0
Definition: CSCEventData.cc:399
CSCEventData::alctTrailer
CSCALCTTrailer * alctTrailer() const
user must check if nalct > 0
Definition: CSCEventData.cc:375
CSCEventData::theTMBData
CSCTMBData * theTMBData
Definition: CSCEventData.h:159
CSCEventData::nalct
int nalct() const
the flag for existence of ALCT data
Definition: CSCEventData.h:70
GEMDetId
Definition: GEMDetId.h:18
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:73
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
CSCTMBData
Definition: CSCTMBData.h:24
CSCEventData::debug
static std::atomic< bool > debug
Definition: CSCEventData.h:130
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:26
CSCEventData::zseEnable
int zseEnable
Definition: CSCEventData.h:173
CSCEventData::getFormatVersion
uint16_t getFormatVersion() const
Definition: CSCEventData.h:123
CSCDMBHeader
Definition: CSCDMBHeader.h:15
GEMDetId.h
CSCStripDigi
Definition: CSCStripDigi.h:17
CSCEventData::theDMBTrailer
CSCDMBTrailer theDMBTrailer
Definition: CSCEventData.h:164
CSCEventData::chamberType
int chamberType() const
might not be set in real data
Definition: CSCEventData.h:121
CSCEventData::theCFEBData
CSCCFEBData * theCFEBData[7]
for up to MAX_CFEB CFEB boards
Definition: CSCEventData.h:162
relativeConstraints.value
value
Definition: relativeConstraints.py:53
CSCAnodeData
Definition: CSCAnodeData.h:10
CSCEventData::theAnodeData
CSCAnodeData * theAnodeData
Definition: CSCEventData.h:157
CSCEventData::copy
void copy(const CSCEventData &)
Definition: CSCEventData.cc:282
CSCEventData::theALCTTrailer
CSCALCTTrailer * theALCTTrailer
Definition: CSCEventData.h:158
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:176
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
CSCEventData::~CSCEventData
~CSCEventData()
Definition: CSCEventData.cc:259
CSCEventData::isTMB
bool isTMB(const uint16_t *buf)
if dealing with TMB data
Definition: CSCEventData.cc:255
CSCComparatorData
Definition: CSCComparatorData.h:24