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> &);
106  void addShower(const std::vector<CSCShowerDigi> &); // add LCT CSCShower
107  void addAnodeShower(const std::vector<CSCShowerDigi> &); // add Anode CSCShower
108  void addCathodeShower(const std::vector<CSCShowerDigi> &); // add Cathode CSCShower
109  void addAnodeALCTShower(const std::vector<CSCShowerDigi> &); // add Anode ALCT CSCShower
111  void add(const std::vector<GEMPadDigiCluster> &, const GEMDetId &);
112 
115  void setEventInformation(int bxnum, int lvl1num);
116 
118  boost::dynamic_bitset<> pack();
119 
121  void addALCTStructures();
122 
124  int chamberType() const { return theChamberType; }
125 
126  uint16_t getFormatVersion() const { return theFormatVersion; }
127 
128  unsigned int calcALCTcrc(std::vector<std::pair<unsigned int, unsigned short *> > &vec);
129 
130 #ifdef LOCAL_UNPACK
131  static bool debug;
132 #else
133  static std::atomic<bool> debug;
134 #endif
135  //uint16_t dataPresent; // 7 bit word which will tell if alct, clct, and 5 cfebs are present
136  static void selfTest();
137 
138 private:
141  void init();
142  void unpack_data(const uint16_t *buf);
143  void copy(const CSCEventData &);
144  void destroy();
145 
147  void checkALCTClasses();
149  void checkTMBClasses();
150 
152  void addComparatorInformation(std::vector<CSCStripDigi> &, int layer) const;
153 
155  //these are empty data objects unless filled in CSCEventData.cc
163 
166 
168 
169  int size_;
173 
175  unsigned short *alctZSErecovered;
177 
180 };
181 
182 std::ostream &operator<<(std::ostream &os, const CSCEventData &evt);
183 #endif
void unpack_data(const uint16_t *buf)
Definition: CSCEventData.cc:39
void setEventInformation(int bxnum, int lvl1num)
unsigned short * alctZSErecovered
Auxiliary bufer to recove the ALCT raw payload from zero suppression.
Definition: CSCEventData.h:175
uint16_t theFormatVersion
Output Format Version (2005, 2013)
Definition: CSCEventData.h:179
void checkALCTClasses()
makes new ALCT classes, if needed
CSCCFEBData * theCFEBData[CSCConstants::MAX_CFEBS_RUN2]
for up to MAX_CFEB CFEB boards
Definition: CSCEventData.h:165
void addComparatorInformation(std::vector< CSCStripDigi > &, int layer) const
adds the comparators to the strip digis
unsigned nalct() const
Definition: CSCDMBHeader.h:42
void addALCTStructures()
adds an empty ALCTHeader, trailer, and anode data
void checkTMBClasses()
makes new TMB classes, if needed
CSCAnodeData * alctData() const
user must check if nalct > 0
unsigned short size() const
size of the data buffer used, in bytes
Definition: CSCEventData.h:39
const CSCCFEBData * cfebData(unsigned icfeb) const
unpacked in long mode: has overflow and error bits decoded
void addAnodeShower(const std::vector< CSCShowerDigi > &)
Add/pack anode CSCShower object (from OTMB header)
CSCComparatorData * comparatorData() const
user must check if nclct > 0
void addAnodeALCTShower(const std::vector< CSCShowerDigi > &)
Add/pack anode CSCShower objects (from ALCT board data)
bool isALCT(const uint16_t *buf)
if dealing with ALCT data
CSCDMBHeader theDMBHeader
Definition: CSCEventData.h:154
const CSCDMBHeader * dmbHeader() const
the DAQ motherboard header. A good place for event and chamber info
Definition: CSCEventData.h:73
CSCTMBData * theTMBData
Definition: CSCEventData.h:162
int nalct() const
the flag for existence of ALCT data
Definition: CSCEventData.h:67
void addShower(const std::vector< CSCShowerDigi > &)
Run3 CSC Shower HMT objects.
CSCALCTHeader * theALCTHeader
Definition: CSCEventData.h:159
std::ostream & operator<<(std::ostream &os, const CSCEventData &evt)
CSCDMBHeader * dmbHeader()
Definition: CSCEventData.h:74
const CSCDMBTrailer * dmbTrailer() const
DMB trailer.
Definition: CSCEventData.h:95
CSCDMBTrailer theDMBTrailer
Definition: CSCEventData.h:167
Definition: value.py:1
int chamberType() const
might not be set in real data
Definition: CSCEventData.h:124
CSCEventData operator=(const CSCEventData &data)
CSCALCTTrailer * theALCTTrailer
Definition: CSCEventData.h:161
unsigned nclct() const
Definition: CSCDMBHeader.h:43
void copy(const CSCEventData &)
bool isTMB(const uint16_t *buf)
if dealing with TMB data
std::vector< std::vector< CSCStripDigi > > stripDigis() const
deprecated. Use the above methods instead
CSCALCTTrailer * alctTrailer() const
user must check if nalct > 0
void add(const CSCStripDigi &, int layer)
routines to add digis to the data
int nclct() const
the number of CLCTs
Definition: CSCEventData.h:70
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
static std::atomic< bool > debug
Definition: CSCEventData.h:133
CSCALCTHeader * alctHeader() const
user must check if nalct > 0
CSCTMBData * tmbData() const
user must check in nclct > 0
boost::dynamic_bitset pack()
returns the packed event data.
std::vector< std::vector< CSCWireDigi > > wireDigis() const
deprecated. Use the above method instead.
void addCathodeShower(const std::vector< CSCShowerDigi > &)
Add/pack cathode CSCShower object (from OTMB header)
uint16_t getFormatVersion() const
Definition: CSCEventData.h:126
unsigned int calcALCTcrc(std::vector< std::pair< unsigned int, unsigned short *> > &vec)
static void setDebug(const bool value)
Definition: CSCEventData.h:42
CSCTMBHeader * tmbHeader() const
user must check if nclct > 0
CSCAnodeData * theAnodeData
Definition: CSCEventData.h:160
static void selfTest()