ATLAS Offline Software
Loading...
Searching...
No Matches
LArCellMuxAlg.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4
5#ifndef GLOBALSIM_LARCELLMUXALG_H
6#define GLOBALSIM_LARCELLMUXALG_H
7
8/*
9 This Algorithm simulates both the input bitsream which would be received by the MUX from the LASP based on
10 the input GlobalLArCellContainer, as well as the output bitsream which each MUX would send to the GEPs. All
11 bitstreams are stored as textfiles in the running directory
12*/
13
17#include "GaudiKernel/ToolHandle.h"
18
19#include "GlobalLArCell.h"
21
22#include <vector>
23#include <bitset>
24
25namespace GlobalSim {
26
28 public:
29
30 using AthReentrantAlgorithm::AthReentrantAlgorithm;
31
32 static constexpr std::size_t FEB2_BITSTREAM_SIZE = 576;
33 static constexpr std::size_t BITWIDTH_2SIGMAMASK = 128;
34 static constexpr std::size_t BITWIDTH_MUX_INPUT = 32;
35 static constexpr std::size_t BITWIDTH_MUX_OUTPUT = 64; // Needs to be multiple of 8
36 static constexpr std::size_t N_WORDS_MUX_HEADER = 2;
37 static constexpr std::size_t N_WORDS_MUX_FOOTER = 7;
38
39 // Define a short-hand alias for the FEB2 bitset map
40 using Feb2BitsetMap = std::map<std::string, std::bitset<FEB2_BITSTREAM_SIZE>>;
41
43 virtual StatusCode initialize() override;
45 virtual StatusCode execute(const EventContext& ) const override;
46
47 private:
48
50 StatusCode writeMuxInputBitstream(Feb2BitsetMap& feb2Bitsets, const xAOD::EventInfo& eventInfo, const GlobalSim::GlobalLArCellContainer& gblLArCells) const;
52 StatusCode writeMuxOutputBitstream(const Feb2BitsetMap& feb2Bitsets, const xAOD::EventInfo& eventInfo, const GlobalSim::GlobalLArCellContainer& gblLArCells) const;
54 std::bitset<FEB2_BITSTREAM_SIZE> assembleBitsetForFeb2(const std::vector<GlobalSim::GlobalLArCell*>& cells, std::size_t maxCells, bool inOverflow, bool inError, uint32_t bcid) const;
56 template <std::size_t N, typename T> static std::size_t appendBits(std::bitset<N>& target, const T& src, std::size_t pos);
57
58
60 SG::ReadHandleKey<xAOD::EventInfo> m_eventInfo{this, "EventInfo", "EventInfo", "Key for the EventInfo container"};
61
63 SG::ReadHandleKey<GlobalSim::GlobalLArCellContainer> m_gblLArCellContainerKey {this, "GlobalLArCellsKey", "GlobalLArCells", "Key for the output container of the LAr cells sent to Global"};
64
66 Gaudi::Property<bool> m_writeMuxInputBitstreamToFile {this, "WriteMuxInputBitstreamToFile", true, "Flag to enable the writing of MUX input bitstreams to file"};
67
69 Gaudi::Property<bool> m_writeMuxOutputBitstreamToFile {this, "WriteMuxOutputBitstreamToFile", true, "Flag to enable the writing of MUX output bitstreams to file"};
70
71 };
72
73}
74#endif
75
76
77
78
An algorithm that can be simultaneously executed in multiple threads.
static constexpr std::size_t FEB2_BITSTREAM_SIZE
Gaudi::Property< bool > m_writeMuxInputBitstreamToFile
Flag to enable writing of MUX input bitstreams (FEB2/LASP -> MUX) to file.
std::map< std::string, std::bitset< FEB2_BITSTREAM_SIZE > > Feb2BitsetMap
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfo
Key for the EventInfo object.
Gaudi::Property< bool > m_writeMuxOutputBitstreamToFile
Flag to enable writing ofMUX output bitstreams (MUX -> GEP) to file.
static constexpr std::size_t BITWIDTH_MUX_OUTPUT
static constexpr std::size_t BITWIDTH_MUX_INPUT
static constexpr std::size_t N_WORDS_MUX_FOOTER
virtual StatusCode initialize() override
initialize function running before first event
SG::ReadHandleKey< GlobalSim::GlobalLArCellContainer > m_gblLArCellContainerKey
Key to the GlobalLArCellContainer.
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.
static constexpr std::size_t N_WORDS_MUX_HEADER
static constexpr std::size_t BITWIDTH_2SIGMAMASK
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
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.
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.
Property holding a SG store/key/clid from which a ReadHandle is made.
AlgTool that to test whether expected the TIP values generated by data supplied by eEmMultTestBench c...
EventInfo_v1 EventInfo
Definition of the latest event info version.