test
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 struct 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>
23 #ifndef LOCAL_UNPACK
24 #include <atomic>
25 #endif
37 #include <boost/dynamic_bitset.hpp>
38 
40 #define MAX_CFEB 7
41 
42 class CSCEventData {
43  public:
44  explicit CSCEventData(int chamberType, uint16_t format_version = 2005);
46  CSCEventData(unsigned short * buf, uint16_t format_version = 2005);
50  ~CSCEventData();
53 
55  unsigned short size() const {return size_;}
56 
58  static void setDebug(const bool value) {debug = value;}
59 
60 
62  bool isALCT(const short unsigned int * buf);
63 
65  bool isTMB(const short unsigned int * buf);
66 
67 
68 
69 
71  CSCCFEBData * cfebData(unsigned icfeb) const;
72 
74  std::vector<CSCStripDigi> stripDigis(const CSCDetId & idlayer) const;
75 
77  std::vector<CSCStripDigi> stripDigis(unsigned idlayer, unsigned icfeb) const;
78 
79 
81  std::vector< std::vector<CSCStripDigi> > stripDigis() const;
82 
83 
84  std::vector<CSCWireDigi> wireDigis(unsigned ilayer) const;
86  std::vector< std::vector<CSCWireDigi> > wireDigis() const;
87 
88 
90  int nalct() const {return theDMBHeader.nalct();}
91 
93  int nclct() const {return theDMBHeader.nclct();}
94 
96  const CSCDMBHeader * dmbHeader() const {return &theDMBHeader;}
98 
100  CSCALCTHeader * alctHeader() const;
101 
103  CSCALCTTrailer * alctTrailer() const;
104 
106  CSCAnodeData * alctData() const;
107 
109  CSCTMBData * tmbData() const;
110 
112  CSCTMBHeader * tmbHeader() const;
113 
115  CSCCLCTData * clctData() const;
116 
118  const CSCDMBTrailer * dmbTrailer() const {return &theDMBTrailer;}
120  void add(const CSCStripDigi &, int layer);
121  void add(const CSCWireDigi &, int layer);
122  void add(const CSCComparatorDigi &, int layer);
123  void add(const CSCComparatorDigi &, const CSCDetId &);
125  void add(const std::vector<CSCALCTDigi> &);
126  void add(const std::vector<CSCCLCTDigi> &);
127  void add(const std::vector<CSCCorrelatedLCTDigi> &);
128 
129 
132  void setEventInformation(int bxnum, int lvl1num);
133 
135  boost::dynamic_bitset<> pack();
136 
138  void addALCTStructures();
139 
141  int chamberType() const {return theChamberType;}
142 
143  uint16_t getFormatVersion() const { return theFormatVersion; }
144 
145  unsigned int calcALCTcrc(std::vector< std::pair<unsigned int, unsigned short*> > &vec);
146 
147 
148 #ifdef LOCAL_UNPACK
149  static bool debug;
150 #else
151  static std::atomic<bool> debug;
152 #endif
153  //uint16_t dataPresent; // 7 bit word which will tell if alct, clct, and 5 cfebs are present
154  static void selfTest();
155 
156 private:
159  void init();
160  void unpack_data(unsigned short * buf);
161  void copy(const CSCEventData &);
162  void destroy();
163 
165  void checkALCTClasses();
167  void checkTMBClasses();
168 
170  void addComparatorInformation(std::vector<CSCStripDigi>&, int layer) const;
171 
173  //these are empty data objects unless filled in CSCEventData.cc
181 
184 
186 
187  int size_;
191 
193  unsigned short * alctZSErecovered;
194  int zseEnable;
195 
198 };
199 
200 std::ostream & operator<<(std::ostream & os, const CSCEventData & evt);
201 #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:193
int nclct() const
the number of CLCTs
Definition: CSCEventData.h:93
uint16_t theFormatVersion
Output Format Version (2005, 2013)
Definition: CSCEventData.h:197
#define MAX_CFEB
Maximum available CFEBs per chamber (for old system 5, for new ME11 should be 7)
Definition: CSCEventData.h:40
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:118
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:188
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:90
CSCDMBHeader theDMBHeader
Definition: CSCEventData.h:172
uint16_t getFormatVersion() const
Definition: CSCEventData.h:143
CSCCLCTData * clctData() const
user must check if nclct &gt; 0
CSCTMBData * theTMBData
Definition: CSCEventData.h:180
CSCALCTTrailer * alctTrailer() const
user must check if nalct &gt; 0
CSCALCTHeader * theALCTHeader
Definition: CSCEventData.h:177
CSCTMBData * tmbData() const
user must check in nclct &gt; 0
CSCDMBHeader * dmbHeader()
Definition: CSCEventData.h:97
CSCDMBTrailer theDMBTrailer
Definition: CSCEventData.h:185
void unpack_data(unsigned short *buf)
Definition: CSCEventData.cc:45
CSCEventData operator=(const CSCEventData &data)
CSCCFEBData * theCFEBData[7]
for up to MAX_CFEB CFEB boards
Definition: CSCEventData.h:183
CSCALCTTrailer * theALCTTrailer
Definition: CSCEventData.h:179
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:55
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
static std::atomic< bool > debug
Definition: CSCEventData.h:151
int chamberType() const
might not be set in real data
Definition: CSCEventData.h:141
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:96
static void setDebug(const bool value)
Definition: CSCEventData.h:58
CSCAnodeData * theAnodeData
Definition: CSCEventData.h:178
static void selfTest()