ATLAS Offline Software
Loading...
Searching...
No Matches
EfexMonitorAlgorithm.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7
8EfexMonitorAlgorithm::EfexMonitorAlgorithm( const std::string& name, ISvcLocator* pSvcLocator )
9 : AthMonitorAlgorithm(name,pSvcLocator)
10{
11}
12
14
15 ATH_MSG_DEBUG("EfexMonitorAlgorith::initialize");
16 ATH_MSG_DEBUG("Package Name "<< m_packageName);
17 ATH_MSG_DEBUG("Low Pt Cut "<< m_lowPtCut);
18 ATH_MSG_DEBUG("High Pt Cut "<< m_hiPtCut);
19
20 ATH_MSG_INFO("m_eFexEMTobKeyList "<< m_eFexEMTobKeyList);
21 ATH_MSG_INFO("m_eFexTauTobKeyList "<< m_eFexTauTobKeyList);
22
23 // we initialise all the containers that we need
24 ATH_CHECK( m_eFexEMTobKeyList.initialize() );
25 ATH_CHECK( m_eFexTauTobKeyList.initialize() );
26
28
29 return StatusCode::SUCCESS;
30}
31
32StatusCode EfexMonitorAlgorithm::fillHistograms( const EventContext& ctx ) const {
33
34 ATH_MSG_DEBUG("EfexMonitorAlgorithm::fillHistograms");
35
36 auto locIdx = Monitored::Scalar<std::string>("locIdx","");
37 auto tobEt = Monitored::Scalar<float>("tobEt",0);
38 auto lbn = Monitored::Scalar<int>("LBN",GetEventInfo(ctx)->lumiBlock());
39
40 // Loop over EM read handle keys in key array
42 SG::ReadHandle<xAOD::eFexEMRoIContainer> eFexContainer (key, ctx);
43 // Check that this container is present
44 if ( !eFexContainer.isValid() ) {
45 ATH_MSG_WARNING("No eFex EM container found in storegate "<< key.key());
46 }
47 else {
48 auto nEmTOBs_total = Monitored::Scalar<int>(key.key() +"_nTOBs_nocut",0.0);
49 nEmTOBs_total = eFexContainer->size();
50 fill(m_packageName, nEmTOBs_total,lbn);
51 // Fill EM histograms for the low/high cuts
52 const xAOD::eFexEMRoIContainer* emDataContPtr = eFexContainer.cptr();
53 ATH_CHECK(fillEMHistograms(m_packageName+'_'+key.key()+"_LowPtCut", emDataContPtr, m_lowPtCut,ctx));
54 ATH_CHECK(fillEMHistograms(m_packageName+'_'+key.key()+"_HiPtCut", emDataContPtr, m_hiPtCut,ctx));
55 if(key.key().find("Sim") == std::string::npos) {
56 for (const xAOD::eFexEMRoI *roi: *emDataContPtr) {
57 locIdx = std::to_string(roi->iPhi() / 8) + ":" + std::to_string(roi->iEta());
58 tobEt = roi->et();
59 fill(m_packageName + "_" + key.key(), tobEt, lbn, locIdx);
60 }
61 }
62 }
63 } // Finished EM loop
64
65 // Loop over Tau read handle keys in key array
67 SG::ReadHandle<xAOD::eFexTauRoIContainer> eFexTauContainer(key, ctx);
68 // Check that this container is present
69 if ( !eFexTauContainer.isValid() ) {
70 ATH_MSG_WARNING("No eFex Tau container found in storegate "<< key.key());
71 }
72 else {
73 auto nTauTOBs_total = Monitored::Scalar<int>(key.key()+"_nTOBs_nocut",0.0);
74 nTauTOBs_total = eFexTauContainer->size();
75 fill(m_packageName, nTauTOBs_total,lbn);
76 // Fill Tau histograms for the low/high cuts
77 const xAOD::eFexTauRoIContainer* tauDataContPtr = eFexTauContainer.cptr();
78 ATH_CHECK(fillTauHistograms(m_packageName+'_'+key.key()+"_LowPtCut", tauDataContPtr, m_lowPtCut,ctx));
79 ATH_CHECK(fillTauHistograms(m_packageName+'_'+key.key()+"_HiPtCut", tauDataContPtr, m_hiPtCut,ctx));
80 if(key.key().find("Sim") == std::string::npos) {
81 for (const xAOD::eFexTauRoI *roi: *tauDataContPtr) {
82 locIdx = std::to_string(roi->iPhi() / 8) + ":" + std::to_string(roi->iEta());
83 tobEt = roi->et();
84 fill(m_packageName + "_" + key.key(), tobEt, lbn, locIdx);
85 }
86 }
87 }
88 } // Finished Tau loop
89
90 return StatusCode::SUCCESS;
91}
92
93StatusCode EfexMonitorAlgorithm::fillEMHistograms(const std::string& groupName, const xAOD::eFexEMRoIContainer *emcont, const float &cut_et,const EventContext& ctx) const {
94
95 ATH_MSG_DEBUG("EfexMonitorAlgorithm::fillEMHistograms");
96
97 // monitored variables for histograms
98 auto lbn = Monitored::Scalar<int>("LBN",GetEventInfo(ctx)->lumiBlock());
99 auto binNumber = Monitored::Scalar<int>("binNumber",0);
100 auto nEmTOBs_passcut = Monitored::Scalar<int>("nEMTOBs",0.0); // Number of ToBs passing the cut
101 auto TOBeT = Monitored::Scalar<float>("TOBTransverseEnergy",0.0);
102 auto TOBeta = Monitored::Scalar<float>("TOBEta",0.0);
103 auto TOBphi = Monitored::Scalar<float>("TOBPhi",0.0);
104 auto TOBshelfNumber = Monitored::Scalar<float>("TOBshelfNumber",0.0);
105 auto TOBeFEXNumberSh0 = Monitored::Scalar<float>("TOBeFEXNumberSh0",0.0);
106 auto TOBeFEXNumberSh1 = Monitored::Scalar<float>("TOBeFEXNumberSh1",0.0);
107 auto TOBfpga = Monitored::Scalar<float>("TOBfpga",0.0);
108 auto TOBReta = Monitored::Scalar<float>("TOBReta",0.0);
109 auto TOBRhad = Monitored::Scalar<float>("TOBRhad",0.0);
110 auto TOBWstot = Monitored::Scalar<float>("TOBWstot",0.0);
111 auto TOBReta_threshold = Monitored::Scalar<float>("TOBReta_threshold",0.0);
112 auto TOBRhad_threshold = Monitored::Scalar<float>("TOBRhad_threshold",0.0);
113 auto TOBWstot_threshold = Monitored::Scalar<float>("TOBWstot_threshold",0.0);
114
115 for(const xAOD::eFexEMRoI* efexEmRoI : *emcont){
116 if (efexEmRoI->et() >= cut_et){
117 nEmTOBs_passcut += 1;
118 TOBeT = efexEmRoI->et();
119 fill(groupName, TOBeT);
120 TOBeta = efexEmRoI->eta();
121 TOBphi = efexEmRoI->phi();
122 fill(groupName, TOBeta, TOBphi);
123 TOBshelfNumber=efexEmRoI->shelfNumber();
124 fill(groupName, TOBshelfNumber);
125 // Only fill the relevant shelf variable
126 if (TOBshelfNumber == 0) {
127 TOBeFEXNumberSh0 = int(efexEmRoI->eFexNumber());
128 fill(groupName, TOBeFEXNumberSh0);
129 } else {
130 TOBeFEXNumberSh1 = int(efexEmRoI->eFexNumber());
131 fill(groupName, TOBeFEXNumberSh1);
132 }
133 TOBfpga = efexEmRoI->fpga();
134 fill(groupName, TOBfpga);
135 TOBReta = efexEmRoI->Reta();
136 fill(groupName, TOBReta);
137 TOBRhad = efexEmRoI->Rhad();
138 fill(groupName, TOBRhad);
139 TOBWstot = efexEmRoI->Wstot();
140 fill(groupName, TOBWstot);
141 TOBReta_threshold = efexEmRoI->RetaThresholds();
142 fill(groupName, TOBReta_threshold);
143 TOBRhad_threshold = efexEmRoI->RhadThresholds();
144 fill(groupName, TOBRhad_threshold);
145 TOBWstot_threshold = efexEmRoI->WstotThresholds();
146 fill(groupName, TOBWstot_threshold);
147 int iPhi = efexEmRoI->iPhi();
148 if (iPhi>31) iPhi -= 64;
149 binNumber = (25 + efexEmRoI->iEta())*64 + iPhi+33;
150 fill(groupName,binNumber,lbn);
151 }
152 }
153 fill(groupName, nEmTOBs_passcut);
154
155 return StatusCode::SUCCESS;
156}
157
158StatusCode EfexMonitorAlgorithm::fillTauHistograms(const std::string& groupName, const xAOD::eFexTauRoIContainer *taucont, const float &cut_et,const EventContext& ctx) const {
159
160 ATH_MSG_DEBUG("EfexMonitorAlgorithm::fillTauHistograms");
161
162 // monitored variables for histograms
163 auto lbn = Monitored::Scalar<int>("LBN",GetEventInfo(ctx)->lumiBlock());
164 auto binNumber = Monitored::Scalar<int>("binNumber",0);
165 auto nTauTOBs_passcut = Monitored::Scalar<int>("nTauTOBs",0.0); // Number of ToBs passing the cut
166 auto tauTOBeT = Monitored::Scalar<float>("tauTOBTransverseEnergy",0.0);
167 auto tauTOBeta = Monitored::Scalar<float>("tauTOBEta",0.0);
168 auto tauTOBphi = Monitored::Scalar<float>("tauTOBPhi",0.0);
169 auto tauTOBshelfNumber = Monitored::Scalar<float>("tauTOBshelfNumber",0.0);
170 auto tauTOBeFEXNumberSh0 = Monitored::Scalar<float>("tauTOBeFEXNumberSh0",0.0);
171 auto tauTOBeFEXNumberSh1 = Monitored::Scalar<float>("tauTOBeFEXNumberSh1",0.0);
172 auto tauTOBfpga = Monitored::Scalar<float>("tauTOBfpga",0.0);
173 auto tauTOBRcore = Monitored::Scalar<float>("tauTOBRcore",0.0);
174 auto tauTOBRhad = Monitored::Scalar<float>("tauTOBRhad",0.0);
175 auto tauTOBRcore_threshold = Monitored::Scalar<float>("tauTOBRcore_threshold",0.0);
176 auto tauTOBRhad_threshold = Monitored::Scalar<float>("tauTOBRhad_threshold",0.0);
177 auto tauTOBthree_threshold = Monitored::Scalar<float>("tauTOBthree_threshold",0.0);
178
179 for(const xAOD::eFexTauRoI* efexTauRoI : *taucont){
180 if (efexTauRoI->et() >= cut_et){
181 nTauTOBs_passcut += 1;
182 tauTOBeT = efexTauRoI->et();
183 fill(groupName, tauTOBeT);
184 tauTOBeta = efexTauRoI->eta();
185 tauTOBphi = efexTauRoI->phi();
186 fill(groupName, tauTOBeta, tauTOBphi);
187 tauTOBshelfNumber=efexTauRoI->shelfNumber();
188 fill(groupName, tauTOBshelfNumber);
189 // Only fill the relevant shelf variable
190 if (tauTOBshelfNumber == 0) {
191 tauTOBeFEXNumberSh0 = int(efexTauRoI->eFexNumber());
192 fill(groupName, tauTOBeFEXNumberSh0);
193 } else {
194 tauTOBeFEXNumberSh1 = int(efexTauRoI->eFexNumber());
195 fill(groupName, tauTOBeFEXNumberSh1);
196 }
197 tauTOBfpga = efexTauRoI->fpga();
198 fill(groupName, tauTOBfpga);
199 tauTOBRcore = efexTauRoI->rCore();
200 fill(groupName, tauTOBRcore);
201 tauTOBRhad = efexTauRoI->rHad();
202 fill(groupName, tauTOBRhad);
203 tauTOBRcore_threshold=efexTauRoI->rCoreThresholds();
204 fill(groupName, tauTOBRcore_threshold);
205 tauTOBRhad_threshold=efexTauRoI->rHadThresholds();
206 fill(groupName, tauTOBRhad_threshold);
207 tauTOBthree_threshold=efexTauRoI->tauThreeThresholds();
208 fill(groupName, tauTOBthree_threshold);
209 int iPhi = efexTauRoI->iPhi();
210 if (iPhi>31) iPhi -= 64;
211 binNumber = (25 + efexTauRoI->iEta())*64 + iPhi+33;
212 fill(groupName,binNumber,lbn);
213 }
214 }
215 fill(groupName, nTauTOBs_passcut);
216
217 return StatusCode::SUCCESS;
218}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
uint16_t tobEt(const T *tob)
virtual StatusCode initialize() override
initialize
SG::ReadHandle< xAOD::EventInfo > GetEventInfo(const EventContext &) const
Return a ReadHandle for an EventInfo object (get run/event numbers, etc.)
AthMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
StatusCode fillTauHistograms(const std::string &groupName, const xAOD::eFexTauRoIContainer *taucont, const float &cut_et, const EventContext &ctx) const
EfexMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
SG::ReadHandleKeyArray< xAOD::eFexTauRoIContainer > m_eFexTauTobKeyList
Gaudi::Property< float > m_lowPtCut
virtual StatusCode initialize() override
initialize
SG::ReadHandleKeyArray< xAOD::eFexEMRoIContainer > m_eFexEMTobKeyList
StatusCode fillEMHistograms(const std::string &groupName, const xAOD::eFexEMRoIContainer *emcont, const float &cut_et, const EventContext &ctx) const
Gaudi::Property< float > m_hiPtCut
virtual StatusCode fillHistograms(const EventContext &ctx) const override
adds event to the monitoring histograms
Declare a monitored scalar variable.
Property holding a SG store/key/clid from which a ReadHandle is made.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
eFexEMRoIContainer_v1 eFexEMRoIContainer
eFexEMRoI_v1 eFexEMRoI
Define the latest version of the eFexEMRoI class.
Definition eFexEMRoI.h:17
eFexTauRoIContainer_v1 eFexTauRoIContainer
eFexTauRoI_v1 eFexTauRoI
Define the latest version of the eFexTauRoI class.
Definition eFexTauRoI.h:16
void fill(H5::Group &out_file, size_t iterations)