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,
48 const EventContext& eventContext) override;
49
51 virtual const std::vector<uint32_t>& robIds() const override {
52 return m_robIds.value();
53 }
54
55 private:
56 // ------------------------- Properties --------------------------------------
57
58 ToolHandle<GenericMonitoringTool> m_monTool{this,"MonTool","","Monitoring tool"};
59 bool m_UseMonitoring = false;
60
61 Gaudi::Property<bool> m_doThinning {this, "DoThinning" , true, "Remove overlapped towers. Only FPGA Core region is saved"};
62
63 // ROBIDs property required by the interface
64 Gaudi::Property<std::vector<uint32_t>> m_robIds {this, "ROBIDs", {}, "List of ROB IDs required for conversion to/from xAOD RoI"};
65
66 // FiberMapping property required by the interface
67 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"};
68
69 //Write handle keys for the L1Calo EDMs for BS->xAOD mode of operation
70 SG::WriteHandleKey< xAOD::jFexTowerContainer> m_jTowersWriteKey {this,"jTowersWriteKey" ,"L1_jFexDataTowers","Write jFexEDM Trigger Tower container"};
71
72 // Read handle keys for the L1Calo EDMs for xAOD->BS mode of operation
73 SG::ReadHandleKey < xAOD::jFexTowerContainer> m_jTowersReadKey {this,"jTowersReadKey" ,"L1_jFexDataTowers","Read jFexEDM Trigger Tower container"};
74
75 std::array<uint32_t,4> jFEXtoRODTrailer (uint32_t, uint32_t) const;
76 std::array<uint16_t,2> BulkStreamTrailer (uint32_t, uint32_t, uint32_t) const;
77 std::array<uint16_t,3> Dataformat1 (uint32_t ) const;
78 std::array<uint16_t,4> Dataformat2 (uint32_t ) const;
79 //bool m_verbose = 1;
80
81 // Read Mapping file to link fibers to Simulation ID and Eta/Phi coordinates
82 StatusCode ReadfromFile(const std::string&);
83
84 // hash the index into one integer in the format 0xJFCCT (hexadecimal)
85 constexpr static unsigned int mapIndex(unsigned int jfex, unsigned int fpga, unsigned int channel, unsigned int tower);
86 std::unordered_map<unsigned int, std::array<float,6> > m_Firm2Tower_map;
87
88 void printError(const std::string& location, const std::string& title, MSG::Level type, const std::string& detail) const;
89
90};
91
92#endif // JFEXINPUTBYTESTREAMTOOL_H
void printError()
static Double_t tc
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 xAOD::TrigCompositeContainer *tc, 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
TrigCompositeContainer_v1 TrigCompositeContainer
Declare the latest version of the container.