ATLAS Offline Software
EnergyInputProvider.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include <math.h> /* atan2 */
6 
7 #include "EnergyInputProvider.h"
10 
11 #include "L1TopoEvent/ClusterTOB.h"
13 
14 
15 using namespace std;
16 using namespace LVL1;
17 
18 EnergyInputProvider::EnergyInputProvider(const std::string& type, const std::string& name,
19  const IInterface* parent) :
20  base_class(type, name, parent),
21  m_energyLocation(TrigT1CaloDefs::EnergyTopoDataLocation)
22 {
23  declareInterface<LVL1::IInputTOBConverter>( this );
24  declareProperty( "EnergyROILocation", m_energyLocation, "Storegate key for reading the Topo Energy ROI" );
25 
26 }
27 
29 {}
30 
33 
35 
36  if (!m_monTool.empty()) ATH_CHECK(m_monTool.retrieve());
37 
38  return StatusCode::SUCCESS;
39 }
40 
43 
53 // EnergyRoI * energyROI = 0;
54 // if( ! evtStore()->retrieve(energyROI, m_energyLocation).isSuccess()) {
55 // ATH_MSG_ERROR("No EnergyROI with key '" << m_energyLocation << "' found in the event. Configuration issue.");
56 // return StatusCode::FAILURE;
57 // }
58 
59 // ATH_MSG_DEBUG("Not filling the input event from EnergyROI. There is not enough information.");
60 // ATH_MSG_DEBUG("EnergyROI: word0 = " << hex << energyROI->roiWord0()
61 // << ", word1 = " << hex << energyROI->roiWord1()
62 // << ", word2 = " << hex << energyROI->roiWord2());
63 
64 
66 
67  if( !topoData.isValid()){
68  ATH_MSG_WARNING("No EnergyTopoData with SG key '" << m_energyLocation.key() << "' found in the event. No MET input for the L1Topo simulation.");
69  return StatusCode::RECOVERABLE;
70  }
71 
72  ATH_MSG_DEBUG( "EnergyTopoData" << dec
73  << ": Ex = " << topoData->Ex()
74  << ", Ey = " << topoData->Ey()
75  << ", Et = " << topoData->Et()
76  << ", ExTC = " << topoData->ExTC()
77  << ", EyTC = " << topoData->EyTC()
78  );
79 
80 
81  TCS::MetTOB met( -(topoData->Ex()), -(topoData->Ey()), topoData->Et() );
82  inputEvent.setMET( met );
83  const bool has_overflow = (topoData->ExOverflow() or
84  topoData->EyOverflow() or
85  topoData->EtOverflow());
86  if(has_overflow) {
87  inputEvent.setOverflowFromEnergyInput(true);
88  ATH_MSG_DEBUG("setOverflowFromEnergyInput : true");
89  }
90  auto mon_hPt = Monitored::Scalar("MET", met.Et());
91  auto mon_hPhi = Monitored::Scalar("METPhi", atan2(met.Ey(),met.Ex()));
92  Monitored::Group(m_monTool, mon_hPt, mon_hPhi);
93 
94  return StatusCode::SUCCESS;
95 }
LVL1::EnergyTopoData::EyOverflow
unsigned int EyOverflow(SumTypes type=LVL1::EnergyTopoData::Normal) const
Definition: EnergyTopoData.cxx:137
TrigDefs::Group
Group
Properties of a chain group.
Definition: GroupProperties.h:13
EnergyInputProvider.h
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
TCS::MetTOB
Definition: MetTOB.h:13
LVL1::EnergyTopoData::Ex
int Ex(SumTypes type=LVL1::EnergyTopoData::Normal) const
return Ex, Ey, ET values
Definition: EnergyTopoData.cxx:79
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
LVL1::EnergyInputProvider::fillTopoInputEvent
virtual StatusCode fillTopoInputEvent(TCS::TopoInputEvent &) const
Definition: EnergyInputProvider.cxx:42
LVL1::EnergyInputProvider::~EnergyInputProvider
virtual ~EnergyInputProvider()
Definition: EnergyInputProvider.cxx:28
LVL1::EnergyTopoData::EtOverflow
unsigned int EtOverflow(SumTypes type=LVL1::EnergyTopoData::Normal) const
Definition: EnergyTopoData.cxx:144
TopoInputEvent.h
met
Definition: IMETSignificance.h:24
LVL1::EnergyTopoData::ExTC
int ExTC(SumTypes type=LVL1::EnergyTopoData::Normal) const
return twos-complement Ex, Ey values
Definition: EnergyTopoData.cxx:109
TCS::TopoInputEvent::setOverflowFromEnergyInput
void setOverflowFromEnergyInput(bool v)
Definition: TopoInputEvent.cxx:278
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
TCS::TopoInputEvent
Definition: TopoInputEvent.h:42
test_pyathena.parent
parent
Definition: test_pyathena.py:15
LVL1::EnergyInputProvider::m_energyLocation
SG::ReadHandleKey< LVL1::EnergyTopoData > m_energyLocation
EnergyROI SG key.
Definition: EnergyInputProvider.h:31
LVL1::EnergyTopoData::Ey
int Ey(SumTypes type=LVL1::EnergyTopoData::Normal) const
Ey (signed)
Definition: EnergyTopoData.cxx:89
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
LVL1::EnergyTopoData::EyTC
int EyTC(SumTypes type=LVL1::EnergyTopoData::Normal) const
Ey (twos complement)
Definition: EnergyTopoData.cxx:119
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
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
TrigConf::name
Definition: HLTChainList.h:35
LVL1::EnergyInputProvider::initialize
virtual StatusCode initialize()
Definition: EnergyInputProvider.cxx:32
LVL1::EnergyTopoData::Et
int Et(SumTypes type=LVL1::EnergyTopoData::Normal) const
ET Sum.
Definition: EnergyTopoData.cxx:99
EnergyRoI_ClassDEF.h
ClusterTOB.h
TrigT1CaloDefs.h
LVL1::TrigT1CaloDefs
Definition: TrigT1CaloDefs.h:24
LVL1::EnergyTopoData::ExOverflow
unsigned int ExOverflow(SumTypes type=LVL1::EnergyTopoData::Normal) const
return overflow flags
Definition: EnergyTopoData.cxx:130
TCS::TopoInputEvent::setMET
StatusCode setMET(const MetTOB &met)
Definition: TopoInputEvent.cxx:137
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
LVL1::EnergyInputProvider::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: EnergyInputProvider.h:29
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34