From 877318db65b67f1f28c03cab09b202cbd6436c49 Mon Sep 17 00:00:00 2001 From: Cecilia Tosciri <cecilia.tosciri@cern.ch> Date: Fri, 14 Jan 2022 19:10:06 +0100 Subject: [PATCH 1/3] Add global objects in validation tree --- .../L1CaloFEXSim/gFEXNtupleWriter.h | 15 +++ .../L1CaloFEXSim/src/gFEXNtupleWriter.cxx | 92 +++++++++++++++++-- 2 files changed, 97 insertions(+), 10 deletions(-) diff --git a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/gFEXNtupleWriter.h b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/gFEXNtupleWriter.h index 418e2dfe4c83..ec1db7fc1723 100644 --- a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/gFEXNtupleWriter.h +++ b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/gFEXNtupleWriter.h @@ -45,8 +45,14 @@ private: SG::ReadHandleKey< xAOD::gFexJetRoIContainer > m_gFexRhoOutKey {this,"Key_gFexRhoOutputContainer","L1_gFexRhoRoI","Output gFexRho"}; SG::ReadHandleKey< xAOD::gFexJetRoIContainer > m_gFexBlockOutKey {this,"Key_gFexSRJetOutputContainer","L1_gFexSRJetRoI","Output gFexBlock"}; SG::ReadHandleKey< xAOD::gFexJetRoIContainer > m_gFexJetOutKey {this,"Key_gFexLRJetOutputContainer","L1_gFexLRJetRoI","Output gFexJet"}; + SG::ReadHandleKey< xAOD::gFexGlobalRoIContainer > m_gScalarEJwojOutKey {this,"Key_gScalarEJwojOutputContainer","L1_gScalarEJwoj","Output Scalar MET and SumET"}; + SG::ReadHandleKey< xAOD::gFexGlobalRoIContainer > m_gMETComponentsJwojOutKey {this,"Key_gMETComponentsJwojOutputContainer","L1_gMETComponentsJwoj","Output total MET components"}; + SG::ReadHandleKey< xAOD::gFexGlobalRoIContainer > m_gMHTComponentsJwojOutKey {this,"Key_gMHTComponentsJwojOutputContainer","L1_gMHTComponentsJwoj","Output hard MET components"}; + SG::ReadHandleKey< xAOD::gFexGlobalRoIContainer > m_gMSTComponentsJwojOutKey {this,"Key_gMSTComponentsJwojOutputContainer","L1_gMSTComponentsJwoj","Output soft MET components"}; + SG::ReadHandleKey<CaloCellContainer> m_scellsCollectionSGKey {this, "SCell", "SCell", "SCell"}; + gFEXOutputCollection* m_gFEXOutputCollection; float m_jet_nTOBs; float m_global_nTOBs; @@ -102,6 +108,15 @@ private: std::vector<float> m_gLJ_phi; std::vector<float> m_gLJ_et; + std::vector<float> m_gGlobal_MET; + std::vector<float> m_gGlobal_SumET; + std::vector<float> m_gGlobal_METx; + std::vector<float> m_gGlobal_METy; + std::vector<float> m_gGlobal_MHTx; + std::vector<float> m_gGlobal_MHTy; + std::vector<float> m_gGlobal_MSTx; + std::vector<float> m_gGlobal_MSTy; + StatusCode loadJetAlgoVariables(SG::ReadHandle<LVL1::gFEXOutputCollection>); StatusCode loadGlobalAlgoVariables(SG::ReadHandle<LVL1::gFEXOutputCollection>); diff --git a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/gFEXNtupleWriter.cxx b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/gFEXNtupleWriter.cxx index 8d1740d65d79..7640dc50f2d7 100644 --- a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/gFEXNtupleWriter.cxx +++ b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/gFEXNtupleWriter.cxx @@ -43,7 +43,12 @@ StatusCode LVL1::gFEXNtupleWriter::initialize () { ATH_CHECK( m_gFexRhoOutKey.initialize() ); ATH_CHECK( m_gFexBlockOutKey.initialize() ); ATH_CHECK( m_gFexJetOutKey.initialize() ); - ATH_CHECK( m_gFexJetOutKey.initialize() ); + + ATH_CHECK( m_gScalarEJwojOutKey.initialize() ); + ATH_CHECK( m_gMETComponentsJwojOutKey.initialize() ); + ATH_CHECK( m_gMHTComponentsJwojOutKey.initialize() ); + ATH_CHECK( m_gMSTComponentsJwojOutKey.initialize() ); + ATH_CHECK( m_scellsCollectionSGKey.initialize() ); m_valiTree = new TTree("valiTree","valiTree"); @@ -72,6 +77,18 @@ StatusCode LVL1::gFEXNtupleWriter::initialize () { m_valiTree->Branch ("gLJ_phi", &m_gLJ_phi); m_valiTree->Branch ("gLJ_et", &m_gLJ_et); + m_valiTree->Branch ("gLJ_eta", &m_gLJ_eta); + m_valiTree->Branch ("gLJ_phi", &m_gLJ_phi); + m_valiTree->Branch ("gLJ_et", &m_gLJ_et); + + m_valiTree->Branch ("gGlobal_MET", &m_gGlobal_MET); + m_valiTree->Branch ("gGlobal_SumET", &m_gGlobal_SumET); + m_valiTree->Branch ("gGlobal_METx", &m_gGlobal_METx); + m_valiTree->Branch ("gGlobal_METy", &m_gGlobal_METy); + m_valiTree->Branch ("gGlobal_MHTx", &m_gGlobal_MHTx); + m_valiTree->Branch ("gGlobal_MHTy", &m_gGlobal_MHTy); + m_valiTree->Branch ("gGlobal_MSTx", &m_gGlobal_MSTx); + m_valiTree->Branch ("gGlobal_MSTy", &m_gGlobal_MSTy); ATH_CHECK( m_gFEXOutputCollectionSGKey.initialize() ); @@ -106,13 +123,20 @@ StatusCode LVL1::gFEXNtupleWriter::initialize () { StatusCode LVL1::gFEXNtupleWriter::execute () { + SG::ReadHandle<CaloCellContainer> SCCollection =SG::ReadHandle<CaloCellContainer>(m_scellsCollectionSGKey); + if(!SCCollection.isValid()){ + ATH_MSG_FATAL("Could not retrieve SCCollection " << m_scellsCollectionSGKey.key() ); + return StatusCode::FAILURE; + } + SG::ReadHandle<LVL1::gTowerContainer> gTowersHandle = SG::ReadHandle<LVL1::gTowerContainer>(m_gTowerContainerSGKey); if(!gTowersHandle.isValid()){ ATH_MSG_FATAL("Could not retrieve gTowerContainer " << m_gTowerContainerSGKey.key()); return StatusCode::FAILURE; } - - SG::ReadHandle<xAOD::gFexJetRoIContainer> gRhoHandle = SG::ReadHandle<xAOD::gFexJetRoIContainer>(m_gFexRhoOutKey); + + //Read objects from gFEX JetContainer + SG::ReadHandle<xAOD::gFexJetRoIContainer> gRhoHandle = SG::ReadHandle<xAOD::gFexJetRoIContainer>(m_gFexRhoOutKey); if(!gRhoHandle.isValid()){ ATH_MSG_FATAL("Could not retrieve gRhoContainer " << m_gFexRhoOutKey.key()); return StatusCode::FAILURE; @@ -130,12 +154,33 @@ StatusCode LVL1::gFEXNtupleWriter::execute () { return StatusCode::FAILURE; } - SG::ReadHandle<CaloCellContainer> SCCollection =SG::ReadHandle<CaloCellContainer>(m_scellsCollectionSGKey); - if(!SCCollection.isValid()){ - ATH_MSG_FATAL("Could not retrieve SCCollection " << m_scellsCollectionSGKey.key() ); - return StatusCode::FAILURE; + //Read objects from gFEX GlobalContainer + SG::ReadHandle<xAOD::gFexGlobalRoIContainer> gScalarEHandle = SG::ReadHandle<xAOD::gFexGlobalRoIContainer>(m_gScalarEJwojOutKey); + if(!gScalarEHandle.isValid()){ + ATH_MSG_FATAL("Could not retrieve gBlockContainer " << m_gScalarEJwojOutKey.key()); + return StatusCode::FAILURE; + } + + SG::ReadHandle<xAOD::gFexGlobalRoIContainer> gMETHandle = SG::ReadHandle<xAOD::gFexGlobalRoIContainer>(m_gMETComponentsJwojOutKey); + if(!gMETHandle.isValid()){ + ATH_MSG_FATAL("Could not retrieve gBlockContainer " << m_gMETComponentsJwojOutKey.key()); + return StatusCode::FAILURE; + } + + SG::ReadHandle<xAOD::gFexGlobalRoIContainer> gMHTHandle = SG::ReadHandle<xAOD::gFexGlobalRoIContainer>(m_gMHTComponentsJwojOutKey); + if(!gMHTHandle.isValid()){ + ATH_MSG_FATAL("Could not retrieve gBlockContainer " << m_gMHTComponentsJwojOutKey.key()); + return StatusCode::FAILURE; } + SG::ReadHandle<xAOD::gFexGlobalRoIContainer> gMSTHandle = SG::ReadHandle<xAOD::gFexGlobalRoIContainer>(m_gMSTComponentsJwojOutKey); + if(!gMSTHandle.isValid()){ + ATH_MSG_FATAL("Could not retrieve gBlockContainer " << m_gMSTComponentsJwojOutKey.key()); + return StatusCode::FAILURE; + } + + + m_SC_eta.clear(); m_SC_phi.clear(); m_SC_et.clear(); @@ -156,9 +201,15 @@ StatusCode LVL1::gFEXNtupleWriter::execute () { m_gSJ_phi.clear(); m_gSJ_et.clear(); - m_gLJ_eta.clear(); - m_gLJ_phi.clear(); - m_gLJ_et.clear(); + m_gGlobal_MET.clear(); + m_gGlobal_SumET.clear(); + m_gGlobal_METx.clear(); + m_gGlobal_METy.clear(); + m_gGlobal_MHTx.clear(); + m_gGlobal_MHTy.clear(); + m_gGlobal_MSTx.clear(); + m_gGlobal_MSTy.clear(); + for (const auto& cell : * SCCollection){ @@ -195,6 +246,27 @@ StatusCode LVL1::gFEXNtupleWriter::execute () { m_gLJ_phi.push_back(gLJ->iPhi()); m_gLJ_et.push_back(gLJ->tobEt()); } + + for (auto const gScalarE : *gScalarEHandle) { + m_gGlobal_MET.push_back(gScalarE->quantityOne()); + m_gGlobal_SumET.push_back(gScalarE->quantityTwo()); + } + + for (auto const gMET : *gMETHandle) { + m_gGlobal_METx.push_back(gMET->quantityOne()); + m_gGlobal_METy.push_back(gMET->quantityTwo()); + } + + for (auto const gMHT : *gMETHandle) { + m_gGlobal_MHTx.push_back(gMHT->quantityOne()); + m_gGlobal_MHTy.push_back(gMHT->quantityTwo()); + } + + for (auto const gMST : *gMSTHandle) { + m_gGlobal_MSTx.push_back(gMST->quantityOne()); + m_gGlobal_MSTy.push_back(gMST->quantityTwo()); + } + m_valiTree->Fill(); -- GitLab From 7c9cc092f5ba8bc1ece5670d162db015e07eba89 Mon Sep 17 00:00:00 2001 From: Cecilia Tosciri <cecilia.tosciri@cern.ch> Date: Tue, 18 Jan 2022 00:42:58 +0100 Subject: [PATCH 2/3] Include truth jets in output tree --- .../L1CaloFEXSim/src/gFEXNtupleWriter.cxx | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/gFEXNtupleWriter.cxx b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/gFEXNtupleWriter.cxx index 7640dc50f2d7..1df3cd5f350a 100644 --- a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/gFEXNtupleWriter.cxx +++ b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/gFEXNtupleWriter.cxx @@ -40,6 +40,7 @@ StatusCode LVL1::gFEXNtupleWriter::initialize () { CHECK( histSvc->regTree("/ANALYSIS/data",m_myTree) ); ATH_CHECK( m_gTowerContainerSGKey.initialize() ); + ATH_CHECK( m_gFexRhoOutKey.initialize() ); ATH_CHECK( m_gFexBlockOutKey.initialize() ); ATH_CHECK( m_gFexJetOutKey.initialize() ); @@ -50,6 +51,8 @@ StatusCode LVL1::gFEXNtupleWriter::initialize () { ATH_CHECK( m_gMSTComponentsJwojOutKey.initialize() ); ATH_CHECK( m_scellsCollectionSGKey.initialize() ); + + ATH_CHECK( m_gFEXOutputCollectionSGKey.initialize() ); m_valiTree = new TTree("valiTree","valiTree"); CHECK( histSvc->regTree("/ANALYSIS/valiTree",m_valiTree) ); @@ -90,15 +93,13 @@ StatusCode LVL1::gFEXNtupleWriter::initialize () { m_valiTree->Branch ("gGlobal_MSTx", &m_gGlobal_MSTx); m_valiTree->Branch ("gGlobal_MSTy", &m_gGlobal_MSTy); - - ATH_CHECK( m_gFEXOutputCollectionSGKey.initialize() ); - - m_load_truth_jet = false; + + m_load_truth_jet = true; if (m_load_truth_jet){ - m_myTree->Branch ("truth_jet_eta", &m_truth_jet_eta); - m_myTree->Branch ("truth_jet_phi", &m_truth_jet_phi); - m_myTree->Branch ("truth_jet_ET", &m_truth_jet_ET); + m_valiTree->Branch ("truth_jet_eta", &m_truth_jet_eta); + m_valiTree->Branch ("truth_jet_phi", &m_truth_jet_phi); + m_valiTree->Branch ("truth_jet_ET", &m_truth_jet_ET); } m_myTree->Branch ("jet_TOB", &m_jet_TOB); @@ -201,6 +202,10 @@ StatusCode LVL1::gFEXNtupleWriter::execute () { m_gSJ_phi.clear(); m_gSJ_et.clear(); + m_gLJ_eta.clear(); + m_gLJ_phi.clear(); + m_gLJ_et.clear(); + m_gGlobal_MET.clear(); m_gGlobal_SumET.clear(); m_gGlobal_METx.clear(); @@ -267,10 +272,6 @@ StatusCode LVL1::gFEXNtupleWriter::execute () { m_gGlobal_MSTy.push_back(gMST->quantityTwo()); } - m_valiTree->Fill(); - - - SG::ReadHandle<LVL1::gFEXOutputCollection> gFEXOutputCollectionobj = SG::ReadHandle<LVL1::gFEXOutputCollection>(m_gFEXOutputCollectionSGKey); if(!gFEXOutputCollectionobj.isValid()){ ATH_MSG_FATAL("Could not retrieve gFEXOutputCollection " << m_gFEXOutputCollectionSGKey.key()); @@ -288,6 +289,7 @@ StatusCode LVL1::gFEXNtupleWriter::execute () { CHECK(loadGlobalAlgoVariables(gFEXOutputCollectionobj)); + m_valiTree->Fill(); m_myTree->Fill(); return StatusCode::SUCCESS; } -- GitLab From a258df5ce41c36fc885f0325808ecefe1fbd9ef8 Mon Sep 17 00:00:00 2001 From: Cecilia Tosciri <cecilia.tosciri@cern.ch> Date: Tue, 18 Jan 2022 16:14:36 +0100 Subject: [PATCH 3/3] Remove duplicated lines --- .../TrigT1/L1CaloFEX/L1CaloFEXSim/src/gFEXNtupleWriter.cxx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/gFEXNtupleWriter.cxx b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/gFEXNtupleWriter.cxx index 1df3cd5f350a..776a3af16dff 100644 --- a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/gFEXNtupleWriter.cxx +++ b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/gFEXNtupleWriter.cxx @@ -80,10 +80,6 @@ StatusCode LVL1::gFEXNtupleWriter::initialize () { m_valiTree->Branch ("gLJ_phi", &m_gLJ_phi); m_valiTree->Branch ("gLJ_et", &m_gLJ_et); - m_valiTree->Branch ("gLJ_eta", &m_gLJ_eta); - m_valiTree->Branch ("gLJ_phi", &m_gLJ_phi); - m_valiTree->Branch ("gLJ_et", &m_gLJ_et); - m_valiTree->Branch ("gGlobal_MET", &m_gGlobal_MET); m_valiTree->Branch ("gGlobal_SumET", &m_gGlobal_SumET); m_valiTree->Branch ("gGlobal_METx", &m_gGlobal_METx); -- GitLab