10 unsigned packedChip = ((chip & 1) + 2 * (chip > 1));
11 theFrame = data + ((tbin & 0x1F) << 8) + (packedChip << 13);
15 : nAFEBs_(header.nLCTChipRead()), nTimeBins_(header.NTBins()) {
19 for (
int afeb = 0; afeb <
nAFEBs_; ++afeb) {
20 for (
int tbin = 0; tbin <
nTimeBins_; ++tbin) {
22 for (
int halfLayer = 0; halfLayer < 2; ++halfLayer) {
34 : nAFEBs_(header.nLCTChipRead()), nTimeBins_(header.NTBins()) {
40 LogTrace(
"CSCAnodeData|CSCRawToDigi") << header <<
" HEADER CHECK " << header.
check();
46 std::vector<CSCWireDigi> digis;
47 uint32_t tbinbits = 0;
48 uint16_t wireGroup = 0;
49 for (
int afeb = 0; afeb <
nAFEBs_; ++afeb) {
50 for (
int halfLayer = 0; halfLayer < 2; ++halfLayer) {
51 for (
int j = 0;
j < 8; ++
j) {
52 for (
int tbin = 0; tbin <
nTimeBins_; ++tbin) {
55 if (frame.
data() != 0) {
57 tbinbits = tbinbits + (1 << tbin);
62 wireGroup = (afeb * 16 + halfLayer * 8 +
j) + 1;
64 wireGroup = wireGroup | (wireGroupBX << 16);
66 LogTrace(
"CSCAnodeData|CSCRawToDigi") <<
"Layer " << layer <<
" " << digi;
67 digis.push_back(digi);
80 int alctBoard = (wireGroup - 1) / 16;
81 int localGroup = (wireGroup - 1) % 16;
87 edm::LogError(
"CSCAnodeData|CSCRawToDigi") <<
"Bad Wire Number for this digi.";
93 unsigned halfLayer = (localGroup > 7);
94 unsigned bitNumber = localGroup % 8;
96 addHit(alctBoard, bxn, layer, halfLayer, bitNumber);
98 LogTrace(
"CSCAnodeData|CSCRawToDigi") <<
"warning: not saving anode data in bx " << bxn <<
": out of range ";
103 int i =
index(afeb, tbin, layer) + halfLayer;
133 anodeData.
add(wireDigi, 1);
134 anodeData.
add(wireDigi, 6);
136 std::vector<CSCWireDigi> wires1 = anodeData.
wireDigis(1);
137 std::vector<CSCWireDigi> wires6 = anodeData.
wireDigis(6);
139 assert(wires1.size() == 1);
140 assert(wires6.size() == 1);
141 assert(wires1[0].getWireGroup() == 10);
142 assert(wires6[0].getWireGroup() == 10);
void addHit(unsigned wireBit)
sets a bit, from 0 to 7
CSCAnodeDataFrame2006 rawHit(int afeb, int tbin, int layer, int halfLayer) const
unsigned short theDataFrames[2700]
we don't know the size at first. Max should be 7 boards * 32 bins * 6 layers * 2
Log< level::Error, false > LogError
constexpr std::array< uint8_t, layerIndexSize > layer
int getBeamCrossingTag() const
return tbin number, (obsolete, use getTimeBin() instead)
int index(int afeb, int tbin, int layer) const
the index into theDataFrames
unsigned tbin() const
time bin
CSCAnodeData2006(const CSCALCTHeader &)
a blank one, for Monte Carlo
int getWireGroup() const
default
unsigned short data() const
int nAFEBs_
in 2007 format the max number of frames is 1860
void add(const CSCWireDigi &, int layer) override
char data[epos_bytes_allocation]
bool isHit(unsigned wireGroup) const
given a wiregroup between 0 and 7, it tells whether this bit was on
void addHit(int afeb, int tbin, int layer, int halfLayer, unsigned wireBit)
unsigned short int sizeInWords() const override
the amount of the input binary buffer read, in 16-bit words
std::vector< CSCWireDigi > wireDigis(int layer) const override
input layer is from 1 to 6
unsigned short frame() const