Skip to content

Commit

Permalink
Merge pull request #31776 from jshlee/gem-fed-bugfix-CMSSW_11_2_0_pre6
Browse files Browse the repository at this point in the history
GEM - fed data size
  • Loading branch information
cmsbuild authored Oct 14, 2020
2 parents b9b52ed + d2467cd commit d3fe185
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
10 changes: 7 additions & 3 deletions EventFilter/GEMRawToDigi/plugins/GEMDigiToRawModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/Utilities/interface/ESGetToken.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

class GEMDigiToRawModule : public edm::global::EDProducer<edm::RunCache<GEMROMapping>> {
public:
Expand Down Expand Up @@ -122,8 +123,8 @@ void GEMDigiToRawModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve
}
}

uint32_t amc13EvtLength = 0;
for (unsigned int fedId = FEDNumbering::MINGEMFEDID; fedId <= FEDNumbering::MAXGEMFEDID; ++fedId) {
uint32_t amc13EvtLength = 0;
std::unique_ptr<AMC13Event> amc13Event = std::make_unique<AMC13Event>();

for (auto const& gemBx : gemBxMap) {
Expand Down Expand Up @@ -222,6 +223,8 @@ void GEMDigiToRawModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve
amc13Event->setAMC13Trailer(BX_id, LV1_id, BX_id);
//CDF trailer
uint32_t EvtLength = amc13EvtLength + 4; // 2 header and 2 trailer
LogDebug("GEMDigiToRawModule") << " EvtLength: " << int(EvtLength);

amc13Event->setCDFTrailer(EvtLength);
amc13Events.emplace_back(std::move(amc13Event));
} // finished making amc13Event data
Expand Down Expand Up @@ -266,9 +269,10 @@ void GEMDigiToRawModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve
fedRawData.resize(dataSize);

uint64_t* w = reinterpret_cast<uint64_t*>(fedRawData.data());
for (const auto& word : words)
for (const auto& word : words) {
LogDebug("GEMDigiToRawModule") << std::bitset<64>(word);
*(w++) = word;

}
LogDebug("GEMDigiToRawModule") << " words " << words.size();
}

Expand Down
12 changes: 7 additions & 5 deletions EventFilter/GEMRawToDigi/plugins/GEMRawToDigiModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "FWCore/Utilities/interface/ESGetToken.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "FWCore/Utilities/interface/Transition.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

class GEMRawToDigiModule : public edm::global::EDProducer<edm::RunCache<GEMROMapping> > {
public:
Expand Down Expand Up @@ -113,13 +114,14 @@ void GEMRawToDigiModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve
const FEDRawData& fedData = fed_buffers->FEDData(fedId);

int nWords = fedData.size() / sizeof(uint64_t);
LogDebug("GEMRawToDigiModule") << " words " << nWords;
LogDebug("GEMRawToDigiModule") << "fedId:" << fedId << " words: " << nWords;

if (nWords < 5)
continue;
const unsigned char* data = fedData.data();

const uint64_t* word = reinterpret_cast<const uint64_t*>(data);

auto amc13Event = gemRawToDigi_->convertWordToAMC13Event(word);

if (amc13Event == nullptr)
Expand All @@ -133,7 +135,6 @@ void GEMRawToDigiModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve
for (auto gebData : *amcData.gebs()) {
uint8_t gebId = gebData.inputID();
GEMROMapping::chamEC geb_ec = {fedId, amcNum, gebId};
LogDebug("GEMRawToDigiModule") << " fed: " << fedId << " amc:" << int(amcNum) << " geb:" << int(gebId);
GEMROMapping::chamDC geb_dc = gemROMap->chamberPos(geb_ec);
GEMDetId gemChId = geb_dc.detId;

Expand All @@ -142,7 +143,6 @@ void GEMRawToDigiModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve
vfatData.setVersion(geb_dc.vfatVer);
uint16_t vfatId = vfatData.vfatId();
GEMROMapping::vfatEC vfat_ec = {vfatId, gemChId};
LogDebug("GEMRawToDigiModule") << " vfatId: " << vfatId << " gemChId:" << gemChId;

// check if ChipID exists.
if (!gemROMap->isValidChipID(vfat_ec)) {
Expand All @@ -167,7 +167,6 @@ void GEMRawToDigiModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve
vfatData.setPhi(vfat_dc.localPhi);
GEMDetId gemId = vfat_dc.detId;
int bx(vfatData.bc());
LogDebug("GEMRawToDigiModule") << " gemId: " << gemId << " bx:" << bx;

for (int chan = 0; chan < VFATdata::nChannels; ++chan) {
uint8_t chan0xf = 0;
Expand All @@ -187,7 +186,10 @@ void GEMRawToDigiModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve

GEMDigi digi(stripId, bx);

LogDebug("GEMRawToDigiModule") << stripId << " ";
LogDebug("GEMRawToDigiModule")
<< " fed: " << fedId << " amc:" << int(amcNum) << " geb:" << int(gebId) << " vfat:" << vfat_dc.localPhi
<< ",type: " << vfat_dc.vfatType << " id:" << gemId << " ch:" << chMap.chNum << " st:" << digi.strip()
<< " bx:" << digi.bx();

outGEMDigis.get()->insertDigi(gemId, digi);

Expand Down

0 comments on commit d3fe185

Please sign in to comment.