diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/EventSaverFlatNtuple.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/EventSaverFlatNtuple.cxx index 459ec759b3120ed78204d95f3edd0df6ae1940bd..ff59ee21dc3097dcb67922a5c0230edca628b7d5 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/EventSaverFlatNtuple.cxx +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/EventSaverFlatNtuple.cxx @@ -1250,6 +1250,8 @@ namespace top { m_upgradeTreeManager->makeOutputVariable(m_mu_true_type, "mu_true_type"); m_upgradeTreeManager->makeOutputVariable(m_mu_true_origin, "mu_true_origin"); m_upgradeTreeManager->makeOutputVariable(m_mu_true_isPrompt, "mu_true_isPrompt"); + m_upgradeTreeManager->makeOutputVariable(m_mu_prodVtx_z, "mu_prodVtx_z"); + m_upgradeTreeManager->makeOutputVariable(m_mu_prodVtx_perp, "mu_prodVtx_perp"); // jets m_upgradeTreeManager->makeOutputVariable(m_jet_pt, "jet_pt"); @@ -3341,6 +3343,8 @@ namespace top { m_mu_true_type.resize(upgradeEvent.m_muons->size()); m_mu_true_origin.resize(upgradeEvent.m_muons->size()); m_mu_true_isPrompt.resize(upgradeEvent.m_muons->size()); + m_mu_prodVtx_z.resize(upgradeEvent.m_muons->size()); + m_mu_prodVtx_perp.resize(upgradeEvent.m_muons->size()); for (const auto muPtr : * upgradeEvent.m_muons) { m_mu_pt[i] = muPtr->pt(); @@ -3352,6 +3356,8 @@ namespace top { m_mu_true_type[i] = 0; m_mu_true_origin[i] = 0; m_mu_true_isPrompt[i] = 0; + m_mu_prodVtx_z[i] = 0; + m_mu_prodVtx_perp[i] = 0; if (muPtr->isAvailable<unsigned int>("particleType")) { m_mu_true_type[i] = muPtr->auxdata<unsigned int>("particleType"); } else if (muPtr->isAvailable<unsigned int>("classifierParticleType")) { @@ -3367,6 +3373,12 @@ namespace top { top::check(false, "Could not obtain truth Origin decoration for muon!"); } m_mu_true_isPrompt[i] = isPromptMuon(m_mu_true_type[i], m_mu_true_origin[i]); + if (muPtr->isAvailable<float>("prodVtx_z")) { + m_mu_prodVtx_z[i] = muPtr->auxdata<float>("prodVtx_z"); + } + if (muPtr->isAvailable<float>("prodVtx_perp")) { + m_mu_prodVtx_perp[i] = muPtr->auxdata<float>("prodVtx_perp"); + } ++i; } diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/EventSaverFlatNtuple.h b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/EventSaverFlatNtuple.h index 344ba0b94e58063ba02e370a62443a38e6834f4b..00f439ad90174dc7a55117804a0187afff15bb12 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/EventSaverFlatNtuple.h +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/EventSaverFlatNtuple.h @@ -492,6 +492,8 @@ private: std::vector<int> m_mu_true_type; std::vector<int> m_mu_true_origin; std::vector<char> m_mu_true_isPrompt; + std::vector<float> m_mu_prodVtx_z; + std::vector<float> m_mu_prodVtx_perp; //photons std::vector<float> m_ph_pt; std::vector<float> m_ph_eta; diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopHLUpgrade/Root/UpgradeObjectLoader.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopHLUpgrade/Root/UpgradeObjectLoader.cxx index dead8c43f1832dfe4db19d53eee3f2424d9b6b0f..28ccf1cfdb4f2924c6315bb300c82121f6488d62 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopHLUpgrade/Root/UpgradeObjectLoader.cxx +++ b/PhysicsAnalysis/TopPhys/xAOD/TopHLUpgrade/Root/UpgradeObjectLoader.cxx @@ -10,6 +10,7 @@ #include "TopHLUpgrade/UpgradePhotonObjectSelector.h" #include "TopParticleLevel/ParticleLevelPhotonObjectSelector.h" +#include "xAODTruth/TruthVertexContainer.h" #include "xAODTruth/TruthParticleContainer.h" #include "xAODTruth/TruthParticleAuxContainer.h" #include "xAODMissingET/MissingETContainer.h" @@ -152,6 +153,14 @@ ParticleLevelEvent UpgradeObjectLoader::load() { // apply all cuts if( m_objectSelector_Muon->apply( *muon ) ) m_selectedMuons->push_back( muon ); + //add production vertex info + const ElementLink<xAOD::TruthVertexContainer> prodVtxLink = + muon->auxdata<ElementLink< xAOD::TruthVertexContainer > >("prodVtxLinkx"); + if(prodVtxLink.isValid()) { + const xAOD::TruthVertex *tvtx = *prodVtxLink; + muon->auxdata<float>("prodVtx_z") = tvtx->z(); + muon->auxdata<float>("prodVtx_perp") = tvtx->perp(); + } } // sort the muons by pT