ATLAS Offline Software
jFexEmulatedTowers.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 //***************************************************************************
6 // jFexEmulatedTowers - description:
7 // This reentrant algorithm is meant to build the jFEX Towers from LAr and Tile containers
8 // -------------------
9 // begin : 01 11 2022
10 // email : sergi.rodriguez@cern.ch
11 //***************************************************************************/
12 
13 
14 #ifndef JFEXEMULATEDTOWERS_H
15 #define JFEXEMULATEDTOWERS_H
16 
18 #include "AsgTools/ToolHandle.h"
24 
27 
31 
34 
35 namespace LVL1 {
36 
38  public:
39  jFexEmulatedTowers(const std::string& name, ISvcLocator* svc);
40 
42  virtual StatusCode initialize() override;
44  virtual StatusCode execute( const EventContext& ) const override;
45 
46  private:
47  // ------------------------- Properties --------------------------------------
48  //Readhandle for Scell container
49  SG::ReadHandleKey<CaloCellContainer> m_SCellKey {this, "SCell", "SCell", "SCell container"};
50 
51  //Readhandle for TriggerTower container
52  SG::ReadHandleKey<xAOD::TriggerTowerContainer> m_triggerTowerKey {this, "xODTriggerTowers", "xAODTriggerTowers", "xAODTriggerTowers container"};
53 
54  //Writehandle for EmulatedTowers container
55  SG::WriteHandleKey < xAOD::jFexTowerContainer > m_jTowersWriteKey {this,"jTowersWriteKey" ,"L1_jFexEmulatedTowers", "Write jFexEDM Trigger Tower container"};
56 
57  // FiberMapping property required by the interface
58  Gaudi::Property<std::string> m_FiberMapping {this, "jFexTowerMapping", PathResolver::find_calib_file("L1CaloFEXByteStream/2023-08-01/jFexTowerMap.txt"), "Text file to convert from hardware fiber to eta-phi location"};
59 
60  //property for jFEX mapping
61  Gaudi::Property<bool> m_apply_masking {this, "SCellMasking", true, "Applies masking. Only use for data"};
62  Gaudi::Property<bool> m_isDATA {this, "isDATA" , true, "Tells the algorithm if it is data. Used for xAOD::TriggerTower WARNING due to the 0 supresion"};
63  Gaudi::Property<bool> m_doThinning {this, "DoThinning" , true, "Remove overlapped towers. Only FPGA Core region is saved"};
64 
65  //property for jFEX mapping
66  Gaudi::Property<std::string> m_jFEX2Scellmapping {this, "jFEX2SCmapping" , PathResolver::find_calib_file("L1CaloFEXByteStream/2022-10-19/jfex_SCID.txt") , "Text file to convert from simulation ID to SuperCell Identifier"};
67  Gaudi::Property<std::string> m_jFEX2Tilemapping {this, "jFEX2Tilemapping", PathResolver::find_calib_file("L1CaloFEXByteStream/2022-10-19/jfex_TileID.txt"), "Text file to convert from simulation ID to Tile Identifier"};
68 
69 
70  // Read mapping fucntions
71  StatusCode ReadFibersfromFile(const std::string& );
72  StatusCode ReadSCfromFile (const std::string& );
73  StatusCode ReadTilefromFile (const std::string& );
74  bool isBadSCellID(const std::string&) const;
75 
76  std::unordered_map< uint32_t, std::vector<uint64_t> > m_map_TTower2SCellsEM;
77  std::unordered_map< uint32_t, std::vector<uint64_t> > m_map_TTower2SCellsHAD;
78  std::unordered_map< uint32_t, std::tuple<uint32_t,float,float> > m_map_TTower2Tile;
79 
80  // hash the index into one integer in the format 0xJFCCT (hexadecimal)
81  constexpr static unsigned int mapIndex(unsigned int jfex, unsigned int fpga, unsigned int channel, unsigned int tower);
82  std::unordered_map<unsigned int, std::array<float,6> > m_Firm2Tower_map;
83 
84  // Code below concerns decorating the towers with offline energy sum
85  // ReadHandle for offline cells
86  SG::ReadHandleKey<CaloCellContainer> m_CaloCellKey {this, "CaloCell", "", "Calo Cell container, supply AllCalo to activate"};
87  // SCell to offline LAr cell mapping tool
88  ToolHandle<ICaloSuperCellIDTool> m_scellIdTool{this, "CaloSuperCellIDTool", "", "Offline / SuperCell ID mapping tool"};
89  // and for finding the Cell
91 
92  // read the offline energy decoration from the xAODTriggerTowers for the Tile
93  SG::ReadDecorHandleKey<xAOD::TriggerTowerContainer> m_readTileOfflineDecorKey { this, "TileOfflineETKey", m_triggerTowerKey, "", "decoration of offline energy from Tile Towers" };
94 
95  // decoration write handles
96  SG::WriteDecorHandleKey<xAOD::jFexTowerContainer> m_caloCellSumETdecorKey {this, "CaloCellSumEtdecorKey", m_jTowersWriteKey, "", "Offline Calo Cell Et information of the jTower in MeV"};
97  SG::WriteDecorHandleKey<xAOD::jFexTowerContainer> m_jtowerEtMeVdecorKey{ this, "jtowerEtMeVdecorKey", m_jTowersWriteKey, "jtowerEtMeV", "jFex Tower Et in MeV"};
98  SG::WriteDecorHandleKey<xAOD::jFexTowerContainer> m_jtowerEtTimingMeVdecorKey{ this, "jtowerEtTimingMeVdecorKey", m_jTowersWriteKey, "jtowerEtTimingMeV", "jFex Tower Et, after timing cut, in MeV"};
99 
100 
101 };
102 }
103 #endif
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
LVL1::jFexEmulatedTowers::m_readTileOfflineDecorKey
SG::ReadDecorHandleKey< xAOD::TriggerTowerContainer > m_readTileOfflineDecorKey
Definition: jFexEmulatedTowers.h:93
SG::WriteDecorHandleKey
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
Definition: StoreGate/StoreGate/WriteDecorHandleKey.h:89
PathResolver::find_calib_file
static std::string find_calib_file(const std::string &logical_file_name)
Definition: PathResolver.cxx:273
LVL1::jFexEmulatedTowers::execute
virtual StatusCode execute(const EventContext &) const override
Function executing the algorithm.
Definition: jFexEmulatedTowers.cxx:76
jFexTowerContainer.h
ReadDecorHandleKey.h
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:24
TriggerTowerContainer.h
LVL1::jFexEmulatedTowers::initialize
virtual StatusCode initialize() override
Function initialising the algorithm.
Definition: jFexEmulatedTowers.cxx:33
LVL1::jFexEmulatedTowers::m_jFEX2Scellmapping
Gaudi::Property< std::string > m_jFEX2Scellmapping
Definition: jFexEmulatedTowers.h:66
LVL1::jFexEmulatedTowers::ReadTilefromFile
StatusCode ReadTilefromFile(const std::string &)
Definition: jFexEmulatedTowers.cxx:456
SG::ReadHandleKey< CaloCellContainer >
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
LVL1::jFexEmulatedTowers::isBadSCellID
bool isBadSCellID(const std::string &) const
Definition: jFexEmulatedTowers.cxx:443
ICaloSuperCellIDTool.h
CaloCell_ID.h
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:74
LVL1::jFexEmulatedTowers::m_scellIdTool
ToolHandle< ICaloSuperCellIDTool > m_scellIdTool
Definition: jFexEmulatedTowers.h:88
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition: StoreGate/StoreGate/WriteHandleKey.h:40
WriteDecorHandleKey.h
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
LVL1::jFexEmulatedTowers::m_caloCellIdHelper
const CaloCell_ID * m_caloCellIdHelper
Definition: jFexEmulatedTowers.h:90
CaloCell_ID
Helper class for offline cell identifiers.
Definition: CaloCell_ID.h:34
LVL1::jFexEmulatedTowers::jFexEmulatedTowers
jFexEmulatedTowers(const std::string &name, ISvcLocator *svc)
Definition: jFexEmulatedTowers.cxx:31
LVL1::jFexEmulatedTowers::m_Firm2Tower_map
std::unordered_map< unsigned int, std::array< float, 6 > > m_Firm2Tower_map
Definition: jFexEmulatedTowers.h:82
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
LVL1::jFexEmulatedTowers::m_CaloCellKey
SG::ReadHandleKey< CaloCellContainer > m_CaloCellKey
{map index, {IDsimulation,eta,phi,source,iEta,iPhi}}
Definition: jFexEmulatedTowers.h:86
LVL1::jFexEmulatedTowers::m_jTowersWriteKey
SG::WriteHandleKey< xAOD::jFexTowerContainer > m_jTowersWriteKey
Definition: jFexEmulatedTowers.h:55
TrigConf::name
Definition: HLTChainList.h:35
LVL1::jFexEmulatedTowers
Definition: jFexEmulatedTowers.h:37
LVL1::jFexEmulatedTowers::m_map_TTower2SCellsHAD
std::unordered_map< uint32_t, std::vector< uint64_t > > m_map_TTower2SCellsHAD
Definition: jFexEmulatedTowers.h:77
AthReentrantAlgorithm.h
WriteHandleKey.h
Property holding a SG store/key/clid from which a WriteHandle is made.
PathResolver.h
LVL1::jFexEmulatedTowers::m_map_TTower2SCellsEM
std::unordered_map< uint32_t, std::vector< uint64_t > > m_map_TTower2SCellsEM
Definition: jFexEmulatedTowers.h:76
LVL1::jFexEmulatedTowers::m_triggerTowerKey
SG::ReadHandleKey< xAOD::TriggerTowerContainer > m_triggerTowerKey
Definition: jFexEmulatedTowers.h:52
CaloCellContainer.h
LVL1::jFexEmulatedTowers::m_SCellKey
SG::ReadHandleKey< CaloCellContainer > m_SCellKey
Definition: jFexEmulatedTowers.h:49
LVL1::jFexEmulatedTowers::m_jFEX2Tilemapping
Gaudi::Property< std::string > m_jFEX2Tilemapping
Definition: jFexEmulatedTowers.h:67
LVL1::jFexEmulatedTowers::ReadSCfromFile
StatusCode ReadSCfromFile(const std::string &)
Definition: jFexEmulatedTowers.cxx:379
jFexTowerAuxContainer.h
LVL1::jFexEmulatedTowers::m_apply_masking
Gaudi::Property< bool > m_apply_masking
Definition: jFexEmulatedTowers.h:61
LVL1::jFexEmulatedTowers::m_isDATA
Gaudi::Property< bool > m_isDATA
Definition: jFexEmulatedTowers.h:62
LVL1::jFexEmulatedTowers::ReadFibersfromFile
StatusCode ReadFibersfromFile(const std::string &)
Definition: jFexEmulatedTowers.cxx:325
LVL1::jFexEmulatedTowers::m_jtowerEtMeVdecorKey
SG::WriteDecorHandleKey< xAOD::jFexTowerContainer > m_jtowerEtMeVdecorKey
Definition: jFexEmulatedTowers.h:97
ToolHandle.h
LVL1::jFexEmulatedTowers::m_map_TTower2Tile
std::unordered_map< uint32_t, std::tuple< uint32_t, float, float > > m_map_TTower2Tile
Definition: jFexEmulatedTowers.h:78
LVL1::jFexEmulatedTowers::m_FiberMapping
Gaudi::Property< std::string > m_FiberMapping
Definition: jFexEmulatedTowers.h:58
SG::ReadDecorHandleKey
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Definition: StoreGate/StoreGate/ReadDecorHandleKey.h:85
LVL1::jFexEmulatedTowers::m_caloCellSumETdecorKey
SG::WriteDecorHandleKey< xAOD::jFexTowerContainer > m_caloCellSumETdecorKey
Definition: jFexEmulatedTowers.h:96
LVL1::jFexEmulatedTowers::m_jtowerEtTimingMeVdecorKey
SG::WriteDecorHandleKey< xAOD::jFexTowerContainer > m_jtowerEtTimingMeVdecorKey
Definition: jFexEmulatedTowers.h:98
LVL1::jFexEmulatedTowers::m_doThinning
Gaudi::Property< bool > m_doThinning
Definition: jFexEmulatedTowers.h:63
LVL1::jFexEmulatedTowers::mapIndex
constexpr static unsigned int mapIndex(unsigned int jfex, unsigned int fpga, unsigned int channel, unsigned int tower)
Definition: jFexEmulatedTowers.cxx:374
TriggerTowerAuxContainer.h