ATLAS Offline Software
Loading...
Searching...
No Matches
jFexRoiByteStreamTool.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// jFexRoiByteStreamTool - This tool decodes Run3 jFEX RoI data!
7// -------------------
8// begin : 01 01 2022
9// email : Sergi.Rodriguez@cern.ch
10// ***************************************************************************/
11
12#ifndef JFEXROIBYTESTREAMTOOL_H
13#define JFEXROIBYTESTREAMTOOL_H
14
15// Trigger includes
17
30
31#include "TrigConfData/L1Menu.h"
32
33// Athena includes
36
38
39// Gaudi includes
40#include "Gaudi/Property.h"
41
46class jFexRoiByteStreamTool : public extends<AthAlgTool, IL1TriggerByteStreamTool> {
47 public:
48 jFexRoiByteStreamTool(const std::string& type, const std::string& name, const IInterface* parent);
49 virtual ~jFexRoiByteStreamTool() override = default;
50
51 // ------------------------- IAlgTool methods --------------------------------
52 virtual StatusCode initialize() override;
53 virtual StatusCode start() override;
54
55 // ------------------------- IL1TriggerByteStreamTool methods ----------------------
57 virtual StatusCode convertFromBS(const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& vrobf, const EventContext& eventContext)const override;
58
60 virtual StatusCode convertToBS(std::vector<OFFLINE_FRAGMENTS_NAMESPACE_WRITE::ROBFragment*>& vrobf, const EventContext& eventContext) override;
61
63 virtual const std::vector<uint32_t>& robIds() const override {
64 return m_robIds.value();
65 }
66
67 private:
68 // ------------------------- Properties --------------------------------------
69 ToolHandle<GenericMonitoringTool> m_monTool{this,"MonTool","","Monitoring tool"};
70 bool m_UseMonitoring = false;
71
72
73
74 // ROBIDs property required by the interface
75 Gaudi::Property<std::vector<uint32_t>> m_robIds {this, "ROBIDs", {}, "List of ROB IDs required for conversion to/from xAOD RoI"};
76 Gaudi::Property<bool> m_convertExtendedTOBs {this, "ConvertExtendedTOBs", false, "Convert xTOBs instead of TOBs"};
77
78 Gaudi::Property<std::string> m_TobMapping {this, "jFexTobMapping", "L1CaloFEXByteStream/2022-10-19/jFexTobMap.txt", "Text file to convert from hardware internal coordinates to eta-phi location"};
79
80 //Read handle key for the L1Menu
81 SG::ReadHandleKey<TrigConf::L1Menu> m_l1MenuKey {this, "L1TriggerMenu", "DetectorStore+L1TriggerMenu","Name of the L1Menu object to read configuration from"};
82
83
84 // Write handle keys for the L1Calo EDMs for BS->xAOD mode of operation
85 SG::WriteHandleKey< xAOD::jFexSRJetRoIContainer> m_jJWriteKey {this,"jJRoIContainerWriteKey" ,"L1_jFexSRJetRoI","Write jFexEDM SRjet container"};
86 SG::WriteHandleKey< xAOD::jFexLRJetRoIContainer> m_jLJWriteKey {this,"jLJRoIContainerWriteKey" ,"L1_jFexLRJetRoI","Write jFexEDM LRjet container"};
87 SG::WriteHandleKey< xAOD::jFexTauRoIContainer > m_jTauWriteKey {this,"jTauRoIContainerWriteKey","L1_jFexTauRoI" ,"Write jFexEDM tau container"};
88 SG::WriteHandleKey< xAOD::jFexSumETRoIContainer> m_jTEWriteKey {this,"jTERoIContainerWriteKey" ,"L1_jFexSumETRoI","Write jFexEDM SumET container"};
89 SG::WriteHandleKey< xAOD::jFexMETRoIContainer > m_jXEWriteKey {this,"jXERoIContainerWriteKey" ,"L1_jFexMETRoI" ,"Write jFexEDM Met container"};
90 SG::WriteHandleKey< xAOD::jFexFwdElRoIContainer> m_jEMWriteKey {this,"jEMRoIContainerWriteKey" ,"L1_jFexFwdElRoI","Write jFexEDM fwdEl container"};
91
92 // Read handle keys for the L1Calo EDMs for xAOD->BS mode of operation
93 SG::ReadHandleKey< xAOD::jFexSRJetRoIContainer> m_jJReadKey {this,"jJRoIContainerReadKey" ,"L1_jFexSRJetRoI","Read jFexEDM SRjet container"};
94 SG::ReadHandleKey< xAOD::jFexLRJetRoIContainer> m_jLJReadKey {this,"jLJRoIContainerReadKey" ,"L1_jFexLRJetRoI","Read jFexEDM LRjet container"};
95 SG::ReadHandleKey< xAOD::jFexTauRoIContainer > m_jTauReadKey {this,"jTauRoIContainerReadKey","L1_jFexTauRoI" ,"Read jFexEDM tau container"};
96 SG::ReadHandleKey< xAOD::jFexSumETRoIContainer> m_jTEReadKey {this,"jTERoIContainerReadKey" ,"L1_jFexSumETRoI","Read jFexEDM SumET container"};
97 SG::ReadHandleKey< xAOD::jFexMETRoIContainer > m_jXEReadKey {this,"jXERoIContainerReadKey" ,"L1_jFexMETRoI" ,"Read jFexEDM Met container"};
98 SG::ReadHandleKey< xAOD::jFexFwdElRoIContainer> m_jEMReadKey {this,"jEMRoIContainerReadKey" ,"L1_jFexFwdElRoI","Read jFexEDM fwdEl container"};
99
100 std::array<uint32_t,6> TOBCounterTrailer (uint32_t word) const;
101 std::array<uint32_t,4> xTOBCounterTrailer(uint32_t word) const;
102 std::array<uint32_t,4> jFEXtoRODTrailer (uint32_t word0, uint32_t word1) const;
103 std::array<uint32_t,1> RODTrailer (uint32_t word0, uint32_t word1) const;
104 void jFEXtoRODHeader (uint32_t word0, uint32_t word1) const;
105
106
107 //unpacking internal coordinates
108
109 std::array<float,2> getEtaPhi (unsigned int jfex, unsigned int fpga, uint32_t word, const char* obj) const;
110 std::array<uint8_t,2> unpackLocalCoords (uint32_t word) const;
111 static const int s_etaBit = 5;
112 static const int s_phiBit = 1;
113 static const int s_etaMask = 0x1f;
114 static const int s_phiMask = 0xf;
115
116 int m_jTauRes = 0;
117 int m_jJRes = 0;
118 int m_jLJRes = 0;
119 int m_jEMRes = 0;
120 int m_jXERes = 0;
121 int m_jTERes = 0;
122
123
124
125 // Read Mapping file to link internal word eta/phi to float Eta/Phi coordinates
126 StatusCode ReadfromFile(const std::string&);
127
128 // hash the index into one integer in the format 0xJFCCT (hexadecimal)
129 constexpr static unsigned int mapIndex(unsigned int jfex, unsigned int fpga, unsigned int iEta, unsigned int iPhi);
130 std::unordered_map<unsigned int, std::array<float,2> > m_TobPos_map;
131
132 void printError(const std::string& location, const std::string& title, MSG::Level type, const std::string& detail) const;
133
134};
135
136#endif // JFEXROIBYTESTREAMTOOL_H
void printError()
Header file to be included by clients of the Monitored infrastructure.
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
virtual const std::vector< uint32_t > & robIds() const override
Declare ROB IDs for conversion.
virtual StatusCode convertToBS(std::vector< OFFLINE_FRAGMENTS_NAMESPACE_WRITE::ROBFragment * > &vrobf, const EventContext &eventContext) override
xAOD->BS conversion
Gaudi::Property< bool > m_convertExtendedTOBs
virtual StatusCode convertFromBS(const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &vrobf, const EventContext &eventContext) const override
BS->xAOD conversion.
static constexpr unsigned int mapIndex(unsigned int jfex, unsigned int fpga, unsigned int iEta, unsigned int iPhi)
virtual StatusCode initialize() override
std::array< float, 2 > getEtaPhi(unsigned int jfex, unsigned int fpga, uint32_t word, const char *obj) const
std::array< uint32_t, 4 > jFEXtoRODTrailer(uint32_t word0, uint32_t word1) const
SG::ReadHandleKey< xAOD::jFexSRJetRoIContainer > m_jJReadKey
SG::WriteHandleKey< xAOD::jFexSumETRoIContainer > m_jTEWriteKey
SG::ReadHandleKey< TrigConf::L1Menu > m_l1MenuKey
SG::WriteHandleKey< xAOD::jFexSRJetRoIContainer > m_jJWriteKey
SG::WriteHandleKey< xAOD::jFexFwdElRoIContainer > m_jEMWriteKey
std::unordered_map< unsigned int, std::array< float, 2 > > m_TobPos_map
virtual StatusCode start() override
SG::ReadHandleKey< xAOD::jFexLRJetRoIContainer > m_jLJReadKey
SG::WriteHandleKey< xAOD::jFexLRJetRoIContainer > m_jLJWriteKey
std::array< uint32_t, 4 > xTOBCounterTrailer(uint32_t word) const
SG::WriteHandleKey< xAOD::jFexTauRoIContainer > m_jTauWriteKey
ToolHandle< GenericMonitoringTool > m_monTool
virtual ~jFexRoiByteStreamTool() override=default
jFexRoiByteStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
std::array< uint32_t, 6 > TOBCounterTrailer(uint32_t word) const
SG::ReadHandleKey< xAOD::jFexFwdElRoIContainer > m_jEMReadKey
Gaudi::Property< std::string > m_TobMapping
std::array< uint32_t, 1 > RODTrailer(uint32_t word0, uint32_t word1) const
Gaudi::Property< std::vector< uint32_t > > m_robIds
SG::ReadHandleKey< xAOD::jFexMETRoIContainer > m_jXEReadKey
void jFEXtoRODHeader(uint32_t word0, uint32_t word1) const
std::array< uint8_t, 2 > unpackLocalCoords(uint32_t word) const
StatusCode ReadfromFile(const std::string &)
SG::ReadHandleKey< xAOD::jFexTauRoIContainer > m_jTauReadKey
SG::WriteHandleKey< xAOD::jFexMETRoIContainer > m_jXEWriteKey
SG::ReadHandleKey< xAOD::jFexSumETRoIContainer > m_jTEReadKey