CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
void unpack_data(const uint16_t *buf)
Definition: CSCEventData.cc:39
CSCComparatorData * comparatorData() const
user must check if nclct &gt; 0
void setEventInformation(int bxnum, int lvl1num)
unsigned int calcALCTcrc(std::vector< std::pair< unsigned int, unsigned short * > > &vec)
unsigned short * alctZSErecovered
Auxiliary bufer to recove the ALCT raw payload from zero suppression.
Definition: CSCEventData.h:170
int nclct() const
the number of CLCTs
Definition: CSCEventData.h:70
uint16_t theFormatVersion
Output Format Version (2005, 2013)
Definition: CSCEventData.h:174
std::vector< std::vector< CSCStripDigi > > stripDigis() const
deprecated. Use the above methods instead
unsigned nclct() const
Definition: CSCDMBHeader.h:43
void checkALCTClasses()
makes new ALCT classes, if needed
std::vector< std::vector< CSCWireDigi > > wireDigis() const
deprecated. Use the above method instead.
CSCCFEBData * theCFEBData[CSCConstants::MAX_CFEBS_RUN2]
for up to MAX_CFEB CFEB boards
Definition: CSCEventData.h:160
const CSCDMBTrailer * dmbTrailer() const
DMB trailer.
Definition: CSCEventData.h:95
void addALCTStructures()
adds an empty ALCTHeader, trailer, and anode data
void checkTMBClasses()
makes new TMB classes, if needed
unsigned nalct() const
Definition: CSCDMBHeader.h:42
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
CSCAnodeData * alctData() const
user must check if nalct &gt; 0
CSCALCTHeader * alctHeader() const
user must check if nalct &gt; 0
int nalct() const
the flag for existence of ALCT data
Definition: CSCEventData.h:67
constexpr std::array< uint8_t, layerIndexSize > layer
bool isALCT(const uint16_t *buf)
if dealing with ALCT data
CSCDMBHeader theDMBHeader
Definition: CSCEventData.h:149
uint16_t getFormatVersion() const
Definition: CSCEventData.h:121
CSCTMBData * theTMBData
Definition: CSCEventData.h:157
CSCALCTTrailer * alctTrailer() const
user must check if nalct &gt; 0
CSCALCTHeader * theALCTHeader
Definition: CSCEventData.h:154
CSCTMBData * tmbData() const
user must check in nclct &gt; 0
CSCDMBHeader * dmbHeader()
Definition: CSCEventData.h:74
CSCDMBTrailer theDMBTrailer
Definition: CSCEventData.h:162
CSCEventData operator=(const CSCEventData &data)
CSCALCTTrailer * theALCTTrailer
Definition: CSCEventData.h:156
void copy(const CSCEventData &)
bool isTMB(const uint16_t *buf)
if dealing with TMB data
unsigned short size() const
size of the data buffer used, in bytes
Definition: CSCEventData.h:39
void add(const CSCStripDigi &, int layer)
routines to add digis to the data
CSCTMBHeader * tmbHeader() const
user must check if nclct &gt; 0
const CSCCFEBData * cfebData(unsigned icfeb) const
unpacked in long mode: has overflow and error bits decoded
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
void addComparatorInformation(std::vector< CSCStripDigi > &, int layer) const
adds the comparators to the strip digis
static std::atomic< bool > debug
Definition: CSCEventData.h:128
int chamberType() const
might not be set in real data
Definition: CSCEventData.h:119
boost::dynamic_bitset pack()
returns the packed event data.
const CSCDMBHeader * dmbHeader() const
the DAQ motherboard header. A good place for event and chamber info
Definition: CSCEventData.h:73
static void setDebug(const bool value)
Definition: CSCEventData.h:42
CSCAnodeData * theAnodeData
Definition: CSCEventData.h:155
static void selfTest()