ATLAS Offline Software
eFexTOBDecorator.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //***************************************************************************
6 // eFexTOBDecorator - description
7 // -------------------
8 // This algorithm decorates the eFEX TOBs with jet descriminant variables and, for the EM TOBs, with the cluster layer supercell Et sums
9 // recalculated from input data using the eFEXTOBEtTool
10 // All values are in 25 MeV counts
11 //
12 // begin : 03 02 2022
13 // email : paul.daniel.thompson@cern.ch
14 //***************************************************************************/
15 #include "eFexTOBDecorator.h"
16 #include "L1CaloFEXSim/eFEXegTOB.h"
18 
19 namespace LVL1 {
20 
21  eFexTOBDecorator::eFexTOBDecorator(const std::string& name, ISvcLocator* svc) : AthAlgorithm(name, svc){}
22 
24  ATH_MSG_INFO( "L1CaloFEXTools/eFexTOBDecorator::initialize()");
25 
26  // initialise read and decorator write handles
27  ATH_CHECK( m_eFEXegEDMContainerKey.initialize() );
28  ATH_CHECK( m_eFEXtauEDMContainerKey.initialize() );
29 
30  ATH_CHECK( m_RetaCoreDec.initialize() );
31  ATH_CHECK( m_RetaEnvDec.initialize() );
32  ATH_CHECK( m_RhadEMDec.initialize() );
33  ATH_CHECK( m_RhadHadDec.initialize() );
34  ATH_CHECK( m_WstotDenDec.initialize() );
35  ATH_CHECK( m_WstotNumDec.initialize() );
36 
37  ATH_CHECK( m_ClusterEtSumPSDec.initialize() );
38  ATH_CHECK( m_ClusterEtSumL1Dec.initialize() );
39  ATH_CHECK( m_ClusterEtSumL2Dec.initialize() );
40  ATH_CHECK( m_ClusterEtSumL3Dec.initialize() );
41 
42  ATH_CHECK( m_RCoreDec.initialize() );
43  ATH_CHECK( m_REnvDec.initialize() );
44  ATH_CHECK( m_REMCoreDec.initialize() );
45  ATH_CHECK( m_REMHadDec.initialize() );
46 
47  // Retrieve the TOB ET sum tool
48  ATH_CHECK( m_eFEXTOBEtTool.retrieve() );
49 
50  return StatusCode::SUCCESS;
51  }
52 
54 
55  // read the TOB containers
57  if (!eFEXegEDMContainerObj.isValid()) {
58  ATH_MSG_ERROR("Failed to retrieve EDM collection");
59  return StatusCode::SUCCESS;
60  }
61  const xAOD::eFexEMRoIContainer* emEDMConstPtr = eFEXegEDMContainerObj.cptr();
62 
64  if (!eFEXtauEDMContainerObj.isValid()) {
65  ATH_MSG_ERROR("Failed to retrieve tau EDM collection");
66  return StatusCode::SUCCESS;
67  }
68  const xAOD::eFexTauRoIContainer* tauEDMConstPtr = eFEXtauEDMContainerObj.cptr();
69 
70  //Setup EM Decorator Handlers
77 
82 
83  //looping over EM TOB to decorate them
84  for ( const xAOD::eFexEMRoI* emRoI : *emEDMConstPtr ){
85 
86  float eta = emRoI->eta();
87  float phi = emRoI->phi();
88  int seed = emRoI->seed();
89  int UnD = emRoI->UpNotDown();
90  std::vector<unsigned int> ClusterCellETs;
91  std::vector<unsigned int> RetaSums;
92  std::vector<unsigned int> RhadSums;
93  std::vector<unsigned int> WstotSums;
94 
95  ATH_CHECK( m_eFEXTOBEtTool->getegSums(eta, phi, seed, UnD, ClusterCellETs, RetaSums, RhadSums, WstotSums) );
96 
97  RetaCoreDec (*emRoI) = RetaSums[0];
98  RetaEnvDec (*emRoI) = RetaSums[1];
99  RhadEMDec (*emRoI) = RhadSums[0];
100  RhadHadDec (*emRoI) = RhadSums[1];
101  WstotDenDec (*emRoI) = WstotSums[0];
102  WstotNumDec (*emRoI) = WstotSums[1];
103 
104  // cluster et per layer summed from SCells
105  unsigned int ps(0); // 0-1 - pre-sampler
106  unsigned int l1(0); // 2-7 - layer 1
107  unsigned int l2(0); // 8-13 - layer 2
108  unsigned int l3(0); // 14-15 - layer 3
109  for(std::size_t i = 0; i < ClusterCellETs.size(); ++i) {
110  if (i<2)
111  ps += ClusterCellETs[i];
112  else if (i < 8 )
113  l1 += ClusterCellETs[i];
114  else if (i < 14 )
115  l2 += ClusterCellETs[i];
116  else
117  l3 += ClusterCellETs[i];
118  }
119 
120  ClusterEtSumPSDec (*emRoI) = ps;
121  ClusterEtSumL1Dec (*emRoI) = l1;
122  ClusterEtSumL2Dec (*emRoI) = l2;
123  ClusterEtSumL3Dec (*emRoI) = l3;
124  }
125 
126  //Setup Tau Decorator Handlers
131 
132  //looping over Tau TOB to decorate them
133  for ( const xAOD::eFexTauRoI* tauRoI : *tauEDMConstPtr ){
134 
135  float eta = tauRoI->eta();
136  float phi = tauRoI->phi();
137  int seed = tauRoI->seed();
138  int UnD = tauRoI->upNotDown();
139  std::vector<unsigned int> RcoreSums;
140  std::vector<unsigned int> RemSums;
141 
142  ATH_CHECK( m_eFEXTOBEtTool->gettauSums(eta, phi, seed, UnD, RcoreSums, RemSums) );
143 
144  RCoreDec (*tauRoI) = RcoreSums[0];
145  REnvDec (*tauRoI) = RcoreSums[1];
146  REMCoreDec (*tauRoI) = RemSums[0];
147  REMHadDec (*tauRoI) = RemSums[1];
148  }
149 
150  // Return gracefully
151  return StatusCode::SUCCESS;
152  }
153 
154 }
LVL1::eFexTOBDecorator::m_RhadHadDec
SG::WriteDecorHandleKey< xAOD::eFexEMRoIContainer > m_RhadHadDec
Definition: eFexTOBDecorator.h:49
LVL1::eFexTOBDecorator::m_RetaEnvDec
SG::WriteDecorHandleKey< xAOD::eFexEMRoIContainer > m_RetaEnvDec
Definition: eFexTOBDecorator.h:47
LVL1::eFexTOBDecorator::m_ClusterEtSumL2Dec
SG::WriteDecorHandleKey< xAOD::eFexEMRoIContainer > m_ClusterEtSumL2Dec
Definition: eFexTOBDecorator.h:55
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
eFexTOBDecorator.h
LVL1::eFexTOBDecorator::eFexTOBDecorator
eFexTOBDecorator(const std::string &name, ISvcLocator *svc)
Definition: eFexTOBDecorator.cxx:21
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
LVL1::eFexTOBDecorator::m_RCoreDec
SG::WriteDecorHandleKey< xAOD::eFexTauRoIContainer > m_RCoreDec
Definition: eFexTOBDecorator.h:60
xAOD::eFexEMRoI_v1
Class describing a LVL1 eFEX EM region of interest.
Definition: eFexEMRoI_v1.h:33
LVL1::eFexTOBDecorator::execute
virtual StatusCode execute()
Definition: eFexTOBDecorator.cxx:53
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
LVL1::eFexTOBDecorator::m_ClusterEtSumPSDec
SG::WriteDecorHandleKey< xAOD::eFexEMRoIContainer > m_ClusterEtSumPSDec
Definition: eFexTOBDecorator.h:53
LVL1::eFexTOBDecorator::m_WstotNumDec
SG::WriteDecorHandleKey< xAOD::eFexEMRoIContainer > m_WstotNumDec
Definition: eFexTOBDecorator.h:51
LVL1::eFexTOBDecorator::m_ClusterEtSumL1Dec
SG::WriteDecorHandleKey< xAOD::eFexEMRoIContainer > m_ClusterEtSumL1Dec
Definition: eFexTOBDecorator.h:54
LVL1::eFexTOBDecorator::m_RetaCoreDec
SG::WriteDecorHandleKey< xAOD::eFexEMRoIContainer > m_RetaCoreDec
Definition: eFexTOBDecorator.h:46
skel.l2
l2
Definition: skel.GENtoEVGEN.py:426
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:92
xAOD::eFexTauRoI_v1
Class describing a LVL1 eFEX tau region of interest.
Definition: eFexTauRoI_v1.h:29
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:99
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
LVL1::eFexTOBDecorator::m_eFEXegEDMContainerKey
SG::ReadHandleKey< xAOD::eFexEMRoIContainer > m_eFEXegEDMContainerKey
Definition: eFexTOBDecorator.h:42
LVL1::eFexTOBDecorator::m_REnvDec
SG::WriteDecorHandleKey< xAOD::eFexTauRoIContainer > m_REnvDec
Definition: eFexTOBDecorator.h:61
LVL1::eFexTOBDecorator::m_ClusterEtSumL3Dec
SG::WriteDecorHandleKey< xAOD::eFexEMRoIContainer > m_ClusterEtSumL3Dec
Definition: eFexTOBDecorator.h:56
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
eFEXegTOB.h
AthAlgorithm
Definition: AthAlgorithm.h:47
TrigConf::name
Definition: HLTChainList.h:35
LVL1::eFexTOBDecorator::m_REMCoreDec
SG::WriteDecorHandleKey< xAOD::eFexTauRoIContainer > m_REMCoreDec
Definition: eFexTOBDecorator.h:62
LVL1::eFexTOBDecorator::initialize
virtual StatusCode initialize()
Definition: eFexTOBDecorator.cxx:23
LVL1::eFexTOBDecorator::m_REMHadDec
SG::WriteDecorHandleKey< xAOD::eFexTauRoIContainer > m_REMHadDec
Definition: eFexTOBDecorator.h:63
LVL1::eFexTOBDecorator::m_eFEXTOBEtTool
ToolHandle< IeFEXTOBEtTool > m_eFEXTOBEtTool
Definition: eFexTOBDecorator.h:65
LVL1::eFexTOBDecorator::m_RhadEMDec
SG::WriteDecorHandleKey< xAOD::eFexEMRoIContainer > m_RhadEMDec
Definition: eFexTOBDecorator.h:48
skel.l1
l1
Definition: skel.GENtoEVGEN.py:425
LVL1::eFexTOBDecorator::m_eFEXtauEDMContainerKey
SG::ReadHandleKey< xAOD::eFexTauRoIContainer > m_eFEXtauEDMContainerKey
Definition: eFexTOBDecorator.h:43
LVL1::eFexTOBDecorator::m_WstotDenDec
SG::WriteDecorHandleKey< xAOD::eFexEMRoIContainer > m_WstotDenDec
Definition: eFexTOBDecorator.h:50
eFEXtauAlgo.h