ATLAS Offline Software
jXEInputAlgTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "./jXEInputAlgTool.h"
6 #include "L1TopoEvent/jXETOB.h"
7 
8 #include <sstream>
9 
10 
11 namespace GlobalSim {
12 
14  const std::string& name,
15  const IInterface* parent):
16  base_class(type, name, parent){
17  }
18 
20 
21  CHECK(m_jFexMETRoIKey.initialize());
23 
24  CHECK(m_monTool.retrieve());
25 
26  return StatusCode::SUCCESS;
27  }
28 
29  StatusCode jXEInputAlgTool::run(const EventContext& ctx) const {
30 
32  jXEContainer(m_jFexMETRoIKey, ctx);
33 
34  CHECK(jXEContainer.isValid());
35 
36  auto jXEs = std::make_unique<GlobalSim::jXETOBArray>("InputjJets", 1);
37 
38 
39  int global_ExTopo = 0;
40  int global_EyTopo = 0;
41 
42  for(const xAOD::jFexMETRoI* jFexRoI : *jXEContainer){
43 
44  // Get the XE components and convert to 100 MeV units
45  int ExTopo = jFexRoI->tobEx() * s_Et_conversion;
46  int EyTopo = jFexRoI->tobEy() * s_Et_conversion;
47  int jFexNumber = jFexRoI->jFexNumber();
48  int fpgaNumber = jFexRoI->fpgaNumber();
49 
50  //Note: flipped to produce the right sign
51  int hemisphere = fpgaNumber == 0 ? -1 : 1;
52 
53  ExTopo = hemisphere * ExTopo;
54  EyTopo = hemisphere * EyTopo;
55 
56  global_ExTopo += ExTopo;
57  global_EyTopo += EyTopo;
58 
59  ATH_MSG_DEBUG("EDM jFex XE Number: "
60  << jFexNumber
61  << " FPGA Number: "
62  << fpgaNumber
63  << " Ex: "
64  << ExTopo
65  << " Ey: "
66  << EyTopo
67  );
68  }
69 
70  unsigned long long global_ExTopoLong =
71  static_cast<unsigned long long>(global_ExTopo);
72 
73  unsigned long long global_EyTopoLong =
74  static_cast<unsigned long long>(global_EyTopo);
75 
76  unsigned long long Et2Topo =
77  global_ExTopoLong*global_ExTopoLong + global_EyTopoLong*global_EyTopoLong;
78 
79  unsigned int EtTopo = std::sqrt(Et2Topo);
80 
81  TCS::jXETOB jxe(global_ExTopo, global_EyTopo, EtTopo, TCS::JXE);
82 
83  jxe.setExDouble(static_cast<double>(global_ExTopo * s_EtDouble_conversion));
84  jxe.setEyDouble(static_cast<double>(global_EyTopo * s_EtDouble_conversion));
85  jxe.setEtDouble(static_cast<double>(EtTopo * s_EtDouble_conversion));
86  jxe.setEt2(Et2Topo);
87 
88  jXEs->push_back(jxe);
89 
91  ctx);
92  CHECK(h_write.record(std::move(jXEs)));
93 
94  auto mon_h_jXE_Pt =
95  Monitored::Scalar("jXETOBPt", jxe.EtDouble());
96 
97  auto mon_h_jXE_Phi =
98  Monitored::Scalar("jXETOBPhi", atan2(jxe.Ey(),jxe.Ex()));
99 
100 
102  mon_h_jXE_Pt,
103  mon_h_jXE_Phi);
104 
105  return StatusCode::SUCCESS;
106  }
107 
108  std::string jXEInputAlgTool::toString() const {
109  std::stringstream ss;
110  ss << "jXEInputAlgTool: " << name() << '\n'
111  << m_jFexMETRoIKey << '\n'
112  << m_jXETOBArrayWriteKey << '\n';
113  return ss.str();
114  }
115 }
116 
GlobalSim::jXEInputAlgTool::toString
virtual std::string toString() const override
Definition: jXEInputAlgTool.cxx:108
TrigDefs::Group
Group
Properties of a chain group.
Definition: GroupProperties.h:13
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
TCS::jXETOB::Ex
int Ex() const
Definition: jXETOB.h:30
TCS::JXE
@ JXE
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/Types.h:27
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
TCS::jXETOB::setEtDouble
void setEtDouble(double et)
Definition: jXETOB.h:47
GlobalSim::jXEInputAlgTool::s_Et_conversion
static constexpr int s_Et_conversion
Definition: jXEInputAlgTool.h:51
GlobalSim::jXEInputAlgTool::s_EtDouble_conversion
static constexpr double s_EtDouble_conversion
Definition: jXEInputAlgTool.h:52
TCS::jXETOB::setEt2
void setEt2(unsigned long long et2)
Definition: jXETOB.h:43
GlobalSim::jXEInputAlgTool::jXEInputAlgTool
jXEInputAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: jXEInputAlgTool.cxx:13
jXEInputAlgTool.h
xAOD::jFexMETRoI_v1
Class describing properties of a LVL1 jFEX global Trigger Object (TOB) in the xAOD format.
Definition: jFexMETRoI_v1.h:22
jXETOB.h
GlobalSim::jXEInputAlgTool::m_jFexMETRoIKey
SG::ReadHandleKey< xAOD::jFexMETRoIContainer > m_jFexMETRoIKey
Definition: jXEInputAlgTool.h:44
GlobalSim
AlgTool to obtain a GlobalSim::cTAUTOBArray This class uses ReadHandls to jFex and eFex Tau Rois If t...
Definition: dump.h:8
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
TCS::jXETOB::Ey
int Ey() const
Definition: jXETOB.h:31
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
GlobalSim::jXEInputAlgTool::m_jXETOBArrayWriteKey
SG::WriteHandleKey< GlobalSim::jXETOBArray > m_jXETOBArrayWriteKey
Definition: jXEInputAlgTool.h:48
TCS::jXETOB::EtDouble
double EtDouble() const
Definition: jXETOB.h:37
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
GlobalSim::jXEInputAlgTool::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: jXEInputAlgTool.h:55
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
GlobalSim::jXEInputAlgTool::initialize
StatusCode initialize() override
Definition: jXEInputAlgTool.cxx:19
GlobalSim::jXEInputAlgTool::run
virtual StatusCode run(const EventContext &ctx) const override
Definition: jXEInputAlgTool.cxx:29
TCS::jXETOB::setEyDouble
void setEyDouble(double ey)
Definition: jXETOB.h:46
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34
TCS::jXETOB::setExDouble
void setExDouble(double ex)
Definition: jXETOB.h:45
TCS::jXETOB
Definition: jXETOB.h:13