ATLAS Offline Software
L1CaloPprEtCorrelationPlotManager.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include "GaudiKernel/ITHistSvc.h"
8 #include "GaudiKernel/MsgStream.h"
9 #include "GaudiKernel/StatusCode.h"
11 #include "StoreGate/StoreGateSvc.h"
12 
17 
20 #include "Identifier/Identifier.h"
21 
22 #include <utility>
23 
24 
26  ToolHandle<LVL1::IL1CaloOfflineTriggerTowerTools>&offlineTT_tool,
27  const unsigned int lumimax,
28  const std::string& pathInRootFile)
29  : L1CaloPprPlotManager(histoSvc,
30  offlineTT_tool,
31  0,
32  lumimax,
33  pathInRootFile,
34  "EtCaloL1Correlation",
35  "etCorrelation",
36  "EtCaloL1Correlation",
37  "",
38  true),
39  m_storeGate("StoreGateSvc", histoSvc->name()),
40  m_caloTool("LVL1::L1CaloMonitoringCaloTool/L1CaloMonitoringCaloTool"),
41  m_EtMin(0.)
42 {
43  this->loadTools();
44 }
45 
46 // --------------------------------------------------------------------------
47 
49  ToolHandle<LVL1::IL1TriggerTowerTool>&onlineTT_tool,
50  const unsigned int lumimax,
51  const std::string& pathInRootFile)
52  : L1CaloPprPlotManager(aMonObj,
53  onlineTT_tool,
54  0,
55  lumimax,
56  pathInRootFile,
57  "EtCaloL1Correlation",
58  "etCorrelation",
59  "EtCaloL1Correlation",
60  ""),
61  m_storeGate("StoreGateSvc", aMonObj->name()),
62  m_caloTool("LVL1::L1CaloMonitoringCaloTool/L1CaloMonitoringCaloTool"),
63  m_EtMin(0.)
64 {
65  this->loadTools();
66 }
67 
68 // --------------------------------------------------------------------------
69 
71 {
72  StatusCode sc;
73 
74  const CaloCellContainer* caloCellContainer = 0;
75 
76  if (!m_isOnline){
77 
78  sc = m_storeGate->retrieve(caloCellContainer, m_caloCellContainerName);
79  if ( sc.isFailure() || !caloCellContainer) {
80  ATH_MSG_WARNING("Could not retrieve calo cell container");
81  }
82  else {
83  m_ttToolOffline->caloCells(caloCellContainer);
84  }
85 
86  }
87  else {
88 
89  sc = m_caloTool->loadCaloCells();
90  if ( sc.isFailure() ) {
91  ATH_MSG_WARNING("Could not load CaloCells");
92  }
93 
94  }
95 
96  return sc;
97 
98 }
99 
100 // --------------------------------------------------------------------------
101 
103 {
104  float caloEnergy = 0.;
105  float ttCpEnergy = trigTower->cpET()*0.5;
106  float absEta = fabs(trigTower->eta() );
107 
108  if (ttCpEnergy <= m_EtMin) return -1000.;
109  if (absEta < 3.2){
111  CaloCellEnergyByLayerAcc("CaloCellEnergyByLayer");
112  if ( CaloCellEnergyByLayerAcc.isAvailable(*trigTower) ) {
113  for (float e : CaloCellEnergyByLayerAcc(*trigTower)) {
114  caloEnergy += e;
115  }
116  caloEnergy = caloEnergy / cosh( trigTower->eta() );
117  }
118  }//for central region only
119  else {
121  CaloCellETByLayerAcc("CaloCellETByLayer");
122  if( CaloCellETByLayerAcc.isAvailable(*trigTower) ){
123  for (float et : CaloCellETByLayerAcc(*trigTower)) {
124  caloEnergy += et;
125  }
126  }
127  }//forward region
128  // round calo energy to nearest GeV in order to compare with L1 energy
129  caloEnergy=int(caloEnergy+0.5);
130 
131  // set calo energy to saturation limit if necessary
132  if (caloEnergy>255.) { caloEnergy=255.; }
133 
134  // fill histograms only if L1 and calo cell energies
135  // are above the threshold defined by m_EtMin
136  if ( caloEnergy > m_EtMin && ttCpEnergy > m_EtMin ) {
137  return ttCpEnergy/caloEnergy;
138  }
139  else {
140  // return default value
141  return -1000.;
142  }
143 }
144 
145 // --------------------------------------------------------------------------
146 
148 {
149  // check if default value (-1000.) has been determined
150  return ( value!=-1000. );
151 }
152 
153 // --------------------------------------------------------------------------
154 
156 {
157  StatusCode sc;
158 
159  if (m_isOnline) {
160  sc = m_caloTool.retrieve();
161  if ( sc.isFailure()) {
162  ATH_MSG_WARNING("Unable to locate tool L1CaloMonitoringCaloTool");
163  }
164  }
165  else {
166  sc = m_storeGate.retrieve();
167  if ( sc.isFailure()) {
168  ATH_MSG_WARNING("Unable to retrieve store gate");
169  }
170  }
171 
172 
173 }
et
Extra patterns decribing particle interation process.
L1CaloPprEtCorrelationPlotManager::m_EtMin
double m_EtMin
Definition: L1CaloPprEtCorrelationPlotManager.h:74
xAOD::TriggerTower_v2::cpET
uint8_t cpET() const
get cpET from peak of lut_cp
Definition: TriggerTower_v2.cxx:180
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
L1CaloPprEtCorrelationPlotManager::getCaloCells
StatusCode getCaloCells()
Definition: L1CaloPprEtCorrelationPlotManager.cxx:70
xAOD::et
et
Definition: TrigEMCluster_v1.cxx:25
ManagedMonitorToolBase
Provides functionality for users to implement and save histograms, ntuples, and summary data,...
Definition: ManagedMonitorToolBase.h:74
L1CaloPprEtCorrelationPlotManager::L1CaloPprEtCorrelationPlotManager
L1CaloPprEtCorrelationPlotManager(ITHistSvc *histoSvc, ToolHandle< LVL1::IL1CaloOfflineTriggerTowerTools > &offlineTT_tool, const unsigned int lumimax, const std::string &pathInRootFile)
Definition: L1CaloPprEtCorrelationPlotManager.cxx:25
IL1CaloOfflineTriggerTowerTools.h
L1CaloPprEtCorrelationPlotManager::loadTools
void loadTools()
Definition: L1CaloPprEtCorrelationPlotManager.cxx:155
L1CaloPprEtCorrelationPlotManager::doMonitoring
bool doMonitoring(double &value)
Definition: L1CaloPprEtCorrelationPlotManager.cxx:147
athena.value
value
Definition: athena.py:122
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:54
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
ManagedMonitorToolBase.h
IL1CaloxAODOfflineTriggerTowerTools.h
L1CaloPprEtCorrelationPlotManager::m_caloTool
ToolHandle< LVL1::IL1CaloMonitoringCaloTool > m_caloTool
Definition: L1CaloPprEtCorrelationPlotManager.h:72
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAOD::TriggerTower_v2
Description of TriggerTower_v2.
Definition: TriggerTower_v2.h:49
xAOD::TriggerTower_v2::eta
virtual double eta() const final
The pseudorapidity ( ) of the particle.
Definition: TriggerTower_v2.cxx:210
L1CaloPprEtCorrelationPlotManager::m_storeGate
ServiceHandle< StoreGateSvc > m_storeGate
Definition: L1CaloPprEtCorrelationPlotManager.h:70
L1CaloPprEtCorrelationPlotManager.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
L1CaloPprEtCorrelationPlotManager::getMonitoringValue
double getMonitoringValue(const xAOD::TriggerTower *trigTower, CalLayerEnum theLayer)
Definition: L1CaloPprEtCorrelationPlotManager.cxx:102
CaloCellContainer.h
CaloCellContainer
Container class for CaloCell.
Definition: CaloCellContainer.h:55
L1CaloPprPlotManager::m_ttToolOffline
ToolHandle< LVL1::IL1CaloOfflineTriggerTowerTools > m_ttToolOffline
Definition: L1CaloPprPlotManager.h:162
IL1TriggerTowerTool.h
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
L1CaloPprPlotManager
Definition: L1CaloPprPlotManager.h:85
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
L1CaloPprPlotManager::m_isOnline
bool m_isOnline
Definition: L1CaloPprPlotManager.h:217
TauGNNUtils::Variables::absEta
bool absEta(const xAOD::TauJet &tau, double &out)
Definition: TauGNNUtils.cxx:232
L1CaloPprEtCorrelationPlotManager::m_caloCellContainerName
std::string m_caloCellContainerName
Definition: L1CaloPprEtCorrelationPlotManager.h:71
SG::ConstAccessor::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
ConstAccessor.h
Helper class to provide constant type-safe access to aux data.
CalLayerEnum
CalLayerEnum
Definition: L1CaloPprPlotManager.h:78
TriggerTower.h
StoreGateSvc.h