1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#ifndef EventFilter_CSCRawToDigi_CSCAnodeData2007_h
#define EventFilter_CSCRawToDigi_CSCAnodeData2007_h
#include "EventFilter/CSCRawToDigi/interface/CSCAnodeDataFormat.h"
#include "DataFormats/CSCDigi/interface/CSCALCTDigi.h"
#include <cassert>
class CSCALCTHeader;
class CSCAnodeDataFrame2007 {
public:
explicit CSCAnodeDataFrame2007(unsigned short data) { data_ = data; }
CSCAnodeDataFrame2007() {}
/// given a wiregroup between 0 and 11, it tells whether this bit was on
bool isHit(unsigned wireGroup) const {
assert(wireGroup < 12);
return ((data_ >> wireGroup) & 0x1);
}
void addHit(unsigned wireGroup) { data_ |= (1 << wireGroup); }
unsigned short data() const { return data_; }
private:
unsigned short data_ : 12;
unsigned short reserved_ : 3;
unsigned short flag_ : 1;
};
class CSCAnodeData2007 : public CSCAnodeDataFormat {
public:
/// a blank one, for Monte Carlo
explicit CSCAnodeData2007(const CSCALCTHeader &);
/// fill from a real datastream
CSCAnodeData2007(const CSCALCTHeader &, const unsigned short *buf);
unsigned short *data() override { return theDataFrames; }
/// the amount of the input binary buffer read, in 16-bit words
unsigned short int sizeInWords() const override { return sizeInWords2007_; }
/// input layer is from 1 to 6
std::vector<CSCWireDigi> wireDigis(int layer) const override;
void add(const CSCWireDigi &, int layer) override;
static void selfTest();
private:
void init(const CSCALCTHeader &);
int index(int tbin, int layer, int layerPart) const;
CSCAnodeDataFrame2007 findFrame(int tbin, int layer, int layerPart) const;
/// we don't know the size at first. Max should be 7 boards * 32 bins * 6 layers * 2
enum { MAXFRAMES = 2700 };
unsigned short theDataFrames[MAXFRAMES];
unsigned short int sizeInWords2007_;
unsigned short int nAFEBs_;
unsigned short int nTimeBins_;
unsigned short int layerParts_; ///number of layer parts in the ALCT
unsigned short int maxWireGroups_; ///number of wiregroups in the ALCT
unsigned int alctBX_; /// To account BX in wire digis
};
#endif
|