Commit 92eeacbe authored by Xiaozhong Huang's avatar Xiaozhong Huang Committed by Adam Edward Barton
Browse files

TrigTauRec: remove TauEventData (ATLASRECTS-3078)

parent 179b08eb
...@@ -32,7 +32,6 @@ AthAlgorithm(name, pSvcLocator), ...@@ -32,7 +32,6 @@ AthAlgorithm(name, pSvcLocator),
m_tools(this), //make tools private m_tools(this), //make tools private
m_maxEta(2.5), m_maxEta(2.5),
m_minPt(10000), m_minPt(10000),
m_data(),
m_cellMakerTool("",this) m_cellMakerTool("",this)
{ {
declareProperty("Tools", m_tools); declareProperty("Tools", m_tools);
...@@ -86,7 +85,6 @@ StatusCode TauProcessorAlg::initialize() { ...@@ -86,7 +85,6 @@ StatusCode TauProcessorAlg::initialize() {
for (; itT != itTE; ++itT) { for (; itT != itTE; ++itT) {
++tool_count; ++tool_count;
ATH_MSG_INFO((*itT)->type() << " - " << (*itT)->name()); ATH_MSG_INFO((*itT)->type() << " - " << (*itT)->name());
(*itT)->setTauEventData(&m_data);
} }
ATH_MSG_INFO(" "); ATH_MSG_INFO(" ");
ATH_MSG_INFO("------------------------------------"); ATH_MSG_INFO("------------------------------------");
...@@ -226,8 +224,14 @@ StatusCode TauProcessorAlg::execute() { ...@@ -226,8 +224,14 @@ StatusCode TauProcessorAlg::execute() {
ToolHandleArray<ITauToolBase> ::iterator itTE = m_tools.end(); ToolHandleArray<ITauToolBase> ::iterator itTE = m_tools.end();
for (; itT != itTE; ++itT) { for (; itT != itTE; ++itT) {
ATH_MSG_DEBUG("ProcessorAlg Invoking tool " << (*itT)->name()); ATH_MSG_DEBUG("ProcessorAlg Invoking tool " << (*itT)->name());
if ( (*itT)->name().find("ShotFinder") != std::string::npos){ if ((*itT)->type() == "TauVertexFinder" ) {
sc = (*itT)->executeVertexFinder(*pTau);
}
else if ( (*itT)->type() == "TauTrackFinder") {
sc = (*itT)->executeTrackFinder(*pTau);
}
else if ( (*itT)->name().find("ShotFinder") != std::string::npos){
sc = (*itT)->executeShotFinder(*pTau, *tauShotClusContainer, *tauShotPFOContainer); sc = (*itT)->executeShotFinder(*pTau, *tauShotClusContainer, *tauShotPFOContainer);
} }
else if ( (*itT)->name().find("Pi0ClusterFinder") != std::string::npos){ else if ( (*itT)->name().find("Pi0ClusterFinder") != std::string::npos){
......
...@@ -28,8 +28,7 @@ ...@@ -28,8 +28,7 @@
TauRunnerAlg::TauRunnerAlg(const std::string &name, TauRunnerAlg::TauRunnerAlg(const std::string &name,
ISvcLocator * pSvcLocator) : ISvcLocator * pSvcLocator) :
AthAlgorithm(name, pSvcLocator), AthAlgorithm(name, pSvcLocator),
m_tools(this), //make tools private m_tools(this) //make tools private
m_data()
{ {
declareProperty("Tools", m_tools); declareProperty("Tools", m_tools);
} }
...@@ -78,7 +77,6 @@ StatusCode TauRunnerAlg::initialize() { ...@@ -78,7 +77,6 @@ StatusCode TauRunnerAlg::initialize() {
for (; itT != itTE; ++itT) { for (; itT != itTE; ++itT) {
++tool_count; ++tool_count;
ATH_MSG_INFO((*itT)->type() << " - " << (*itT)->name()); ATH_MSG_INFO((*itT)->type() << " - " << (*itT)->name());
(*itT)->setTauEventData(&m_data);
} }
ATH_MSG_INFO(" "); ATH_MSG_INFO(" ");
ATH_MSG_INFO("------------------------------------"); ATH_MSG_INFO("------------------------------------");
......
...@@ -9,8 +9,6 @@ ...@@ -9,8 +9,6 @@
#include "AthenaBaseComps/AthAlgorithm.h" #include "AthenaBaseComps/AthAlgorithm.h"
#include "tauRecTools/ITauToolBase.h" #include "tauRecTools/ITauToolBase.h"
#include "tauRecTools/TauEventData.h"
#include "InDetReadoutGeometry/SiDetectorElementCollection.h" #include "InDetReadoutGeometry/SiDetectorElementCollection.h"
#include "StoreGate/ReadCondHandleKey.h" #include "StoreGate/ReadCondHandleKey.h"
#include "StoreGate/ReadHandle.h" #include "StoreGate/ReadHandle.h"
...@@ -56,8 +54,7 @@ class TauProcessorAlg: public AthAlgorithm ...@@ -56,8 +54,7 @@ class TauProcessorAlg: public AthAlgorithm
double m_maxEta; //!< only build taus with eta_seed < m_maxeta double m_maxEta; //!< only build taus with eta_seed < m_maxeta
double m_minPt; //!< only build taus with pt_seed > m_minpt double m_minPt; //!< only build taus with pt_seed > m_minpt
TauEventData m_data; const CaloCell_ID* m_cellID;
const CaloCell_ID* m_cellID;
/** @brief tool handles */ /** @brief tool handles */
ToolHandle<ICaloCellMakerTool> m_cellMakerTool; ToolHandle<ICaloCellMakerTool> m_cellMakerTool;
......
...@@ -9,8 +9,6 @@ ...@@ -9,8 +9,6 @@
#include "AthenaBaseComps/AthAlgorithm.h" #include "AthenaBaseComps/AthAlgorithm.h"
#include "tauRecTools/ITauToolBase.h" #include "tauRecTools/ITauToolBase.h"
#include "tauRecTools/TauEventData.h"
#include "StoreGate/ReadHandle.h" #include "StoreGate/ReadHandle.h"
#include "StoreGate/WriteHandle.h" #include "StoreGate/WriteHandle.h"
...@@ -54,8 +52,6 @@ class TauRunnerAlg: public AthAlgorithm ...@@ -54,8 +52,6 @@ class TauRunnerAlg: public AthAlgorithm
ToolHandleArray<ITauToolBase> m_tools{this, "TauRunnerTools", {}, "Tools building taus"}; ToolHandleArray<ITauToolBase> m_tools{this, "TauRunnerTools", {}, "Tools building taus"};
TauEventData m_data;
SG::ReadHandleKey<xAOD::TauJetContainer> m_tauInputContainer{this,"Key_tauInputContainer","tmp_TauJets","input temp tau key"}; SG::ReadHandleKey<xAOD::TauJetContainer> m_tauInputContainer{this,"Key_tauInputContainer","tmp_TauJets","input temp tau key"};
SG::ReadHandleKey<xAOD::CaloClusterContainer> m_pi0ClusterInputContainer{this,"Key_Pi0ClusterInputContainer", "TauPi0SubtractedClusters", "input pi0 cluster"}; SG::ReadHandleKey<xAOD::CaloClusterContainer> m_pi0ClusterInputContainer{this,"Key_Pi0ClusterInputContainer", "TauPi0SubtractedClusters", "input pi0 cluster"};
......
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
// 16/05/2011: (FF) fix if primaryVertexContainer==NULL (coverity 21734) // 16/05/2011: (FF) fix if primaryVertexContainer==NULL (coverity 21734)
// Dez 2011: (FF) switch to full LC calibrated tau 4-vector for some variables // Dez 2011: (FF) switch to full LC calibrated tau 4-vector for some variables
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#include "tauRecTools/TauEventData.h"
#include "tauRecTools/TauCommonCalcVars.h" #include "tauRecTools/TauCommonCalcVars.h"
#include "tauRecTools/KineUtils.h" #include "tauRecTools/KineUtils.h"
#include <vector> #include <vector>
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#include "FourMomUtils/P4Helpers.h" #include "FourMomUtils/P4Helpers.h"
#include "tauRecTools/TauEventData.h"
#include "tauRecTools/TauGenericPi0Cone.h" #include "tauRecTools/TauGenericPi0Cone.h"
#include "tauRecTools/TauTrackFilterUtils.h" #include "tauRecTools/TauTrackFilterUtils.h"
......
...@@ -9,8 +9,6 @@ ...@@ -9,8 +9,6 @@
#include "TEnv.h" #include "TEnv.h"
#include "THashList.h" #include "THashList.h"
TauEventData defaultTauEventData;
//________________________________________ //________________________________________
std::string TauRecToolBase::find_file(const std::string& fname) const { std::string TauRecToolBase::find_file(const std::string& fname) const {
std::string full_path; std::string full_path;
...@@ -120,15 +118,6 @@ StatusCode TauRecToolBase::readConfig() { ...@@ -120,15 +118,6 @@ StatusCode TauRecToolBase::readConfig() {
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
//________________________________________
void TauRecToolBase::setTauEventData(TauEventData* data){
m_data=data;
if(m_data==0) {
m_data=&defaultTauEventData;
m_data->clear();
}
}
//________________________________________ //________________________________________
TauRecToolBase::TauRecToolBase(const std::string& name) : TauRecToolBase::TauRecToolBase(const std::string& name) :
asg::AsgTool(name) { asg::AsgTool(name) {
...@@ -154,6 +143,16 @@ StatusCode TauRecToolBase::execute(xAOD::TauJet&){ ...@@ -154,6 +143,16 @@ StatusCode TauRecToolBase::execute(xAOD::TauJet&){
return StatusCode::FAILURE; return StatusCode::FAILURE;
} }
StatusCode TauRecToolBase::executeVertexFinder(xAOD::TauJet&, const xAOD::VertexContainer*, const xAOD::TrackParticleContainer*) {
ATH_MSG_ERROR("function not implemented");
return StatusCode::FAILURE;
}
StatusCode TauRecToolBase::executeTrackFinder(xAOD::TauJet&, const xAOD::TrackParticleContainer*) {
ATH_MSG_ERROR("function not implemented");
return StatusCode::FAILURE;
}
StatusCode TauRecToolBase::executeShotFinder(xAOD::TauJet& /*pTau*/, xAOD::CaloClusterContainer& /*shotClusterContainer*/, xAOD::PFOContainer& /*PFOContainer*/ ) { StatusCode TauRecToolBase::executeShotFinder(xAOD::TauJet& /*pTau*/, xAOD::CaloClusterContainer& /*shotClusterContainer*/, xAOD::PFOContainer& /*PFOContainer*/ ) {
ATH_MSG_ERROR("function not implemented"); ATH_MSG_ERROR("function not implemented");
return StatusCode::FAILURE; return StatusCode::FAILURE;
......
...@@ -81,8 +81,6 @@ StatusCode TauSubstructureVariables::execute(xAOD::TauJet& pTau) { ...@@ -81,8 +81,6 @@ StatusCode TauSubstructureVariables::execute(xAOD::TauJet& pTau) {
//---------------------------------------- //----------------------------------------
// Getting the jet seed // Getting the jet seed
// By asking taujet instead of TauEventData->seed, we take advantage of the machinery already
// in place to retrieve a jet seed for track only candidates.
//------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------
const xAOD::Jet* taujetseed = (*pTau.jetLink()); const xAOD::Jet* taujetseed = (*pTau.jetLink());
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include "FourMomUtils/P4Helpers.h" #include "FourMomUtils/P4Helpers.h"
#include "tauRecTools/TauEventData.h"
#include "tauRecTools/TauTrackFilter.h" #include "tauRecTools/TauTrackFilter.h"
#include "tauRecTools/TauTrackFilterUtils.h" #include "tauRecTools/TauTrackFilterUtils.h"
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include "TFile.h" #include "TFile.h"
#include "TH2.h" #include "TH2.h"
#include "TString.h" #include "TString.h"
#include "tauRecTools/TauEventData.h"
#include "tauRecTools/TauWPDecorator.h" #include "tauRecTools/TauWPDecorator.h"
#include "xAODEventInfo/EventInfo.h" #include "xAODEventInfo/EventInfo.h"
......
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
*/ */
#ifndef XAOD_ANALYSIS #ifndef XAOD_ANALYSIS
#include "tauRecTools/TauEventData.h"
#include "xAODTau/TauJetContainer.h" #include "xAODTau/TauJetContainer.h"
#include "xAODTau/TauJetAuxContainer.h" #include "xAODTau/TauJetAuxContainer.h"
#include "xAODTau/TauJet.h" #include "xAODTau/TauJet.h"
......
...@@ -57,8 +57,10 @@ StatusCode TauTrackFinder::initialize() { ...@@ -57,8 +57,10 @@ StatusCode TauTrackFinder::initialize() {
ATH_CHECK( m_caloExtensionTool.retrieve() ); ATH_CHECK( m_caloExtensionTool.retrieve() );
// initialize ReadHandleKey // initialize ReadHandleKey
ATH_CHECK( m_trackPartInputContainer.initialize(!m_trackPartInputContainer.key().empty()) ); // allow empty for trigger
ATH_CHECK( m_ParticleCacheKey.initialize(!m_ParticleCacheKey.key().empty()) ); ATH_CHECK( m_trackPartInputContainer.initialize(SG::AllowEmpty) );
// use CaloExtensionTool when key is empty
ATH_CHECK( m_ParticleCacheKey.initialize(SG::AllowEmpty) );
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
...@@ -69,7 +71,7 @@ StatusCode TauTrackFinder::finalize() { ...@@ -69,7 +71,7 @@ StatusCode TauTrackFinder::finalize() {
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
StatusCode TauTrackFinder::execute(xAOD::TauJet& pTau) { StatusCode TauTrackFinder::executeTrackFinder(xAOD::TauJet& pTau, const xAOD::TrackParticleContainer* trackContainer) {
ElementLink< xAOD::TauTrackContainer > link = pTau.allTauTrackLinksNonConst().at(0);//we don't care about this specific link, just the container ElementLink< xAOD::TauTrackContainer > link = pTau.allTauTrackLinksNonConst().at(0);//we don't care about this specific link, just the container
xAOD::TauTrackContainer* tauTrackCon = link.getDataNonConstPtr(); xAOD::TauTrackContainer* tauTrackCon = link.getDataNonConstPtr();
...@@ -83,13 +85,9 @@ StatusCode TauTrackFinder::execute(xAOD::TauJet& pTau) { ...@@ -83,13 +85,9 @@ StatusCode TauTrackFinder::execute(xAOD::TauJet& pTau) {
std::vector<const xAOD::TrackParticle*> wideTracks; std::vector<const xAOD::TrackParticle*> wideTracks;
std::vector<const xAOD::TrackParticle*> otherTracks; std::vector<const xAOD::TrackParticle*> otherTracks;
const xAOD::TrackParticleContainer* trackParticleCont = 0; const xAOD::TrackParticleContainer* trackParticleCont = nullptr;
if (m_trackPartInputContainer.key().empty()) { if (! m_trackPartInputContainer.empty()) { // MT version of trigger or offline
ATH_CHECK(tauEventData()->getObject( "TrackContainer", trackParticleCont ));
}
else {
// Get the track particle container from StoreGate
SG::ReadHandle<xAOD::TrackParticleContainer> trackPartInHandle( m_trackPartInputContainer ); SG::ReadHandle<xAOD::TrackParticleContainer> trackPartInHandle( m_trackPartInputContainer );
if (!trackPartInHandle.isValid()) { if (!trackPartInHandle.isValid()) {
ATH_MSG_ERROR ("Could not retrieve HiveDataObj with key " << trackPartInHandle.key()); ATH_MSG_ERROR ("Could not retrieve HiveDataObj with key " << trackPartInHandle.key());
...@@ -97,6 +95,15 @@ StatusCode TauTrackFinder::execute(xAOD::TauJet& pTau) { ...@@ -97,6 +95,15 @@ StatusCode TauTrackFinder::execute(xAOD::TauJet& pTau) {
} }
trackParticleCont = trackPartInHandle.cptr(); trackParticleCont = trackPartInHandle.cptr();
} }
else { // coule be possible in trigger
if (trackContainer != nullptr) {
trackParticleCont = trackContainer;
}
else {
ATH_MSG_WARNING("No track container found");
return StatusCode::FAILURE;
}
}
// get the primary vertex // get the primary vertex
const xAOD::Vertex* pVertex = pTau.vertexLink()!=0 ? (*pTau.vertexLink()) : NULL; const xAOD::Vertex* pVertex = pTau.vertexLink()!=0 ? (*pTau.vertexLink()) : NULL;
......
...@@ -62,7 +62,7 @@ public: ...@@ -62,7 +62,7 @@ public:
//! Algorithm functions //! Algorithm functions
//------------------------------------------------------------- //-------------------------------------------------------------
virtual StatusCode initialize() override; virtual StatusCode initialize() override;
virtual StatusCode execute(xAOD::TauJet& pTau) override; virtual StatusCode executeTrackFinder(xAOD::TauJet& pTau, const xAOD::TrackParticleContainer* trackContainer = nullptr) override;
virtual StatusCode finalize() override; virtual StatusCode finalize() override;
private: private:
......
...@@ -36,8 +36,9 @@ TauVertexFinder::~TauVertexFinder() { ...@@ -36,8 +36,9 @@ TauVertexFinder::~TauVertexFinder() {
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
StatusCode TauVertexFinder::initialize() { StatusCode TauVertexFinder::initialize() {
ATH_CHECK( m_vertexInputContainer.initialize() ); ATH_CHECK( m_vertexInputContainer.initialize(SG::AllowEmpty) );
ATH_CHECK( m_trackPartInputContainer.initialize() ); if (m_in_trigger)
ATH_CHECK( m_trackPartInputContainer.initialize(SG::AllowEmpty) );
ATH_CHECK( m_jetTrackVtxAssoc.initialize() ); ATH_CHECK( m_jetTrackVtxAssoc.initialize() );
if (m_useTJVA) ATH_MSG_INFO("using TJVA to determine tau vertex"); if (m_useTJVA) ATH_MSG_INFO("using TJVA to determine tau vertex");
...@@ -52,62 +53,62 @@ StatusCode TauVertexFinder::finalize() { ...@@ -52,62 +53,62 @@ StatusCode TauVertexFinder::finalize() {
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
StatusCode TauVertexFinder::execute(xAOD::TauJet& pTau) { StatusCode TauVertexFinder::executeVertexFinder(xAOD::TauJet& pTau,
const xAOD::VertexContainer* vertexContainer,
const xAOD::TrackParticleContainer* trackContainer) {
const xAOD::VertexContainer * vxContainer = 0; const xAOD::VertexContainer * vxContainer = 0;
const xAOD::Vertex* primaryVertex = 0;
if (!m_vertexInputContainer.empty()) {
// find default PrimaryVertex (needed if TJVA is switched off or fails)
// see: https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/VertexReselectionOnAOD
// code adapted from
// https://svnweb.cern.ch/trac/atlasoff/browser/Tracking/TrkEvent/VxVertex/trunk/VxVertex/PrimaryVertexSelector.h
if ( !m_in_trigger ){
// get the primary vertex container from StoreGate
// do it here because of tau trigger
SG::ReadHandle<xAOD::VertexContainer> vertexInHandle( m_vertexInputContainer ); SG::ReadHandle<xAOD::VertexContainer> vertexInHandle( m_vertexInputContainer );
if (!vertexInHandle.isValid()) { if (!vertexInHandle.isValid()) {
ATH_MSG_ERROR ("Could not retrieve HiveDataObj with key " << vertexInHandle.key()); ATH_MSG_ERROR ("Could not retrieve HiveDataObj with key " << vertexInHandle.key());
return StatusCode::FAILURE; return StatusCode::FAILURE;
} }
vxContainer = vertexInHandle.cptr(); vxContainer = vertexInHandle.cptr();
if (vxContainer->size()>0) {
// simple loop through and get the primary vertex
xAOD::VertexContainer::const_iterator vxIter = vxContainer->begin();
xAOD::VertexContainer::const_iterator vxIterEnd = vxContainer->end();
for ( size_t ivtx = 0; vxIter != vxIterEnd; ++vxIter, ++ivtx ){
// the first and only primary vertex candidate is picked
if ( (*vxIter)->vertexType() == xAOD::VxType::PriVtx){
primaryVertex = (*vxIter);
break;
}
}
}
} }
else { // trigger mode else {
// find default PrimaryVertex (highest sum pt^2) if (vertexContainer != nullptr) {
//for tau trigger vxContainer = vertexContainer;
StatusCode sc = tauEventData()->getObject("VxPrimaryCandidate", vxContainer); }
if ( sc.isFailure() ){ else {
ATH_MSG_WARNING("Could not retrieve VxPrimaryCandidate"); ATH_MSG_WARNING ("No Vertex Container in trigger");
return StatusCode::FAILURE; return StatusCode::FAILURE;
} }
if (vxContainer->size()>0) primaryVertex = (*vxContainer)[0];
} }
ATH_MSG_VERBOSE("size of VxPrimaryContainer is: " << vxContainer->size() ); ATH_MSG_VERBOSE("size of VxPrimaryContainer is: " << vxContainer->size() );
if ( 0 == vxContainer->size()) return StatusCode::SUCCESS;
// find default PrimaryVertex (needed if TJVA is switched off or fails)
// see: https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/VertexReselectionOnAOD
// code adapted from
// https://svnweb.cern.ch/trac/atlasoff/browser/Tracking/TrkEvent/VxVertex/trunk/VxVertex/PrimaryVertexSelector.h
const xAOD::Vertex* primaryVertex = 0;
if ( m_in_trigger) { // trigger: find default PrimaryVertex (highest sum pt^2)
primaryVertex = (*vxContainer)[0];
}
else { // offline: the first and only primary vertex candidate is picked
for (const auto vertex : *vxContainer) {
if (vertex->vertexType() == xAOD::VxType::PriVtx) {
primaryVertex = vertex;
break;
}
}
}
// associate vertex to tau // associate vertex to tau
if (primaryVertex) pTau.setVertex(vxContainer, primaryVertex); if (primaryVertex) pTau.setVertex(vxContainer, primaryVertex);
//stop here if TJVA is disabled or vertex container is empty //stop here if TJVA is disabled
if (!m_useTJVA || vxContainer->size()==0) return StatusCode::SUCCESS; if (!m_useTJVA) return StatusCode::SUCCESS;
// try to find new PV with TJVA // try to find new PV with TJVA
ATH_MSG_DEBUG("TJVA enabled -> try to find new PV for the tau candidate"); ATH_MSG_DEBUG("TJVA enabled -> try to find new PV for the tau candidate");
float maxJVF = -100; float maxJVF = -100;
ElementLink<xAOD::VertexContainer> newPrimaryVertexLink = ElementLink<xAOD::VertexContainer> newPrimaryVertexLink =
getPV_TJVA(pTau, *vxContainer, maxJVF ); getPV_TJVA(pTau, *vxContainer, trackContainer, maxJVF );
if (newPrimaryVertexLink.isValid()) { if (newPrimaryVertexLink.isValid()) {
// set new primary vertex // set new primary vertex
// will overwrite default one which was set above // will overwrite default one which was set above
...@@ -127,6 +128,7 @@ StatusCode TauVertexFinder::execute(xAOD::TauJet& pTau) { ...@@ -127,6 +128,7 @@ StatusCode TauVertexFinder::execute(xAOD::TauJet& pTau) {
ElementLink<xAOD::VertexContainer> ElementLink<xAOD::VertexContainer>
TauVertexFinder::getPV_TJVA(const xAOD::TauJet& pTau, TauVertexFinder::getPV_TJVA(const xAOD::TauJet& pTau,
const xAOD::VertexContainer& vertices, const xAOD::VertexContainer& vertices,
const xAOD::TrackParticleContainer * trackContainer,
float& maxJVF) float& maxJVF)
{ {
const xAOD::Jet* pJetSeed = (*pTau.jetLink()); const xAOD::Jet* pJetSeed = (*pTau.jetLink());
...@@ -139,11 +141,23 @@ TauVertexFinder::getPV_TJVA(const xAOD::TauJet& pTau, ...@@ -139,11 +141,23 @@ TauVertexFinder::getPV_TJVA(const xAOD::TauJet& pTau,
const xAOD::TrackParticleContainer* trackParticleCont = 0; const xAOD::TrackParticleContainer* trackParticleCont = 0;
std::vector<const xAOD::TrackParticle*> assocTracks; std::vector<const xAOD::TrackParticle*> assocTracks;
if (m_in_trigger) { if (m_in_trigger) {
StatusCode sc = tauEventData()->getObject( "TrackContainer", trackParticleCont ); // to be replaced by full FTK collection? if (!m_trackPartInputContainer.empty()) {
if (sc.isFailure() || !trackParticleCont){ SG::ReadHandle<xAOD::TrackParticleContainer> trackPartInHandle( m_trackPartInputContainer );
ATH_MSG_WARNING("No TrackContainer for TJVA in trigger found"); if (!trackPartInHandle.isValid()) {
return ElementLink<xAOD::VertexContainer>(); ATH_MSG_WARNING("No TrackContainer for TJVA in trigger found");
return ElementLink<xAOD::VertexContainer>();
}
trackParticleCont = trackPartInHandle.cptr();
}
else {
if (trackContainer != nullptr) {
trackParticleCont = trackContainer;
}
else {
ATH_MSG_WARNING("No TrackContainer for TJVA in trigger found");
return ElementLink<xAOD::VertexContainer>();
}
} }
// convert TrackParticleContainer in std::vector<const xAOD::TrackParticle*> // convert TrackParticleContainer in std::vector<const xAOD::TrackParticle*>
for (xAOD::TrackParticleContainer::const_iterator tpcItr = trackParticleCont->begin(); tpcItr != trackParticleCont->end(); ++tpcItr) { for (xAOD::TrackParticleContainer::const_iterator tpcItr = trackParticleCont->begin(); tpcItr != trackParticleCont->end(); ++tpcItr) {
...@@ -167,7 +181,6 @@ TauVertexFinder::getPV_TJVA(const xAOD::TauJet& pTau, ...@@ -167,7 +181,6 @@ TauVertexFinder::getPV_TJVA(const xAOD::TauJet& pTau,
tracksForTJVA.push_back(xTrack); tracksForTJVA.push_back(xTrack);
} }
// Get the TVA object // Get the TVA object
const jet::TrackVertexAssociation* tva = NULL; const jet::TrackVertexAssociation* tva = NULL;
...@@ -233,7 +246,6 @@ TauVertexFinder::getPV_TJVA(const xAOD::TauJet& pTau, ...@@ -233,7 +246,6 @@ TauVertexFinder::getPV_TJVA(const xAOD::TauJet& pTau,
tva = tvaInHandle.cptr(); tva = tvaInHandle.cptr();
} }
// Get the highest JVF vertex and store maxJVF for later use // Get the highest JVF vertex and store maxJVF for later use
// Note: the official JetMomentTools/JetVertexFractionTool doesn't provide any possibility to access the JVF value, but just the vertex. // Note: the official JetMomentTools/JetVertexFractionTool doesn't provide any possibility to access the JVF value, but just the vertex.
maxJVF=-100.; maxJVF=-100.;
......
...@@ -40,13 +40,16 @@ public: ...@@ -40,13 +40,16 @@ public:
//! Algorithm functions //! Algorithm functions
//------------------------------------------------------------- //-------------------------------------------------------------
virtual StatusCode initialize() override; virtual StatusCode initialize() override;
virtual StatusCode execute(xAOD::TauJet& pTau) override; virtual StatusCode executeVertexFinder(xAOD::TauJet& pTau,
const xAOD::VertexContainer* vertexContainer = nullptr,
const xAOD::TrackParticleContainer* trackContainer = nullptr) override;
virtual StatusCode finalize() override; virtual StatusCode finalize() override;
private: private:
ElementLink<xAOD::VertexContainer> ElementLink<xAOD::VertexContainer>
getPV_TJVA(const xAOD::TauJet& tauJet, getPV_TJVA(const xAOD::TauJet& tauJet,
const xAOD::VertexContainer& vertices, const xAOD::VertexContainer& vertices,
const xAOD::TrackParticleContainer* trackContainer,
float& maxJVF); float& maxJVF);