ATLAS Offline Software
JEMEnergySim.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // /***************************************************************************
6 // JEMEnergySim.cxx - description
7 // -------------------
8 // begin : Monday 12 May 2014
9 // email : Alan.Watson@CERN.CH
10 // ***************************************************************************/
11 //
12 //================================================
13 // JEMEnergySim class Implementation
14 // ================================================
15 //
16 //
17 //
18 
19 
20 
21 // This algorithm includes
22 #include "JEMEnergySim.h"
24 
29 
30 
31 namespace LVL1 {
32 
33 
34 //--------------------------------
35 // Constructors and destructors
36 //--------------------------------
37 
39  ( const std::string& name, ISvcLocator* pSvcLocator )
40  : AthAlgorithm( name, pSvcLocator ),
41  m_EtTool("LVL1::L1EtTools/L1EtTools"),
42  m_jemContainer(0)
43 {}
44 
45 
46 //---------------------------------
47 // initialise()
48 //---------------------------------
49 
51 {
52  ATH_CHECK( m_JetElementInputKey.initialize() );
53  ATH_CHECK( m_jemEtSumsOutputKey.initialize() );
54  ATH_CHECK( m_energyCMXDataOutputKey.initialize() );
55 
56  ATH_CHECK( m_EtTool.retrieve() );
57  return StatusCode::SUCCESS ;
58 }
59 
60 
61 //----------------------------------------------
62 // execute() method called once per event
63 //----------------------------------------------
64 //
65 
67 {
68  ATH_MSG_DEBUG ( "Executing" );
69 
70  // form module sums
72 
74 
75  if (rh.isValid()) {
76  const DataVector<xAOD::JetElement>* jetelements = &(*rh);
77 
78  // Warn if we find an empty container
79  if (jetelements->size() == 0)
80  ATH_MSG_WARNING("Empty JetElementContainer - looks like a problem" );
81 
82  m_EtTool->moduleSums(jetelements, m_jemContainer);
83  }
84  else ATH_MSG_WARNING("No JetElementCollection at " << m_JetElementInputKey );
85 
86  // Done the processing. Now form & save the various output data
87 
88  // For CMX simulation
90 
91  // for Bytestream simulation
93 
94  cleanup();
95 
96  return StatusCode::SUCCESS ;
97 }
98 
99 
100 } // end of LVL1 namespace bracket
101 
104 
105  delete m_jemContainer;
106 }
107 
110 
111  ATH_MSG_DEBUG("storeJEMEtSums running");
112 
113  JEMEtSumsCollection* JEMRvector = new JEMEtSumsCollection;
114 
116  for ( it=m_jemContainer->begin(); it!=m_jemContainer->end(); ++it ) {
117  std::vector<unsigned int> eX;
118  eX.push_back((*it)->ex());
119  std::vector<unsigned int> eY;
120  eY.push_back((*it)->ey());
121  std::vector<unsigned int> eT;
122  eT.push_back((*it)->et());
123  JEMEtSums* jemEtSums = new JEMEtSums((*it)->crate(), (*it)->module(),eT,eX,eY,0);
124  JEMRvector->push_back(jemEtSums);
125  }
126 
127  ATH_MSG_DEBUG( JEMRvector->size()<<" JEMEtSums objects are being saved");
128 
129  const EventContext& ctx = Gaudi::Hive::currentContext();
130  StatusCode sc = SG::makeHandle(m_jemEtSumsOutputKey, ctx).record( std::unique_ptr<DataVector<JEMEtSums>>(JEMRvector) );
131  if (sc != StatusCode::SUCCESS) {
132  ATH_MSG_ERROR ( "Error registering JEMEtSums collection in TDS " );
133  }
134 
135 }
136 
139 
140  ATH_MSG_DEBUG("storeBackplaneData running");
141 
143 
145  for ( it=m_jemContainer->begin(); it!=m_jemContainer->end(); ++it ) {
146  EnergyCMXData* bpData = new EnergyCMXData((*it)->crate(), (*it)->module(),
147  (*it)->ex(),(*it)->ey(),(*it)->et());
148  bpVector->push_back(bpData);
149  }
150 
151  ATH_MSG_DEBUG( bpVector->size()<<" EnergyCMXData objects are being saved");
152 
153  const EventContext& ctx = Gaudi::Hive::currentContext();
154  StatusCode sc = SG::makeHandle(m_energyCMXDataOutputKey, ctx).record( std::unique_ptr<DataVector<EnergyCMXData>>(bpVector) );
155  if (sc != StatusCode::SUCCESS) {
156  ATH_MSG_ERROR ( "Error registering EnergyCMXData collection in TDS " );
157  }
158 
159 }
160 
161 
162 
LVL1::JEMEnergySim::storeBackplaneData
void storeBackplaneData()
Form EnergyCMXData and put into SG.
Definition: JEMEnergySim.cxx:138
xAOD::JEMEtSums
JEMEtSums_v2 JEMEtSums
Define the latest version of the JEMEtSums class.
Definition: Event/xAOD/xAODTrigL1Calo/xAODTrigL1Calo/JEMEtSums.h:16
LVL1::JEMEnergySim::m_jemContainer
DataVector< ModuleEnergy > * m_jemContainer
vector of ModuleEnergy objects
Definition: JEMEnergySim.h:89
LVL1::JEMEnergySim::m_energyCMXDataOutputKey
SG::WriteHandleKey< DataVector< EnergyCMXData > > m_energyCMXDataOutputKey
Definition: JEMEnergySim.h:86
JEMEtSumsCollection
DataVector< LVL1::JEMEtSums > JEMEtSumsCollection
Definition: JEMEtSumsCollection.h:12
LVL1::EnergyCMXData
The EnergyCMXData object contains the data transferred from the JEM to the EnergySum CMX in the crate...
Definition: EnergyCMXData.h:24
ModuleEnergy.h
skel.it
it
Definition: skel.GENtoEVGEN.py:407
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
LVL1::JEMEnergySim::initialize
StatusCode initialize()
Definition: JEMEnergySim.cxx:50
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
EnergyCMXData.h
JetElementContainer.h
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:274
JEMEnergySim.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
IDTPM::eT
float eT(const U &p)
Accessor utility function for getting the value of Tranverse energy.
Definition: TrackParametersHelper.h:122
DataModel_detail::iterator
(Non-const) Iterator class for DataVector/DataList.
Definition: DVLIterator.h:184
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
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
LVL1::JEMEnergySim::execute
StatusCode execute()
Definition: JEMEnergySim.cxx:66
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
AthAlgorithm
Definition: AthAlgorithm.h:47
TrigConf::name
Definition: HLTChainList.h:35
LVL1::JEMEnergySim::storeJEMEtSums
void storeJEMEtSums()
put results into SG
Definition: JEMEnergySim.cxx:109
LVL1::JEMEnergySim::m_JetElementInputKey
SG::ReadHandleKey< xAOD::JetElementContainer > m_JetElementInputKey
Definition: JEMEnergySim.h:80
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
JetEnergyModuleKey.h
LVL1::JEMEnergySim::m_jemEtSumsOutputKey
SG::WriteHandleKey< DataVector< JEMEtSums > > m_jemEtSumsOutputKey
Definition: JEMEnergySim.h:83
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
LVL1::JEMEtSums
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/JEMEtSums.h:26
LVL1::JEMEnergySim::cleanup
void cleanup()
delete pointers etc.
Definition: JEMEnergySim.cxx:103
LVL1::JEMEnergySim::m_EtTool
ToolHandle< LVL1::IL1EtTools > m_EtTool
Definition: JEMEnergySim.h:77
TrigT1Interfaces_ClassDEF.h
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
LVL1::JEMEnergySim::JEMEnergySim
JEMEnergySim(const std::string &name, ISvcLocator *pSvcLocator)
Definition: JEMEnergySim.cxx:39