66 useDBEMap_(
pset.getParameter<
bool>(
"useDBEMap")),
67 keepDAQStatus_(
pset.getParameter<
bool>(
"keepDAQStatus")),
68 readMultiBX_(
pset.getParameter<
bool>(
"readMultiBX")),
69 unPackStatusDigis_(
pset.getParameter<
bool>(
"unPackStatusDigis")),
71 produces<GEMDigiCollection>();
73 produces<GEMAMC13StatusCollection>(
"AMC13Status");
74 produces<GEMAMCStatusCollection>(
"AMCStatus");
75 produces<GEMOHStatusCollection>(
"OHStatus");
76 produces<GEMVFATStatusCollection>(
"VFATStatus");
80 produces<GEMVfatStatusDigiCollection>(
"vfatStatus");
81 produces<GEMGEBdataCollection>(
"gebStatus");
82 produces<GEMAMCdataCollection>(
"AMCdata");
83 produces<GEMAMC13EventCollection>(
"AMC13Event");
86 gemEMapToken_ = esConsumes<GEMeMap, GEMeMapRcd, edm::Transition::BeginRun>();
93 desc.add<
bool>(
"useDBEMap",
false);
94 desc.add<
bool>(
"unPackStatusDigis",
false);
95 desc.add<
bool>(
"keepDAQStatus",
false);
96 desc.add<
bool>(
"readMultiBX",
false);
97 descriptions.
add(
"muonGEMDigisDefault",
desc);
101 auto gemROmap = std::make_shared<GEMROMapping>();
104 auto gemEMap = std::make_unique<GEMeMap>(eMap);
105 gemEMap->convert(*gemROmap);
109 auto gemEMap = std::make_unique<GEMeMap>();
110 gemEMap->convertDummy(*gemROmap);
117 auto outGEMDigis = std::make_unique<GEMDigiCollection>();
118 auto outAMC13Status = std::make_unique<GEMAMC13StatusCollection>();
119 auto outAMCStatus = std::make_unique<GEMAMCStatusCollection>();
120 auto outOHStatus = std::make_unique<GEMOHStatusCollection>();
121 auto outVFATStatus = std::make_unique<GEMVFATStatusCollection>();
124 auto outVFATStatusOld = std::make_unique<GEMVfatStatusDigiCollection>();
125 auto outGEBStatus = std::make_unique<GEMGEBdataCollection>();
126 auto outAMCdata = std::make_unique<GEMAMCdataCollection>();
127 auto outAMC13Event = std::make_unique<GEMAMC13EventCollection>();
133 auto gemROMap = runCache(
iEvent.getRun().index());
139 LogDebug(
"GEMRawToDigiModule") <<
"fedId:" <<
fedId <<
" words: " << nWords;
141 if (st_amc13.
isBad()) {
142 LogDebug(
"GEMRawToDigiModule") << st_amc13;
144 outAMC13Status.get()->insertDigi(
fedId, st_amc13);
151 LogDebug(
"GEMRawToDigiModule") <<
"Event bx:" <<
iEvent.bunchCrossing() <<
" lv1Id:" <<
iEvent.id().event()
152 <<
" orbitNumber:" <<
iEvent.orbitNumber();
153 LogDebug(
"GEMRawToDigiModule") <<
"AMC13 bx:" << amc13Event->bunchCrossing()
154 <<
" lv1Id:" <<
int(amc13Event->lv1Id())
155 <<
" orbitNumber:" << amc13Event->orbitNumber();
158 for (
auto amcData : *(amc13Event->getAMCpayloads())) {
159 uint8_t amcNum = amcData.amcNum();
161 if (!gemROMap->isValidAMC(amcEC)) {
167 if (st_amc.isBad()) {
168 LogDebug(
"GEMRawToDigiModule") << st_amc;
170 outAMCStatus.get()->insertDigi(
fedId, st_amc);
175 uint16_t amcBx = amcData.bunchCrossing();
176 LogDebug(
"GEMRawToDigiModule") <<
"AMC no.:" <<
int(amcData.amcNum()) <<
" bx:" <<
int(amcData.bunchCrossing())
177 <<
" lv1Id:" <<
int(amcData.lv1Id())
178 <<
" orbitNumber:" <<
int(amcData.orbitNumber());
181 for (
auto optoHybrid : *amcData.gebs()) {
182 uint8_t gebId = optoHybrid.inputID();
185 bool isValidChamber = gemROMap->isValidChamber(geb_ec);
186 if (!isValidChamber) {
195 LogDebug(
"GEMRawToDigiModule") << st_oh;
197 outOHStatus.get()->insertDigi(gemChId, st_oh);
202 for (
auto vfatData : *optoHybrid.vFATs()) {
204 vfatData.setVersion(geb_dc.
vfatVer);
205 uint16_t vfatId = vfatData.vfatId();
208 if (!gemROMap->isValidChipID(vfat_ec)) {
218 if (st_vfat.isBad()) {
219 LogDebug(
"GEMRawToDigiModule") << st_vfat;
221 outVFATStatus.get()->insertDigi(gemId, st_vfat);
226 int bx(vfatData.bc() - amcBx);
231 chan0xf = ((vfatData.lsData() >>
chan) & 0
x1);
233 chan0xf = ((vfatData.msData() >> (
chan - 64)) & 0x1);
247 <<
"fed: " <<
fedId <<
" amc:" <<
int(amcNum) <<
" geb:" <<
int(gebId) <<
" vfat id:" <<
int(vfatId)
248 <<
",type:" << vfat_dc.
vfatType <<
" id:" << gemId <<
" ch:" << chMap.chNum <<
" st:" << digi.
strip()
249 <<
" bx:" << digi.
bx();
251 outGEMDigis.get()->insertDigi(gemId, digi);
256 outVFATStatus.get()->insertDigi(gemId, st_vfat);
265 outOHStatus.get()->insertDigi(gemChId, st_oh);
268 optoHybrid.clearVFATs();
269 outGEBStatus.get()->insertDigi(gemChId.
chamberId(), (optoHybrid));
275 outAMCStatus.get()->insertDigi(
fedId, st_amc);
279 outAMCdata.get()->insertDigi(amcData.boardId(), (amcData));
285 outAMC13Status.get()->insertDigi(
fedId, st_amc13);
289 amc13Event->clearAMCpayloads();