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 
26 class CSCEventData {
27 public:
28  explicit CSCEventData(int chamberType, uint16_t format_version = 2005);
30  CSCEventData(const uint16_t *buf, uint16_t format_version = 2005);
34  ~CSCEventData();
37 
39  unsigned short size() const { return size_; }
40 
42  static void setDebug(const bool value) { debug = value; }
43 
45  bool isALCT(const uint16_t *buf);
46 
48  bool isTMB(const uint16_t *buf);
49 
51  const CSCCFEBData *cfebData(unsigned icfeb) const;
52 
54  std::vector<CSCStripDigi> stripDigis(const CSCDetId &idlayer) const;
55 
57  std::vector<CSCStripDigi> stripDigis(unsigned idlayer, unsigned icfeb) const;
58 
60  std::vector<std::vector<CSCStripDigi> > stripDigis() const;
61 
62  std::vector<CSCWireDigi> wireDigis(unsigned ilayer) const;
64  std::vector<std::vector<CSCWireDigi> > wireDigis() const;
65 
67  int nalct() const { return theDMBHeader.nalct(); }
68 
70  int nclct() const { return theDMBHeader.nclct(); }
71 
73  const CSCDMBHeader *dmbHeader() const { return &theDMBHeader; }
75 
77  CSCALCTHeader *alctHeader() const;
78 
80  CSCALCTTrailer *alctTrailer() const;
81 
83  CSCAnodeData *alctData() const;
84 
86  CSCTMBData *tmbData() const;
87 
89  CSCTMBHeader *tmbHeader() const;
90 
93 
95  const CSCDMBTrailer *dmbTrailer() const { return &theDMBTrailer; }
97  void add(const CSCStripDigi &, int layer);
98  void add(const CSCWireDigi &, int layer);
99  void add(const CSCComparatorDigi &, int layer);
100  void add(const CSCComparatorDigi &, const CSCDetId &);
102  void add(const std::vector<CSCALCTDigi> &);
103  void add(const std::vector<CSCCLCTDigi> &);
104  void add(const std::vector<CSCCorrelatedLCTDigi> &);
105  void add(const std::vector<CSCShowerDigi> &);
106  void add(const std::vector<GEMPadDigiCluster> &, const GEMDetId &);
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:39
CSCEventData::destroy
void destroy()
Definition: CSCEventData.cc:305
CSCEventData::checkTMBClasses
void checkTMBClasses()
makes new TMB classes, if needed
Definition: CSCEventData.cc:443
CSCEventData::pack
boost::dynamic_bitset pack()
returns the packed event data.
Definition: CSCEventData.cc:524
CSCALCTHeader.h
CSCEventData::theChamberType
int theChamberType
Definition: CSCEventData.h:167
CSCEventData
Definition: CSCEventData.h:26
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:42
CSCDMBTrailer.h
CSCEventData::selfTest
static void selfTest()
Definition: CSCEventData.cc:591
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:252
CSCEventData::unpack_data
void unpack_data(const uint16_t *buf)
Definition: CSCEventData.cc:39
CSCEventData::calcALCTcrc
unsigned int calcALCTcrc(std::vector< std::pair< unsigned int, unsigned short * > > &vec)
Definition: CSCEventData.cc:567
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:73
CSCALCTTrailer
Definition: CSCALCTTrailer.h:53
CSCEventData::size_
int size_
Definition: CSCEventData.h:164
CSCEventData::init
void init()
Definition: CSCEventData.cc:270
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:74
CSCEventData::dmbTrailer
const CSCDMBTrailer * dmbTrailer() const
DMB trailer.
Definition: CSCEventData.h:95
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:262
operator<<
std::ostream & operator<<(std::ostream &os, const CSCEventData &evt)
Definition: CSCEventData.cc:513
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:31
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:157
CSCEventData::nalct
int nalct() const
the flag for existence of ALCT data
Definition: CSCEventData.h:67
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:461
value
Definition: value.py:1
CSCEventData::nclct
int nclct() const
the number of CLCTs
Definition: CSCEventData.h:70
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
CSCTMBData
Definition: CSCTMBData.h:24
CSCEventData::debug
static std::atomic< bool > debug
Definition: CSCEventData.h:128
visDQMUpload.buf
buf
Definition: visDQMUpload.py:160
CSCConstants::MAX_CFEBS_RUN2
Definition: CSCConstants.h:24
CSCEventData::wireDigis
std::vector< std::vector< CSCWireDigi > > wireDigis() const
deprecated. Use the above method instead.
Definition: CSCEventData.cc:359
CSCTMBHeader
Definition: CSCTMBHeader.h:27
CSCEventData::zseEnable
int zseEnable
Definition: CSCEventData.h:171
CSCEventData::getFormatVersion
uint16_t getFormatVersion() const
Definition: CSCEventData.h:121
CSCDMBHeader
Definition: CSCDMBHeader.h:15
GEMDetId.h
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
relativeConstraints.value
value
Definition: relativeConstraints.py:53
CSCAnodeData
Definition: CSCAnodeData.h:9
CSCEventData::theAnodeData
CSCAnodeData * theAnodeData
Definition: CSCEventData.h:155
CSCEventData::copy
void copy(const CSCEventData &)
Definition: CSCEventData.cc:283
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:430
CSCEventData::theCFEBData
CSCCFEBData * theCFEBData[CSCConstants::MAX_CFEBS_RUN2]
for up to MAX_CFEB CFEB boards
Definition: CSCEventData.h:160
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:260
CSCEventData::isTMB
bool isTMB(const uint16_t *buf)
if dealing with TMB data
Definition: CSCEventData.cc:256
CSCComparatorData
Definition: CSCComparatorData.h:24