ATLAS Offline Software
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"
20 #include "GlobalLArCellContainer.h"
21 
22 #include <vector>
23 #include <bitset>
24 
25 namespace 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 
RunTileCalibRec.cells
cells
Definition: RunTileCalibRec.py:281
GlobalSim::LArCellMuxAlg::BITWIDTH_MUX_INPUT
static constexpr std::size_t BITWIDTH_MUX_INPUT
Definition: LArCellMuxAlg.h:34
GlobalSim::LArCellMuxAlg::appendBits
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.
Definition: LArCellMuxAlg.cxx:273
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
WriteCellNoiseToCool.src
src
Definition: WriteCellNoiseToCool.py:513
GlobalSim::LArCellMuxAlg
Definition: LArCellMuxAlg.h:27
GlobalSim::LArCellMuxAlg::m_gblLArCellContainerKey
SG::ReadHandleKey< GlobalSim::GlobalLArCellContainer > m_gblLArCellContainerKey
Key to the GlobalLArCellContainer.
Definition: LArCellMuxAlg.h:63
GlobalSim::LArCellMuxAlg::FEB2_BITSTREAM_SIZE
static constexpr std::size_t FEB2_BITSTREAM_SIZE
Definition: LArCellMuxAlg.h:32
GlobalLArCellContainer.h
GlobalSim::LArCellMuxAlg::BITWIDTH_2SIGMAMASK
static constexpr std::size_t BITWIDTH_2SIGMAMASK
Definition: LArCellMuxAlg.h:33
SG::ReadHandleKey< xAOD::EventInfo >
GlobalSim::LArCellMuxAlg::N_WORDS_MUX_HEADER
static constexpr std::size_t N_WORDS_MUX_HEADER
Definition: LArCellMuxAlg.h:36
GlobalSim::LArCellMuxAlg::writeMuxInputBitstream
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.
Definition: LArCellMuxAlg.cxx:64
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:74
GlobalSim::LArCellMuxAlg::writeMuxOutputBitstream
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.
Definition: LArCellMuxAlg.cxx:171
GlobalSim::LArCellMuxAlg::execute
virtual StatusCode execute(const EventContext &) const override
execute function running for every event
Definition: LArCellMuxAlg.cxx:34
GlobalSim
AlgTool to obtain a selection of eFex RoIs read in from the event store.
Definition: dump.h:8
GlobalSim::LArCellMuxAlg::m_writeMuxOutputBitstreamToFile
Gaudi::Property< bool > m_writeMuxOutputBitstreamToFile
Flag to enable writing ofMUX output bitstreams (MUX -> GEP) to file.
Definition: LArCellMuxAlg.h:69
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthAlgTool.h
GlobalLArCell.h
GlobalSim::LArCellMuxAlg::N_WORDS_MUX_FOOTER
static constexpr std::size_t N_WORDS_MUX_FOOTER
Definition: LArCellMuxAlg.h:37
AthReentrantAlgorithm.h
GlobalSim::LArCellMuxAlg::Feb2BitsetMap
std::map< std::string, std::bitset< FEB2_BITSTREAM_SIZE > > Feb2BitsetMap
Definition: LArCellMuxAlg.h:40
GlobalSim::LArCellMuxAlg::BITWIDTH_MUX_OUTPUT
static constexpr std::size_t BITWIDTH_MUX_OUTPUT
Definition: LArCellMuxAlg.h:35
xAOD::bcid
setEventNumber setTimeStamp bcid
Definition: EventInfo_v1.cxx:133
EventInfo.h
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:16
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
GlobalSim::GlobalLArCellContainer
Definition: GlobalLArCellContainer.h:22
GlobalSim::LArCellMuxAlg::m_writeMuxInputBitstreamToFile
Gaudi::Property< bool > m_writeMuxInputBitstreamToFile
Flag to enable writing of MUX input bitstreams (FEB2/LASP -> MUX) to file.
Definition: LArCellMuxAlg.h:66
GlobalSim::LArCellMuxAlg::m_eventInfo
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfo
Key for the EventInfo object.
Definition: LArCellMuxAlg.h:60
copySelective.target
string target
Definition: copySelective.py:36
GlobalSim::LArCellMuxAlg::initialize
virtual StatusCode initialize() override
initialize function running before first event
Definition: LArCellMuxAlg.cxx:22
GlobalSim::LArCellMuxAlg::assembleBitsetForFeb2
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.
Definition: LArCellMuxAlg.cxx:110