ATLAS Offline Software
gFEXNtupleWriter.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 //***************************************************************************
5 // gFEXOutputCollection
6 // -------------------
7 // begin : 01 04 2021
8 // email : cecilia.tosciri@cern.ch
9 //***************************************************************************
10 
12 #include "StoreGate/StoreGateSvc.h"
19 #include <vector>
20 #include "TTree.h"
21 #include "GaudiKernel/ITHistSvc.h"
22 #include "GaudiKernel/ServiceHandle.h"
23 #include <memory>
24 #include <unordered_map>
25 
26 #include "xAODJet/JetContainer.h"
29 
31 
32 LVL1::gFEXNtupleWriter::gFEXNtupleWriter(const std::string& name, ISvcLocator* pSvcLocator): AthAlgorithm(name, pSvcLocator) { }
33 
35 
36 }
37 
40  CHECK( histSvc.retrieve() );
41  m_myTree = new TTree("data","data");
42  CHECK( histSvc->regTree("/ANALYSIS/data",m_myTree) );
43 
44  ATH_CHECK( m_gTowerContainerSGKey.initialize() );
45 
46  ATH_CHECK( m_gFexRhoOutKey.initialize() );
47  ATH_CHECK( m_gFexBlockOutKey.initialize() );
48  ATH_CHECK( m_gFexJetOutKey.initialize() );
49 
50  ATH_CHECK( m_gScalarEJwojOutKey.initialize() );
51  ATH_CHECK( m_gMETComponentsJwojOutKey.initialize() );
52  ATH_CHECK( m_gMHTComponentsJwojOutKey.initialize() );
53  ATH_CHECK( m_gMSTComponentsJwojOutKey.initialize() );
54 
55  ATH_CHECK( m_gMETComponentsNoiseCutOutKey.initialize() );
56  ATH_CHECK( m_gMETComponentsRmsOutKey.initialize() );
57  ATH_CHECK( m_gScalarENoiseCutOutKey.initialize() );
58  ATH_CHECK( m_gScalarERmsOutKey.initialize() );
59 
60  ATH_CHECK( m_scellsCollectionSGKey.initialize() );
61 
62  ATH_CHECK( m_gFEXOutputCollectionSGKey.initialize() );
63 
64  m_valiTree = new TTree("valiTree","valiTree");
65  CHECK( histSvc->regTree("/ANALYSIS/valiTree",m_valiTree) );
66  m_valiTree->Branch ("SC_eta", &m_sc_eta);
67  m_valiTree->Branch ("SC_phi", &m_sc_phi);
68  m_valiTree->Branch ("SC_et", &m_sc_et);
69  m_valiTree->Branch ("gtower_eta", &m_gtower_eta);
70  m_valiTree->Branch ("gtower_phi", &m_gtower_phi);
71  m_valiTree->Branch ("gtower_et", &m_gtower_et);
72  m_valiTree->Branch ("gtower_etFloat", &m_gtower_etFloat);
73  m_valiTree->Branch ("gtower_etEMFloat", &m_gtower_etEMFloat);
74  m_valiTree->Branch ("gtower_etHADFloat", &m_gtower_etHADFloat);
75  m_valiTree->Branch ("gtower_ID", &m_gtower_ID);
76  m_valiTree->Branch ("gtower_posneg", &m_posneg);
77 
78  m_valiTree->Branch ("gRho_eta", &m_gRho_eta);
79  m_valiTree->Branch ("gRho_phi", &m_gRho_phi);
80  m_valiTree->Branch ("gRho_tobEt", &m_gRho_tobEt);
81  m_valiTree->Branch ("gRho_etMeV", &m_gRho_etMeV);
82  m_valiTree->Branch ("gRho_scaleMeV", &m_gRho_etScale);
83 
84  m_valiTree->Branch ("gSJ_iEta", &m_gSJ_iEta);
85  m_valiTree->Branch ("gSJ_iPhi", &m_gSJ_iPhi);
86  m_valiTree->Branch ("gSJ_eta", &m_gSJ_eta);
87  m_valiTree->Branch ("gSJ_gFEXphi", &m_gSJ_gFEXphi);
88  m_valiTree->Branch ("gSJ_phi", &m_gSJ_phi);
89  m_valiTree->Branch ("gSJ_phiTopo", &m_gSJ_phiTopo);
90  m_valiTree->Branch ("gSJ_tobEt", &m_gSJ_tobEt);
91  m_valiTree->Branch ("gSJ_etMeV", &m_gSJ_etMeV);
92  m_valiTree->Branch ("gSJ_scaleMeV", &m_gSJ_etScale);
93 
94  m_valiTree->Branch ("gLJ_iEta", &m_gLJ_iEta);
95  m_valiTree->Branch ("gLJ_iPhi", &m_gLJ_iPhi);
96  m_valiTree->Branch ("gLJ_eta", &m_gLJ_eta);
97  m_valiTree->Branch ("gLJ_gFEXphi", &m_gLJ_gFEXphi);
98  m_valiTree->Branch ("gLJ_phi", &m_gLJ_phi);
99  m_valiTree->Branch ("gLJ_phiTopo", &m_gLJ_phiTopo);
100  m_valiTree->Branch ("gLJ_tobEt", &m_gLJ_tobEt);
101  m_valiTree->Branch ("gLJ_etMeV", &m_gLJ_etMeV);
102  m_valiTree->Branch ("gLJ_scaleMeV", &m_gLJ_etScale);
103 
104  m_valiTree->Branch ("gJwoj_MET", &m_gJwoJ_MET);
105  m_valiTree->Branch ("gJwoj_SumET", &m_gJwoJ_SumET);
106  m_valiTree->Branch ("gJwoj_METx", &m_gJwoJ_METx);
107  m_valiTree->Branch ("gJwoj_METy", &m_gJwoJ_METy);
108  m_valiTree->Branch ("gJwoj_MHTx", &m_gJwoJ_MHTx);
109  m_valiTree->Branch ("gJwoj_MHTy", &m_gJwoJ_MHTy);
110  m_valiTree->Branch ("gJwoj_MSTx", &m_gJwoJ_MSTx);
111  m_valiTree->Branch ("gJwoj_MSTy", &m_gJwoJ_MSTy);
112 
113  m_valiTree->Branch ("gNoiseCut_METx", &m_gNoiseCut_METx);
114  m_valiTree->Branch ("gNoiseCut_METy", &m_gNoiseCut_METy);
115  m_valiTree->Branch ("gRms_METx", &m_gRms_METx);
116  m_valiTree->Branch ("gRms_METy", &m_gRms_METy);
117  m_valiTree->Branch ("gNoiseCut_MET", &m_gNoiseCut_MET);
118  m_valiTree->Branch ("gNoiseCut_SumET", &m_gNoiseCut_SumET);
119  m_valiTree->Branch ("gRms_MET", &m_gRms_MET);
120  m_valiTree->Branch ("gRms_SumET", &m_gRms_SumET);
121 
122  m_valiTree->Branch ("gGlobal_scaleMeV1", &m_gGlobal_etScale1);
123  m_valiTree->Branch ("gGlobal_scaleMeV2", &m_gGlobal_etScale2);
124 
125 
126  m_load_truth_jet = true;
127 
128  if (m_load_truth_jet){
129  m_valiTree->Branch ("truth_jet_eta", &m_truth_jet_eta);
130  m_valiTree->Branch ("truth_jet_phi", &m_truth_jet_phi);
131  m_valiTree->Branch ("truth_jet_ET", &m_truth_jet_ET);
132  }
133 
134  m_myTree->Branch ("jet_TOB", &m_jet_TOB);
135  m_myTree->Branch ("jet_TOB_Eta", &m_jet_TOB_Eta);
136  m_myTree->Branch ("jet_TOB_Phi", &m_jet_TOB_Phi);
137  m_myTree->Branch ("jet_TOB_ET", &m_jet_TOB_ET);
138  m_myTree->Branch ("jet_TOB_ID", &m_jet_TOB_ID);
139  m_myTree->Branch ("jet_TOB_Status", &m_jet_TOB_Status);
140  m_myTree->Branch ("jet_nTOBs", &m_jet_nTOBs);
141 
142  m_myTree->Branch ("global_TOB", &m_global_TOB);
143  m_myTree->Branch ("global_TOB_Quantity1", &m_global_TOB_Quantity1);
144  m_myTree->Branch ("global_TOB_Quantity2", &m_global_TOB_Quantity2);
145  m_myTree->Branch ("global_TOB_Saturation", &m_global_TOB_Saturation);
146  m_myTree->Branch ("global_TOB_ID", &m_global_TOB_ID);
147  m_myTree->Branch ("global_TOB_Status1", &m_global_TOB_Status1);
148  m_myTree->Branch ("global_TOB_Status2", &m_global_TOB_Status2);
149  m_myTree->Branch ("global_nTOBs", &m_global_nTOBs);
150 
151  return StatusCode::SUCCESS;
152 }
153 
155 
156  const EventContext& ctx = Gaudi::Hive::currentContext();
157 
158  SG::ReadHandle<CaloCellContainer> SCCollection =SG::ReadHandle<CaloCellContainer>(m_scellsCollectionSGKey,ctx);
159  if(!SCCollection.isValid()){
160  ATH_MSG_FATAL("Could not retrieve SCCollection " << m_scellsCollectionSGKey.key() );
161  return StatusCode::FAILURE;
162  }
163 
164  SG::ReadHandle<LVL1::gTowerContainer> gTowersHandle = SG::ReadHandle<LVL1::gTowerContainer>(m_gTowerContainerSGKey,ctx);
165  if(!gTowersHandle.isValid()){
166  ATH_MSG_FATAL("Could not retrieve gTowerContainer " << m_gTowerContainerSGKey.key());
167  return StatusCode::FAILURE;
168  }
169 
170  //Read objects from gFEX JetContainer
172  if(!gRhoHandle.isValid()){
173  ATH_MSG_FATAL("Could not retrieve gRhoContainer " << m_gFexRhoOutKey.key());
174  return StatusCode::FAILURE;
175  }
176 
178  if(!gBlockHandle.isValid()){
179  ATH_MSG_FATAL("Could not retrieve gBlockContainer " << m_gFexBlockOutKey.key());
180  return StatusCode::FAILURE;
181  }
182 
184  if(!gJetHandle.isValid()){
185  ATH_MSG_FATAL("Could not retrieve gJetContainer " << m_gFexJetOutKey.key());
186  return StatusCode::FAILURE;
187  }
188 
189  //Read objects from gFEX GlobalContainer
191  if(!gScalarEJwojHandle.isValid()){
192  ATH_MSG_FATAL("Could not retrieve gScalarJwojContainer " << m_gScalarEJwojOutKey.key());
193  return StatusCode::FAILURE;
194  }
195 
196  SG::ReadHandle<xAOD::gFexGlobalRoIContainer> gMETJwojHandle = SG::ReadHandle<xAOD::gFexGlobalRoIContainer>(m_gMETComponentsJwojOutKey, ctx);
197  if(!gMETJwojHandle.isValid()){
198  ATH_MSG_FATAL("Could not retrieve gMETJwojContainer " << m_gMETComponentsJwojOutKey.key());
199  return StatusCode::FAILURE;
200  }
201 
202  SG::ReadHandle<xAOD::gFexGlobalRoIContainer> gMHTJwojHandle = SG::ReadHandle<xAOD::gFexGlobalRoIContainer>(m_gMHTComponentsJwojOutKey, ctx);
203  if(!gMHTJwojHandle.isValid()){
204  ATH_MSG_FATAL("Could not retrieve gMHTJwojContainer " << m_gMHTComponentsJwojOutKey.key());
205  return StatusCode::FAILURE;
206  }
207 
208  SG::ReadHandle<xAOD::gFexGlobalRoIContainer> gMSTJwojHandle = SG::ReadHandle<xAOD::gFexGlobalRoIContainer>(m_gMSTComponentsJwojOutKey, ctx);
209  if(!gMSTJwojHandle.isValid()){
210  ATH_MSG_FATAL("Could not retrieve gMSTJwojContainer " << m_gMSTComponentsJwojOutKey.key());
211  return StatusCode::FAILURE;
212  }
213 
214  SG::ReadHandle<xAOD::gFexGlobalRoIContainer> gMETNoiseCutHandle = SG::ReadHandle<xAOD::gFexGlobalRoIContainer>(m_gMETComponentsNoiseCutOutKey, ctx);
215  if(!gMETNoiseCutHandle.isValid()){
216  ATH_MSG_FATAL("Could not retrieve gMETNoiseCutContainer " << m_gMETComponentsNoiseCutOutKey.key());
217  return StatusCode::FAILURE;
218  }
219 
221  if(!gMETRmsHandle.isValid()){
222  ATH_MSG_FATAL("Could not retrieve gMETRmsContainer " << m_gMETComponentsRmsOutKey.key());
223  return StatusCode::FAILURE;
224  }
225 
226  SG::ReadHandle<xAOD::gFexGlobalRoIContainer> gScalarENoiseCutHandle = SG::ReadHandle<xAOD::gFexGlobalRoIContainer>(m_gScalarENoiseCutOutKey, ctx);
227  if(!gScalarENoiseCutHandle.isValid()){
228  ATH_MSG_FATAL("Could not retrieve gScalarENoiseCutContainer " << m_gScalarENoiseCutOutKey.key());
229  return StatusCode::FAILURE;
230  }
231 
233  if(!gScalarERmsHandle.isValid()){
234  ATH_MSG_FATAL("Could not retrieve gScalarERmsContainer " << m_gScalarERmsOutKey.key());
235  return StatusCode::FAILURE;
236  }
237 
238  m_sc_eta.clear();
239  m_sc_phi.clear();
240  m_sc_et.clear();
241  m_gtower_eta.clear();
242  m_gtower_phi.clear();
243  m_gtower_et.clear();
244  m_gtower_etFloat.clear();
245  m_gtower_etEMFloat.clear();
246  m_gtower_etHADFloat.clear();
247  m_gtower_ID.clear();
248  m_posneg.clear();
249 
250  m_gRho_eta.clear();
251  m_gRho_phi.clear();
252  m_gRho_tobEt.clear();
253  m_gRho_etMeV.clear();
254  m_gRho_etScale.clear();
255 
256  m_gSJ_iEta.clear();
257  m_gSJ_iPhi.clear();
258  m_gSJ_eta.clear();
259  m_gSJ_gFEXphi.clear();
260  m_gSJ_phi.clear();
261  m_gSJ_phiTopo.clear();
262  m_gSJ_tobEt.clear();
263  m_gSJ_etMeV.clear();
264  m_gSJ_etScale.clear();
265 
266  m_gLJ_iEta.clear();
267  m_gLJ_iPhi.clear();
268  m_gLJ_eta.clear();
269  m_gLJ_gFEXphi.clear();
270  m_gLJ_phi.clear();
271  m_gLJ_phiTopo.clear();
272  m_gLJ_tobEt.clear();
273  m_gLJ_etMeV.clear();
274  m_gLJ_etScale.clear();
275 
276 
277  m_gJwoJ_MET.clear();
278  m_gJwoJ_SumET.clear();
279  m_gJwoJ_METx.clear();
280  m_gJwoJ_METy.clear();
281  m_gJwoJ_MHTx.clear();
282  m_gJwoJ_MHTy.clear();
283  m_gJwoJ_MSTx.clear();
284  m_gJwoJ_MSTy.clear();
285 
286  m_gNoiseCut_METx.clear();
287  m_gNoiseCut_METy.clear();
288  m_gRms_METx.clear();
289  m_gRms_METy.clear();
290  m_gNoiseCut_MET.clear();
291  m_gNoiseCut_SumET.clear();
292  m_gRms_MET.clear();
293  m_gRms_SumET.clear();
294 
295  m_gGlobal_etScale1.clear();
296  m_gGlobal_etScale2.clear();
297 
298 
299 
300  for (const CaloCell* cell : * SCCollection){
301  m_sc_eta.push_back((cell)->eta());
302  m_sc_phi.push_back((cell)->phi());
303  m_sc_et.push_back((cell)->energy()/cosh((cell)->eta()));
304  }
305 
306  for (const LVL1::gTower* gTower : *gTowersHandle) {
307  m_gtower_eta.push_back(gTower->eta());
308  m_gtower_phi.push_back(gTower->phi());
309  m_gtower_et.push_back(gTower->getET());
310  m_gtower_etFloat.push_back(gTower->getET_float());
311  m_gtower_etEMFloat.push_back(gTower->getET_EM_float());
312  m_gtower_etHADFloat.push_back(gTower->getET_HAD_float());
313  m_gtower_ID.push_back(gTower->getID());
314  m_posneg.push_back(gTower->getPosNeg());
315  }
316 
317  for (const xAOD::gFexJetRoI* gRho : *gRhoHandle) {
318  m_gRho_eta.push_back(gRho->iEta());
319  m_gRho_phi.push_back(gRho->iPhi());
320  m_gRho_tobEt.push_back(gRho->gFexTobEt());
321  m_gRho_etMeV.push_back(gRho->et());
322  m_gRho_etScale.push_back(gRho->tobEtScale());
323  }
324 
325  for (const xAOD::gFexJetRoI* gSJ : *gBlockHandle) {
326  m_gSJ_iEta.push_back(gSJ->iEta());
327  m_gSJ_iPhi.push_back(gSJ->iPhi());
328  m_gSJ_eta.push_back(gSJ->eta());
329  m_gSJ_gFEXphi.push_back(gSJ->phi_gFex());
330  m_gSJ_phi.push_back(gSJ->phi());
331  m_gSJ_phiTopo.push_back(gSJ->iPhiTopo());
332  m_gSJ_tobEt.push_back(gSJ->gFexTobEt());
333  m_gSJ_etMeV.push_back(gSJ->et());
334  m_gSJ_etScale.push_back(gSJ->tobEtScale());
335 
336  }
337 
338  for (const xAOD::gFexJetRoI* gLJ : *gJetHandle) {
339  m_gLJ_iEta.push_back(gLJ->iEta());
340  m_gLJ_iPhi.push_back(gLJ->iPhi());
341  m_gLJ_eta.push_back(gLJ->eta());
342  m_gLJ_gFEXphi.push_back(gLJ->phi_gFex());
343  m_gLJ_phi.push_back(gLJ->phi());
344  m_gLJ_phiTopo.push_back(gLJ->iPhiTopo());
345  m_gLJ_tobEt.push_back(gLJ->gFexTobEt());
346  m_gLJ_etMeV.push_back(gLJ->et());
347  m_gLJ_etScale.push_back(gLJ->tobEtScale());
348 
349  }
350 
351  for (const xAOD::gFexGlobalRoI* gScalarEJwoj : *gScalarEJwojHandle) {
352  m_gJwoJ_MET.push_back(gScalarEJwoj->METquantityOne());
353  m_gJwoJ_SumET.push_back(gScalarEJwoj->METquantityTwo());
354  m_gGlobal_etScale1.push_back(gScalarEJwoj->tobEtScaleOne());
355  m_gGlobal_etScale2.push_back(gScalarEJwoj->tobEtScaleTwo());
356  }
357 
358  for (const xAOD::gFexGlobalRoI* gMETJwoj : *gMETJwojHandle) {
359  m_gJwoJ_METx.push_back(gMETJwoj->METquantityOne());
360  m_gJwoJ_METy.push_back(gMETJwoj->METquantityTwo());
361  }
362 
363  for (const xAOD::gFexGlobalRoI* gMHTJwoj : *gMHTJwojHandle) {
364  m_gJwoJ_MHTx.push_back(gMHTJwoj->METquantityOne());
365  m_gJwoJ_MHTy.push_back(gMHTJwoj->METquantityTwo());
366  }
367 
368  for (const xAOD::gFexGlobalRoI* gMSTJwoj : *gMSTJwojHandle) {
369  m_gJwoJ_MSTx.push_back(gMSTJwoj->METquantityOne());
370  m_gJwoJ_MSTy.push_back(gMSTJwoj->METquantityTwo());
371  }
372 
373  for (const xAOD::gFexGlobalRoI* gMETNoiseCut : *gMETNoiseCutHandle) {
374  m_gNoiseCut_METx.push_back(gMETNoiseCut->METquantityOne());
375  m_gNoiseCut_METy.push_back(gMETNoiseCut->METquantityTwo());
376  }
377 
378  for (const xAOD::gFexGlobalRoI* gMETRms : *gMETRmsHandle) {
379  m_gRms_METx.push_back(gMETRms->METquantityOne());
380  m_gRms_METy.push_back(gMETRms->METquantityTwo());
381  }
382 
383  for (const xAOD::gFexGlobalRoI* gScalarENoiseCut : *gScalarENoiseCutHandle) {
384  m_gNoiseCut_MET.push_back(gScalarENoiseCut->METquantityOne());
385  m_gNoiseCut_SumET.push_back(gScalarENoiseCut->METquantityTwo());
386  }
387 
388  for (const xAOD::gFexGlobalRoI* gScalarERms : *gScalarERmsHandle) {
389  m_gRms_MET.push_back(gScalarERms->METquantityOne());
390  m_gRms_SumET.push_back(gScalarERms->METquantityTwo());
391  }
392 
393 
394  SG::ReadHandle<LVL1::gFEXOutputCollection> gFEXOutputCollectionobj = SG::ReadHandle<LVL1::gFEXOutputCollection>(m_gFEXOutputCollectionSGKey, ctx);
395  if(!gFEXOutputCollectionobj.isValid()){
396  ATH_MSG_FATAL("Could not retrieve gFEXOutputCollection " << m_gFEXOutputCollectionSGKey.key());
397  return StatusCode::FAILURE;
398  }
399 
400  if (!gFEXOutputCollectionobj->getdooutput()) {
401  return StatusCode::SUCCESS;
402  }
403 
404  CHECK(loadJetAlgoVariables(gFEXOutputCollectionobj));
405  if (m_load_truth_jet){
406  CHECK(loadTruthJets());
407  }
408 
409  CHECK(loadGlobalAlgoVariables(gFEXOutputCollectionobj));
410 
411  m_valiTree->Fill();
412  m_myTree->Fill();
413  return StatusCode::SUCCESS;
414 }
415 
417  ATH_MSG_DEBUG("Finalizing " << name() << "...");
418  return StatusCode::SUCCESS;
419 }
420 
422  m_jet_TOB.clear();
423  m_jet_TOB_Eta.clear();
424  m_jet_TOB_Phi.clear();
425  m_jet_TOB_ET.clear();
426  m_jet_TOB_ID.clear();
427  m_jet_TOB_Status.clear();
428 
429 
430  m_jet_nTOBs = gFEXOutputCollectionobj->jetsSize();
431  for (int i = 0; i < gFEXOutputCollectionobj->jetsSize(); i++)
432  {
433  uint32_t TOB = gFEXOutputCollectionobj->getJetTob()[i];
434  m_jet_TOB.push_back(TOB);
435 
436  std::unordered_map<std::string, float> gFEXjetvalue = (gFEXOutputCollectionobj->getJet(i));
437  m_jet_TOB_Eta.push_back(gFEXjetvalue["EtaJet"]);
438  m_jet_TOB_Phi.push_back(gFEXjetvalue["PhiJet"]);
439  m_jet_TOB_ET.push_back(gFEXjetvalue["ETJet"]);
440  m_jet_TOB_ID.push_back(gFEXjetvalue["TobIDJet"]);
441  m_jet_TOB_Status.push_back(gFEXjetvalue["StatusJet"]);
442 
443  }
444  return StatusCode::SUCCESS;
445 }
446 
448  m_global_TOB.clear();
449  m_global_TOB_Quantity1.clear();
450  m_global_TOB_Quantity2.clear();
451  m_global_TOB_Saturation.clear();
452  m_global_TOB_ID.clear();
453  m_global_TOB_Status1.clear();
454  m_global_TOB_Status2.clear();
455 
456  m_global_nTOBs = gFEXOutputCollectionobj->globalsSize();
457  for (int i = 0; i < gFEXOutputCollectionobj->globalsSize(); i++)
458  {
459  uint32_t TOB = gFEXOutputCollectionobj->getGlobalTob()[i];
460  m_global_TOB.push_back(TOB);
461 
462  std::unordered_map<std::string, float> gFEXglobalvalue = (gFEXOutputCollectionobj->getGlobal(i));
463  m_global_TOB_Quantity1.push_back(gFEXglobalvalue["GlobalQuantity1"]);
464  m_global_TOB_Quantity2.push_back(gFEXglobalvalue["GlobalQuantity2"]);
465  m_global_TOB_Saturation.push_back(gFEXglobalvalue["SaturationGlobal"]);
466  m_global_TOB_ID.push_back(gFEXglobalvalue["TobIDJet"]);
467  m_global_TOB_Status1.push_back(gFEXglobalvalue["GlobalStatus1"]);
468  m_global_TOB_Status2.push_back(gFEXglobalvalue["GlobalStatus2"]);
469  }
470  return StatusCode::SUCCESS;
471 }
472 
474  m_truth_jet_eta.clear();
475  m_truth_jet_phi.clear();
476  m_truth_jet_ET.clear();
477  const xAOD::JetContainer* truth_jets;
478  StatusCode sc = evtStore()->retrieve( truth_jets, m_jet_container_name);
479  if (sc == StatusCode::FAILURE){
480  m_jet_container_name = "InTimeAntiKt4TruthJets";
481  StatusCode sc2 = evtStore()->retrieve( truth_jets, m_jet_container_name);
482  if (sc2 == StatusCode::FAILURE){
483  ATH_MSG_DEBUG("gFEXNtupleWriter::loadTruthJets() Unable to determine truth jet container");
484  m_load_truth_jet = false;
485  return StatusCode::SUCCESS;
486  }
487  }
488  for (unsigned i=0; i!=truth_jets->size(); i++) {
489  const xAOD::Jet* each_jet = (*truth_jets)[i];
490  if(each_jet->pt()<10000) continue;
491  m_truth_jet_eta.push_back(each_jet->p4().Eta());
492  m_truth_jet_phi.push_back(each_jet->p4().Phi());
493  m_truth_jet_ET.push_back(each_jet->p4().Et());
494  }
495  return StatusCode::SUCCESS;
496 }
497 
LVL1::gTower::getET_float
float getET_float() const
Get ET (total) in MeV FLOAT VERSION.
Definition: gTower.cxx:149
LVL1::gFEXNtupleWriter::gFEXNtupleWriter
gFEXNtupleWriter(const std::string &name, ISvcLocator *pSvcLocator)
Definition: gFEXNtupleWriter.cxx:32
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
gFEXJetTOB.h
LVL1::gFEXNtupleWriter::execute
StatusCode execute()
Definition: gFEXNtupleWriter.cxx:154
LVL1::gFEXOutputCollection::getJet
std::unordered_map< std::string, float > getJet(int) const
Definition: gFEXOutputCollection.cxx:53
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
LVL1::gFEXNtupleWriter::loadTruthJets
StatusCode loadTruthJets()
Definition: gFEXNtupleWriter.cxx:473
LVL1::gTower
The gTower class is an interface object for gFEX trigger algorithms The purposes are twofold:
Definition: gTower.h:38
LVL1::gTower::phi
float phi() const
Definition: gTower.h:69
xAOD::gFexGlobalRoI_v1
Class describing properties of a LVL1 gFEX global Trigger Object (TOB) in the xAOD format.
Definition: gFexGlobalRoI_v1.h:25
gFEXOutputCollection.h
LVL1::gFEXOutputCollection::getGlobalTob
const std::vector< uint32_t > & getGlobalTob() const
Definition: gFEXOutputCollection.cxx:96
LVL1::gFEXNtupleWriter::~gFEXNtupleWriter
~gFEXNtupleWriter()
Definition: gFEXNtupleWriter.cxx:34
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
LVL1::gTower::getET
int getET() const
Get ET (total) in MeV.
Definition: gTower.cxx:142
LVL1::gTower::getET_EM_float
int getET_EM_float() const
Get ET in MeV from EM calo FLOAT VERSION.
Definition: gTower.cxx:157
gFEXJwoJTOB.h
gFEXJetAlgo.h
LVL1::gFEXNtupleWriter::finalize
StatusCode finalize()
Definition: gFEXNtupleWriter.cxx:416
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
lumiFormat.i
int i
Definition: lumiFormat.py:85
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
xAOD::gFexJetRoI_v1
Class describing properties of a LVL1 gFEX jet Trigger Object (TOB) in the xAOD format.
Definition: gFexJetRoI_v1.h:25
MuonSegmentReaderConfig.histSvc
histSvc
Definition: MuonSegmentReaderConfig.py:96
CaloCell_SuperCell_ID.h
Helper class for offline supercell identifiers.
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
gFEXNtupleWriter.h
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
LVL1::gTower::getET_HAD_float
int getET_HAD_float() const
Get ET in MeV from HAD calo FLOAT VERSION.
Definition: gTower.cxx:164
LVL1::gFEXNtupleWriter::loadGlobalAlgoVariables
StatusCode loadGlobalAlgoVariables(SG::ReadHandle< LVL1::gFEXOutputCollection >)
Definition: gFEXNtupleWriter.cxx:447
AthAlgorithm
Definition: AthAlgorithm.h:47
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
TrigConf::name
Definition: HLTChainList.h:35
LVL1::gTower::eta
float eta() const
Definition: gTower.h:68
gFEXaltMetAlgo.h
gFEXJwoJAlgo.h
LVL1::gFEXNtupleWriter::loadJetAlgoVariables
StatusCode loadJetAlgoVariables(SG::ReadHandle< LVL1::gFEXOutputCollection >)
Definition: gFEXNtupleWriter.cxx:421
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
MagicNumbers.h
LVL1::gFEXOutputCollection::jetsSize
int jetsSize() const
Definition: gFEXOutputCollection.cxx:48
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
xAOD::Jet_v1::p4
virtual FourMom_t p4() const
The full 4-momentum of the particle.
Definition: Jet_v1.cxx:71
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
JetContainer.h
LVL1::gFEXOutputCollection::getdooutput
bool getdooutput() const
Definition: gFEXOutputCollection.cxx:106
LVL1::gTower::getPosNeg
int getPosNeg() const
Definition: gTower.h:103
LVL1::gFEXOutputCollection::getGlobal
std::unordered_map< std::string, float > getGlobal(int) const
Definition: gFEXOutputCollection.cxx:86
CaloIdManager.h
LVL1::gFEXOutputCollection::globalsSize
int globalsSize() const
Definition: gFEXOutputCollection.cxx:81
LVL1::gFEXOutputCollection::getJetTob
const std::vector< uint32_t > & getJetTob() const
Definition: gFEXOutputCollection.cxx:63
LVL1::gFEXNtupleWriter::initialize
StatusCode initialize()
Definition: gFEXNtupleWriter.cxx:38
xAOD::Jet_v1::pt
virtual double pt() const
The transverse momentum ( ) of the particle.
Definition: Jet_v1.cxx:44
StoreGateSvc.h
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
LVL1::gTower::getID
int getID() const
Add to ET
Definition: gTower.cxx:119
ServiceHandle< ITHistSvc >