Skip to content

Commit 9eaf2ce

Browse files
committed
GEMDigiToRawModule - always make AMCs
1 parent ef24cdc commit 9eaf2ce

File tree

6 files changed

+25
-24
lines changed

6 files changed

+25
-24
lines changed

CondFormats/GEMObjects/interface/GEMROMapping.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class GEMROMapping {
88
public:
99
struct chamEC {
10-
unsigned int fedId;
10+
int fedId;
1111
uint8_t amcNum;
1212
uint8_t gebId;
1313
bool operator<(const chamEC& r) const {

CondFormats/GEMObjects/interface/GEMeMap.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class GEMeMap {
1919
void convertDummy(GEMROMapping& romap);
2020

2121
struct GEMChamberMap {
22-
std::vector<unsigned int> fedId;
22+
std::vector<int> fedId;
2323
std::vector<uint8_t> amcNum;
2424
std::vector<uint8_t> gebId;
2525
std::vector<int> gemNum;
@@ -59,9 +59,11 @@ class GEMeMap {
5959
static const int vfatVerV3_ = 3; // VFAT v3
6060
static const int vfatTypeV3_ = 11; // VFAT v3
6161
static const int chipIdMask_ = 0xfff; // chipId mask for 12 bits
62+
static const int maxAMCs_ = 15; // 4 bits for AMC no.
6263
static const int maxGEBs_ = 32; // 5 bits for GEB id
63-
static const int maxAMCs_ = 16; // 4 bits for AMC no.
64-
static const int maxVFatGE0_ = 12; // vFat per eta partition, not known yet for ME0
64+
static const int maxGEB0_ = 30; // Not known yet for ME0
65+
static const int maxGEB1_ = 12; // 12 for GE11
66+
static const int maxVFatGE0_ = 3; // vFat per eta partition, not known yet for ME0
6567
static const int maxVFatGE11_ = 3; // vFat per eta partition in GE11
6668
static const int maxVFatGE21_ = 6; // vFat per eta partition in GE21
6769
static const int maxChan_ = 128; // channels per vFat

DataFormats/GEMDigi/interface/AMCdata.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ namespace gem {
9292
uint8_t amcNum() const { return AMCheader1{amch1_}.AMCnum; }
9393

9494
uint16_t boardId() const { return AMCheader2{amch2_}.boardID; }
95-
uint16_t orbitNum() const { return AMCheader2{amch2_}.orbitNum; }
95+
int16_t orbitNum() const { return AMCheader2{amch2_}.orbitNum; }
9696
uint8_t param3() const { return AMCheader2{amch2_}.param3; }
9797
uint8_t param2() const { return AMCheader2{amch2_}.param2; }
9898
uint8_t param1() const { return AMCheader2{amch2_}.param1; }

EventFilter/GEMRawToDigi/plugins/GEMDigiToRawModule.cc

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ void GEMDigiToRawModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve
123123
}
124124
}
125125

126-
for (unsigned int fedId = FEDNumbering::MINGEMFEDID; fedId <= FEDNumbering::MAXME0FEDID; ++fedId) {
126+
for (int fedId = FEDNumbering::MINGEMFEDID; fedId <= FEDNumbering::MAXME0FEDID; ++fedId) {
127127
uint32_t amc13EvtLength = 0;
128128
std::unique_ptr<AMC13Event> amc13Event = std::make_unique<AMC13Event>();
129129

@@ -146,7 +146,7 @@ void GEMDigiToRawModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve
146146
uint16_t vfatId = vfat_ec.vfatAdd;
147147

148148
for (auto const& gemBx : gemBxMap) {
149-
int bc = amcData->bx() + gemBx.first;
149+
int bc = BX_id + gemBx.first;
150150

151151
bool hasDigi = false;
152152
uint64_t lsData = 0; ///<channels from 1to64
@@ -188,24 +188,22 @@ void GEMDigiToRawModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve
188188

189189
} // end of vfats in GEB
190190

191-
if (!gebData->vFATs()->empty()) {
191+
if (!gebData->vFATs()->empty()) {
192192
amcSize += 2;
193193
gebData->setChamberHeader(gebData->vFATs()->size() * 3, gebId);
194194
gebData->setChamberTrailer(LV1_id, BX_id, gebData->vFATs()->size() * 3);
195195
amcData->addGEB(*gebData);
196-
}
196+
}
197197
} // end of GEB loop
198198

199-
if (!amcData->gebs()->empty()) {
200-
amcSize += 5;
201-
amcData->setAMCheader1(amcSize, BX_id, LV1_id, amcNum);
202-
amcData->setAMCheader2(amcNum, OrN, 1);
203-
amcData->setGEMeventHeader(amcData->gebs()->size(), 0);
204-
amc13Event->addAMCpayload(*amcData);
205-
// AMC header in AMC13Event
206-
amc13Event->addAMCheader(amcSize, 0, amcNum, 0);
207-
amc13EvtLength += amcSize + 1; // AMC data size + AMC header size
208-
}
199+
amcSize += 5;
200+
amcData->setAMCheader1(amcSize, BX_id, LV1_id, amcNum);
201+
amcData->setAMCheader2(amcNum, OrN, 1);
202+
amcData->setGEMeventHeader(amcData->gebs()->size(), 0);
203+
amc13Event->addAMCpayload(*amcData);
204+
// AMC header in AMC13Event
205+
amc13Event->addAMCheader(amcSize, 0, amcNum, 0);
206+
amc13EvtLength += amcSize + 1; // AMC data size + AMC header size
209207

210208
} // end of AMC loop
211209

@@ -218,9 +216,9 @@ void GEMDigiToRawModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve
218216
amc13Event->setAMC13Trailer(BX_id, LV1_id, BX_id);
219217
//CDF trailer
220218
uint32_t EvtLength = amc13EvtLength + 4; // 2 header and 2 trailer
221-
222219
amc13Event->setCDFTrailer(EvtLength);
223-
amc13Events.emplace_back(std::move(amc13Event));
220+
221+
amc13Events.emplace_back(std::move(amc13Event));
224222
} // finished making amc13Event data
225223
} // end of FED loop
226224

EventFilter/GEMRawToDigi/plugins/GEMRawToDigiModule.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ void GEMRawToDigiModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve
111111

112112
auto gemROMap = runCache(iEvent.getRun().index());
113113

114-
for (unsigned int fedId = FEDNumbering::MINGEMFEDID; fedId <= FEDNumbering::MAXGEMFEDID; ++fedId) {
114+
for (int fedId = FEDNumbering::MINGEMFEDID; fedId <= FEDNumbering::MAXGEMFEDID; ++fedId) {
115115
const FEDRawData& fedData = fed_buffers->FEDData(fedId);
116116

117117
int nWords = fedData.size() / sizeof(uint64_t);
@@ -122,7 +122,7 @@ void GEMRawToDigiModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve
122122

123123
// trailer checks
124124
FEDTrailer trailer(fedData.data() + fedData.size() - FEDTrailer::length);
125-
125+
126126
bool failTrailerCheck = false, failTrailerMatch = false;
127127
if (!trailer.check() || (trailer.fragmentLength() * sizeof(uint64_t) != fedData.size())) {
128128
failTrailerCheck = true;

EventFilter/GEMRawToDigi/src/GEMRawToDigi.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
*/
44
#include "EventFilter/GEMRawToDigi/interface/GEMRawToDigi.h"
55
#include "FWCore/MessageLogger/interface/MessageLogger.h"
6-
6+
// temp
7+
#include <iostream>
78
using namespace gem;
89

910
std::unique_ptr<AMC13Event> GEMRawToDigi::convertWordToAMC13Event(const uint64_t* word) {

0 commit comments

Comments
 (0)