ATLAS Offline Software
Loading...
Searching...
No Matches
eFexInputProvider.cxx
Go to the documentation of this file.
1// Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2
4
5#include <math.h>
6
9
11
12#include "L1TopoEvent/eEmTOB.h"
14
15#include "GaudiKernel/PhysicalConstants.h"
16
17using namespace std;
18using namespace LVL1;
19
20
21// eFex to L1Topo conversion factors
22const double eFexInputProvider::m_EtDouble_conversion = 0.1; // 100 MeV to GeV
23const double eFexInputProvider::m_phiDouble_conversion = 0.05; // 20 x phi to phi
24const double eFexInputProvider::m_etaDouble_conversion = 0.025; // 40 x eta to eta
25
26
27eFexInputProvider::eFexInputProvider(const std::string& type, const std::string& name,
28 const IInterface* parent) :
29 base_class(type, name, parent)
30{
31 declareInterface<LVL1::IInputTOBConverter>( this );
32}
33
36
37StatusCode
39
42
43 if (!m_monTool.empty()) ATH_CHECK(m_monTool.retrieve());
44 return StatusCode::SUCCESS;
45}
46
47StatusCode
49 if (m_eEM_EDMKey.empty()) {
50 ATH_MSG_DEBUG("eFex EM input disabled, skip filling");
51 return StatusCode::SUCCESS;
52 }
53
55 ATH_CHECK(eEM_EDM.isValid());
56
57 for(const auto it : * eEM_EDM){
58 const xAOD::eFexEMRoI* eFexRoI = it;
59 ATH_MSG_DEBUG( "EDM eFex Number: "
60 << +eFexRoI->eFexNumber() // returns an 8 bit unsigned integer referring to the eFEX number
61 << " et: "
62 << eFexRoI->et() // returns the et value of the EM cluster in MeV
63 << " etTOB: "
64 << eFexRoI->etTOB() // returns the et value of the EM cluster in units of 100 MeV
65 << " eta: "
66 << eFexRoI->eta() // returns a floating point global eta
67 << " phi: "
68 << eFexRoI->phi() // returns a floating point global phi
69 << " iEtaTopo: "
70 << eFexRoI->iEtaTopo() // returns 40 x eta (custom function for L1Topo)
71 << " iPhiTopo: "
72 << eFexRoI->iPhiTopo() // returns 20 x phi (custom function for L1Topo)
73 << " reta: "
74 << eFexRoI->RetaThresholds() // jet disc 1
75 << " rhad: "
76 << eFexRoI->RhadThresholds() // jet disc 2
77 << " wstot: "
78 << eFexRoI->WstotThresholds() // jet disc 3
79 );
80
81
82 unsigned int EtTopo = eFexRoI->etTOB();
83 int etaTopo = eFexRoI->iEtaTopo();
84 int phiTopo = eFexRoI->iPhiTopo();
85 unsigned int reta = eFexRoI->RetaThresholds();
86 unsigned int rhad = eFexRoI->RhadThresholds();
87 unsigned int wstot = eFexRoI->WstotThresholds();
88
89 //Em TOB
90 TCS::eEmTOB eem( EtTopo, etaTopo, static_cast<unsigned int>(phiTopo), TCS::EEM , static_cast<long int>(eFexRoI->word0()) );
91 eem.setEtDouble( static_cast<double>(EtTopo*m_EtDouble_conversion) );
92 eem.setEtaDouble( static_cast<double>(etaTopo*m_etaDouble_conversion) );
93 eem.setPhiDouble( static_cast<double>(phiTopo*m_phiDouble_conversion) );
94 eem.setReta( reta );
95 eem.setRhad( rhad );
96 eem.setWstot( wstot );
97
98 inputEvent.addeEm( eem );
99
100 auto mon_hEmEt = Monitored::Scalar("eEmTOBEt", eem.EtDouble());
101 auto mon_hEmREta = Monitored::Scalar("eEmTOBREta", eem.Reta());
102 auto mon_hEmRHad = Monitored::Scalar("eEmTOBRHad", eem.Rhad());
103 auto mon_hEmWsTot = Monitored::Scalar("eEmTOBWsTot", eem.Wstot());
104 auto mon_hEmPhi = Monitored::Scalar("eEmTOBPhi", eem.phi());
105 auto mon_hEmEta = Monitored::Scalar("eEmTOBEta", eem.eta());
106 Monitored::Group(m_monTool, mon_hEmEt, mon_hEmREta, mon_hEmRHad, mon_hEmWsTot, mon_hEmPhi, mon_hEmEta);
107
108 }
109
110 return StatusCode::SUCCESS;
111}
112
113
114StatusCode
116 if (m_eTau_EDMKey.empty()) {
117 ATH_MSG_DEBUG("eFex Tau input disabled, skip filling");
118 return StatusCode::SUCCESS;
119 }
120
122 ATH_CHECK(eTau_EDM.isValid());
123
124 for(const auto it : * eTau_EDM){
125 const xAOD::eFexTauRoI* eFexTauRoI = it;
126 ATH_MSG_DEBUG( "EDM eFex Number: "
127 << +eFexTauRoI->eFexNumber() // returns an 8 bit unsigned integer referring to the eFEX number
128 << " et: "
129 << eFexTauRoI->et() // returns the et value of the Tau cluster in MeV
130 << " etTOB: "
131 << eFexTauRoI->etTOB() // returns the et value of the Tau cluster in units of 100 MeV
132 << " eta: "
133 << eFexTauRoI->eta() // returns a floating point global eta
134 << " phi: "
135 << eFexTauRoI->phi() // returns a floating point global phi
136 << " iEtaTopo: "
137 << eFexTauRoI->iEtaTopo() // returns 40 x eta (custom function for L1Topo)
138 << " iPhiTopo: "
139 << eFexTauRoI->iPhiTopo() // returns 20 x phi (custom function for L1Topo)
140 << " rCore: "
141 << eFexTauRoI->tauOneThresholds() // rCore or BDT working point (eTau algo agnostic accessor)
142 << " rHad: "
143 << eFexTauRoI->tauTwoThresholds() // rHad
144 );
145
146
147 unsigned int EtTopo = eFexTauRoI->etTOB();
148 int etaTopo = eFexTauRoI->iEtaTopo();
149 int phiTopo = eFexTauRoI->iPhiTopo();
150 unsigned int rCore = eFexTauRoI->tauOneThresholds();
151 unsigned int rHad = eFexTauRoI->tauTwoThresholds();
152
153 //Tau TOB
154 TCS::eTauTOB etau( EtTopo, etaTopo, static_cast<unsigned int>(phiTopo), TCS::ETAU );
155 etau.setEtDouble( static_cast<double>(EtTopo*m_EtDouble_conversion) );
156 etau.setEtaDouble( static_cast<double>(etaTopo*m_etaDouble_conversion) );
157 etau.setPhiDouble( static_cast<double>(phiTopo*m_phiDouble_conversion) );
158
159 etau.setRCore( rCore );
160 etau.setRHad( rHad );
161
162 inputEvent.addeTau( etau );
163 inputEvent.addcTau( etau );
164
165 auto mon_hTauEt = Monitored::Scalar("eTauTOBEt", etau.EtDouble());
166 auto mon_hTauRCore = Monitored::Scalar("eTauTOBRCore", etau.rCore());
167 auto mon_hTauRHad = Monitored::Scalar("eTauTOBRHad", etau.rHad());
168 auto mon_hTauPhi = Monitored::Scalar("eTauTOBPhi", etau.phi());
169 auto mon_hTauEta = Monitored::Scalar("eTauTOBEta", etau.eta());
170 Monitored::Group(m_monTool, mon_hTauEt, mon_hTauRCore, mon_hTauRHad, mon_hTauPhi, mon_hTauEta);
171 }
172
173 return StatusCode::SUCCESS;
174}
175
176StatusCode
178 ATH_CHECK(fillEM(inputEvent));
179 ATH_CHECK(fillTau(inputEvent));
180 return StatusCode::SUCCESS;
181}
182
183
184void
185eFexInputProvider::CalculateCoordinates(int32_t roiWord, double & eta, double & phi) const {
187 double TwoPI = 2 * M_PI;
188 CoordinateRange coordRange = get.coordinate( roiWord );
189
190 eta = coordRange.eta();
191 phi = coordRange.phi();
192 if( phi > M_PI ) phi -= TwoPI;
193}
#define M_PI
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
#define CHECK(...)
Evaluate an expression and check for errors.
A level 1 calorimeter trigger conversion service: returns the Coordinate represented by a RoI word.
CoordinateRange class declaration.
double phi() const
return phi
double eta() const
return eta
StatusCode fillEM(TCS::TopoInputEvent &inputEvent) const
virtual StatusCode initialize() override final
ToolHandle< GenericMonitoringTool > m_monTool
static const double m_etaDouble_conversion
virtual StatusCode fillTopoInputEvent(TCS::TopoInputEvent &) const override final
eFexInputProvider(const std::string &type, const std::string &name, const IInterface *parent)
static const double m_EtDouble_conversion
SG::ReadHandleKey< xAOD::eFexEMRoIContainer > m_eEM_EDMKey
void CalculateCoordinates(int32_t roiWord, double &eta, double &phi) const
calculates eta and phi from roiWord
SG::ReadHandleKey< xAOD::eFexTauRoIContainer > m_eTau_EDMKey
static const double m_phiDouble_conversion
StatusCode fillTau(TCS::TopoInputEvent &inputEvent) const
Group of local monitoring quantities and retain correlation when filling histograms
Declare a monitored scalar variable.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
StatusCode addcTau(const eTauTOB &eTau)
StatusCode addeEm(const eEmTOB &eEm)
StatusCode addeTau(const eTauTOB &eTau)
void setRCore(unsigned int th)
Definition eTauTOB.h:53
unsigned int rHad() const
Definition eTauTOB.h:42
void setEtaDouble(double eta)
Definition eTauTOB.h:50
void setRHad(unsigned int th)
Definition eTauTOB.h:54
void setPhiDouble(double phi)
Definition eTauTOB.h:51
int eta() const
Definition eTauTOB.h:34
void setEtDouble(double et)
Definition eTauTOB.h:49
unsigned int phi() const
Definition eTauTOB.h:35
unsigned int rCore() const
Definition eTauTOB.h:41
double EtDouble() const
Definition eTauTOB.h:37
float et() const
TOB ET (decoded from TOB, stored for convenience)
uint32_t word0() const
The "raw" 32-bit words describing the e/gamma candidate.
float eta() const
setter for the above
unsigned int eFexNumber() const
Methods to decode data from the TOB/RoI and return to the user.
unsigned int RetaThresholds() const
Jet Discriminant 1 (R_eta) results.
unsigned int WstotThresholds() const
Jet Discriminant 3 (W_stot) results.
float phi() const
Seed supercell index within central tower (0 -> 3)
unsigned int RhadThresholds() const
Jet Discriminant 2 (R_had) results.
unsigned int etTOB() const
Cluster ET (TOB ET scale, 100 MeV/count)
int iEtaTopo() const
Getter for integer phi index (0-63)
int iPhiTopo() const
Return phi index in the range used by L1Topo (0->127)
int iPhiTopo() const
Return phi index in the range used by L1Topo (0->127)
unsigned int eFexNumber() const
eFEX number
float et() const
TOB ET (decoded from TOB, stored for convenience)
float phi() const
Seed supercell index within central tower (0 -> 3)
unsigned int tauOneThresholds() const
Tau Condition 1 (generic) results.
unsigned int etTOB() const
Cluster ET (TOB ET scale, 100 MeV/count)
float eta() const
setter for the above
int iEtaTopo() const
Getter for integer phi index (0-63)
unsigned int tauTwoThresholds() const
Tau Condition 2 (generic) results.
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:130
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
STL namespace.
eFexEMRoI_v1 eFexEMRoI
Define the latest version of the eFexEMRoI class.
Definition eFexEMRoI.h:17
eFexTauRoI_v1 eFexTauRoI
Define the latest version of the eFexTauRoI class.
Definition eFexTauRoI.h:16