ATLAS Offline Software
jFEXForwardElecAlgo.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 //***************************************************************************
5 // jFEXForwardElecAlgo - Algorithm for Forward Electron Algorithm in jFEX
6 // -------------------
7 // begin : 16 11 2021
8 // email : Sergi.Rodriguez@cern.ch
9 // email : sjolin@cern.ch
10 //***************************************************************************
11 
12 #ifndef jFEXForwardElecAlgo_H
13 #define jFEXForwardElecAlgo_H
14 
17 #include "AthenaKernel/CLASS_DEF.h"
25 #include "StoreGate/StoreGateSvc.h"
27 
28 namespace LVL1 {
29 
30  class jFEXForwardElecAlgo : public AthAlgTool, virtual public IjFEXForwardElecAlgo {
31 
32  public:
34  jFEXForwardElecAlgo(const std::string& type, const std::string& name, const IInterface* parent);
35 
37  virtual StatusCode initialize() override;
38 
40  virtual ~jFEXForwardElecAlgo();
41 
43  virtual StatusCode safetyTest() override;
44  virtual StatusCode reset() override;
45 
46  virtual void setup(
48  int jfex, int fpga ) override;
49 
50  virtual std::unordered_map<uint, jFEXForwardElecInfo> calculateEDM() override;
51  virtual void setFPGAEnergy(
52  std::unordered_map<int,std::vector<int> > etmapEM,
53  std::unordered_map<int,std::vector<int> > etmapHAD) override;
54 
55  private:
56  SG::ReadHandleKey<LVL1::jTowerContainer> m_jTowerContainerKey {this, "MyjTowers", "jTowerContainer", "jTower input container"};
58  std::unordered_map<int,std::vector<int> > m_map_Etvalues_EM;
59  std::unordered_map<int,std::vector<int> > m_map_Etvalues_HAD;
61  int m_jfex;
62  int m_fpga;
63  static constexpr float m_2PI = 2*M_PI;
64  static constexpr float m_TT_Size_phi = M_PI/32;
65  const int m_Edge_dR2 = std::round( (std::pow(2*M_PI/32,2)) * 1e5 );
66  const int m_Edge_dR3 = std::round( (std::pow(3*M_PI/32,2)) * 1e5 );
67  const int m_Edge_dR4 = std::round( (std::pow(4*M_PI/32,2)) * 1e5 );
68 
69  Gaudi::Property<std::string> m_IsoMapStr {this, "IsoMap", "Run3L1CaloSimulation/JetMaps/2024_04_09/jFEX_FWD_iso.dat", "Contains Trigger towers in (forward) EM layer used for isolation"};
70  Gaudi::Property<std::string> m_Frac1MapStr {this, "Frac1Map", "Run3L1CaloSimulation/JetMaps/2024_04_09/jFEX_FWD_frac.dat", "Contains Trigger towers in FCal layer2 used for hadronic fraction 1 discriminant"};
71  Gaudi::Property<std::string> m_Frac2MapStr {this, "Frac2Map", "Run3L1CaloSimulation/JetMaps/2024_04_09/jFEX_FWD_frac2.dat", "Contains Trigger towers in FCal layer3 used for hadronic fraction 2 discriminant"};
72  Gaudi::Property<std::string> m_SearchGTauStr {this, "SearchGTauMap", "Run3L1CaloSimulation/JetMaps/2024_04_09/jFEX_FWD_searchGTau.dat" , "Contains Trigger tower to find local max (greater than)"};
73  Gaudi::Property<std::string> m_SearchGeTauStr {this, "SearchGeTauMap", "Run3L1CaloSimulation/JetMaps/2024_04_09/jFEX_FWD_searchGeTau.dat", "Contains Trigger tower to find local max (greater or equal than)"};
74 
75  std::unordered_map<unsigned int, std::vector<unsigned int> > m_SeedRingMap;
76  std::unordered_map<unsigned int, std::vector<unsigned int> > m_1stRingMap;
77  std::unordered_map<unsigned int, std::vector<unsigned int> > m_IsoMap;
78  std::unordered_map<unsigned int, std::vector<unsigned int> > m_Frac1Map;
79  std::unordered_map<unsigned int, std::vector<unsigned int> > m_Frac2Map;
80  std::unordered_map<unsigned int, std::vector<unsigned int> > m_SearchGTauMap;
81  std::unordered_map<unsigned int, std::vector<unsigned int> > m_SearchGeTauMap;
82 
83  virtual std::array<float,2> getEtaPhi(uint) override;
84  virtual std::array<int,2> getEtEmHad(uint) override;
85  bool getEMSat(unsigned int ttID);
86 
87  bool isValidSeed(uint seedTTID);
88  void findAndFillNextTT(jFEXForwardElecInfo& elCluster, int neta, int nphi);
89 
90  StatusCode ReadfromFile(const std::string& , std::unordered_map<unsigned int, std::vector<unsigned int> >&);
91  };
92 
93 }//end of namespace
94 
96 
97 #endif
98 
LVL1::jFEXForwardElecAlgo::m_jTowerContainer
SG::ReadHandle< jTowerContainer > m_jTowerContainer
Definition: jFEXForwardElecAlgo.h:57
LVL1::jFEXForwardElecAlgo::m_Edge_dR3
const int m_Edge_dR3
Definition: jFEXForwardElecAlgo.h:66
LVL1::jFEXForwardElecAlgo::getEMSat
bool getEMSat(unsigned int ttID)
Definition: jFEXForwardElecAlgo.cxx:98
LVL1::jFEXForwardElecAlgo::m_fpga
int m_fpga
Definition: jFEXForwardElecAlgo.h:62
LVL1::jFEXForwardElecAlgo::m_TT_Size_phi
static constexpr float m_TT_Size_phi
Definition: jFEXForwardElecAlgo.h:64
jFEXForwardElecTOB.h
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
LVL1::jFEXForwardElecAlgo::m_jTowerContainerKey
SG::ReadHandleKey< LVL1::jTowerContainer > m_jTowerContainerKey
Definition: jFEXForwardElecAlgo.h:56
LVL1::jFEXForwardElecAlgo::m_SearchGTauStr
Gaudi::Property< std::string > m_SearchGTauStr
Definition: jFEXForwardElecAlgo.h:72
LVL1::jFEXForwardElecAlgo::ReadfromFile
StatusCode ReadfromFile(const std::string &, std::unordered_map< unsigned int, std::vector< unsigned int > > &)
Definition: jFEXForwardElecAlgo.cxx:359
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
MuonGM::round
float round(const float toRound, const unsigned int decimals)
Definition: Mdt.cxx:27
LVL1::jFEXForwardElecAlgo::m_map_Etvalues_EM
std::unordered_map< int, std::vector< int > > m_map_Etvalues_EM
Definition: jFEXForwardElecAlgo.h:58
LVL1::IjFEXForwardElecAlgo
Definition: IjFEXForwardElecAlgo.h:24
M_PI
#define M_PI
Definition: ActiveFraction.h:11
LVL1::jFEXForwardElecAlgo::m_jfex
int m_jfex
Definition: jFEXForwardElecAlgo.h:61
LVL1::jFEXForwardElecAlgo::m_IsoMap
std::unordered_map< unsigned int, std::vector< unsigned int > > m_IsoMap
Definition: jFEXForwardElecAlgo.h:77
LVL1::FEXAlgoSpaceDefs::jFEX_algoSpace_height
constexpr static int jFEX_algoSpace_height
Definition: FEXAlgoSpaceDefs.h:27
SG::ReadHandleKey< LVL1::jTowerContainer >
LVL1::jFEXForwardElecAlgo::m_SearchGeTauMap
std::unordered_map< unsigned int, std::vector< unsigned int > > m_SearchGeTauMap
Definition: jFEXForwardElecAlgo.h:81
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
LVL1::jFEXForwardElecAlgo::m_Frac2Map
std::unordered_map< unsigned int, std::vector< unsigned int > > m_Frac2Map
Definition: jFEXForwardElecAlgo.h:79
LVL1::jFEXForwardElecAlgo::m_Edge_dR4
const int m_Edge_dR4
Definition: jFEXForwardElecAlgo.h:67
LVL1::jFEXForwardElecAlgo::m_map_Etvalues_HAD
std::unordered_map< int, std::vector< int > > m_map_Etvalues_HAD
Definition: jFEXForwardElecAlgo.h:59
LVL1::jFEXForwardElecAlgo::m_Frac1Map
std::unordered_map< unsigned int, std::vector< unsigned int > > m_Frac1Map
Definition: jFEXForwardElecAlgo.h:78
LVL1::jFEXForwardElecAlgo::m_1stRingMap
std::unordered_map< unsigned int, std::vector< unsigned int > > m_1stRingMap
Definition: jFEXForwardElecAlgo.h:76
AthAlgorithm.h
uint
unsigned int uint
Definition: LArOFPhaseFill.cxx:20
LVL1::jFEXForwardElecAlgo::m_2PI
static constexpr float m_2PI
Definition: jFEXForwardElecAlgo.h:63
LVL1::jFEXForwardElecAlgo::m_Edge_dR2
const int m_Edge_dR2
Definition: jFEXForwardElecAlgo.h:65
IjFEXForwardElecAlgo.h
LVL1::jFEXForwardElecAlgo::m_Frac1MapStr
Gaudi::Property< std::string > m_Frac1MapStr
Definition: jFEXForwardElecAlgo.h:70
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
LVL1::jFEXForwardElecAlgo
Definition: jFEXForwardElecAlgo.h:30
LVL1::FEXAlgoSpaceDefs::jFEX_wide_algoSpace_width
constexpr static int jFEX_wide_algoSpace_width
Definition: FEXAlgoSpaceDefs.h:25
AthAlgTool.h
LVL1::jFEXForwardElecAlgo::m_IsoMapStr
Gaudi::Property< std::string > m_IsoMapStr
Definition: jFEXForwardElecAlgo.h:69
test_pyathena.parent
parent
Definition: test_pyathena.py:15
CaloCell_SuperCell_ID.h
Helper class for offline supercell identifiers.
LVL1::jFEXForwardElecAlgo::setFPGAEnergy
virtual void setFPGAEnergy(std::unordered_map< int, std::vector< int > > etmapEM, std::unordered_map< int, std::vector< int > > etmapHAD) override
Definition: jFEXForwardElecAlgo.cxx:107
LVL1::jFEXForwardElecAlgo::m_Frac2MapStr
Gaudi::Property< std::string > m_Frac2MapStr
Definition: jFEXForwardElecAlgo.h:71
LVL1::jFEXForwardElecAlgo::findAndFillNextTT
void findAndFillNextTT(jFEXForwardElecInfo &elCluster, int neta, int nphi)
Definition: jFEXForwardElecAlgo.cxx:151
FEXAlgoSpaceDefs.h
TrigConf::name
Definition: HLTChainList.h:35
LVL1::jFEXForwardElecAlgo::jFEXForwardElecAlgo
jFEXForwardElecAlgo(const std::string &type, const std::string &name, const IInterface *parent)
Constructors.
Definition: jFEXForwardElecAlgo.cxx:33
jTowerContainer.h
LVL1::jFEXForwardElecAlgo::initialize
virtual StatusCode initialize() override
standard Athena-Algorithm method
Definition: jFEXForwardElecAlgo.cxx:41
LVL1::jFEXForwardElecAlgo::calculateEDM
virtual std::unordered_map< uint, jFEXForwardElecInfo > calculateEDM() override
Definition: jFEXForwardElecAlgo.cxx:236
LVL1::jFEXForwardElecAlgo::safetyTest
virtual StatusCode safetyTest() override
Standard methods.
Definition: jFEXForwardElecAlgo.cxx:54
CaloCellContainer.h
LVL1::jFEXForwardElecAlgo::reset
virtual StatusCode reset() override
Definition: jFEXForwardElecAlgo.cxx:63
LVL1::jFEXForwardElecAlgo::getEtEmHad
virtual std::array< int, 2 > getEtEmHad(uint) override
Definition: jFEXForwardElecAlgo.cxx:82
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
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
jFEXForwardElecInfo.h
LVL1::jFEXForwardElecAlgo::m_SearchGTauMap
std::unordered_map< unsigned int, std::vector< unsigned int > > m_SearchGTauMap
Definition: jFEXForwardElecAlgo.h:80
LVL1::jFEXForwardElecAlgo::m_jFEXalgoTowerID
int m_jFEXalgoTowerID[FEXAlgoSpaceDefs::jFEX_algoSpace_height][FEXAlgoSpaceDefs::jFEX_wide_algoSpace_width]
Definition: jFEXForwardElecAlgo.h:60
LVL1::jFEXForwardElecAlgo::m_SeedRingMap
std::unordered_map< unsigned int, std::vector< unsigned int > > m_SeedRingMap
Definition: jFEXForwardElecAlgo.h:75
LVL1::jFEXForwardElecAlgo::setup
virtual void setup(int inputTable[FEXAlgoSpaceDefs::jFEX_algoSpace_height][FEXAlgoSpaceDefs::jFEX_wide_algoSpace_width], int jfex, int fpga) override
Definition: jFEXForwardElecAlgo.cxx:67
CaloIdManager.h
LVL1::jFEXForwardElecInfo
Definition: jFEXForwardElecInfo.h:28
LVL1::jFEXForwardElecAlgo::getEtaPhi
virtual std::array< float, 2 > getEtaPhi(uint) override
Definition: jFEXForwardElecAlgo.cxx:74
AthAlgTool
Definition: AthAlgTool.h:26
LVL1::jFEXForwardElecAlgo::~jFEXForwardElecAlgo
virtual ~jFEXForwardElecAlgo()
Destructor.
Definition: jFEXForwardElecAlgo.cxx:38
LVL1::jFEXForwardElecAlgo::m_SearchGeTauStr
Gaudi::Property< std::string > m_SearchGeTauStr
Definition: jFEXForwardElecAlgo.h:73
StoreGateSvc.h
CLASS_DEF.h
macros to associate a CLID to a type
LVL1::jFEXForwardElecAlgo::isValidSeed
bool isValidSeed(uint seedTTID)
Definition: jFEXForwardElecAlgo.cxx:115