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();
38  CSCEventData operator=(const CSCEventData & data);
39 
41  unsigned short size() const {return size_;}
42 
44  static void setDebug(const bool value) {debug = value;}
45 
46 
48  bool isALCT(const uint16_t * buf);
49 
51  bool isTMB(const uint16_t * buf);
52 
53 
54 
55 
57  const CSCCFEBData * cfebData(unsigned icfeb) const;
58 
60  std::vector<CSCStripDigi> stripDigis(const CSCDetId & idlayer) const;
61 
63  std::vector<CSCStripDigi> stripDigis(unsigned idlayer, unsigned icfeb) const;
64 
65 
67  std::vector< std::vector<CSCStripDigi> > stripDigis() const;
68 
69 
70  std::vector<CSCWireDigi> wireDigis(unsigned ilayer) const;
72  std::vector< std::vector<CSCWireDigi> > wireDigis() const;
73 
74 
76  int nalct() const {return theDMBHeader.nalct();}
77 
79  int nclct() const {return theDMBHeader.nclct();}
80 
82  const CSCDMBHeader * dmbHeader() const {return &theDMBHeader;}
84 
86  CSCALCTHeader * alctHeader() const;
87 
89  CSCALCTTrailer * alctTrailer() const;
90 
92  CSCAnodeData * alctData() const;
93 
95  CSCTMBData * tmbData() const;
96 
98  CSCTMBHeader * tmbHeader() const;
99 
101  CSCCLCTData * clctData() const;
102 
104  const CSCDMBTrailer * dmbTrailer() const {return &theDMBTrailer;}
106  void add(const CSCStripDigi &, int layer);
107  void add(const CSCWireDigi &, int layer);
108  void add(const CSCComparatorDigi &, int layer);
109  void add(const CSCComparatorDigi &, const CSCDetId &);
111  void add(const std::vector<CSCALCTDigi> &);
112  void add(const std::vector<CSCCLCTDigi> &);
113  void add(const std::vector<CSCCorrelatedLCTDigi> &);
114 
115 
118  void setEventInformation(int bxnum, int lvl1num);
119 
121  boost::dynamic_bitset<> pack();
122 
124  void addALCTStructures();
125 
127  int chamberType() const {return theChamberType;}
128 
129  uint16_t getFormatVersion() const { return theFormatVersion; }
130 
131  unsigned int calcALCTcrc(std::vector< std::pair<unsigned int, unsigned short*> > &vec);
132 
133 
134 #ifdef LOCAL_UNPACK
135  static bool debug;
136 #else
137  static std::atomic<bool> debug;
138 #endif
139  //uint16_t dataPresent; // 7 bit word which will tell if alct, clct, and 5 cfebs are present
140  static void selfTest();
141 
142 private:
145  void init();
146  void unpack_data(const uint16_t * buf);
147  void copy(const CSCEventData &);
148  void destroy();
149 
151  void checkALCTClasses();
153  void checkTMBClasses();
154 
156  void addComparatorInformation(std::vector<CSCStripDigi>&, int layer) const;
157 
159  //these are empty data objects unless filled in CSCEventData.cc
167 
170 
172 
173  int size_;
177 
179  unsigned short * alctZSErecovered;
180  int zseEnable;
181 
184 };
185 
186 std::ostream & operator<<(std::ostream & os, const CSCEventData & evt);
187 #endif
void unpack_data(const uint16_t *buf)
Definition: CSCEventData.cc:45
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:179
int nclct() const
the number of CLCTs
Definition: CSCEventData.h:79
uint16_t theFormatVersion
Output Format Version (2005, 2013)
Definition: CSCEventData.h:183
#define MAX_CFEB
Maximum available CFEBs per chamber (for old system 5, for new ME11 should be 7)
Definition: CSCEventData.h:26
std::vector< std::vector< CSCStripDigi > > stripDigis() const
deprecated. Use the above methods instead
unsigned nclct() const
Definition: CSCDMBHeader.h:48
void checkALCTClasses()
makes new ALCT classes, if needed
std::vector< std::vector< CSCWireDigi > > wireDigis() const
deprecated. Use the above method instead.
const CSCDMBTrailer * dmbTrailer() const
DMB trailer.
Definition: CSCEventData.h:104
void addALCTStructures()
adds an empty ALCTHeader, trailer, and anode data
void checkTMBClasses()
makes new TMB classes, if needed
unsigned nalct() const
Definition: CSCDMBHeader.h:47
CSCAnodeData * alctData() const
user must check if nalct > 0
CSCALCTHeader * alctHeader() const
user must check if nalct > 0
int nalct() const
the flag for existence of ALCT data
Definition: CSCEventData.h:76
bool isALCT(const uint16_t *buf)
if dealing with ALCT data
CSCDMBHeader theDMBHeader
Definition: CSCEventData.h:158
uint16_t getFormatVersion() const
Definition: CSCEventData.h:129
CSCCLCTData * clctData() const
user must check if nclct > 0
CSCTMBData * theTMBData
Definition: CSCEventData.h:166
CSCALCTTrailer * alctTrailer() const
user must check if nalct > 0
CSCALCTHeader * theALCTHeader
Definition: CSCEventData.h:163
std::ostream & operator<<(std::ostream &os, const CSCEventData &evt)
CSCTMBData * tmbData() const
user must check in nclct > 0
CSCDMBHeader * dmbHeader()
Definition: CSCEventData.h:83
CSCDMBTrailer theDMBTrailer
Definition: CSCEventData.h:171
Definition: value.py:1
CSCEventData operator=(const CSCEventData &data)
CSCCFEBData * theCFEBData[7]
for up to MAX_CFEB CFEB boards
Definition: CSCEventData.h:169
CSCALCTTrailer * theALCTTrailer
Definition: CSCEventData.h:165
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:41
void add(const CSCStripDigi &, int layer)
routines to add digis to the data
CSCTMBHeader * tmbHeader() const
user must check if nclct > 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:82
void addComparatorInformation(std::vector< CSCStripDigi > &, int layer) const
adds the comparators to the strip digis
static std::atomic< bool > debug
Definition: CSCEventData.h:137
int chamberType() const
might not be set in real data
Definition: CSCEventData.h:127
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:82
static void setDebug(const bool value)
Definition: CSCEventData.h:44
CSCAnodeData * theAnodeData
Definition: CSCEventData.h:164
static void selfTest()