 |
ATLAS Offline Software
|
Go to the documentation of this file.
28 return StatusCode::SUCCESS;
44 CHECK(h_gblLArCells.isValid());
45 const auto & gblLArCells = *h_gblLArCells;
57 return StatusCode::SUCCESS;
74 return StatusCode::FAILURE;
78 for (
const auto& feb2Key : gblLArCells.
getFeb2Keys()) {
87 feb2Bitsets[feb2Key] = input_bitstream;
90 out <<
"====== " << feb2Key <<
" is sending to " << gblLArCells.
getMuxForFeb2(feb2Key) <<
":\n";
95 out << input_bitstream[bitIndex];
105 return StatusCode::SUCCESS;
113 std::vector<const GlobalSim::GlobalLArCell*> sortedCells(
cells.begin(),
cells.end());
114 std::sort(sortedCells.begin(), sortedCells.end(), [](
const auto*
a,
const auto*
b) {
115 return a->getChannel() < b->getChannel();
119 const std::size_t bitwidth_4SigmaMask = maxCells;
123 std::vector<bool> mask_fourSigma(bitwidth_4SigmaMask,
false);
124 std::vector<bool> energyBits(bitwidth_energyBlock,
false);
126 std::size_t bitPosEnergy = 0;
128 for (std::size_t
i = 0;
i < sortedCells.size(); ++
i) {
130 const auto*
cell = sortedCells[
i];
133 mask_twoSigma[
cell->getChannel()] =
true;
136 mask_fourSigma[
i] = (
cell->getSigma() >= 4.0);
139 const boost::dynamic_bitset<>& enBits =
cell->getEnergyBitstring();
140 for (std::size_t j = 0; j < enBits.size() && bitPosEnergy < bitwidth_energyBlock; ++j, ++bitPosEnergy) {
141 energyBits[bitPosEnergy]= enBits[j];
146 std::bitset<8> bitsBCN(
bcid & 0xFF);
149 std::bitset<FEB2_BITSTREAM_SIZE> bitstream;
155 if (inOverflow) bitstream.set(
pos);
157 if (inError) bitstream.set(
pos);
176 return StatusCode::SUCCESS;
183 return StatusCode::FAILURE;
190 unsigned long long markerPattern =
191 (0xAULL << nBitsMarker*7) |
192 (0xBULL << nBitsMarker*6) |
193 (0xBULL << nBitsMarker*5) |
194 (0xAULL << nBitsMarker*4) |
195 (0xAULL << nBitsMarker*3) |
196 (0xBULL << nBitsMarker*2) |
197 (0xBULL << nBitsMarker) |
200 std::bitset<BITWIDTH_MUX_OUTPUT> markerBitset(markerPattern);
203 std::bitset<12> bitsBCN(eventInfo.
bcid() & 0xFFF);
206 for (
int muxID = 0; muxID < 32; ++muxID) {
208 std::string muxKey =
fmt::format(
"apl-gbl-mux-lasp-{:02d}", muxID);
209 out <<
"====== " << muxKey <<
" is sending to GEP:\n";
211 std::bitset<6> bitsetMuxID(muxID);
215 std::bitset<bitwidthMuxHeader> fullMuxHeader;
233 out << fullMuxHeader[bitIndex];
240 for (
const auto& feb2 : feb2s) {
242 auto it = feb2Bitsets.find(feb2);
243 if (
it == feb2Bitsets.end()) {
245 return StatusCode::FAILURE;
247 const std::bitset<FEB2_BITSTREAM_SIZE>& feb2Bitset =
it->second;
252 out << feb2Bitset[bitIndex];
270 return StatusCode::SUCCESS;
274 for (std::size_t
i = 0;
i <
src.size(); ++
i, ++
pos)
std::size_t getMaxCellsPerFeb2() const
Function to get maximum number of cells per FEB2.
bool feb2InOverflow(const std::string &feb2Key) const
Check if a given FEB2 is in overflow.
const std::vector< std::string > & getOrderedFeb2sForMux(const std::string &mux) const
Function to get ordered list of FEB2s for a given MUX name.
uint64_t eventNumber() const
The current event's event number.
static constexpr std::size_t BITWIDTH_MUX_INPUT
static std::size_t appendBits(std::bitset< N > &target, const T &src, std::size_t pos)
Helper function to append a bitset or vector of bools at a specific position in another bitset.
bool feb2InError(const std::string &feb2Key) const
Check if a given FEB2 is in error.
SG::ReadHandleKey< GlobalSim::GlobalLArCellContainer > m_gblLArCellContainerKey
Key to the GlobalLArCellContainer.
static constexpr std::size_t FEB2_BITSTREAM_SIZE
static constexpr std::size_t BITWIDTH_2SIGMAMASK
const std::unordered_set< std::string > & getFeb2Keys() const
Function to return the full list of FEB2 names.
static constexpr std::size_t N_WORDS_MUX_HEADER
uint32_t runNumber() const
The current event's run number.
StatusCode writeMuxInputBitstream(Feb2BitsetMap &feb2Bitsets, const xAOD::EventInfo &eventInfo, const GlobalSim::GlobalLArCellContainer &gblLArCells) const
Function that compiles the LASP to MUX bitstream and writes it to file.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
StatusCode writeMuxOutputBitstream(const Feb2BitsetMap &feb2Bitsets, const xAOD::EventInfo &eventInfo, const GlobalSim::GlobalLArCellContainer &gblLArCells) const
Function that compiles the MUX to GEP bitstream and writes it to file.
virtual StatusCode execute(const EventContext &) const override
execute function running for every event
AlgTool to obtain a selection of eFex RoIs read in from the event store.
Gaudi::Property< bool > m_writeMuxOutputBitstreamToFile
Flag to enable writing ofMUX output bitstreams (MUX -> GEP) to file.
::StatusCode StatusCode
StatusCode definition for legacy code.
const std::vector< GlobalLArCell * > & getCellsForFeb2(const std::string &feb2) const
Function to get all GlobalLArCells for a given FEB2 name.
#define CHECK(...)
Evaluate an expression and check for errors.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
static constexpr std::size_t N_WORDS_MUX_FOOTER
std::map< std::string, std::bitset< FEB2_BITSTREAM_SIZE > > Feb2BitsetMap
std::string to_string(const DetectorType &type)
static constexpr std::size_t BITWIDTH_MUX_OUTPUT
setEventNumber setTimeStamp bcid
const std::string & getMuxForFeb2(const std::string &feb2Key) const
Function to get the associated MUX name for a given FEB2.
Class describing the basic event information.
bool muxInOverflow(const std::string &muxKey) const
Check if a given MUX is in overflow.
Gaudi::Property< bool > m_writeMuxInputBitstreamToFile
Flag to enable writing of MUX input bitstreams (FEB2/LASP -> MUX) to file.
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfo
Key for the EventInfo object.
uint32_t bcid() const
The bunch crossing ID of the event.
virtual StatusCode initialize() override
initialize function running before first event
std::bitset< FEB2_BITSTREAM_SIZE > assembleBitsetForFeb2(const std::vector< GlobalSim::GlobalLArCell * > &cells, std::size_t maxCells, bool inOverflow, bool inError, uint32_t bcid) const
Function which compiles the bitset for one particular FEB2.
bool muxInError(const std::string &muxKey) const
Check if a given MUX is in error.