ATLAS Offline Software
Loading...
Searching...
No Matches
jFexInputByteStreamTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5//***************************************************************************
6// jFexInputByteStreamTool - This tool decodes Run3 jFEX input data!
7// -------------------
8// begin : 01 07 2022
9// email : Sergi.Rodriguez@cern.ch
10// ***************************************************************************/
11
12#ifndef JFEXINPUTBYTESTREAMTOOL_H
13#define JFEXINPUTBYTESTREAMTOOL_H
14
15// Trigger includes
19
20// Athena includes
23
25
26// Gaudi includes
27#include "Gaudi/Property.h"
28
33class jFexInputByteStreamTool : public extends<AthAlgTool, IL1TriggerByteStreamTool> {
34 public:
35 jFexInputByteStreamTool(const std::string& type, const std::string& name, const IInterface* parent);
36 virtual ~jFexInputByteStreamTool() override = default;
37
38 // ------------------------- IAlgTool methods --------------------------------
39 virtual StatusCode initialize() override;
40
41 // ------------------------- IL1TriggerByteStreamTool methods ----------------------
43 virtual StatusCode convertFromBS(const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& vrobf, const EventContext& eventContext)const override;
44
46 virtual StatusCode convertToBS(std::vector<OFFLINE_FRAGMENTS_NAMESPACE_WRITE::ROBFragment*>& vrobf, const EventContext& eventContext) override;
47
49 virtual const std::vector<uint32_t>& robIds() const override {
50 return m_robIds.value();
51 }
52
53 private:
54 // ------------------------- Properties --------------------------------------
55
56 ToolHandle<GenericMonitoringTool> m_monTool{this,"MonTool","","Monitoring tool"};
57 bool m_UseMonitoring = false;
58
59 Gaudi::Property<bool> m_doThinning {this, "DoThinning" , true, "Remove overlapped towers. Only FPGA Core region is saved"};
60
61 // ROBIDs property required by the interface
62 Gaudi::Property<std::vector<uint32_t>> m_robIds {this, "ROBIDs", {}, "List of ROB IDs required for conversion to/from xAOD RoI"};
63
64 // FiberMapping property required by the interface
65 Gaudi::Property<std::string> m_FiberMapping {this, "jFexTowerMapping", "L1CaloFEXByteStream/2023-08-01/jFexTowerMap.txt", "Text file to convert from hardware fiber to eta-phi location"};
66
67 //Write handle keys for the L1Calo EDMs for BS->xAOD mode of operation
68 SG::WriteHandleKey< xAOD::jFexTowerContainer> m_jTowersWriteKey {this,"jTowersWriteKey" ,"L1_jFexDataTowers","Write jFexEDM Trigger Tower container"};
69
70 // Read handle keys for the L1Calo EDMs for xAOD->BS mode of operation
71 SG::ReadHandleKey < xAOD::jFexTowerContainer> m_jTowersReadKey {this,"jTowersReadKey" ,"L1_jFexDataTowers","Read jFexEDM Trigger Tower container"};
72
73 std::array<uint32_t,4> jFEXtoRODTrailer (uint32_t, uint32_t) const;
74 std::array<uint16_t,2> BulkStreamTrailer (uint32_t, uint32_t, uint32_t) const;
75 std::array<uint16_t,3> Dataformat1 (uint32_t ) const;
76 std::array<uint16_t,4> Dataformat2 (uint32_t ) const;
77 //bool m_verbose = 1;
78
79 // Read Mapping file to link fibers to Simulation ID and Eta/Phi coordinates
80 StatusCode ReadfromFile(const std::string&);
81
82 // hash the index into one integer in the format 0xJFCCT (hexadecimal)
83 constexpr static unsigned int mapIndex(unsigned int jfex, unsigned int fpga, unsigned int channel, unsigned int tower);
84 std::unordered_map<unsigned int, std::array<float,6> > m_Firm2Tower_map;
85
86 void printError(const std::string& location, const std::string& title, MSG::Level type, const std::string& detail) const;
87
88};
89
90#endif // JFEXINPUTBYTESTREAMTOOL_H
void printError()
Header file to be included by clients of the Monitored infrastructure.
Property holding a SG store/key/clid from which a WriteHandle is made.
std::array< uint16_t, 3 > Dataformat1(uint32_t) const
ToolHandle< GenericMonitoringTool > m_monTool
std::array< uint16_t, 4 > Dataformat2(uint32_t) const
static constexpr unsigned int mapIndex(unsigned int jfex, unsigned int fpga, unsigned int channel, unsigned int tower)
virtual const std::vector< uint32_t > & robIds() const override
Declare ROB IDs for conversion.
Gaudi::Property< std::vector< uint32_t > > m_robIds
virtual StatusCode convertFromBS(const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &vrobf, const EventContext &eventContext) const override
BS->xAOD conversion.
StatusCode ReadfromFile(const std::string &)
std::array< uint32_t, 4 > jFEXtoRODTrailer(uint32_t, uint32_t) const
std::array< uint16_t, 2 > BulkStreamTrailer(uint32_t, uint32_t, uint32_t) const
Gaudi::Property< bool > m_doThinning
jFexInputByteStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
Gaudi::Property< std::string > m_FiberMapping
SG::WriteHandleKey< xAOD::jFexTowerContainer > m_jTowersWriteKey
SG::ReadHandleKey< xAOD::jFexTowerContainer > m_jTowersReadKey
virtual StatusCode convertToBS(std::vector< OFFLINE_FRAGMENTS_NAMESPACE_WRITE::ROBFragment * > &vrobf, const EventContext &eventContext) override
xAOD->BS conversion
virtual StatusCode initialize() override
virtual ~jFexInputByteStreamTool() override=default
std::unordered_map< unsigned int, std::array< float, 6 > > m_Firm2Tower_map