diff --git a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/gFEXNtupleWriter.h b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/gFEXNtupleWriter.h index 418e2dfe4c832e7462da34924354b0cfe368dddf..ec1db7fc1723d0b7546e04c128cfaa2944450e22 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 8d1740d65d799497a83d01175c9055ebbbcb0e2f..776a3af16dffd567da69f75343f1b593e39aec85 100644 --- a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/gFEXNtupleWriter.cxx +++ b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/gFEXNtupleWriter.cxx @@ -40,11 +40,19 @@ 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() ); - 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() ); + + ATH_CHECK( m_gFEXOutputCollectionSGKey.initialize() ); m_valiTree = new TTree("valiTree","valiTree"); CHECK( histSvc->regTree("/ANALYSIS/valiTree",m_valiTree) ); @@ -72,16 +80,22 @@ StatusCode LVL1::gFEXNtupleWriter::initialize () { 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() ); - - 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); @@ -106,13 +120,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 +151,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(); @@ -160,6 +202,16 @@ StatusCode LVL1::gFEXNtupleWriter::execute () { 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){ m_SC_eta.push_back((cell)->eta()); @@ -195,9 +247,26 @@ StatusCode LVL1::gFEXNtupleWriter::execute () { m_gLJ_phi.push_back(gLJ->iPhi()); m_gLJ_et.push_back(gLJ->tobEt()); } - m_valiTree->Fill(); - + 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()); + } SG::ReadHandle<LVL1::gFEXOutputCollection> gFEXOutputCollectionobj = SG::ReadHandle<LVL1::gFEXOutputCollection>(m_gFEXOutputCollectionSGKey); if(!gFEXOutputCollectionobj.isValid()){ @@ -216,6 +285,7 @@ StatusCode LVL1::gFEXNtupleWriter::execute () { CHECK(loadGlobalAlgoVariables(gFEXOutputCollectionobj)); + m_valiTree->Fill(); m_myTree->Fill(); return StatusCode::SUCCESS; }