24 : event_type_(
pset.getParameter<
int>(
"eventType")),
26 useDBEMap_(
pset.getParameter<
bool>(
"useDBEMap")) {
27 produces<FEDRawDataCollection>();
33 desc.
add<
int>(
"eventType", 0);
34 desc.
add<
bool>(
"useDBEMap",
false);
35 descriptions.
add(
"gemPackerDefault", desc);
39 auto gemROmap = std::make_shared<GEMROMapping>();
43 auto gemEMap = std::make_unique<GEMeMap>(*(gemEMapRcd.
product()));
44 gemEMap->convert(*gemROmap);
48 auto gemEMap = std::make_unique<GEMeMap>();
49 gemEMap->convertDummy(*gemROmap);
56 auto fedRawDataCol = std::make_unique<FEDRawDataCollection>();
65 auto gemROMap = runCache(
iEvent.getRun().index());
67 std::vector<std::unique_ptr<AMC13Event>> amc13Events;
71 std::unique_ptr<AMC13Event> amc13Event = std::make_unique<AMC13Event>();
74 std::unique_ptr<AMCdata> amcData = std::make_unique<AMCdata>();
77 std::unique_ptr<GEBdata> gebData = std::make_unique<GEBdata>();
80 if (!gemROMap->isValidChamber(geb_ec))
84 auto vfats = gemROMap->getVfats(geb_dc.
detId);
85 for (
auto vfat_ec : vfats) {
88 uint16_t vfatId = vfat_ec.vfatAdd;
98 const GEMDigi& digi = (*digiIt);
112 if (chMap.
chNum < 64)
113 lsData |= 1UL << chMap.
chNum;
115 msData |= 1UL << (chMap.
chNum - 64);
118 <<
" fed: " <<
fedId <<
" amc:" <<
int(amcNum) <<
" geb:" <<
int(gebId)
119 <<
" vfat:" << vfat_dc.
localPhi <<
",type: " << vfat_dc.
vfatType <<
" id:" << gemId
120 <<
" ch:" << chMap.
chNum <<
" st:" << digi.
strip() <<
" bx:" << digi.
bx();
126 auto vfatData = std::make_unique<VFATdata>(geb_dc.
vfatVer, bc, 0, vfatId, lsData, msData);
127 gebData->addVFAT(*vfatData);
132 if (!gebData->vFATs()->empty()) {
133 gebData->setChamberHeader(gebData->vFATs()->size() * 3, gebId);
134 gebData->setChamberTrailer(0, 0, gebData->vFATs()->size() * 3);
135 amcData->addGEB(*gebData);
140 if (!amcData->gebs()->empty()) {
142 amcData->setAMCheader2(amcNum, 0, 1);
143 amcData->setGEMeventHeader(amcData->gebs()->size(), 0);
144 amc13Event->addAMCpayload(*amcData);
149 if (!amc13Event->getAMCpayloads()->empty()) {
151 uint32_t LV1_id =
iEvent.id().event();
152 uint16_t BX_id =
iEvent.bunchCrossing();
157 uint8_t nAMC = amc13Event->getAMCpayloads()->size();
159 amc13Event->setAMC13Header(CalTyp, nAMC, OrN);
161 for (
unsigned short i = 0;
i < amc13Event->nAMC(); ++
i) {
162 uint32_t AMC_size = 0;
165 uint16_t BoardID = 0;
166 amc13Event->addAMCheader(AMC_size, Blk_No, AMC_No, BoardID);
172 uint16_t BX_idT = BX_id;
173 amc13Event->setAMC13Trailer(Blk_NoT, LV1_idT, BX_idT);
175 uint32_t EvtLength = 0;
176 amc13Event->setCDFTrailer(EvtLength);
177 amc13Events.emplace_back(
std::move(amc13Event));
183 for (
const auto& amc13e : amc13Events) {
184 std::vector<uint64_t> words;
185 words.emplace_back(amc13e->getCDFHeader());
186 words.emplace_back(amc13e->getAMC13Header());
188 for (
const auto&
w : *amc13e->getAMCheaders())
189 words.emplace_back(
w);
191 for (
const auto&
amc : *amc13e->getAMCpayloads()) {
192 words.emplace_back(
amc.getAMCheader1());
193 words.emplace_back(
amc.getAMCheader2());
194 words.emplace_back(
amc.getGEMeventHeader());
196 for (
const auto& geb : *
amc.gebs()) {
197 words.emplace_back(geb.getChamberHeader());
199 for (
const auto& vfat : *geb.vFATs()) {
200 words.emplace_back(vfat.get_fw());
201 words.emplace_back(vfat.get_sw());
202 words.emplace_back(vfat.get_tw());
205 words.emplace_back(geb.getChamberTrailer());
208 words.emplace_back(
amc.getGEMeventTrailer());
209 words.emplace_back(
amc.getAMCTrailer());
212 words.emplace_back(amc13e->getAMC13Trailer());
213 words.emplace_back(amc13e->getCDFTrailer());
217 int dataSize = (words.size()) *
sizeof(
uint64_t);
221 for (
const auto&
word : words)
224 LogDebug(
"GEMDigiToRawModule") <<
" words " << words.size();