ATLAS Offline Software
eFexInputProvider.cxx
Go to the documentation of this file.
1 // Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
3 #include "./eFexInputProvider.h"
4 
5 #include <math.h>
6 
9 
11 
12 #include "L1TopoEvent/eEmTOB.h"
14 
15 #include "GaudiKernel/PhysicalConstants.h"
16 
17 using namespace std;
18 using namespace LVL1;
19 
20 
21 // eFex to L1Topo conversion factors
22 const double eFexInputProvider::m_EtDouble_conversion = 0.1; // 100 MeV to GeV
23 const double eFexInputProvider::m_phiDouble_conversion = 0.05; // 20 x phi to phi
24 const double eFexInputProvider::m_etaDouble_conversion = 0.025; // 40 x eta to eta
25 
26 
27 eFexInputProvider::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 
35 {}
36 
39 
40  CHECK(m_eEM_EDMKey.initialize(SG::AllowEmpty));
41  CHECK(m_eTau_EDMKey.initialize(SG::AllowEmpty));
42 
43  if (!m_monTool.empty()) ATH_CHECK(m_monTool.retrieve());
44  return StatusCode::SUCCESS;
45 }
46 
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 
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 
178  ATH_CHECK(fillEM(inputEvent));
179  ATH_CHECK(fillTau(inputEvent));
180  return StatusCode::SUCCESS;
181 }
182 
183 
184 void
185 eFexInputProvider::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 }
TCS::eTauTOB::rHad
unsigned int rHad() const
Definition: eTauTOB.h:42
LVL1::eFexInputProvider::initialize
virtual StatusCode initialize() override final
Definition: eFexInputProvider.cxx:38
xAOD::eFexTauRoI_v1::iEtaTopo
int iEtaTopo() const
Getter for integer phi index (0-63)
Definition: eFexTauRoI_v1.cxx:280
xAOD::eFexTauRoI_v1::et
float et() const
TOB ET (decoded from TOB, stored for convenience)
TrigDefs::Group
Group
Properties of a chain group.
Definition: GroupProperties.h:13
EmTauROI_ClassDEF.h
LVL1::Coordinate::phi
double phi() const
return phi
Definition: Coordinate.cxx:50
xAOD::eFexEMRoI_v1::iEtaTopo
int iEtaTopo() const
Getter for integer phi index (0-63)
Definition: eFexEMRoI_v1.cxx:262
TCS::eTauTOB::setEtaDouble
void setEtaDouble(double eta)
Definition: eTauTOB.h:50
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
TCS::eTauTOB::EtDouble
double EtDouble() const
Definition: eTauTOB.h:37
eFexInputProvider.h
TCS::eTauTOB::eta
int eta() const
Definition: eTauTOB.h:34
xAOD::eFexTauRoI_v1::eta
float eta() const
setter for the above
LVL1::eFexInputProvider::fillEM
StatusCode fillEM(TCS::TopoInputEvent &inputEvent) const
Definition: eFexInputProvider.cxx:48
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
CPCMXTopoData.h
TCS::eEmTOB::setRhad
void setRhad(unsigned int th)
Definition: eEmTOB.h:55
LVL1::eFexInputProvider::m_phiDouble_conversion
static const double m_phiDouble_conversion
Definition: eFexInputProvider.h:43
xAOD::eFexTauRoI_v1::tauTwoThresholds
unsigned int tauTwoThresholds() const
Tau Condition 2 (generic) results.
Definition: eFexTauRoI_v1.cxx:205
CPRoIDecoder.h
skel.it
it
Definition: skel.GENtoEVGEN.py:423
xAOD::eFexEMRoI_v1::eFexNumber
unsigned int eFexNumber() const
Methods to decode data from the TOB/RoI and return to the user.
Definition: eFexEMRoI_v1.cxx:116
M_PI
#define M_PI
Definition: ActiveFraction.h:11
LVL1::eFexInputProvider::~eFexInputProvider
virtual ~eFexInputProvider()
Definition: eFexInputProvider.cxx:34
xAOD::wstot
setEt setPhi setE277 setWeta2 setEta1 setE2tsts1 wstot
Definition: TrigEMCluster_v1.cxx:49
xAOD::eFexEMRoI_v1
Class describing a LVL1 eFEX EM region of interest.
Definition: eFexEMRoI_v1.h:33
TCS::eEmTOB::setWstot
void setWstot(unsigned int th)
Definition: eEmTOB.h:56
LVL1::eFexInputProvider::m_eTau_EDMKey
SG::ReadHandleKey< xAOD::eFexTauRoIContainer > m_eTau_EDMKey
Definition: eFexInputProvider.h:39
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
xAOD::eFexTauRoI
eFexTauRoI_v1 eFexTauRoI
Define the latest version of the eFexTauRoI class.
Definition: eFexTauRoI.h:16
TCS::eTauTOB::setRCore
void setRCore(unsigned int th)
Definition: eTauTOB.h:53
TCS::TopoInputEvent::addeTau
StatusCode addeTau(const eTauTOB &eTau)
Definition: TopoInputEvent.cxx:61
TCS::eEmTOB::setEtDouble
void setEtDouble(double et)
Definition: eEmTOB.h:50
xAOD::roiWord
roiWord
Definition: TrigMissingET_v1.cxx:36
xAOD::eFexEMRoI_v1::word0
uint32_t word0() const
The "raw" 32-bit words describing the e/gamma candidate.
TopoInputEvent.h
xAOD::eFexTauRoI_v1::tauOneThresholds
unsigned int tauOneThresholds() const
Tau Condition 1 (generic) results.
Definition: eFexTauRoI_v1.cxx:201
LVL1::eFexInputProvider::m_EtDouble_conversion
static const double m_EtDouble_conversion
Definition: eFexInputProvider.h:42
LVL1::CoordinateRange
CoordinateRange class declaration.
Definition: CoordinateRange.h:36
LVL1::eFexInputProvider::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: eFexInputProvider.h:36
xAOD::eFexTauRoI_v1::iPhiTopo
int iPhiTopo() const
Return phi index in the range used by L1Topo (0->127)
Definition: eFexTauRoI_v1.cxx:272
TCS::eTauTOB
Definition: eTauTOB.h:13
xAOD::eFexTauRoI_v1
Class describing a LVL1 eFEX tau region of interest.
Definition: eFexTauRoI_v1.h:29
LVL1::eFexInputProvider::fillTopoInputEvent
virtual StatusCode fillTopoInputEvent(TCS::TopoInputEvent &) const override final
Definition: eFexInputProvider.cxx:177
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAOD::eFexEMRoI_v1::RetaThresholds
unsigned int RetaThresholds() const
Jet Discriminant 1 (R_eta) results.
Definition: eFexEMRoI_v1.cxx:177
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TCS::eEmTOB
Definition: eEmTOB.h:13
TCS::TopoInputEvent
Definition: TopoInputEvent.h:42
TCS::eEmTOB::Rhad
unsigned int Rhad() const
Definition: eEmTOB.h:42
xAOD::eFexEMRoI_v1::iPhiTopo
int iPhiTopo() const
Return phi index in the range used by L1Topo (0->127)
Definition: eFexEMRoI_v1.cxx:254
LVL1::eFexInputProvider::fillTau
StatusCode fillTau(TCS::TopoInputEvent &inputEvent) const
Definition: eFexInputProvider.cxx:115
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
xAOD::eFexEMRoI_v1::etTOB
unsigned int etTOB() const
Cluster ET (TOB ET scale, 100 MeV/count)
Definition: eFexEMRoI_v1.cxx:157
xAOD::eFexEMRoI_v1::et
float et() const
TOB ET (decoded from TOB, stored for convenience)
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
TrigConf::name
Definition: HLTChainList.h:35
TCS::eEmTOB::Wstot
unsigned int Wstot() const
Definition: eEmTOB.h:43
LVL1::eFexInputProvider::m_eEM_EDMKey
SG::ReadHandleKey< xAOD::eFexEMRoIContainer > m_eEM_EDMKey
Definition: eFexInputProvider.h:38
xAOD::eFexTauRoI_v1::phi
float phi() const
Seed supercell index within central tower (0 -> 3)
TCS::eEmTOB::setReta
void setReta(unsigned int th)
Definition: eEmTOB.h:54
TCS::eTauTOB::phi
unsigned int phi() const
Definition: eTauTOB.h:35
xAOD::eFexTauRoI_v1::eFexNumber
unsigned int eFexNumber() const
eFEX number
Definition: eFexTauRoI_v1.cxx:114
xAOD::eFexEMRoI_v1::WstotThresholds
unsigned int WstotThresholds() const
Jet Discriminant 3 (W_stot) results.
Definition: eFexEMRoI_v1.cxx:185
TCS::eTauTOB::rCore
unsigned int rCore() const
Definition: eTauTOB.h:41
TCS::eEmTOB::phi
unsigned int phi() const
Definition: eEmTOB.h:35
eEmTOB.h
TCS::eTauTOB::setEtDouble
void setEtDouble(double et)
Definition: eTauTOB.h:49
TCS::eEmTOB::eta
int eta() const
Definition: eEmTOB.h:34
TCS::eEmTOB::EtDouble
double EtDouble() const
Definition: eEmTOB.h:37
xAOD::eFexEMRoI_v1::eta
float eta() const
setter for the above
TCS::eEmTOB::setPhiDouble
void setPhiDouble(double phi)
Definition: eEmTOB.h:52
LVL1::eFexInputProvider::m_etaDouble_conversion
static const double m_etaDouble_conversion
Definition: eFexInputProvider.h:44
LVL1::eFexInputProvider::CalculateCoordinates
void CalculateCoordinates(int32_t roiWord, double &eta, double &phi) const
calculates eta and phi from roiWord
Definition: eFexInputProvider.cxx:185
TCS::TopoInputEvent::addeEm
StatusCode addeEm(const eEmTOB &eEm)
Definition: TopoInputEvent.cxx:51
LVL1::Coordinate::eta
double eta() const
return eta
Definition: Coordinate.cxx:45
LVL1::CPRoIDecoder
A level 1 calorimeter trigger conversion service: returns the Coordinate represented by a RoI word.
Definition: CPRoIDecoder.h:37
xAOD::eFexTauRoI_v1::etTOB
unsigned int etTOB() const
Cluster ET (TOB ET scale, 100 MeV/count)
Definition: eFexTauRoI_v1.cxx:155
TCS::eEmTOB::setEtaDouble
void setEtaDouble(double eta)
Definition: eEmTOB.h:51
TCS::eTauTOB::setRHad
void setRHad(unsigned int th)
Definition: eTauTOB.h:54
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition: hcg.cxx:127
TCS::TopoInputEvent::addcTau
StatusCode addcTau(const eTauTOB &eTau)
Definition: TopoInputEvent.cxx:66
TCS::ETAU
@ ETAU
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/Types.h:22
TCS::eTauTOB::setPhiDouble
void setPhiDouble(double phi)
Definition: eTauTOB.h:51
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34
xAOD::eFexEMRoI_v1::RhadThresholds
unsigned int RhadThresholds() const
Jet Discriminant 2 (R_had) results.
Definition: eFexEMRoI_v1.cxx:181
xAOD::eFexEMRoI_v1::phi
float phi() const
Seed supercell index within central tower (0 -> 3)
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:30
TCS::eEmTOB::Reta
unsigned int Reta() const
Definition: eEmTOB.h:41
TCS::EEM
@ EEM
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/Types.h:21