ATLAS Offline Software
JfexMonitorAlgorithm.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "JfexMonitorAlgorithm.h"
6 #include "TMath.h"
7 
8 JfexMonitorAlgorithm::JfexMonitorAlgorithm( const std::string& name, ISvcLocator* pSvcLocator )
9  : AthMonitorAlgorithm(name,pSvcLocator)
10 {
11 }
12 
14 
15  ATH_MSG_DEBUG("JfexMonitorAlgorith::initialize");
16  ATH_MSG_DEBUG("Package Name "<< m_Grouphist);
17 
18  ATH_MSG_DEBUG("m_jFexLRJetContainerKey"<< m_jFexLRJetContainerKey);
19  ATH_MSG_DEBUG("m_jFexSRJetContainerKey"<< m_jFexSRJetContainerKey);
20  ATH_MSG_DEBUG("m_jFexTauContainerKey" << m_jFexTauContainerKey);
21  ATH_MSG_DEBUG("m_jFexFwdElContainerKey"<< m_jFexFwdElContainerKey);
22  ATH_MSG_DEBUG("m_jFexMETContainerKey" << m_jFexMETContainerKey);
23  ATH_MSG_DEBUG("m_jFexSumEtContainerKey"<< m_jFexSumEtContainerKey);
24 
25  ATH_CHECK( m_jFexLRJetContainerKey.initialize() );
26  ATH_CHECK( m_jFexSRJetContainerKey.initialize() );
27  ATH_CHECK( m_jFexTauContainerKey.initialize() );
28  ATH_CHECK( m_jFexFwdElContainerKey.initialize() );
29  ATH_CHECK( m_jFexMETContainerKey.initialize() );
30  ATH_CHECK( m_jFexSumEtContainerKey.initialize() );
31 
32  // TOBs may come from trigger bytestream - renounce from scheduler
39 
41 }
42 
43 StatusCode JfexMonitorAlgorithm::fillHistograms( const EventContext& ctx ) const {
44 
45  ATH_MSG_DEBUG("JfexMonitorAlgorithm::fillHistograms");
46 
47  bool jJ_isInValid = false;
48  bool jLJ_isInValid = false;
49  bool jTau_isInValid = false;
50  bool jEM_isInValid = false;
51  bool jXE_isInValid = false;
52  bool jTE_isInValid = false;
53 
55  if(!jFexSRJetContainer.isValid()) {
56  ATH_MSG_WARNING("No jFex SR Jet container found in storegate "<< m_jFexSRJetContainerKey<<". Will be skipped!");
57  jJ_isInValid = true;
58  }
60  if(!jFexLRJetContainer.isValid()) {
61  ATH_MSG_WARNING("No jFex LR Jet container found in storegate "<< m_jFexLRJetContainerKey<<". Will be skipped!");
62  jLJ_isInValid = true;
63  }
65  if(!jFexTauContainer.isValid()) {
66  ATH_MSG_WARNING("No jFex Tau container found in storegate "<< m_jFexTauContainerKey<<". Will be skipped!");
67  jTau_isInValid = true;
68  }
70  if(!jFexEMContainer.isValid()) {
71  ATH_MSG_WARNING("No jFex EM container found in storegate "<< m_jFexFwdElContainerKey<<". Will be skipped!");
72  jEM_isInValid = true;
73  }
75  if(!jFexMETContainer.isValid()) {
76  ATH_MSG_WARNING("No jFex MET container found in storegate "<< m_jFexMETContainerKey<<". Will be skipped!");
77  jXE_isInValid = true;
78  }
80  if(!jFexSumETContainer.isValid()) {
81  ATH_MSG_WARNING("No jFex MET container found in storegate "<< m_jFexSumEtContainerKey<<". Will be skipped!");
82  jTE_isInValid = true;
83  }
84 
85  // variables for histograms
86  // jJ
87  auto jFexSRJetModule = Monitored::Scalar<int> ("jJ_jFexNumber",0);
88  auto jFexSRJetFPGA = Monitored::Scalar<int> ("jJ_fpgaNumber",0);
89  auto jFexSRJetEt = Monitored::Scalar<int> ("jJ_Et",0);
90  auto jFexSRJeteta = Monitored::Scalar<float>("jJ_Eta",0.0);
91  auto jFexSRJetphi = Monitored::Scalar<float>("jJ_Phi",0.0);
92  auto jFexSRJeteta_glo = Monitored::Scalar<float>("jJ_GlobalEta",0.0);
93  auto jFexSRJetphi_glo = Monitored::Scalar<float>("jJ_GlobalPhi",0.0);
94 
95  // jLJ
96  auto jFexLRJetModule = Monitored::Scalar<int> ("jLJ_jFexNumber",0);
97  auto jFexLRJetFPGA = Monitored::Scalar<int> ("jLJ_fpgaNumber",0);
98  auto jFexLRJetEt = Monitored::Scalar<int> ("jLJ_Et",0);
99  auto jFexLRJeteta = Monitored::Scalar<float>("jLJ_Eta",0.0);
100  auto jFexLRJetphi = Monitored::Scalar<float>("jLJ_Phi",0.0);
101  auto jFexLRJeteta_glo = Monitored::Scalar<float>("jLJ_GlobalEta",0.0);
102  auto jFexLRJetphi_glo = Monitored::Scalar<float>("jLJ_GlobalPhi",0.0);
103 
104 
105  // jTau
106  auto jFexTauModule = Monitored::Scalar<int> ("jTau_jFexNumber",0);
107  auto jFexTauFPGA = Monitored::Scalar<int> ("jTau_fpgaNumber",0);
108  auto jFexTauEt = Monitored::Scalar<int> ("jTau_Et",0);
109  auto jFexTauIso = Monitored::Scalar<int> ("jTau_Iso",0);
110  auto jFexTaueta = Monitored::Scalar<float>("jTau_Eta",0.0);
111  auto jFexTauphi = Monitored::Scalar<float>("jTau_Phi",0.0);
112  auto jFexTaueta_glo = Monitored::Scalar<float>("jTau_GlobalEta",0.0);
113  auto jFexTauphi_glo = Monitored::Scalar<float>("jTau_GlobalPhi",0.0);
114 
115  // jEM
116  auto jFexEMModule = Monitored::Scalar<int> ("jEM_jFexNumber",0);
117  auto jFexEMFPGA = Monitored::Scalar<int> ("jEM_fpgaNumber",0);
118  auto jFexEMEt = Monitored::Scalar<int> ("jEM_Et",0);
119  auto jFexEMeta = Monitored::Scalar<float>("jEM_Eta",0.0);
120  auto jFexEMphi = Monitored::Scalar<float>("jEM_Phi",0.0);
121  auto jFexEMeta_glo = Monitored::Scalar<float>("jEM_GlobalEta",0.0);
122  auto jFexEMphi_glo = Monitored::Scalar<float>("jEM_GlobalPhi",0.0);
123  auto jFexEMIso = Monitored::Scalar<int> ("jEM_Iso",0);
124  auto jFexEMf1 = Monitored::Scalar<int> ("jEM_f1",0);
125  auto jFexEMf2 = Monitored::Scalar<int> ("jEM_f2",0);
126 
127  // jXE
128  auto jFexMETX = Monitored::Scalar<int> ("jXE_X",0);
129  auto jFexMETY = Monitored::Scalar<int> ("jXE_Y",0);
130  auto jFexMET = Monitored::Scalar<float>("jXE_MET",0.0);
131  auto jFexMETphi = Monitored::Scalar<float>("jXE_phi",0.0);
132 
133  // jTE
134  auto jFexSumEt_low = Monitored::Scalar<int> ("jTE_low",0);
135  auto jFexSumEt_high = Monitored::Scalar<int> ("jTE_high",0);
136  auto jFexSumEt_total = Monitored::Scalar<float>("jTE_SumEt",0.0);
137 
138  if(!jJ_isInValid) {
139  for(const xAOD::jFexSRJetRoI* jFexSRJetRoI : *jFexSRJetContainer) {
140  if(jFexSRJetRoI->tobWord()==0) continue; //remove empty TOBs
141  jFexSRJetModule=jFexSRJetRoI->jFexNumber();
142  jFexSRJetFPGA=jFexSRJetRoI->fpgaNumber();
143  jFexSRJetEt=jFexSRJetRoI->tobEt();
144  jFexSRJeteta=jFexSRJetRoI->eta();
145  jFexSRJetphi=jFexSRJetRoI->phi();
146  jFexSRJeteta_glo=jFexSRJetRoI->globalEta();
147  jFexSRJetphi_glo=jFexSRJetRoI->globalPhi();
148  fill(m_Grouphist,jFexSRJetModule,jFexSRJetFPGA,jFexSRJetEt,jFexSRJeteta,jFexSRJetphi,jFexSRJeteta_glo,jFexSRJetphi_glo);
149 
150  }
151  }
152 
153  if(!jLJ_isInValid) {
154  for(const xAOD::jFexLRJetRoI* jFexLRJetRoI : *jFexLRJetContainer) {
155  if(jFexLRJetRoI->tobWord()==0) continue; //remove empty TOBs
156  jFexLRJetModule=jFexLRJetRoI->jFexNumber();
157  jFexLRJetFPGA=jFexLRJetRoI->fpgaNumber();
158  jFexLRJetEt=jFexLRJetRoI->tobEt();
159  jFexLRJeteta=jFexLRJetRoI->eta();
160  jFexLRJetphi=jFexLRJetRoI->phi();
161  jFexLRJeteta_glo=jFexLRJetRoI->globalEta();
162  jFexLRJetphi_glo=jFexLRJetRoI->globalPhi();
163  fill(m_Grouphist,jFexLRJetModule,jFexLRJetFPGA,jFexLRJetEt,jFexLRJeteta,jFexLRJetphi,jFexLRJeteta_glo,jFexLRJetphi_glo);
164  }
165  }
166 
167  if(!jTau_isInValid) {
168  for(const xAOD::jFexTauRoI* jFexTauRoI : *jFexTauContainer) {
169  if(jFexTauRoI->tobWord()==0) continue; //remove empty TOBs
170  jFexTauModule =jFexTauRoI->jFexNumber();
171  jFexTauFPGA =jFexTauRoI->fpgaNumber();
172  jFexTauEt =jFexTauRoI->tobEt();
173  jFexTauIso=jFexTauRoI->tobIso();
174  jFexTaueta=jFexTauRoI->eta();
175  jFexTauphi=jFexTauRoI->phi();
176  jFexTaueta_glo=jFexTauRoI->globalEta();
177  jFexTauphi_glo=jFexTauRoI->globalPhi();
178  fill(m_Grouphist,jFexTauModule,jFexTauFPGA,jFexTauEt,jFexTauIso,jFexTaueta,jFexTauphi,jFexTaueta_glo,jFexTauphi_glo);
179  }
180  }
181 
182  if(!jEM_isInValid){
183  for(const xAOD::jFexFwdElRoI* jFexFwdElRoI : *jFexEMContainer) {
184  if(jFexFwdElRoI->tobWord()==0) continue; //remove empty TOBs
185  jFexEMModule =jFexFwdElRoI->jFexNumber();
186  jFexEMFPGA =jFexFwdElRoI->fpgaNumber();
187  jFexEMEt =jFexFwdElRoI->tobEt();
188  jFexEMeta=jFexFwdElRoI->eta();
189  jFexEMphi=jFexFwdElRoI->phi();
190  jFexEMeta_glo=jFexFwdElRoI->globalEta();
191  jFexEMphi_glo=jFexFwdElRoI->globalPhi();
192  jFexEMIso=jFexFwdElRoI->tobEMIso();
193  jFexEMf1 =jFexFwdElRoI->tobEMf1();
194  jFexEMf2 =jFexFwdElRoI->tobEMf2();
195  fill(m_Grouphist,jFexEMModule,jFexEMFPGA,jFexEMEt,jFexEMeta,jFexEMphi,jFexEMeta_glo,jFexEMphi_glo,jFexEMIso,jFexEMf1,jFexEMf2);
196  }
197  }
198 
199  if(!jXE_isInValid){
200  float metx = 0;
201  float mety = 0;
202  for(const xAOD::jFexMETRoI* jFexMETRoI : *jFexMETContainer) {
203  jFexMETX =jFexMETRoI->tobEx();
204  jFexMETY =jFexMETRoI->tobEy();
205  if(jFexMETRoI->tobEtScale() != 0) {
206  metx += jFexMETRoI->Ex()/jFexMETRoI->tobEtScale();
207  mety += jFexMETRoI->Ey()/jFexMETRoI->tobEtScale();
208  }
209 
210  fill(m_Grouphist,jFexMETX,jFexMETY);
211  }
212  if(jFexMETContainer->size()>0) {
213  jFexMET = TMath::Sqrt(std::pow(metx,2)+std::pow(mety,2));
214  jFexMETphi = TMath::ATan2(mety,metx);
215  fill(m_Grouphist,jFexMET,jFexMETphi);
216  }
217  }
218 
219  if(!jTE_isInValid){
220  int sumEt_total = 0;
221  for(const xAOD::jFexSumETRoI* jFexSumETRoI : *jFexSumETContainer) {
222  jFexSumEt_low =jFexSumETRoI->tobEt_lower();
223  jFexSumEt_high =jFexSumETRoI->tobEt_upper();
224  sumEt_total += jFexSumETRoI->tobEt_lower()+jFexSumETRoI->tobEt_upper();
225  fill(m_Grouphist,jFexSumEt_low,jFexSumEt_high);
226  }
227  if(jFexSumETContainer->size()>0) {
228  jFexSumEt_total = sumEt_total;
229  fill(m_Grouphist,jFexSumEt_total);
230  }
231  }
232 
233 
234 
235  return StatusCode::SUCCESS;
236 }
JfexMonitorAlgorithm::JfexMonitorAlgorithm
JfexMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Definition: JfexMonitorAlgorithm.cxx:8
xAOD::jFexTauRoI_v1
Class describing properties of a LVL1 jFEX global Trigger Object (TOB) in the xAOD format.
Definition: jFexTauRoI_v1.h:22
xAOD::jFexSRJetRoI_v1
Class describing properties of a LVL1 jFEX global Trigger Object (TOB) in the xAOD format.
Definition: jFexSRJetRoI_v1.h:22
JfexMonitorAlgorithm::m_jFexFwdElContainerKey
SG::ReadHandleKey< xAOD::jFexFwdElRoIContainer > m_jFexFwdElContainerKey
Definition: JfexMonitorAlgorithm.h:41
xAOD::jFexTauRoI_v1::eta
float eta() const
xAOD::jFexTauRoI_v1::jFexNumber
uint8_t jFexNumber() const
xAOD::jFexLRJetRoI_v1::eta
float eta() const
xAOD::jFexLRJetRoI
jFexLRJetRoI_v1 jFexLRJetRoI
Define the latest version of the jFexLRJetRoI class
Definition: jFexLRJetRoI.h:13
xAOD::jFexFwdElRoI_v1::tobEMf1
uint8_t tobEMf1() const
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
xAOD::jFexFwdElRoI_v1::eta
float eta() const
xAOD::jFexSRJetRoI_v1::globalEta
int globalEta() const
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
JfexMonitorAlgorithm::m_jFexMETContainerKey
SG::ReadHandleKey< xAOD::jFexMETRoIContainer > m_jFexMETContainerKey
Definition: JfexMonitorAlgorithm.h:42
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounce
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)
Definition: AthCommonDataStore.h:380
xAOD::jFexFwdElRoI_v1::jFexNumber
uint8_t jFexNumber() const
Additional info (initialization)
xAOD::jFexTauRoI_v1::globalPhi
uint globalPhi() const
xAOD::jFexFwdElRoI_v1::phi
float phi() const
xAOD::jFexMETRoI_v1::tobEtScale
int tobEtScale() const
xAOD::jFexFwdElRoI_v1::globalEta
int globalEta() const
Calculated from Tob.
xAOD::jFexMETRoI_v1::Ex
int Ex() const
Methods that require combining results or applying scales.
Definition: jFexMETRoI_v1.cxx:105
xAOD::jFexTauRoI_v1::tobIso
uint16_t tobIso() const
xAOD::jFexLRJetRoI_v1::jFexNumber
uint8_t jFexNumber() const
xAOD::jFexTauRoI_v1::globalEta
int globalEta() const
xAOD::jFexSRJetRoI_v1::eta
float eta() const
xAOD::jFexSRJetRoI_v1::phi
float phi() const
xAOD::jFexSRJetRoI_v1::tobWord
uint32_t tobWord() const
The "raw" 32-bit word describing the object candidate.
JfexMonitorAlgorithm::m_jFexSumEtContainerKey
SG::ReadHandleKey< xAOD::jFexSumETRoIContainer > m_jFexSumEtContainerKey
Definition: JfexMonitorAlgorithm.h:43
JfexMonitorAlgorithm::m_jFexLRJetContainerKey
SG::ReadHandleKey< xAOD::jFexLRJetRoIContainer > m_jFexLRJetContainerKey
Definition: JfexMonitorAlgorithm.h:39
xAOD::jFexMETRoI_v1
Class describing properties of a LVL1 jFEX global Trigger Object (TOB) in the xAOD format.
Definition: jFexMETRoI_v1.h:22
AthMonitorAlgorithm
Base class for Athena Monitoring Algorithms.
Definition: AthMonitorAlgorithm.h:36
xAOD::jFexFwdElRoI_v1::tobEMIso
uint8_t tobEMIso() const
xAOD::jFexLRJetRoI_v1
Class describing properties of a LVL1 jFEX global Trigger Object (TOB) in the xAOD format.
Definition: jFexLRJetRoI_v1.h:22
xAOD::jFexLRJetRoI_v1::tobWord
uint32_t tobWord() const
The "raw" 32-bit word describing the object candidate.
xAOD::jFexFwdElRoI_v1::globalPhi
uint globalPhi() const
xAOD::jFexTauRoI_v1::tobEt
uint16_t tobEt() const
xAOD::jFexTauRoI_v1::fpgaNumber
uint8_t fpgaNumber() const
xAOD::jFexLRJetRoI_v1::globalEta
int globalEta() const
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAOD::jFexMETRoI_v1::tobEy
int tobEy() const
xAOD::jFexLRJetRoI_v1::tobEt
uint16_t tobEt() const
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
xAOD::jFexLRJetRoI_v1::globalPhi
uint globalPhi() const
xAOD::jFexSRJetRoI_v1::tobEt
uint16_t tobEt() const
xAOD::jFexTauRoI_v1::tobWord
uint32_t tobWord() const
The "raw" 32-bit word describing the object candidate.
xAOD::jFexMETRoI_v1::tobEx
int tobEx() const
xAOD::jFexFwdElRoI_v1::tobEMf2
uint8_t tobEMf2() const
xAOD::jFexSRJetRoI_v1::globalPhi
uint globalPhi() const
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
xAOD::jFexSRJetRoI
jFexSRJetRoI_v1 jFexSRJetRoI
Define the latest version of the jFexSRJetRoI class
Definition: jFexSRJetRoI.h:14
xAOD::jFexTauRoI_v1::phi
float phi() const
AthMonitorAlgorithm::fill
void fill(const ToolHandle< GenericMonitoringTool > &groupHandle, std::vector< std::reference_wrapper< Monitored::IMonitoredVariable >> &&variables) const
Fills a vector of variables to a group by reference.
JfexMonitorAlgorithm::fillHistograms
virtual StatusCode fillHistograms(const EventContext &ctx) const override
adds event to the monitoring histograms
Definition: JfexMonitorAlgorithm.cxx:43
JfexMonitorAlgorithm::initialize
virtual StatusCode initialize() override
initialize
Definition: JfexMonitorAlgorithm.cxx:13
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
xAOD::jFexFwdElRoI_v1::tobEt
uint16_t tobEt() const
Decoded from Tob (for convenience)
xAOD::jFexSumETRoI_v1
Class describing properties of a LVL1 jFEX global Trigger Object (TOB) in the xAOD format.
Definition: jFexSumETRoI_v1.h:22
xAOD::jFexFwdElRoI
jFexFwdElRoI_v1 jFexFwdElRoI
Define the latest version of the jFexFwdElJetRoI class
Definition: jFexFwdElRoI.h:13
xAOD::jFexMETRoI_v1::Ey
int Ey() const
Met Ey in 1 MeV scale (all signs considered)
Definition: jFexMETRoI_v1.cxx:114
xAOD::jFexSumETRoI_v1::tobEt_upper
uint16_t tobEt_upper() const
AthMonitorAlgorithm::initialize
virtual StatusCode initialize() override
initialize
Definition: AthMonitorAlgorithm.cxx:18
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
JfexMonitorAlgorithm::m_Grouphist
StringProperty m_Grouphist
Definition: JfexMonitorAlgorithm.h:35
xAOD::jFexLRJetRoI_v1::phi
float phi() const
xAOD::jFexMETRoI
jFexMETRoI_v1 jFexMETRoI
Define the latest version of the jFexMETRoI class
Definition: jFexMETRoI.h:13
xAOD::jFexSRJetRoI_v1::fpgaNumber
uint8_t fpgaNumber() const
xAOD::jFexTauRoI
jFexTauRoI_v1 jFexTauRoI
Define the latest version of the jFexSRJetRoI class
Definition: jFexTauRoI.h:13
JfexMonitorAlgorithm.h
JfexMonitorAlgorithm::m_jFexSRJetContainerKey
SG::ReadHandleKey< xAOD::jFexSRJetRoIContainer > m_jFexSRJetContainerKey
Definition: JfexMonitorAlgorithm.h:38
xAOD::jFexFwdElRoI_v1::tobWord
uint32_t tobWord() const
The "raw" 32-bit word describing the object candidate, 27 bit-word used at hardware level.
xAOD::jFexSumETRoI
jFexSumETRoI_v1 jFexSumETRoI
Define the latest version of the jFexSumETJetRoI class
Definition: jFexSumETRoI.h:13
xAOD::jFexSRJetRoI_v1::jFexNumber
uint8_t jFexNumber() const
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34
xAOD::jFexSumETRoI_v1::tobEt_lower
uint16_t tobEt_lower() const
xAOD::jFexFwdElRoI_v1
Class describing properties of a LVL1 jFEX global Trigger Object (TOB) in the xAOD format.
Definition: jFexFwdElRoI_v1.h:22
xAOD::jFexLRJetRoI_v1::fpgaNumber
uint8_t fpgaNumber() const
xAOD::jFexFwdElRoI_v1::fpgaNumber
uint8_t fpgaNumber() const
JfexMonitorAlgorithm::m_jFexTauContainerKey
SG::ReadHandleKey< xAOD::jFexTauRoIContainer > m_jFexTauContainerKey
Definition: JfexMonitorAlgorithm.h:40
LArGeo::ATan2
GeoGenfun::FunctionNoop ATan2(GeoGenfun::GENFUNCTION y, GeoGenfun::GENFUNCTION x)
Definition: BarrelAuxFunctions.cxx:50