Skip to content

Commit

Permalink
code format
Browse files Browse the repository at this point in the history
  • Loading branch information
aloeliger committed Jun 24, 2024
1 parent e045296 commit 8d28d38
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,30 +35,34 @@ bool l1t::stage2::CaloSummaryUnpacker::unpack(const Block& block, UnpackerCollec
int nBX = int(ceil(block.header().getSize() / nFramesPerEvent));
int firstBX = (nBX / 2) - nBX + 1;
int lastBX = nBX / 2;
int processedBXs = 0; //This will just help us keep track of what words we are grabbing

int processedBXs = 0; //This will just help us keep track of what words we are grabbing

auto res_ = static_cast<L1TObjectCollections*>(coll)->getCICADAScore();
res_ -> setBXRange(firstBX, lastBX);
res_->setBXRange(firstBX, lastBX);

for (int bx = firstBX; bx <= lastBX; ++bx){
for (int bx = firstBX; bx <= lastBX; ++bx) {
//convert to float and then multiply by a factor based on the index?
unsigned int cicadaBits[numCICADAWords] = {0, 0, 0, 0};

for (unsigned int wordNum = 0; wordNum < numCICADAWords; ++wordNum) {
unsigned short wordLocation = processedBXs*nFramesPerEvent + wordNum; //Calculate the location of the needed CICADA word based on how many BXs we have already handled, and how many words of CICADA we have already grabbed.
unsigned short wordLocation =
processedBXs * nFramesPerEvent +
wordNum; //Calculate the location of the needed CICADA word based on how many BXs we have already handled, and how many words of CICADA we have already grabbed.
//Frame 0 of a bx are the most significant integer bits
//Frame 1 of a bx are the least significant integer bits
//Frame 2 of a bx are the most significant decimal bits
//Frame 3 of a bx are the lest significant decimal bits
//Frames 4&5 are unused (by CICADA), they are reserved.
uint32_t raw_data = block.payload().at(wordLocation);
cicadaBits[wordNum] =
(cicadaBitsPattern & raw_data) >>
28; //The 28 shifts the extracted bits over to the start of the 32 bit result data for easier working with later
(cicadaBitsPattern & raw_data) >>
28; //The 28 shifts the extracted bits over to the start of the 32 bit result data for easier working with later
}
res_->push_back(bx, processBitsToScore(cicadaBits)); //Now we insert CICADA into the proper BX, after a quick utility constructs a number from the 4 sets of bits.
++processedBXs; //index BXs
res_->push_back(
bx,
processBitsToScore(
cicadaBits)); //Now we insert CICADA into the proper BX, after a quick utility constructs a number from the 4 sets of bits.
++processedBXs; //index BXs
}

return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ namespace l1t {

bool unpack(const Block& block, UnpackerCollections* coll) override;
float processBitsToScore(const unsigned int[]);

static constexpr unsigned short numCICADAWords = 4; // We have 4 words/frames that contain CICADA bits
static constexpr unsigned int nFramesPerEvent = 6; //Calo Summary outputs 6 32 bit words (or frames in uGT parlance) per event.
static constexpr unsigned int nFramesPerEvent =
6; //Calo Summary outputs 6 32 bit words (or frames in uGT parlance) per event.
static constexpr unsigned int cicadaBitsPattern =
0xF0000000; //first 4 bits of the first 4 words/frames are CICADA
};
Expand Down

0 comments on commit 8d28d38

Please sign in to comment.