CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSCEventData.h
Go to the documentation of this file.
1 #ifndef CSCEventData_h
2 #define CSCEventData_h
3 
4 class CSCCFEBData;
5 class CLCTData;
6 class TMBScope;
7 class CSCDMBHeader;
8 class CSCDMBTrailer;
9 class CSCStripDigi;
10 class CSCALCTHeader;
11 class CSCALCTHeader2007;
12 class CSCAnodeData;
13 class CSCALCTTrailer;
14 class CSCTMBHeader;
15 class CSCTMBData;
16 class CSCCLCTData;
17 class CSCTMBTrailer;
18 class CSCWireDigi;
19 class CSCStripDigi;
20 class CSCComparatorOutput;
21 #include <map>
22 #include <vector>
34 #include <boost/dynamic_bitset.hpp>
35 
37 #define MAX_CFEB 7
38 
39 class CSCEventData {
40  public:
41  explicit CSCEventData(int chamberType, uint16_t format_version = 2005);
43  CSCEventData(unsigned short * buf, uint16_t format_version = 2005);
47  ~CSCEventData();
50 
52  unsigned short size() const {return size_;}
53 
55  static void setDebug(const bool value) {debug = value;}
56 
57 
59  bool isALCT(const short unsigned int * buf);
60 
62  bool isTMB(const short unsigned int * buf);
63 
64 
65 
66 
68  CSCCFEBData * cfebData(unsigned icfeb) const;
69 
71  std::vector<CSCStripDigi> stripDigis(const CSCDetId & idlayer) const;
72 
74  std::vector<CSCStripDigi> stripDigis(unsigned idlayer, unsigned icfeb) const;
75 
76 
78  std::vector< std::vector<CSCStripDigi> > stripDigis() const;
79 
80 
81  std::vector<CSCWireDigi> wireDigis(unsigned ilayer) const;
83  std::vector< std::vector<CSCWireDigi> > wireDigis() const;
84 
85 
87  int nalct() const {return theDMBHeader.nalct();}
88 
90  int nclct() const {return theDMBHeader.nclct();}
91 
93  const CSCDMBHeader * dmbHeader() const {return &theDMBHeader;}
95 
97  CSCALCTHeader * alctHeader() const;
98 
100  CSCALCTTrailer * alctTrailer() const;
101 
103  CSCAnodeData * alctData() const;
104 
106  CSCTMBData * tmbData() const;
107 
109  CSCTMBHeader * tmbHeader() const;
110 
112  CSCCLCTData * clctData() const;
113 
115  const CSCDMBTrailer * dmbTrailer() const {return &theDMBTrailer;}
117  void add(const CSCStripDigi &, int layer);
118  void add(const CSCWireDigi &, int layer);
119  void add(const CSCComparatorDigi &, int layer);
120  void add(const CSCComparatorDigi &, const CSCDetId &);
122  void add(const std::vector<CSCALCTDigi> &);
123  void add(const std::vector<CSCCLCTDigi> &);
124  void add(const std::vector<CSCCorrelatedLCTDigi> &);
125 
126 
129  void setEventInformation(int bxnum, int lvl1num);
130 
132  boost::dynamic_bitset<> pack();
133 
135  void addALCTStructures();
136 
138  int chamberType() const {return theChamberType;}
139 
140  uint16_t getFormatVersion() const { return theFormatVersion; }
141 
142  unsigned int calcALCTcrc(std::vector< std::pair<unsigned int, unsigned short*> > &vec);
143 
144 
145  static bool debug;
146  //uint16_t dataPresent; // 7 bit word which will tell if alct, clct, and 5 cfebs are present
147  static void selfTest();
148 
149 private:
152  void init();
153  void unpack_data(unsigned short * buf);
154  void copy(const CSCEventData &);
155  void destroy();
156 
158  void checkALCTClasses();
160  void checkTMBClasses();
161 
163  void addComparatorInformation(std::vector<CSCStripDigi>&, int layer) const;
164 
166  //these are empty data objects unless filled in CSCEventData.cc
174 
177 
179 
180  int size_;
184 
186  unsigned short * alctZSErecovered;
187  int zseEnable;
188 
191 };
192 
193 std::ostream & operator<<(std::ostream & os, const CSCEventData & evt);
194 #endif
void setEventInformation(int bxnum, int lvl1num)
bool isALCT(const short unsigned int *buf)
if dealing with ALCT data
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:186
int nclct() const
the number of CLCTs
Definition: CSCEventData.h:90
uint16_t theFormatVersion
Output Format Version (2005, 2013)
Definition: CSCEventData.h:190
#define MAX_CFEB
Maximum available CFEBs per chamber (for old system 5, for new ME11 should be 7)
Definition: CSCEventData.h:37
std::vector< std::vector< CSCStripDigi > > stripDigis() const
deprecated. Use the above methods instead
unsigned nclct() const
Definition: CSCDMBHeader.h:54
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:115
void addALCTStructures()
adds an empty ALCTHeader, trailer, and anode data
void checkTMBClasses()
makes new TMB classes, if needed
unsigned nalct() const
Definition: CSCDMBHeader.h:53
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
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:87
CSCDMBHeader theDMBHeader
Definition: CSCEventData.h:165
uint16_t getFormatVersion() const
Definition: CSCEventData.h:140
CSCCLCTData * clctData() const
user must check if nclct &gt; 0
CSCTMBData * theTMBData
Definition: CSCEventData.h:173
static bool debug
Definition: CSCEventData.h:145
CSCALCTTrailer * alctTrailer() const
user must check if nalct &gt; 0
CSCALCTHeader * theALCTHeader
Definition: CSCEventData.h:170
CSCTMBData * tmbData() const
user must check in nclct &gt; 0
CSCDMBHeader * dmbHeader()
Definition: CSCEventData.h:94
CSCDMBTrailer theDMBTrailer
Definition: CSCEventData.h:178
void unpack_data(unsigned short *buf)
Definition: CSCEventData.cc:41
CSCEventData operator=(const CSCEventData &data)
CSCCFEBData * theCFEBData[7]
for up to MAX_CFEB CFEB boards
Definition: CSCEventData.h:176
CSCALCTTrailer * theALCTTrailer
Definition: CSCEventData.h:172
bool isTMB(const short unsigned int *buf)
if dealing with TMB data
void copy(const CSCEventData &)
unsigned short size() const
size of the data buffer used, in bytes
Definition: CSCEventData.h:52
void add(const CSCStripDigi &, int layer)
routines to add digis to the data
CSCTMBHeader * tmbHeader() const
user must check if nclct &gt; 0
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
CSCCFEBData * cfebData(unsigned icfeb) const
unpacked in long mode: has overflow and error bits decoded
int chamberType() const
might not be set in real data
Definition: CSCEventData.h:138
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:93
static void setDebug(const bool value)
Definition: CSCEventData.h:55
CSCAnodeData * theAnodeData
Definition: CSCEventData.h:171
static void selfTest()