ATLAS Offline Software
jFEXFPGA.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //***************************************************************************
6 // jFEXFPGA.h -
7 // -------------------
8 // begin : 15 10 2019
9 // email : jacob.julian.kempster@cern.ch
10 // ***************************************************************************/
11 
12 #ifndef jFEXFPGA_H
13 #define jFEXFPGA_H
14 
16 #include "AthenaKernel/CLASS_DEF.h"
18 #include "L1CaloFEXSim/jTower.h"
34 #include "TrigConfData/L1Menu.h"
35 #include <vector>
36 #include "GaudiKernel/ServiceHandle.h"
37 #include "GaudiKernel/ISvcLocator.h"
38 #include "GaudiKernel/ITHistSvc.h"
39 #include "GaudiKernel/IClassIDSvc.h"
40 #include "SGTools/StlMapClids.h"
41 #include "SGTools/TestStore.h"
42 #include "StoreGate/WriteHandle.h"
43 #include "StoreGate/ReadHandle.h"
44 #include "StoreGate/StoreGateSvc.h"
45 
46 #include "L1CaloFEXSim/jFEXTOB.h"
47 
48 namespace LVL1 {
49 
50  //Doxygen class description below:
57  class jFEXFPGA : public AthAlgTool, virtual public IjFEXFPGA {
58 
59  public:
61  jFEXFPGA(const std::string& type,const std::string& name,const IInterface* parent);
62 
64  virtual StatusCode initialize() override;
66  virtual ~jFEXFPGA();
67 
68  virtual StatusCode init(int id, int efexid) override ;
69 
70  virtual StatusCode execute(jFEXOutputCollection* inputOutputCollection, const std::pair<unsigned int, const std::vector<int>&> & jetCalibrationParameters) override ;
71 
72  virtual void reset() override ;
73 
74  virtual int ID() override {return m_id;}
75 
76  virtual void SetTowersAndCells_SG( int [][FEXAlgoSpaceDefs::jFEX_wide_algoSpace_width] ) override ;
77  virtual void SetTowersAndCells_SG( int [][FEXAlgoSpaceDefs::jFEX_thin_algoSpace_width] ) override ;
78 
80  virtual std::vector <std::unique_ptr<jFEXTOB>> getSmallRJetTOBs() override;
81  virtual std::vector <std::unique_ptr<jFEXTOB>> getLargeRJetTOBs() override;
82 
84  virtual std::vector <std::vector <uint32_t>> getFwdElTOBs() override;
85 
86  /* Retreive Tau TOB words */
87  virtual std::vector<std::unique_ptr<jFEXTOB>> getTauTOBs() override;
88 
90  virtual std::vector<std::unique_ptr<jFEXTOB>> getSumEtTOBs() override;
91 
93  virtual std::vector<std::unique_ptr<jFEXTOB>> getMetTOBs() override;
94 
95  int getTTowerET_EM (unsigned int TTID ) override;
96  int getTTowerET_HAD (unsigned int TTID ) override;
97  int getTTowerET (unsigned int TTID ) override;
98  int getTTowerET_forMET (unsigned int TTID ) override;
99 
101  private:
102 
103  template <class TOBObjectClass> static bool TOBetSort(const TOBObjectClass& i, const TOBObjectClass& j , uint bits, uint mask) {
104  return (((i->getWord() >> bits ) & mask)>((j->getWord() >> bits ) & mask));
105  }
106 
107  static bool etFwdElSort (const std::vector<uint32_t>& i,
108  const std::vector<uint32_t>& j)
109  { return (((i.at(0) >> FEXAlgoSpaceDefs::jEM_etBit ) & 0x7ff )> ((j.at(0) >> FEXAlgoSpaceDefs::jEM_etBit) & 0x7ff ));}
110 
111  std::vector<std::unique_ptr<jFEXTOB>> m_tau_tobwords;
112  std::vector<std::unique_ptr<jFEXTOB>> m_SRJet_tobwords;
113  std::vector<std::unique_ptr<jFEXTOB>> m_LRJet_tobwords;
114  std::vector<std::unique_ptr<jFEXTOB>> m_sumET_tobwords;
115  std::vector<std::unique_ptr<jFEXTOB>> m_Met_tobwords;
116 
117  int m_id;
118  int m_jfexid;
119 
120  std::vector<std::vector<uint32_t>> m_FwdEl_tobwords;
121 
124 
125  std::unordered_map<int,jTower> m_jTowersColl;
126  std::unordered_map<int,std::vector<int> > m_map_Etvalues_FPGA;
127  std::unordered_map<int,std::vector<int> > m_map_HAD_Etvalues_FPGA;
128  std::unordered_map<int,std::vector<int> > m_map_EM_Etvalues_FPGA;
129 
130 
131  std::unordered_map<int, jFEXForwardJetsInfo> m_FCALJets;
132  std::unordered_map<uint, jFEXForwardElecInfo> m_ForwardElecs;
133 
136 
138 
139  SG::ReadHandleKey<LVL1::jTowerContainer> m_jTowerContainerKey {this, "MyETowers", "jTowerContainer", "Input container for jTowers"};
140  SG::ReadHandleKey<TrigConf::L1Menu> m_l1MenuKey{this, "L1TriggerMenu", "DetectorStore+L1TriggerMenu","Name of the L1Menu object to read configuration from"};
141  ToolHandle<IjFEXSmallRJetAlgo> m_jFEXSmallRJetAlgoTool {this, "jFEXSmallRJetAlgoTool", "LVL1::jFEXSmallRJetAlgo", "Tool that runs the jFEX Small R Jet algorithm"};
142  ToolHandle<IjFEXLargeRJetAlgo> m_jFEXLargeRJetAlgoTool {this, "jFEXLargeRJetAlgoTool", "LVL1::jFEXLargeRJetAlgo", "Tool that runs the jFEX Large R Jet algorithm"};
143  ToolHandle<IjFEXtauAlgo> m_jFEXtauAlgoTool {this, "jFEXtauAlgoTool" , "LVL1::jFEXtauAlgo" , "Tool that runs the jFEX tau algorithm"};
144  ToolHandle<IjFEXsumETAlgo> m_jFEXsumETAlgoTool {this, "jFEXsumETAlgoTool" , "LVL1::jFEXsumETAlgo" , "Tool that runs the jFEX sumET algorithm"};
145  ToolHandle<IjFEXmetAlgo> m_jFEXmetAlgoTool {this, "jFEXmetAlgoTool" , "LVL1::jFEXmetAlgo" , "Tool that runs the jFEX met algorithm"};
146  ToolHandle<IjFEXForwardJetsAlgo> m_jFEXForwardJetsAlgoTool {this, "jFEXForwardJetsAlgoTool" , "LVL1::jFEXForwardJetsAlgo" , "Tool that runs the jFEX FCAL Jets algorithm"};
147  ToolHandle<IjFEXForwardElecAlgo> m_jFEXForwardElecAlgoTool {this, "jFEXForwardElecAlgoTool" , "LVL1::jFEXForwardElecAlgo" , "Tool that runs the jFEX FCAL Electrons algorithm"};
148  ToolHandle<IjFEXPileupAndNoise> m_jFEXPileupAndNoiseTool {this, "jFEXPileupAndNoiseTool", "LVL1::jFEXPileupAndNoise", "Tool that applies Pileup and Noise"};
149  ToolHandle<IjFEXFormTOBs> m_IjFEXFormTOBsTool {this, "IjFEXFormTOBsTool", "LVL1::jFEXFormTOBs", "Tool that forms TOB words"};
150 
151  int getTTowerET_SG(unsigned int TTID);
152  std::string m_jfex_string[6] = {"1C","2C","3C","3A","2A","1A"};
153  };
154 
155 } // end of namespace
156 
157 
158 CLASS_DEF( LVL1::jFEXFPGA , 76081081 , 1 )
159 #endif
IjFEXmetAlgo.h
jFEXTOB.h
LVL1::jFEXFPGA::getMetTOBs
virtual std::vector< std::unique_ptr< jFEXTOB > > getMetTOBs() override
Form a tob word out of the potential candidate MET tob.
Definition: jFEXFPGA.cxx:614
LVL1::jFEXFPGA::m_FwdEl_tobwords
std::vector< std::vector< uint32_t > > m_FwdEl_tobwords
Definition: jFEXFPGA.h:120
LVL1::jFEXFPGA::jFEXFPGA
jFEXFPGA(const std::string &type, const std::string &name, const IInterface *parent)
Constructors.
Definition: jFEXFPGA.cxx:49
IjFEXSmallRJetAlgo.h
LVL1::jFEXFPGA::m_l1MenuKey
SG::ReadHandleKey< TrigConf::L1Menu > m_l1MenuKey
Definition: jFEXFPGA.h:140
LVL1::jFEXFPGA::reset
virtual void reset() override
Definition: jFEXFPGA.cxx:76
LVL1::jFEXFPGA::m_LRJetET
int m_LRJetET
Definition: jFEXFPGA.h:135
LVL1::FEXAlgoSpaceDefs::jFEX_thin_algoSpace_width
constexpr static int jFEX_thin_algoSpace_width
Definition: FEXAlgoSpaceDefs.h:26
LVL1::jFEXFPGA::m_jTowerContainerKey
SG::ReadHandleKey< LVL1::jTowerContainer > m_jTowerContainerKey
Definition: jFEXFPGA.h:139
LVL1::jFEXFPGA::m_jFEXtauAlgoTool
ToolHandle< IjFEXtauAlgo > m_jFEXtauAlgoTool
Definition: jFEXFPGA.h:143
LVL1::jFEXFPGA::m_jfex_string
std::string m_jfex_string[6]
Definition: jFEXFPGA.h:152
LVL1::jFEXFPGA::m_jFEXSmallRJetAlgoTool
ToolHandle< IjFEXSmallRJetAlgo > m_jFEXSmallRJetAlgoTool
Definition: jFEXFPGA.h:141
LVL1::jFEXFPGA::getTTowerET
int getTTowerET(unsigned int TTID) override
Definition: jFEXFPGA.cxx:656
LVL1::jFEXFPGA::m_Met_tobwords
std::vector< std::unique_ptr< jFEXTOB > > m_Met_tobwords
Definition: jFEXFPGA.h:115
LVL1::jFEXFPGA::m_sumET_tobwords
std::vector< std::unique_ptr< jFEXTOB > > m_sumET_tobwords
Definition: jFEXFPGA.h:114
LVL1::FEXAlgoSpaceDefs::jFEX_algoSpace_height
constexpr static int jFEX_algoSpace_height
Definition: FEXAlgoSpaceDefs.h:27
LVL1::jFEXFPGA::getTTowerET_HAD
int getTTowerET_HAD(unsigned int TTID) override
Definition: jFEXFPGA.cxx:643
SG::ReadHandleKey< LVL1::jTowerContainer >
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
IjFEXFPGA.h
python.utils.AtlRunQueryLookup.mask
string mask
Definition: AtlRunQueryLookup.py:460
LVL1::jFEXFPGA::initialize
virtual StatusCode initialize() override
standard Athena-Algorithm method
Definition: jFEXFPGA.cxx:60
jFEXOutputCollection.h
LVL1::jFEXFPGA::getTauTOBs
virtual std::vector< std::unique_ptr< jFEXTOB > > getTauTOBs() override
Definition: jFEXFPGA.cxx:584
LVL1::jFEXFPGA::m_jFEXForwardJetsAlgoTool
ToolHandle< IjFEXForwardJetsAlgo > m_jFEXForwardJetsAlgoTool
Definition: jFEXFPGA.h:146
LVL1::jFEXFPGA::m_SRJet_tobwords
std::vector< std::unique_ptr< jFEXTOB > > m_SRJet_tobwords
Definition: jFEXFPGA.h:112
LVL1::jFEXFPGA::getTTowerET_forMET
int getTTowerET_forMET(unsigned int TTID) override
Definition: jFEXFPGA.cxx:664
LVL1::jFEXFPGA::m_tau_tobwords
std::vector< std::unique_ptr< jFEXTOB > > m_tau_tobwords
Definition: jFEXFPGA.h:111
uint
unsigned int uint
Definition: LArOFPhaseFill.cxx:20
WriteHandle.h
Handle class for recording to StoreGate.
LVL1::jFEXFPGA::m_jTowersIDs_Wide
int m_jTowersIDs_Wide[FEXAlgoSpaceDefs::jFEX_algoSpace_height][FEXAlgoSpaceDefs::jFEX_wide_algoSpace_width]
Definition: jFEXFPGA.h:122
LVL1::jFEXFPGA::m_jFEXsumETAlgoTool
ToolHandle< IjFEXsumETAlgo > m_jFEXsumETAlgoTool
Definition: jFEXFPGA.h:144
LVL1::jFEXFPGA::init
virtual StatusCode init(int id, int efexid) override
Definition: jFEXFPGA.cxx:68
IjFEXForwardElecAlgo.h
lumiFormat.i
int i
Definition: lumiFormat.py:85
LVL1::jFEXFPGA::m_ForwardElecs
std::unordered_map< uint, jFEXForwardElecInfo > m_ForwardElecs
Definition: jFEXFPGA.h:132
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
LVL1::jFEXFPGA::ID
virtual int ID() override
Definition: jFEXFPGA.h:74
IjFEXtauAlgo.h
LVL1::FEXAlgoSpaceDefs::jFEX_wide_algoSpace_width
constexpr static int jFEX_wide_algoSpace_width
Definition: FEXAlgoSpaceDefs.h:25
AthAlgTool.h
LVL1::jFEXFPGA::getLargeRJetTOBs
virtual std::vector< std::unique_ptr< jFEXTOB > > getLargeRJetTOBs() override
Definition: jFEXFPGA.cxx:554
LVL1::jFEXFPGA::m_FCALJets
std::unordered_map< int, jFEXForwardJetsInfo > m_FCALJets
Definition: jFEXFPGA.h:131
LVL1::jFEXFPGA::TOBetSort
static bool TOBetSort(const TOBObjectClass &i, const TOBObjectClass &j, uint bits, uint mask)
Internal data.
Definition: jFEXFPGA.h:103
LVL1::jFEXFPGA::m_map_Etvalues_FPGA
std::unordered_map< int, std::vector< int > > m_map_Etvalues_FPGA
Definition: jFEXFPGA.h:126
test_pyathena.parent
parent
Definition: test_pyathena.py:15
CaloCell_SuperCell_ID.h
Helper class for offline supercell identifiers.
LVL1::jFEXFPGA::getSmallRJetTOBs
virtual std::vector< std::unique_ptr< jFEXTOB > > getSmallRJetTOBs() override
Form a tob word out of the potential candidate SmallRJet tob.
Definition: jFEXFPGA.cxx:538
LVL1::jFEXFPGA::m_sCellsCollection
CaloCellContainer m_sCellsCollection
Definition: jFEXFPGA.h:137
LVL1::jFEXFPGA::m_IjFEXFormTOBsTool
ToolHandle< IjFEXFormTOBs > m_IjFEXFormTOBsTool
Definition: jFEXFPGA.h:149
LVL1::jFEXOutputCollection
Definition: jFEXOutputCollection.h:23
IjFEXPileupAndNoise.h
LVL1::jFEXFPGA::SetTowersAndCells_SG
virtual void SetTowersAndCells_SG(int[][FEXAlgoSpaceDefs::jFEX_wide_algoSpace_width]) override
Definition: jFEXFPGA.cxx:497
FEXAlgoSpaceDefs.h
LVL1::jFEXFPGA::m_jfexid
int m_jfexid
Definition: jFEXFPGA.h:118
TrigConf::name
Definition: HLTChainList.h:35
IjFEXForwardJetsAlgo.h
jTowerContainer.h
TestStore.h
Dummy event store, for regression tests.
LVL1::jFEXFPGA::m_LRJet_tobwords
std::vector< std::unique_ptr< jFEXTOB > > m_LRJet_tobwords
Definition: jFEXFPGA.h:113
LVL1::jFEXFPGA::getFwdElTOBs
virtual std::vector< std::vector< uint32_t > > getFwdElTOBs() override
sorted Electron tobs
Definition: jFEXFPGA.cxx:571
StlMapClids.h
LVL1::jFEXFPGA::etFwdElSort
static bool etFwdElSort(const std::vector< uint32_t > &i, const std::vector< uint32_t > &j)
Definition: jFEXFPGA.h:107
LVL1::jFEXFPGA::m_jFEXForwardElecAlgoTool
ToolHandle< IjFEXForwardElecAlgo > m_jFEXForwardElecAlgoTool
Definition: jFEXFPGA.h:147
CaloCellContainer.h
CaloCellContainer
Container class for CaloCell.
Definition: CaloCellContainer.h:55
LVL1::jFEXFPGA::m_jFEXmetAlgoTool
ToolHandle< IjFEXmetAlgo > m_jFEXmetAlgoTool
Definition: jFEXFPGA.h:145
LVL1::jFEXFPGA::execute
virtual StatusCode execute(jFEXOutputCollection *inputOutputCollection, const std::pair< unsigned int, const std::vector< int > & > &jetCalibrationParameters) override
Definition: jFEXFPGA.cxx:91
LVL1::jFEXFPGA::getSumEtTOBs
virtual std::vector< std::unique_ptr< jFEXTOB > > getSumEtTOBs() override
Form a tob word out of the potential candidate SumET tob.
Definition: jFEXFPGA.cxx:598
LVL1::jFEXFPGA::m_jTowersColl
std::unordered_map< int, jTower > m_jTowersColl
Definition: jFEXFPGA.h:125
LVL1::jFEXFPGA::m_map_EM_Etvalues_FPGA
std::unordered_map< int, std::vector< int > > m_map_EM_Etvalues_FPGA
Definition: jFEXFPGA.h:128
LVL1::jFEXFPGA::m_map_HAD_Etvalues_FPGA
std::unordered_map< int, std::vector< int > > m_map_HAD_Etvalues_FPGA
Definition: jFEXFPGA.h:127
LVL1::jFEXFPGA::m_id
int m_id
Definition: jFEXFPGA.h:117
LVL1::jFEXFPGA::~jFEXFPGA
virtual ~jFEXFPGA()
Destructor.
Definition: jFEXFPGA.cxx:54
IjFEXFormTOBs.h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
LVL1::jFEXFPGA::getTTowerET_EM
int getTTowerET_EM(unsigned int TTID) override
Definition: jFEXFPGA.cxx:630
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:64
CaloIdManager.h
ReadHandle.h
Handle class for reading from StoreGate.
LVL1::IjFEXFPGA
Definition: IjFEXFPGA.h:34
AthAlgTool
Definition: AthAlgTool.h:26
L1Menu.h
LVL1::jFEXFPGA::m_SRJetET
int m_SRJetET
Definition: jFEXFPGA.h:134
jTower.h
LVL1::FEXAlgoSpaceDefs::jEM_etBit
constexpr static int jEM_etBit
Definition: FEXAlgoSpaceDefs.h:111
StoreGateSvc.h
LVL1::jFEXFPGA::getTTowerET_SG
int getTTowerET_SG(unsigned int TTID)
Definition: jFEXFPGA.cxx:692
CLASS_DEF.h
macros to associate a CLID to a type
IjFEXLargeRJetAlgo.h
IjFEXsumETAlgo.h
LVL1::jFEXFPGA
The jFEXFPGA class defines the structure of a single jFEX FPGA Its purpose is:
Definition: jFEXFPGA.h:57
LVL1::jFEXFPGA::m_jFEXLargeRJetAlgoTool
ToolHandle< IjFEXLargeRJetAlgo > m_jFEXLargeRJetAlgoTool
Definition: jFEXFPGA.h:142
LVL1::jFEXFPGA::m_jFEXPileupAndNoiseTool
ToolHandle< IjFEXPileupAndNoise > m_jFEXPileupAndNoiseTool
Definition: jFEXFPGA.h:148
LVL1::jFEXFPGA::m_jTowersIDs_Thin
int m_jTowersIDs_Thin[FEXAlgoSpaceDefs::jFEX_algoSpace_height][FEXAlgoSpaceDefs::jFEX_thin_algoSpace_width]
Definition: jFEXFPGA.h:123