|
|
Go to the documentation of this file.
37 {0x0ff,
"All RCT Calo Regions"},
39 {0x583,
"ConcJet: Jet Cands and Counts Output to GT"},
41 {0x683,
"ConcElec: EM Cands and Energy Sums Output to GT"},
43 {0x804,
"Leaf0ElecPosEtaU1: Raw Input"},
44 {0x884,
"Leaf0ElecPosEtaU2: Raw Input"},
45 {0xc04,
"Leaf0ElecNegEtaU1: Raw Input"},
46 {0xc84,
"Leaf0ElecNegEtaU2: Raw Input"}};
68 {0x804, 13}, {0x884, 9}, {0xc04, 4}, {0xc84, 0}};
99 uint32_t blockId = hdr & 0xfff;
100 uint32_t blockLength = 0;
101 uint32_t
nSamples = (hdr >> 16) & 0xf;
102 uint32_t bxId = (hdr >> 20) & 0xfff;
103 uint32_t eventId = (hdr >> 12) & 0xf;
153 unsigned&
offset = bx0EmCandOffsets.at(iCat);
155 LogDebug(
"GCT") <<
"No EM candidates with bx=0!\nAborting packing of GCT EM Cand and Energy Sum Output!";
160 <<
"Insufficient EM candidates with bx=0!\nAborting packing of GCT EM Cand and Energy Sum Output!";
165 unsigned bx0EtTotalOffset, bx0EtHadOffset, bx0EtMissOffset;
167 LogDebug(
"GCT") <<
"No Et Total value for bx=0!\nAborting packing of GCT EM Cand and Energy Sum Output!";
171 LogDebug(
"GCT") <<
"No Et Hadronic value for bx=0!\nAborting packing of GCT EM Cand and Energy Sum Output!";
175 LogDebug(
"GCT") <<
"No Et Miss value for bx=0!\nAborting packing of GCT EM Cand and Energy Sum Output!";
191 uint16_t* p16 = reinterpret_cast<uint16_t*>(
d);
196 const unsigned bx0Offset = bx0EmCandOffsets.at(iCat);
198 uint16_t*
cand = p16 + (iCat * 4);
200 *
cand = em->at(bx0Offset).raw();
202 *
cand = em->at(bx0Offset + 2).raw();
204 *
cand = em->at(bx0Offset + 1).raw();
206 *
cand = em->at(bx0Offset + 3).raw();
212 *p16 = etTotal->at(bx0EtTotalOffset).raw();
214 *p16 = etHad->at(bx0EtHadOffset).raw();
216 uint32_t* p32 = reinterpret_cast<uint32_t*>(p16);
217 *p32 = etMiss->at(bx0EtMissOffset).raw();
241 unsigned&
offset = bx0JetCandOffsets.at(iCat);
243 LogDebug(
"GCT") <<
"No jet candidates with bx=0!\nAborting packing of GCT Jet Output!";
246 if ((jetCands->size() -
offset) < 4) {
247 LogDebug(
"GCT") <<
"Insufficient jet candidates with bx=0!\nAborting packing of GCT Jet Output!";
253 unsigned bx0HfRingSumsOffset, bx0HfBitCountsOffset, bx0HtMissOffset;
255 LogDebug(
"GCT") <<
"No ring sums with bx=0!\nAborting packing of GCT Jet Output!";
259 LogDebug(
"GCT") <<
"No bit counts with bx=0!\nAborting packing of GCT Jet Output!";
263 LogDebug(
"GCT") <<
"No missing Ht with bx=0!\nAborting packing of GCT Jet Output!";
274 uint16_t* p16 = reinterpret_cast<uint16_t*>(
d);
276 const unsigned categoryOffset = 4;
277 const unsigned nextCandPairOffset = 2;
282 const unsigned cand0Offset =
283 iCat * categoryOffset;
284 const unsigned bx0Offset = bx0JetCandOffsets.at(iCat);
286 p16[cand0Offset] = jetCands->at(bx0Offset).raw();
287 p16[cand0Offset + nextCandPairOffset] = jetCands->at(bx0Offset + 1).raw();
288 p16[cand0Offset + 1] = jetCands->at(bx0Offset + 2).raw();
289 p16[cand0Offset + nextCandPairOffset + 1] = jetCands->at(bx0Offset + 3).raw();
296 uint32_t* p32 = reinterpret_cast<uint32_t*>(
d);
298 uint32_t
tmp = hfBitCounts->at(bx0HfBitCountsOffset).raw() & 0xfff;
299 tmp |= hfRingSums->at(bx0HfRingSumsOffset).etSum(0) << 12;
300 tmp |= hfRingSums->at(bx0HfRingSumsOffset).etSum(1) << 16;
301 tmp |= hfRingSums->at(bx0HfRingSumsOffset).etSum(2) << 19;
302 tmp |= hfRingSums->at(bx0HfRingSumsOffset).etSum(3) << 22;
305 const L1GctHtMiss& bx0HtMiss = htMiss->at(bx0HtMissOffset);
306 uint32_t htMissRaw = 0x5555c000 | (bx0HtMiss.
overFlow() ? 0x1000 : 0x0000) | ((bx0HtMiss.
et() & 0x7f) << 5) |
307 ((bx0HtMiss.
phi() & 0x1f));
315 if (rctEm->empty() ||
316 rctEm->size() % 144 != 0)
318 LogDebug(
"GCT") <<
"Block pack error: bad L1CaloEmCollection size detected!\n"
319 <<
"Aborting packing of RCT EM Cand data!";
327 for (
unsigned i = 0,
size = rctEm->size();
i <
size; ++
i) {
329 if (
cand.bx() != 0) {
332 unsigned crateNum =
cand.rctCrate();
339 if (
cand.isolated()) {
355 for (
unsigned c = 0;
c < 18; ++
c) {
357 emuToSfpData[
c].eIsoCardId,
358 emuToSfpData[
c].eIsoRegionId,
359 emuToSfpData[
c].eNonIsoRank,
360 emuToSfpData[
c].eNonIsoCardId,
361 emuToSfpData[
c].eNonIsoRegionId,
362 emuToSfpData[
c].mipBits,
363 emuToSfpData[
c].qBits,
364 emuToSfpData[
c].sfp);
369 ++blockStartCrateIter) {
370 unsigned blockId = blockStartCrateIter->first;
371 unsigned startCrate = blockStartCrateIter->second;
374 unsigned blockLength_32bit =
found->second;
380 uint16_t* p16 = reinterpret_cast<uint16_t*>(const_cast<unsigned char*>(
d));
382 for (
unsigned iCrate = startCrate,
end = startCrate + blockLength_32bit / 3; iCrate <
end; ++iCrate) {
383 for (
unsigned iOutput = 1; iOutput < 4; ++iOutput)
385 for (
unsigned iCycle = 0; iCycle < 2; ++iCycle) {
386 *p16 = emuToSfpData[iCrate].
sfp[iCycle][iOutput];
393 d += (blockLength_32bit * 4);
400 if (rctCalo->empty() || rctCalo->size() % 396 != 0)
402 LogDebug(
"GCT") <<
"Block pack error: bad L1CaloRegionCollection size detected!\n"
403 <<
"Aborting packing of RCT Calo Region data!";
411 uint16_t* p16 = reinterpret_cast<uint16_t*>(const_cast<unsigned char*>(
d));
413 for (
unsigned i = 0,
size = rctCalo->size();
i <
size; ++
i) {
418 const unsigned crateNum = reg.
rctCrate();
423 const uint16_t raw = reg.
et() | (reg.
overFlow() ? 0x400 : 0x0) | (reg.
fineGrain() ? 0x800 : 0x0) |
424 (reg.
mip() ? 0x1000 : 0x0) | (reg.
quiet() ? 0x2000 : 0x0);
429 const unsigned cardNum = reg.
rctCard();
434 offset = crateNum * 22 + cardNum * 2 + regionIndex;
438 offset = crateNum * 22 + 14 + regionIndex;
449 const uint32_t eventId)
const {
460 return ((bxId & 0xfff) << 20) | ((
nSamples & 0xf) << 16) | ((eventId & 0xf) << 12) | (blockId & 0xfff);
467 const unsigned int id = hdr.
blockId();
472 const uint16_t* p16 = reinterpret_cast<const uint16_t*>(
d);
476 const unsigned int emCandCategoryOffset =
478 const unsigned int timeSampleOffset =
nSamples * 2;
480 unsigned int samplesToUnpack = 1;
485 for (
unsigned int iso = 0; iso < 2; ++iso)
487 bool isoFlag = (iso == 1);
497 for (
unsigned int bx = 0;
bx < samplesToUnpack; ++
bx)
501 const unsigned int cand0Offset = iso * emCandCategoryOffset +
bx * 2;
503 em->push_back(
L1GctEmCand(p16[cand0Offset], isoFlag,
id, 0,
bx));
504 em->push_back(
L1GctEmCand(p16[cand0Offset + timeSampleOffset], isoFlag,
id, 1,
bx));
505 em->push_back(
L1GctEmCand(p16[cand0Offset + 1], isoFlag,
id, 2,
bx));
506 em->push_back(
L1GctEmCand(p16[cand0Offset + timeSampleOffset + 1], isoFlag,
id, 3,
bx));
510 p16 += emCandCategoryOffset * 2;
519 const uint32_t* p32 = reinterpret_cast<const uint32_t*>(p16);
525 const unsigned int id = hdr.
blockId();
530 const uint16_t* p16 = reinterpret_cast<const uint16_t*>(
d);
534 const unsigned int jetCandCategoryOffset =
nSamples * 4;
535 const unsigned int timeSampleOffset =
nSamples * 2;
537 unsigned int samplesToUnpack = 1;
551 for (
unsigned int bx = 0;
bx < samplesToUnpack; ++
bx) {
553 const unsigned int cand0Offset = iCat * jetCandCategoryOffset +
bx * 2;
558 jets->push_back(
L1GctJetCand(p16[cand0Offset + timeSampleOffset], tauflag, forwardFlag,
id, 1,
bx));
562 jets->push_back(
L1GctJetCand(p16[cand0Offset + timeSampleOffset + 1], tauflag, forwardFlag,
id, 3,
bx));
572 const uint32_t* p32 = reinterpret_cast<const uint32_t*>(p16);
587 LogDebug(
"GCT") <<
"HLT mode - skipping unpack of RCT EM Cands";
591 unsigned int id = hdr.
blockId();
596 uint16_t*
p = reinterpret_cast<uint16_t*>(const_cast<unsigned char*>(
d));
600 uint16_t eIsoRank[4];
601 uint16_t eIsoCard[4];
603 uint16_t eNonIsoRank[4];
604 uint16_t eNonIsoCard[4];
605 uint16_t eNonIsoRgn[4];
606 uint16_t MIPbits[7][2];
607 uint16_t QBits[7][2];
614 for (
unsigned int crate =
found->second; crate < found->
second + length / 3; ++crate) {
616 for (
unsigned short iSfp = 0; iSfp < 4; ++iSfp) {
617 for (
unsigned short cyc = 0; cyc < 2; ++cyc) {
630 srcCardRouting().
SFPtoEMU(eIsoRank, eIsoCard, eIsoRgn, eNonIsoRank, eNonIsoCard, eNonIsoRgn, MIPbits, QBits, sfp);
633 for (
unsigned short int i = 0;
i < 4; ++
i) {
636 for (
unsigned short int i = 0;
i < 4; ++
i) {
646 LogDebug(
"GCT") <<
"HLT mode - skipping unpack of GCT Fibres";
650 unsigned int id = hdr.
blockId();
655 uint32_t*
p = reinterpret_cast<uint32_t*>(const_cast<unsigned char*>(
d));
657 for (
unsigned int i = 0;
i < length; ++
i) {
673 LogDebug(
"GCT") <<
"HLT mode - skipping unpack of RCT Calo Regions";
683 const uint16_t* p16 = reinterpret_cast<const uint16_t*>(
d);
685 for (
unsigned iCrate = 0; iCrate < 18; ++iCrate) {
687 for (
unsigned iCard = 0; iCard < 7; ++iCard) {
689 for (int16_t iSample = 0; iSample <
nSamples; ++iSample) {
691 for (
unsigned iRegion = 0; iRegion < 2; ++iRegion) {
699 for (
unsigned iRegionPairNum = 0; iRegionPairNum < 4; ++iRegionPairNum) {
701 for (int16_t iSample = 0; iSample <
nSamples; ++iSample) {
703 for (
unsigned iPair = 0; iPair < 2; ++iPair) {
714 template <
typename Collection>
716 bool foundBx0 =
false;
717 unsigned size = coll->size();
718 for (bx0Offset = 0; bx0Offset <
size; ++bx0Offset) {
719 if (coll->at(bx0Offset).bx() == 0) {
Persistable copy of missing Et measured at Level-1.
bool fineGrain() const
get fine grain bit
Level-1 Trigger jet candidate.
A calorimeter trigger region (sum of 4x4 trigger towers)
static L1GctHFBitCounts fromConcHFBitCounts(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data)
L1CaloEmCollection *const rctEm() const
Input electrons from the RCT to the GCT.
std::vector< L1GctJetCand > L1GctJetCandCollection
int16_t bx() const
get bunch-crossing index
unsigned short eIsoRank[4]
Level-1 Trigger EM candidate at output of GCT.
U second(std::pair< T, U > const &p)
L1GctHFBitCountsCollection *const gctHfBitCounts() const
GCT output: Hadronic-Forward bit-counts collection.
L1GctHFRingEtSumsCollection *const gctHfRingEtSums() const
GCT output: Hadronic-Forward ring-sums collection.
unsigned short eIsoRegionId[4]
L1GctEmCandCollection *const gctNonIsoEm() const
GCT output: Non-isolated EM candidate collection.
std::vector< L1GctEtMiss > L1GctEtMissCollection
std::vector< L1CaloEmCand > L1CaloEmCollection
Persistable copy of missing Et measured at Level-1.
L1GctHtMissCollection *const gctHtMiss() const
GCT output: Missing Ht collection.
bool mip() const
get MIP bit
Persistable copy of total Et measured at Level-1.
std::vector< L1GctEtTotal > L1GctEtTotalCollection
bool overFlow() const
get overflow
unsigned rctCrate() const
get RCT crate ID
unsigned et() const
get Et
static L1GctHFRingEtSums fromConcRingSums(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data)
L1CaloRegionCollection *const rctCalo() const
Input calo regions from the RCT to the GCT.
unsigned rctCard() const
get RCT reciever card ID (valid output for HB/HE)
unsigned short eNonIsoRank[4]
unsigned short eNonIsoCardId[4]
void SFPtoEMU(unsigned short(&eIsoRank)[4], unsigned short(&eIsoCardId)[4], unsigned short(&eIsoRegionId)[4], unsigned short(&eNonIsoRank)[4], unsigned short(&eNonIsoCardId)[4], unsigned short(&eNonIsoRegionId)[4], unsigned short(&MIPbits)[7][2], unsigned short(&Qbits)[7][2], unsigned short(&SFP)[2][4]) const
std::vector< L1GctHFBitCounts > L1GctHFBitCountsCollection
void EMUtoSFP(unsigned short(&eIsoRank)[4], unsigned short(&eIsoCardId)[4], unsigned short(&eIsoRegionId)[4], unsigned short(&eNonIsoRank)[4], unsigned short(&eNonIsoCardId)[4], unsigned short(&eNonIsoRegionId)[4], unsigned short(&MIPbits)[7][2], unsigned short(&Qbits)[7][2], unsigned short(&SFP)[2][4]) const
L1GctEmCandCollection *const gctIsoEm() const
GCT output: Isolated EM candidate collection.
unsigned phi() const
get the Et
Persistable copy of total Ht measured at Level-1.
std::vector< L1CaloRegion > L1CaloRegionCollection
std::vector< L1GctEmCand > L1GctEmCandCollection
L1GctEtHadCollection *const gctEtHad() const
GCT output: Hadronic transverse-energy (Ht) collection.
bool quiet() const
get quiet bit
L1GctEtMissCollection *const gctEtMiss() const
GCT output: Missing Et collection.
char data[epos_bytes_allocation]
Global Calorimeter Trigger SC -> CC fibre data word.
L1GctEtTotalCollection *const gctEtTot() const
GCT output: Total Et collection.
std::vector< L1GctEtHad > L1GctEtHadCollection
unsigned short eNonIsoRegionId[4]
bool overFlow() const
get the overflow
unsigned rctRegionIndex() const
get RCT region index
Level-1 Region Calorimeter Trigger EM candidate.
L1GctFibreCollection *const gctFibres() const
Raw fibre input to the GCT.
std::vector< L1GctHFRingEtSums > L1GctHFRingEtSumsCollection
std::vector< L1GctHtMiss > L1GctHtMissCollection
unsigned et() const
get the magnitude
unsigned short eIsoCardId[4]