ATLAS Offline Software
eFEXSysSim.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 //***************************************************************************
6 // eFEXSysSim.h -
7 // -------------------
8 // begin : 12 07 2019
9 // email : alison.elliot@cern.ch, jacob.julian.kempster@cern.ch
10 // ***************************************************************************/
11 
12 
13 #ifndef eFEXSysSim_H
14 #define eFEXSysSim_H
18 #include "AthenaKernel/CLASS_DEF.h"
19 #include "L1CaloFEXSim/eFEXSim.h"
20 #include "L1CaloFEXSim/eTower.h"
23 #include "L1CaloFEXSim/eFEXegTOB.h"
25 
28 
31 
32 namespace LVL1 {
33 
34  //Doxygen class description below:
42  class eFEXSysSim : public AthAlgTool, virtual public IeFEXSysSim {
43 
44  public:
45 
48  eFEXSysSim(const std::string& type,const std::string& name,const IInterface* parent);
50  eFEXSysSim&& operator= (const eFEXSysSim& ) = delete;
51 
53  virtual StatusCode initialize() override;
55  virtual StatusCode finalize () override;
56 
57  virtual StatusCode execute(eFEXOutputCollection* inputOutputCollection) override ;
58 
59  virtual void init() override ;
60 
61  virtual void cleanup() override;
62 
63  virtual int calcTowerID(int eta, int phi, int mod) const override;
64 
66  private:
67  // TOB sorting function
68  template <class TOBObjectClass> static bool TOBetSort(const TOBObjectClass& i, const TOBObjectClass& j, bool isTau ) {
69  auto et_i = (i->getTobword() >> 0 ) & 0xfff;
70  auto et_j = (j->getTobword() >> 0 ) & 0xfff;
71  if(et_i > et_j) return true;
72  if(et_i==et_j) {
73  // resolve ties with procNumber (2,1,3,0 for em, 2,1,0,3 for tau), then phi, then eta
74  auto procOrder = (isTau) ? std::map<unsigned int,unsigned int>{{2,3},{1,2},{0,1},{3,0}} :
75  std::map<unsigned int,unsigned int>{{2,3},{1,2},{3,1},{0,0}};
76  auto proc_i = procOrder.at((i->getTobword()) >> 30);
77  auto proc_j = procOrder.at((j->getTobword()) >> 30);
78  if(proc_i > proc_j) return true;
79  if (proc_i == proc_j) {
80  auto phi_i = (i->getTobword()) & 0x07000000;
81  auto phi_j = (j->getTobword()) & 0x07000000;
82  if(phi_i > phi_j) return true;
83  if(phi_i == phi_j) {
84  auto eta_i = (i->getTobword()) & 0x38000000;
85  auto eta_j = (j->getTobword()) & 0x38000000;
86  if(eta_i > eta_j) return true;
87  }
88 
89  }
90  }
91  return false;
92  }
93 
94  // Auxiliary for storing EDMs of both tau algos
95  StatusCode StoreTauTOBs(std::map<int, std::vector<std::unique_ptr<eFEXtauTOB>> >& allTauTobObjects,
98 
99  // EM TOBs and xTOBS
100  std::unique_ptr< xAOD::eFexEMRoIContainer > m_eContainer;
101  std::unique_ptr< xAOD::eFexEMRoIAuxContainer > m_eAuxContainer;
102  std::unique_ptr< xAOD::eFexEMRoIContainer > m_xeContainer;
103  std::unique_ptr< xAOD::eFexEMRoIAuxContainer > m_xeAuxContainer;
104 
105  std::vector<eFEXSim*> m_eFEXCollection;
106 
107  ToolHandle<IeFEXSim> m_eFEXSimTool {this, "eFEXSimTool", "LVL1::eFEXSim", "Tool that creates the eFEX Simulation"};
108 
109  ToolHandle<IeFEXFillEDM> m_eFEXFillEDMTool {this, "eFEXFillEDMTool", "LVL1::eFEXFillEDM", "Tool to fille eFEX EDMs"};
110 
111  SG::ReadHandleKey<LVL1::eTowerContainer> m_eTowerContainerSGKey {this, "MyETowers", "eTowerContainer", "Input container for eTowers"};
112  SG::ReadHandleKey<TrigConf::L1Menu> m_l1MenuKey{this, "L1TriggerMenu", "DetectorStore+L1TriggerMenu","Name of the L1Menu object to read configuration from"};
113 
114  SG::WriteHandleKey< xAOD::eFexEMRoIContainer > m_eFexOutKey {this,"Key_eFexEMOutputContainer","L1_eEMRoI","Output eFexEM TOB container"};
115  SG::WriteHandleKey< xAOD::eFexEMRoIContainer > m_eFexEMxTOBOutKey {this,"Key_eFexEMxTOBOutputContainer","L1_eEMxRoI","Output eFexEM xTOB container"};
116  SG::WriteHandleKey< xAOD::eFexTauRoIContainer > m_eFexTauActiveOutKey {this,"Key_eFexTauOutputContainer","L1_eTauRoI","Output eFexTau active (BDT/heuristic) algorithm TOB container"};
117  SG::WriteHandleKey< xAOD::eFexTauRoIContainer > m_eFexTauActivexTOBOutKey {this,"Key_eFexTauxTOBOutputContainer","L1_eTauxRoI","Output eFexTau active (BDT/heuristic) algorithm xTOB container"};
118  SG::WriteHandleKey< xAOD::eFexTauRoIContainer > m_eFexTauAltOutKey {this,"Key_eFexAltTauOutputContainer","","Output eFexTau alternative (BDT/heuristic) algorithm TOB container"};
119  SG::WriteHandleKey< xAOD::eFexTauRoIContainer > m_eFexTauAltxTOBOutKey {this,"Key_eFexAltTauxTOBOutputContainer","","Output eFexTau alternative (BDT/heuristic) algorithm xTOB container"};
120  ToolHandle<IeFEXFPGATowerIdProvider> m_eFEXFPGATowerIdProviderTool {this, "eFEXFPGATowerIdProviderTool", "LVL1::eFEXFPGATowerIdProvider", "Tool that provides tower-FPGA mapping"};
121  ToolHandle<IeFEXFPGA> m_eFEXFPGATool {this, "eFEXFPGATool", "LVL1::eFEXFPGA", "Tool that simulates the FPGA hardware"};
122 
123  //std::map<int,eTower> m_eTowersColl;
124 
125  std::map<int, std::vector<std::unique_ptr<eFEXegTOB>> > m_allEmTobObjects;
126 
127  std::map<int, std::vector<std::unique_ptr<eFEXtauTOB>> > m_allTauHeuristicTobObjects;
128  std::map<int, std::vector<std::unique_ptr<eFEXtauTOB>> > m_allTauBDTTobObjects;
129 
130  };
131 
132 } // end of namespace
133 
134 //CLASS_DEF( LVL1::eFEXSysSim , 32201258 , 1 )
135 
136 
137 #endif
LVL1::eFEXSysSim::m_eFEXCollection
std::vector< eFEXSim * > m_eFEXCollection
Definition: eFEXSysSim.h:105
LVL1::eFEXSysSim::m_eFexTauActiveOutKey
SG::WriteHandleKey< xAOD::eFexTauRoIContainer > m_eFexTauActiveOutKey
Definition: eFEXSysSim.h:116
eTowerContainer.h
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
LVL1::eFEXSysSim::m_eFexTauActivexTOBOutKey
SG::WriteHandleKey< xAOD::eFexTauRoIContainer > m_eFexTauActivexTOBOutKey
Definition: eFEXSysSim.h:117
LVL1::eFEXSysSim::execute
virtual StatusCode execute(eFEXOutputCollection *inputOutputCollection) override
Definition: eFEXSysSim.cxx:99
LVL1::eFEXSysSim::StoreTauTOBs
StatusCode StoreTauTOBs(std::map< int, std::vector< std::unique_ptr< eFEXtauTOB >> > &allTauTobObjects, SG::WriteHandleKey< xAOD::eFexTauRoIContainer > &eFexTauxTOBOutKey, SG::WriteHandleKey< xAOD::eFexTauRoIContainer > &eFexTauOutKey)
Definition: eFEXSysSim.cxx:475
eFEXSim.h
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
LVL1::eFEXSysSim::m_eFEXSimTool
ToolHandle< IeFEXSim > m_eFEXSimTool
Definition: eFEXSysSim.h:107
eFexEMRoIAuxContainer.h
eFEXtauTOB.h
eFexTauRoIContainer.h
LVL1::eFEXSysSim::m_eContainer
std::unique_ptr< xAOD::eFexEMRoIContainer > m_eContainer
Definition: eFEXSysSim.h:100
LVL1::eFEXSysSim::m_eTowerContainerSGKey
SG::ReadHandleKey< LVL1::eTowerContainer > m_eTowerContainerSGKey
Definition: eFEXSysSim.h:111
LVL1::eFEXSysSim
The eFEXSysSim class defines the structure of the eFEX system Its purpose is:
Definition: eFEXSysSim.h:42
SG::ReadHandleKey< LVL1::eTowerContainer >
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
LVL1::eFEXSysSim::m_eFexTauAltxTOBOutKey
SG::WriteHandleKey< xAOD::eFexTauRoIContainer > m_eFexTauAltxTOBOutKey
Definition: eFEXSysSim.h:119
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition: StoreGate/StoreGate/WriteHandleKey.h:40
maskDeadModules.mod
mod
Definition: maskDeadModules.py:36
LVL1::eFEXSysSim::m_allTauHeuristicTobObjects
std::map< int, std::vector< std::unique_ptr< eFEXtauTOB > > > m_allTauHeuristicTobObjects
Definition: eFEXSysSim.h:127
lumiFormat.i
int i
Definition: lumiFormat.py:92
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
LVL1::eFEXSysSim::m_eFexEMxTOBOutKey
SG::WriteHandleKey< xAOD::eFexEMRoIContainer > m_eFexEMxTOBOutKey
Definition: eFEXSysSim.h:115
AthAlgTool.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
LVL1::eFEXSysSim::calcTowerID
virtual int calcTowerID(int eta, int phi, int mod) const override
Definition: eFEXSysSim.cxx:94
LVL1::eFEXSysSim::init
virtual void init() override
Definition: eFEXSysSim.cxx:84
LVL1::eFEXSysSim::eFEXSysSim
eFEXSysSim(const std::string &type, const std::string &name, const IInterface *parent)
Constructors.
Definition: eFEXSysSim.cxx:37
LVL1::eFEXSysSim::m_eFEXFPGATowerIdProviderTool
ToolHandle< IeFEXFPGATowerIdProvider > m_eFEXFPGATowerIdProviderTool
Definition: eFEXSysSim.h:120
eFEXegTOB.h
LVL1::eFEXSysSim::finalize
virtual StatusCode finalize() override
standard Athena-Algorithm method
Definition: eFEXSysSim.cxx:78
eFEXFPGATowerIdProvider.h
Provide tower-FPGA mapping.
LVL1::eFEXSysSim::m_l1MenuKey
SG::ReadHandleKey< TrigConf::L1Menu > m_l1MenuKey
Definition: eFEXSysSim.h:112
TrigConf::name
Definition: HLTChainList.h:35
isTau
bool isTau(const T &p)
Definition: AtlasPID.h:148
LVL1::eFEXSysSim::m_eFexOutKey
SG::WriteHandleKey< xAOD::eFexEMRoIContainer > m_eFexOutKey
Definition: eFEXSysSim.h:114
LVL1::eFEXSysSim::initialize
virtual StatusCode initialize() override
standard Athena-Algorithm method
Definition: eFEXSysSim.cxx:52
LVL1::eFEXSysSim::m_allEmTobObjects
std::map< int, std::vector< std::unique_ptr< eFEXegTOB > > > m_allEmTobObjects
Definition: eFEXSysSim.h:125
IeFEXFillEDM.h
LVL1::eFEXSysSim::m_eFexTauAltOutKey
SG::WriteHandleKey< xAOD::eFexTauRoIContainer > m_eFexTauAltOutKey
Definition: eFEXSysSim.h:118
LVL1::eFEXSysSim::m_eAuxContainer
std::unique_ptr< xAOD::eFexEMRoIAuxContainer > m_eAuxContainer
Definition: eFEXSysSim.h:101
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
LVL1::IeFEXSysSim
Definition: IeFEXSysSim.h:27
eFexTauRoIAuxContainer.h
LVL1::eFEXSysSim::m_eFEXFPGATool
ToolHandle< IeFEXFPGA > m_eFEXFPGATool
Definition: eFEXSysSim.h:121
LVL1::eFEXSysSim::m_xeContainer
std::unique_ptr< xAOD::eFexEMRoIContainer > m_xeContainer
Definition: eFEXSysSim.h:102
IeFEXSysSim.h
AthAlgTool
Definition: AthAlgTool.h:26
LVL1::eFEXSysSim::TOBetSort
static bool TOBetSort(const TOBObjectClass &i, const TOBObjectClass &j, bool isTau)
Internal data.
Definition: eFEXSysSim.h:68
LVL1::eFEXOutputCollection
Definition: eFEXOutputCollection.h:23
eTower.h
LVL1::eFEXSysSim::m_eFEXFillEDMTool
ToolHandle< IeFEXFillEDM > m_eFEXFillEDMTool
Definition: eFEXSysSim.h:109
CLASS_DEF.h
macros to associate a CLID to a type
LVL1::eFEXSysSim::cleanup
virtual void cleanup() override
Definition: eFEXSysSim.cxx:88
LVL1::eFEXSysSim::m_allTauBDTTobObjects
std::map< int, std::vector< std::unique_ptr< eFEXtauTOB > > > m_allTauBDTTobObjects
Definition: eFEXSysSim.h:128
LVL1::eFEXSysSim::operator=
eFEXSysSim && operator=(const eFEXSysSim &)=delete
Destructor.
LVL1::eFEXSysSim::m_xeAuxContainer
std::unique_ptr< xAOD::eFexEMRoIAuxContainer > m_xeAuxContainer
Definition: eFEXSysSim.h:103
eFexEMRoIContainer.h