ATLAS Offline Software
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 
33 class 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
jFexTowerContainer.h
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:24
jFexInputByteStreamTool::m_FiberMapping
Gaudi::Property< std::string > m_FiberMapping
Definition: jFexInputByteStreamTool.h:65
jFexInputByteStreamTool::mapIndex
constexpr static unsigned int mapIndex(unsigned int jfex, unsigned int fpga, unsigned int channel, unsigned int tower)
Definition: jFexInputByteStreamTool.cxx:463
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
jFexInputByteStreamTool::m_robIds
Gaudi::Property< std::vector< uint32_t > > m_robIds
Definition: jFexInputByteStreamTool.h:62
jFexInputByteStreamTool::Dataformat2
std::array< uint16_t, 4 > Dataformat2(uint32_t) const
Definition: jFexInputByteStreamTool.cxx:372
jFexInputByteStreamTool::m_jTowersWriteKey
SG::WriteHandleKey< xAOD::jFexTowerContainer > m_jTowersWriteKey
Definition: jFexInputByteStreamTool.h:68
jFexInputByteStreamTool::robIds
virtual const std::vector< uint32_t > & robIds() const override
Declare ROB IDs for conversion.
Definition: jFexInputByteStreamTool.h:49
detail
Definition: extract_histogram_tag.cxx:14
IL1TriggerByteStreamTool.h
jFexInputByteStreamTool::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: jFexInputByteStreamTool.h:56
jFexInputByteStreamTool::convertFromBS
virtual StatusCode convertFromBS(const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &vrobf, const EventContext &eventContext) const override
BS->xAOD conversion.
Definition: jFexInputByteStreamTool.cxx:80
jFexInputByteStreamTool::BulkStreamTrailer
std::array< uint16_t, 2 > BulkStreamTrailer(uint32_t, uint32_t, uint32_t) const
Definition: jFexInputByteStreamTool.cxx:333
jFexInputByteStreamTool
Implementation of a tool for L1 input data conversion from BS to xAOD and from xAOD to BS (IL1Trigger...
Definition: jFexInputByteStreamTool.h:33
jFexInputByteStreamTool::convertToBS
virtual StatusCode convertToBS(std::vector< OFFLINE_FRAGMENTS_NAMESPACE_WRITE::ROBFragment * > &vrobf, const EventContext &eventContext) override
xAOD->BS conversion
Definition: jFexInputByteStreamTool.cxx:385
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition: StoreGate/StoreGate/ReadHandleKey.h:39
jFexInputByteStreamTool::~jFexInputByteStreamTool
virtual ~jFexInputByteStreamTool() override=default
jFexInputByteStreamTool::printError
void printError(const std::string &location, const std::string &title, MSG::Level type, const std::string &detail) const
{map index, {IDsimulation,eta,phi,source,iEta,iPhi}}
Definition: jFexInputByteStreamTool.cxx:468
jFexInputByteStreamTool::m_UseMonitoring
bool m_UseMonitoring
Definition: jFexInputByteStreamTool.h:57
jFexInputByteStreamTool::ReadfromFile
StatusCode ReadfromFile(const std::string &)
Definition: jFexInputByteStreamTool.cxx:415
jFexInputByteStreamTool::m_doThinning
Gaudi::Property< bool > m_doThinning
Definition: jFexInputByteStreamTool.h:59
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition: StoreGate/StoreGate/WriteHandleKey.h:40
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
covarianceTool.title
title
Definition: covarianceTool.py:542
AthAlgTool.h
jFexInputByteStreamTool::Dataformat1
std::array< uint16_t, 3 > Dataformat1(uint32_t) const
Definition: jFexInputByteStreamTool.cxx:361
test_pyathena.parent
parent
Definition: test_pyathena.py:15
jFexInputByteStreamTool::m_jTowersReadKey
SG::ReadHandleKey< xAOD::jFexTowerContainer > m_jTowersReadKey
Definition: jFexInputByteStreamTool.h:71
Monitored.h
Header file to be included by clients of the Monitored infrastructure.
jFexInputByteStreamTool::initialize
virtual StatusCode initialize() override
Definition: jFexInputByteStreamTool.cxx:46
PathResolver.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
jFexInputByteStreamTool::jFEXtoRODTrailer
std::array< uint32_t, 4 > jFEXtoRODTrailer(uint32_t, uint32_t) const
Definition: jFexInputByteStreamTool.cxx:320
jFexTowerAuxContainer.h
jFexInputByteStreamTool::jFexInputByteStreamTool
jFexInputByteStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: jFexInputByteStreamTool.cxx:41
jFexInputByteStreamTool::m_Firm2Tower_map
std::unordered_map< unsigned int, std::array< float, 6 > > m_Firm2Tower_map
Definition: jFexInputByteStreamTool.h:84