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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
#include "EventFilter/CSCRawToDigi/interface/CSCALCTHeader2006.h"
#include "EventFilter/CSCRawToDigi/interface/CSCDMBHeader.h"
#ifdef LOCAL_UNPACK
static int activeFEBsForChamberType[11] = {0, 7, 7, 0xf, 7, 0x7f, 0xf, 0x3f, 0xf, 0x3f, 0xf};
static int nTBinsForChamberType[11] = {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7};
#else
constexpr int activeFEBsForChamberType[11] = {0, 7, 7, 0xf, 7, 0x7f, 0xf, 0x3f, 0xf, 0x3f, 0xf};
constexpr int nTBinsForChamberType[11] = {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7};
#endif
CSCALCTHeader2006::CSCALCTHeader2006(int chamberType) { //constructor for digi->raw packing based on header2006
// we count from 1 to 10, ME11, ME12, ME13, ME1A, ME21, ME22, ....
init();
flag_0 = 0xC;
flag_1 = 0;
reserved_1 = 0;
fifoMode = 1;
// examiner demands this
l1aMatch = 1;
lctChipRead = activeFEBsForChamberType[chamberType];
activeFEBs = lctChipRead;
nTBins = nTBinsForChamberType[chamberType];
///in order to be able to return header via data()
//memcpy(theOriginalBuffer, &header2006, header2006.sizeForPacking());
}
void CSCALCTHeader2006::setEventInformation(const CSCDMBHeader& dmb) {
l1Acc = dmb.l1a();
cscID = dmb.dmbID();
nTBins = 16;
bxnCount = dmb.bxn();
}
unsigned short CSCALCTHeader2006::nLCTChipRead() const { ///header2006 method
int count = 0;
for (int i = 0; i < 7; ++i) {
if ((lctChipRead >> i) & 1)
++count;
}
return count;
}
std::vector<CSCALCTDigi> CSCALCTs2006::ALCTDigis() const {
std::vector<CSCALCTDigi> result;
result.reserve(2);
CSCALCTDigi digi0(
alct0_valid, alct0_quality, alct0_accel, alct0_pattern, alct0_key_wire, alct0_bxn_low | (alct0_bxn_high << 3), 1);
CSCALCTDigi digi1(
alct1_valid, alct1_quality, alct1_accel, alct1_pattern, alct1_key_wire, alct1_bxn_low | (alct1_bxn_high << 3), 2);
result.push_back(digi0);
result.push_back(digi1);
return result;
}
void CSCALCTs2006::add(const std::vector<CSCALCTDigi>& digis) {
//FIXME doesn't do any sorting
if (!digis.empty())
addALCT0(digis[0]);
if (digis.size() > 1)
addALCT1(digis[1]);
}
void CSCALCTs2006::addALCT0(const CSCALCTDigi& digi) {
alct0_valid = digi.isValid();
alct0_quality = digi.getQuality();
alct0_accel = digi.getAccelerator();
alct0_pattern = digi.getCollisionB();
alct0_key_wire = digi.getKeyWG();
// probably not right
alct0_bxn_low = digi.getBX();
}
void CSCALCTs2006::addALCT1(const CSCALCTDigi& digi) {
alct1_valid = digi.isValid();
alct1_quality = digi.getQuality();
alct1_accel = digi.getAccelerator();
alct1_pattern = digi.getCollisionB();
alct1_key_wire = digi.getKeyWG();
// probably not right
alct1_bxn_low = digi.getBX();
}
|