21 #include "GaudiKernel/ITHistSvc.h"
22 #include "GaudiKernel/ServiceHandle.h"
24 #include <unordered_map>
41 m_myTree =
new TTree(
"data",
"data");
44 ATH_CHECK( m_gTowerContainerSGKey.initialize() );
46 ATH_CHECK( m_gFexRhoOutKey.initialize() );
47 ATH_CHECK( m_gFexBlockOutKey.initialize() );
48 ATH_CHECK( m_gFexJetOutKey.initialize() );
50 ATH_CHECK( m_gScalarEJwojOutKey.initialize() );
51 ATH_CHECK( m_gMETComponentsJwojOutKey.initialize() );
52 ATH_CHECK( m_gMHTComponentsJwojOutKey.initialize() );
53 ATH_CHECK( m_gMSTComponentsJwojOutKey.initialize() );
55 ATH_CHECK( m_gMETComponentsNoiseCutOutKey.initialize() );
56 ATH_CHECK( m_gMETComponentsRmsOutKey.initialize() );
57 ATH_CHECK( m_gScalarENoiseCutOutKey.initialize() );
58 ATH_CHECK( m_gScalarERmsOutKey.initialize() );
60 ATH_CHECK( m_scellsCollectionSGKey.initialize() );
62 ATH_CHECK( m_gFEXOutputCollectionSGKey.initialize() );
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);
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);
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);
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);
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);
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);
122 m_valiTree->Branch (
"gGlobal_scaleMeV1", &m_gGlobal_etScale1);
123 m_valiTree->Branch (
"gGlobal_scaleMeV2", &m_gGlobal_etScale2);
126 m_load_truth_jet =
true;
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);
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);
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);
151 return StatusCode::SUCCESS;
156 const EventContext& ctx = Gaudi::Hive::currentContext();
160 ATH_MSG_FATAL(
"Could not retrieve SCCollection " << m_scellsCollectionSGKey.key() );
161 return StatusCode::FAILURE;
166 ATH_MSG_FATAL(
"Could not retrieve gTowerContainer " << m_gTowerContainerSGKey.key());
167 return StatusCode::FAILURE;
173 ATH_MSG_FATAL(
"Could not retrieve gRhoContainer " << m_gFexRhoOutKey.key());
174 return StatusCode::FAILURE;
179 ATH_MSG_FATAL(
"Could not retrieve gBlockContainer " << m_gFexBlockOutKey.key());
180 return StatusCode::FAILURE;
185 ATH_MSG_FATAL(
"Could not retrieve gJetContainer " << m_gFexJetOutKey.key());
186 return StatusCode::FAILURE;
191 if(!gScalarEJwojHandle.
isValid()){
192 ATH_MSG_FATAL(
"Could not retrieve gScalarJwojContainer " << m_gScalarEJwojOutKey.key());
193 return StatusCode::FAILURE;
198 ATH_MSG_FATAL(
"Could not retrieve gMETJwojContainer " << m_gMETComponentsJwojOutKey.key());
199 return StatusCode::FAILURE;
204 ATH_MSG_FATAL(
"Could not retrieve gMHTJwojContainer " << m_gMHTComponentsJwojOutKey.key());
205 return StatusCode::FAILURE;
210 ATH_MSG_FATAL(
"Could not retrieve gMSTJwojContainer " << m_gMSTComponentsJwojOutKey.key());
211 return StatusCode::FAILURE;
215 if(!gMETNoiseCutHandle.
isValid()){
216 ATH_MSG_FATAL(
"Could not retrieve gMETNoiseCutContainer " << m_gMETComponentsNoiseCutOutKey.key());
217 return StatusCode::FAILURE;
222 ATH_MSG_FATAL(
"Could not retrieve gMETRmsContainer " << m_gMETComponentsRmsOutKey.key());
223 return StatusCode::FAILURE;
227 if(!gScalarENoiseCutHandle.
isValid()){
228 ATH_MSG_FATAL(
"Could not retrieve gScalarENoiseCutContainer " << m_gScalarENoiseCutOutKey.key());
229 return StatusCode::FAILURE;
233 if(!gScalarERmsHandle.
isValid()){
234 ATH_MSG_FATAL(
"Could not retrieve gScalarERmsContainer " << m_gScalarERmsOutKey.key());
235 return StatusCode::FAILURE;
241 m_gtower_eta.clear();
242 m_gtower_phi.clear();
244 m_gtower_etFloat.clear();
245 m_gtower_etEMFloat.clear();
246 m_gtower_etHADFloat.clear();
252 m_gRho_tobEt.clear();
253 m_gRho_etMeV.clear();
254 m_gRho_etScale.clear();
259 m_gSJ_gFEXphi.clear();
261 m_gSJ_phiTopo.clear();
264 m_gSJ_etScale.clear();
269 m_gLJ_gFEXphi.clear();
271 m_gLJ_phiTopo.clear();
274 m_gLJ_etScale.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();
286 m_gNoiseCut_METx.clear();
287 m_gNoiseCut_METy.clear();
290 m_gNoiseCut_MET.clear();
291 m_gNoiseCut_SumET.clear();
293 m_gRms_SumET.clear();
295 m_gGlobal_etScale1.clear();
296 m_gGlobal_etScale2.clear();
301 m_sc_eta.push_back((
cell)->eta());
302 m_sc_phi.push_back((
cell)->phi());
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());
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());
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());
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());
359 m_gJwoJ_METx.push_back(gMETJwoj->METquantityOne());
360 m_gJwoJ_METy.push_back(gMETJwoj->METquantityTwo());
364 m_gJwoJ_MHTx.push_back(gMHTJwoj->METquantityOne());
365 m_gJwoJ_MHTy.push_back(gMHTJwoj->METquantityTwo());
369 m_gJwoJ_MSTx.push_back(gMSTJwoj->METquantityOne());
370 m_gJwoJ_MSTy.push_back(gMSTJwoj->METquantityTwo());
374 m_gNoiseCut_METx.push_back(gMETNoiseCut->METquantityOne());
375 m_gNoiseCut_METy.push_back(gMETNoiseCut->METquantityTwo());
379 m_gRms_METx.push_back(gMETRms->METquantityOne());
380 m_gRms_METy.push_back(gMETRms->METquantityTwo());
384 m_gNoiseCut_MET.push_back(gScalarENoiseCut->METquantityOne());
385 m_gNoiseCut_SumET.push_back(gScalarENoiseCut->METquantityTwo());
389 m_gRms_MET.push_back(gScalarERms->METquantityOne());
390 m_gRms_SumET.push_back(gScalarERms->METquantityTwo());
395 if(!gFEXOutputCollectionobj.
isValid()){
396 ATH_MSG_FATAL(
"Could not retrieve gFEXOutputCollection " << m_gFEXOutputCollectionSGKey.key());
397 return StatusCode::FAILURE;
401 return StatusCode::SUCCESS;
404 CHECK(loadJetAlgoVariables(gFEXOutputCollectionobj));
405 if (m_load_truth_jet){
406 CHECK(loadTruthJets());
409 CHECK(loadGlobalAlgoVariables(gFEXOutputCollectionobj));
413 return StatusCode::SUCCESS;
418 return StatusCode::SUCCESS;
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();
430 m_jet_nTOBs = gFEXOutputCollectionobj->
jetsSize();
431 for (
int i = 0;
i < gFEXOutputCollectionobj->
jetsSize();
i++)
434 m_jet_TOB.push_back(TOB);
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"]);
444 return StatusCode::SUCCESS;
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();
456 m_global_nTOBs = gFEXOutputCollectionobj->
globalsSize();
460 m_global_TOB.push_back(TOB);
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"]);
470 return StatusCode::SUCCESS;
474 m_truth_jet_eta.clear();
475 m_truth_jet_phi.clear();
476 m_truth_jet_ET.clear();
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;
488 for (
unsigned i=0;
i!=truth_jets->
size();
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());
495 return StatusCode::SUCCESS;