Commit 24d104ca authored by Marcin Piotr Wandas's avatar Marcin Piotr Wandas Committed by Walter Lampl
Browse files

Make algorithm TrigTauRecMergedMT reentrant

parent 0eef7071
......@@ -47,8 +47,6 @@ class TauProcessorAlg: public AthAlgorithm
private:
void setEmptyTauTrack(xAOD::TauJet* &tauJet, xAOD::TauTrackContainer* tauTrackCont);
Gaudi::Property<double> m_maxEta {this, "MaxEta", 2.5, "maximum eta for jet seed"};
Gaudi::Property<double> m_minPt {this, "MinPt", 10 * Gaudi::Units::GeV, "minimum pT for jet seed"};
......
......@@ -149,12 +149,12 @@ StatusCode TauRecToolBase::execute(xAOD::TauJet&) const {
return StatusCode::FAILURE;
}
StatusCode TauRecToolBase::executeVertexFinder(xAOD::TauJet&, const xAOD::VertexContainer*, const xAOD::TrackParticleContainer*) {
StatusCode TauRecToolBase::executeVertexFinder(xAOD::TauJet&, const xAOD::VertexContainer*, const xAOD::TrackParticleContainer*) const {
ATH_MSG_ERROR("function not implemented");
return StatusCode::FAILURE;
}
StatusCode TauRecToolBase::executeTrackFinder(xAOD::TauJet&, xAOD::TauTrackContainer&, const xAOD::TrackParticleContainer*) {
StatusCode TauRecToolBase::executeTrackFinder(xAOD::TauJet&, xAOD::TauTrackContainer&, const xAOD::TrackParticleContainer*) const {
ATH_MSG_ERROR("function not implemented");
return StatusCode::FAILURE;
}
......@@ -189,7 +189,7 @@ StatusCode TauRecToolBase::executePi0ClusterCreator(xAOD::TauJet& /*pTau*/, xAOD
return StatusCode::FAILURE;
}
StatusCode TauRecToolBase::executeVertexVariables(xAOD::TauJet& /*pTau*/, xAOD::VertexContainer& /*vertexContainer*/ ) {
StatusCode TauRecToolBase::executeVertexVariables(xAOD::TauJet& /*pTau*/, xAOD::VertexContainer& /*vertexContainer*/ ) const {
ATH_MSG_ERROR("function not implemented");
return StatusCode::FAILURE;
}
......@@ -210,7 +210,7 @@ StatusCode TauRecToolBase::executePanTau(xAOD::TauJet& /*pTau*/, xAOD::ParticleC
}
//________________________________________
StatusCode TauRecToolBase::eventFinalize(){
StatusCode TauRecToolBase::eventFinalize() const {
return StatusCode::SUCCESS;
}
......
......@@ -47,7 +47,7 @@ StatusCode TauTrackFinder::finalize() {
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
StatusCode TauTrackFinder::executeTrackFinder(xAOD::TauJet& pTau, xAOD::TauTrackContainer& tauTrackCon, const xAOD::TrackParticleContainer* trackContainer) {
StatusCode TauTrackFinder::executeTrackFinder(xAOD::TauJet& pTau, xAOD::TauTrackContainer& tauTrackCon, const xAOD::TrackParticleContainer* trackContainer) const {
std::vector<const xAOD::TrackParticle*> tauTracks;
std::vector<const xAOD::TrackParticle*> wideTracks;
......@@ -222,7 +222,7 @@ StatusCode TauTrackFinder::executeTrackFinder(xAOD::TauJet& pTau, xAOD::TauTrack
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
TauTrackFinder::TauTrackType TauTrackFinder::tauTrackType( const xAOD::TauJet& pTau,
const xAOD::TrackParticle& trackParticle,
const xAOD::Vertex* primaryVertex)
const xAOD::Vertex* primaryVertex) const
{
double dR = Tau1P3PKineUtils::deltaR(pTau.eta(),pTau.phi(),trackParticle.eta(),trackParticle.phi());
......@@ -247,7 +247,7 @@ void TauTrackFinder::getTauTracksFromPV( const xAOD::TauJet& pTau,
const xAOD::Vertex* primaryVertex,
std::vector<const xAOD::TrackParticle*> &tauTracks,
std::vector<const xAOD::TrackParticle*> &wideTracks,
std::vector<const xAOD::TrackParticle*> &otherTracks)
std::vector<const xAOD::TrackParticle*> &otherTracks) const
{
for (xAOD::TrackParticleContainer::const_iterator tpcItr = trackParticleCont.begin(); tpcItr != trackParticleCont.end(); ++tpcItr) {
const xAOD::TrackParticle *trackParticle = *tpcItr;
......@@ -267,7 +267,7 @@ void TauTrackFinder::getTauTracksFromPV( const xAOD::TauJet& pTau,
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
StatusCode TauTrackFinder::extrapolateToCaloSurface(xAOD::TauJet& pTau) {
StatusCode TauTrackFinder::extrapolateToCaloSurface(xAOD::TauJet& pTau) const {
Trk::TrackParametersIdHelper parsIdHelper;
......@@ -381,7 +381,7 @@ void TauTrackFinder::removeOffsideTracksWrtLeadTrk(std::vector<const xAOD::Track
std::vector<const xAOD::TrackParticle*> &wideTracks,
std::vector<const xAOD::TrackParticle*> &otherTracks,
const xAOD::Vertex* tauOrigin,
double maxDeltaZ0)
double maxDeltaZ0) const
{
float MAX=1e5;
......@@ -435,7 +435,7 @@ void TauTrackFinder::removeOffsideTracksWrtLeadTrk(std::vector<const xAOD::Track
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
float TauTrackFinder::getZ0(const xAOD::TrackParticle* track, const xAOD::Vertex* vertex)
float TauTrackFinder::getZ0(const xAOD::TrackParticle* track, const xAOD::Vertex* vertex) const
{
float MAX=1e5;
......
......@@ -58,37 +58,37 @@ public:
//! Algorithm functions
//-------------------------------------------------------------
virtual StatusCode initialize() override;
virtual StatusCode executeTrackFinder(xAOD::TauJet& pTau, xAOD::TauTrackContainer& tauTrackCon, const xAOD::TrackParticleContainer* trackContainer = nullptr) override;
virtual StatusCode executeTrackFinder(xAOD::TauJet& pTau, xAOD::TauTrackContainer& tauTrackCon, const xAOD::TrackParticleContainer* trackContainer = nullptr) const override;
virtual StatusCode finalize() override;
private:
//-------------------------------------------------------------
//! Extrapolate track eta and phi to the calorimeter middle surface
//-------------------------------------------------------------
StatusCode extrapolateToCaloSurface(xAOD::TauJet& pTau);
StatusCode extrapolateToCaloSurface(xAOD::TauJet& pTau) const;
TauTrackType tauTrackType( const xAOD::TauJet& tauJet,
const xAOD::TrackParticle& trackParticle,
const xAOD::Vertex* primaryVertex);
const xAOD::Vertex* primaryVertex) const;
void getTauTracksFromPV( const xAOD::TauJet& tauJet,
const xAOD::TrackParticleContainer& trackParticleCont,
const xAOD::Vertex* primaryVertex,
std::vector<const xAOD::TrackParticle*> &tauTracks,
std::vector<const xAOD::TrackParticle*> &wideTracks,
std::vector<const xAOD::TrackParticle*> &otherTracks);
std::vector<const xAOD::TrackParticle*> &otherTracks) const;
// new xAOD version
void removeOffsideTracksWrtLeadTrk(std::vector<const xAOD::TrackParticle*> &tauTracks,
std::vector<const xAOD::TrackParticle*> &wideTracks,
std::vector<const xAOD::TrackParticle*> &otherTracks,
const xAOD::Vertex* tauOrigin,
double maxDeltaZ0);
double maxDeltaZ0) const;
//-------------------------------------------------------------
//! Some internally used functions
//-------------------------------------------------------------
float getZ0(const xAOD::TrackParticle* track, const xAOD::Vertex* vertex); //xAOD version
float getZ0(const xAOD::TrackParticle* track, const xAOD::Vertex* vertex) const; //xAOD version
//-------------------------------------------------------------
//! tools
......
......@@ -42,14 +42,7 @@ public:
StatusCode initialize() override;
StatusCode executeVertexFinder(xAOD::TauJet& pTau,
const xAOD::VertexContainer* vertexContainer = nullptr,
const xAOD::TrackParticleContainer* trackContainer = nullptr) override
{
return static_cast<const TauVertexFinder*>(this)->executeVertexFinder(pTau, vertexContainer, trackContainer);
}
StatusCode executeVertexFinder(xAOD::TauJet& pTau,
const xAOD::VertexContainer* vertexContainer = nullptr,
const xAOD::TrackParticleContainer* trackContainer = nullptr) const;
const xAOD::TrackParticleContainer* trackContainer = nullptr) const override;
StatusCode finalize() override;
......
......@@ -55,7 +55,7 @@ StatusCode TauVertexVariables::finalize() {
//-----------------------------------------------------------------------------
// Execution
//-----------------------------------------------------------------------------
StatusCode TauVertexVariables::executeVertexVariables(xAOD::TauJet& pTau, xAOD::VertexContainer& pSecVtxContainer) {
StatusCode TauVertexVariables::executeVertexVariables(xAOD::TauJet& pTau, xAOD::VertexContainer& pSecVtxContainer) const {
ATH_MSG_DEBUG("execut()");
// impact parameter variables for standard tracks
......@@ -169,7 +169,7 @@ StatusCode TauVertexVariables::executeVertexVariables(xAOD::TauJet& pTau, xAOD::
//-------------------------------------------------------------------------
// calculate the transverse flight path significance
//-------------------------------------------------------------------------
double TauVertexVariables::trFlightPathSig(const xAOD::TauJet& pTau, const xAOD::Vertex& secVertex) {
double TauVertexVariables::trFlightPathSig(const xAOD::TauJet& pTau, const xAOD::Vertex& secVertex) const {
const xAOD::Vertex* pVertex = 0;
if (pTau.vertexLink()) pVertex = *pTau.vertexLink();
......
......@@ -33,13 +33,13 @@ public:
~TauVertexVariables();
virtual StatusCode initialize() override;
virtual StatusCode executeVertexVariables(xAOD::TauJet& pTau, xAOD::VertexContainer& pVertexContainer) override;
virtual StatusCode executeVertexVariables(xAOD::TauJet& pTau, xAOD::VertexContainer& pVertexContainer) const override;
virtual StatusCode finalize() override;
//-------------------------------------------------------------
//! determines the transverse flight path significance from
//! the primary vertex and the secondary vertex of tau candidate
//-------------------------------------------------------------
double trFlightPathSig(const xAOD::TauJet& pTau, const xAOD::Vertex& secVertex);
double trFlightPathSig(const xAOD::TauJet& pTau, const xAOD::Vertex& secVertex) const;
private:
ToolHandle<Trk::ITrackToVertexIPEstimator> m_trackToVertexIPEstimator {this, "TrackToVertexIPEstimator", ""};
......
......@@ -50,8 +50,8 @@ class ITauToolBase : virtual public asg::IAsgTool
virtual StatusCode execute(xAOD::TauJet& pTau) const = 0;
virtual StatusCode executeVertexFinder(xAOD::TauJet& pTau,
const xAOD::VertexContainer* vertexContainer = nullptr,
const xAOD::TrackParticleContainer* trackContainer = nullptr) = 0;
virtual StatusCode executeTrackFinder(xAOD::TauJet& pTau, xAOD::TauTrackContainer& tauTrackContainer, const xAOD::TrackParticleContainer* trackContainer = nullptr) = 0;
const xAOD::TrackParticleContainer* trackContainer = nullptr) const = 0;
virtual StatusCode executeTrackFinder(xAOD::TauJet& pTau, xAOD::TauTrackContainer& tauTrackContainer, const xAOD::TrackParticleContainer* trackContainer = nullptr) const = 0;
virtual StatusCode executeTrackClassifier(xAOD::TauJet& pTau, xAOD::TauTrackContainer& tauTrackContainer) const = 0;
virtual StatusCode executeRNNTrackClassifier(xAOD::TauJet& pTau, xAOD::TauTrackContainer& tauTrackContainer) = 0;
virtual StatusCode executeShotFinder(xAOD::TauJet& pTau, xAOD::CaloClusterContainer& shotClusterContainer, xAOD::PFOContainer& PFOContainer ) = 0;
......@@ -62,7 +62,7 @@ class ITauToolBase : virtual public asg::IAsgTool
xAOD::PFOContainer& hadronicPFOContainer,
xAOD::CaloClusterContainer& caloClusterContainer,
const xAOD::CaloClusterContainer& pCaloClusterContainer ) = 0;
virtual StatusCode executeVertexVariables(xAOD::TauJet& pTau, xAOD::VertexContainer& vertexContainer ) = 0;
virtual StatusCode executeVertexVariables(xAOD::TauJet& pTau, xAOD::VertexContainer& vertexContainer ) const = 0;
virtual StatusCode executePi0ClusterScaler(xAOD::TauJet& pTau, xAOD::PFOContainer& neutralPFOContainer, xAOD::PFOContainer& chargedPFOContainer ) = 0;
virtual StatusCode executePi0nPFO(xAOD::TauJet& pTau, xAOD::PFOContainer& neutralPFOContainer) = 0;
virtual StatusCode executePanTau(xAOD::TauJet& pTau, xAOD::ParticleContainer& particleContainer) =0;
......@@ -70,7 +70,7 @@ class ITauToolBase : virtual public asg::IAsgTool
//-----------------------------------------------------------------
//! Event finalizer - called at the end of each event
//-----------------------------------------------------------------
virtual StatusCode eventFinalize() = 0;
virtual StatusCode eventFinalize() const = 0;
//-----------------------------------------------------------------
//! Finalizer
......
......@@ -42,8 +42,8 @@ class TauRecToolBase : public asg::AsgTool, virtual public ITauToolBase {
virtual StatusCode execute(xAOD::TauJet& pTau) const override;
virtual StatusCode executeVertexFinder(xAOD::TauJet& pTau,
const xAOD::VertexContainer* vertexContainer = nullptr,
const xAOD::TrackParticleContainer* trackContainer = nullptr) override;
virtual StatusCode executeTrackFinder(xAOD::TauJet& pTau, xAOD::TauTrackContainer& tauTrackContainer, const xAOD::TrackParticleContainer* trackContainer = nullptr) override;
const xAOD::TrackParticleContainer* trackContainer = nullptr) const override;
virtual StatusCode executeTrackFinder(xAOD::TauJet& pTau, xAOD::TauTrackContainer& tauTrackContainer, const xAOD::TrackParticleContainer* trackContainer = nullptr) const override;
virtual StatusCode executeTrackClassifier(xAOD::TauJet& pTau, xAOD::TauTrackContainer& tauTrackContainer) const override;
virtual StatusCode executeRNNTrackClassifier(xAOD::TauJet& pTau, xAOD::TauTrackContainer& tauTrackContainer) override;
virtual StatusCode executeShotFinder(xAOD::TauJet& pTau, xAOD::CaloClusterContainer& shotClusterContainer, xAOD::PFOContainer& PFOContainer ) override;
......@@ -54,7 +54,7 @@ class TauRecToolBase : public asg::AsgTool, virtual public ITauToolBase {
xAOD::PFOContainer& hadronicPFOContainer,
xAOD::CaloClusterContainer& caloClusterContainer,
const xAOD::CaloClusterContainer& pCaloClusterContainer ) override;
virtual StatusCode executeVertexVariables(xAOD::TauJet& pTau, xAOD::VertexContainer& vertexContainer ) override;
virtual StatusCode executeVertexVariables(xAOD::TauJet& pTau, xAOD::VertexContainer& vertexContainer ) const override;
virtual StatusCode executePi0ClusterScaler(xAOD::TauJet& pTau, xAOD::PFOContainer& neutralPFOContainer, xAOD::PFOContainer& chargedPFOContainer ) override;
virtual StatusCode executePi0nPFO(xAOD::TauJet& pTau, xAOD::PFOContainer& neutralPFOContainer) override;
virtual StatusCode executePanTau(xAOD::TauJet& pTau, xAOD::ParticleContainer& particleContainer) override;
......@@ -62,7 +62,7 @@ class TauRecToolBase : public asg::AsgTool, virtual public ITauToolBase {
//-----------------------------------------------------------------
//! Event finalizer - called at the end of each event
//-----------------------------------------------------------------
virtual StatusCode eventFinalize() override;
virtual StatusCode eventFinalize() const override;
//-----------------------------------------------------------------
//! Finalizer
......
......@@ -65,9 +65,6 @@ class TrigTauRecMerged: public HLT::FexAlgo {
private:
void setEmptyTauTrack( xAOD::TauJet* &tauJet,
xAOD::TauTrackContainer* &tauTrackCont);
enum TAUEFCALOMON{
NoROIDescr=0,
NoCellCont=1,
......
......@@ -42,12 +42,8 @@
// Invokes base class constructor.
TrigTauRecMergedMT::TrigTauRecMergedMT(const std::string& name,ISvcLocator* pSvcLocator)
:AthAlgorithm(name, pSvcLocator),
m_tools(this),
m_endtools(this)
:AthReentrantAlgorithm(name, pSvcLocator)
{
declareProperty("Tools", m_tools, "List of ITauToolBase tools" );
declareProperty("EndTools", m_endtools, "List of End ITauToolBase tools" );
}
TrigTauRecMergedMT::~TrigTauRecMergedMT()
......@@ -63,42 +59,26 @@ StatusCode TrigTauRecMergedMT::initialize()
return StatusCode::FAILURE;
}
ToolHandleArray<ITauToolBase> ::iterator p_itT = m_tools.begin();
ToolHandleArray<ITauToolBase> ::iterator p_itTE = m_tools.end();
ATH_MSG_DEBUG("List of tools in execution sequence:");
for(; p_itT != p_itTE; ++p_itT ) {
for(const auto& tool : m_tools) {
// make sure the key of the container in tauRecTool are the same
// need to set the property before the initialization of tools
if (p_itT->name().find("VertexFinder") != std::string::npos) {
ATH_CHECK( AAH::setProperty(*p_itT, "Key_trackPartInputContainer",m_tracksKey.key()) );
ATH_CHECK( AAH::setProperty(*p_itT, "Key_vertexInputContainer",m_vertexKey.key()) );
if (tool.name().find("VertexFinder") != std::string::npos) {
ATH_CHECK( AAH::setProperty(tool, "Key_trackPartInputContainer",m_tracksKey.key()) );
ATH_CHECK( AAH::setProperty(tool, "Key_vertexInputContainer",m_vertexKey.key()) );
}
else if (p_itT->name().find("TrackFinder") != std::string::npos) {
ATH_CHECK( AAH::setProperty(*p_itT, "Key_trackPartInputContainer",m_tracksKey.key()) );
else if (tool.name().find("TrackFinder") != std::string::npos) {
ATH_CHECK( AAH::setProperty(tool, "Key_trackPartInputContainer",m_tracksKey.key()) );
}
StatusCode p_sc = p_itT->retrieve();
StatusCode p_sc = tool.retrieve();
if( p_sc.isFailure() ) {
ATH_MSG_DEBUG("Cannot find tool named <" << *p_itT << ">");
ATH_MSG_DEBUG("Cannot find tool named <" << tool << ">");
return StatusCode::FAILURE;
}
else {
ATH_MSG_DEBUG("Add timer for tool "<< ( *p_itT )->type() <<" "<< ( *p_itT )->name());
}
}
ToolHandleArray<ITauToolBase> ::iterator p_itTe = m_endtools.begin();
ToolHandleArray<ITauToolBase> ::iterator p_itTEe = m_endtools.end();
for(; p_itTe != p_itTEe; ++p_itTe ) {
StatusCode p_sc = p_itTe->retrieve();
if( p_sc.isFailure() ) {
ATH_MSG_DEBUG("Cannot find tool named <" << *p_itTe << ">");
return StatusCode::FAILURE;
}
else {
ATH_MSG_DEBUG(" Add time for end tool "<< ( *p_itTe )->type() <<" "<< ( *p_itTe )->name());
ATH_MSG_DEBUG("Add timer for tool "<< tool.type() <<" "<< tool.name());
}
}
......@@ -106,17 +86,17 @@ StatusCode TrigTauRecMergedMT::initialize()
ATH_CHECK( m_monTool.retrieve() );
}
ATH_MSG_DEBUG( "Initialising HandleKeys" );
CHECK( m_roIInputKey.initialize() );
CHECK( m_L1RoIKey.initialize() );
CHECK( m_clustersKey.initialize(!m_clustersKey.key().empty()));
CHECK( m_tracksKey.initialize(!m_tracksKey.key().empty()));
CHECK( m_vertexKey.initialize(!m_vertexKey.key().empty()));
CHECK( m_trigTauJetKey.initialize(!m_trigTauJetKey.key().empty()));
CHECK( m_trigTauTrackInKey.initialize(!m_trigTauTrackInKey.key().empty()));
CHECK( m_trigtauSeedOutKey.initialize() );
CHECK( m_trigtauRecOutKey.initialize() );
CHECK( m_trigtauTrkOutKey.initialize() );
ATH_MSG_DEBUG("Initialising HandleKeys");
ATH_CHECK(m_roIInputKey.initialize());
ATH_CHECK(m_L1RoIKey.initialize());
ATH_CHECK(m_clustersKey.initialize(!m_clustersKey.key().empty()));
ATH_CHECK(m_tracksKey.initialize(!m_tracksKey.key().empty()));
ATH_CHECK(m_vertexKey.initialize(!m_vertexKey.key().empty()));
ATH_CHECK(m_trigTauJetKey.initialize(!m_trigTauJetKey.key().empty()));
ATH_CHECK(m_trigTauTrackInKey.initialize(!m_trigTauTrackInKey.key().empty()));
ATH_CHECK(m_trigtauSeedOutKey.initialize());
ATH_CHECK(m_trigtauRecOutKey.initialize());
ATH_CHECK(m_trigtauTrkOutKey.initialize());
return StatusCode::SUCCESS;
}
......@@ -125,14 +105,10 @@ StatusCode TrigTauRecMergedMT::finalize()
{
return StatusCode::SUCCESS;
}
StatusCode TrigTauRecMergedMT::execute()
StatusCode TrigTauRecMergedMT::execute(const EventContext& ctx) const
{
ATH_MSG_DEBUG("Execution");
auto ctx = getContext();
// variables to initialize and keep values for monitoring variables
std::vector<unsigned char> calo_errors(0);
std::vector<unsigned char> track_errors(0);
......@@ -207,13 +183,13 @@ StatusCode TrigTauRecMergedMT::execute()
const xAOD::TauTrackContainer *pTauTrackContainer = nullptr;
if (!m_trigTauJetKey.key().empty() && m_clustersKey.key().empty()) {
SG::ReadHandle<xAOD::TauJetContainer> tauInputHandle(m_trigTauJetKey);
SG::ReadHandle<xAOD::TauJetContainer> tauInputHandle(m_trigTauJetKey, ctx);
pTauContainer = tauInputHandle.cptr();
ATH_MSG_DEBUG("Tau Calo Only Container Size" << pTauContainer->size());
}
if (!m_trigTauTrackInKey.key().empty() && m_clustersKey.key().empty()) {
SG::ReadHandle<xAOD::TauTrackContainer> tauTrackInputHandle(m_trigTauTrackInKey);
SG::ReadHandle<xAOD::TauTrackContainer> tauTrackInputHandle(m_trigTauTrackInKey, ctx);
pTauTrackContainer = tauTrackInputHandle.cptr();
ATH_MSG_DEBUG("Tau Track Container Size" << pTauTrackContainer->size());
}
......@@ -361,64 +337,49 @@ StatusCode TrigTauRecMergedMT::execute()
ATH_MSG_DEBUG(" roidescriptor roiword " << roiDescriptor->roiWord() << " saved " << p_tau->ROIWord() );
StatusCode processStatus = StatusCode::SUCCESS;
StatusCode processStatus = StatusCode::SUCCESS;
//-------------------------------------------------------------------------
// eventInitialize tauRec colls
//-------------------------------------------------------------------------
ToolHandleArray<ITauToolBase> ::iterator firstTool = m_tools.begin();
ToolHandleArray<ITauToolBase> ::iterator lastTool = m_tools.end();
for ( ; firstTool != lastTool; firstTool++ ) {
processStatus = (*firstTool)->eventInitialize();
if( processStatus != StatusCode :: SUCCESS ) {
ATH_MSG_ERROR("tool "<<(*firstTool)->name()<< "failed in eventInitialize");
return StatusCode::FAILURE;
}
}
ATH_MSG_DEBUG(" initialize all good ");
//-------------------------------------------------------------------------
// loop over booked tau tools
//-------------------------------------------------------------------------
int toolnum = 0;
firstTool = m_tools.begin();
lastTool = m_tools.end();
processStatus = StatusCode::SUCCESS;
processStatus = StatusCode::SUCCESS;
// dummy container passed to TauVertexVariables, not used in trigger though
xAOD::VertexContainer dummyVxCont;
ATH_MSG_DEBUG("Starting tool loop with seed jet");
while ( ! processStatus.isFailure() && firstTool != lastTool ) {
for (const auto& tool : m_tools) {
// loop stops only when Failure indicated by one of the tools
ATH_MSG_DEBUG("Starting Tool: " << (*firstTool)->name() );
ATH_MSG_DEBUG("Starting Tool: " << tool->name() );
// time in the various tools
++toolnum;
if ((*firstTool)->type() == "TauVertexFinder" ) {
processStatus = (*firstTool)->executeVertexFinder(*p_tau);
if (tool->type() == "TauVertexFinder" ) {
processStatus = tool->executeVertexFinder(*p_tau);
}
else if ( (*firstTool)->type() == "TauTrackFinder") {
processStatus = (*firstTool)->executeTrackFinder(*p_tau, *pTrackContainer);
else if (tool->type() == "TauTrackFinder") {
processStatus = tool->executeTrackFinder(*p_tau, *pTrackContainer);
}
else if ( (*firstTool)->type() == "TauVertexVariables" ) {
processStatus = (*firstTool)->executeVertexVariables(*p_tau, dummyVxCont);
else if (tool->type() == "TauVertexVariables" ) {
processStatus = tool->executeVertexVariables(*p_tau, dummyVxCont);
}
else {
processStatus = (*firstTool)->execute( *p_tau );
processStatus = tool->execute( *p_tau );
}
if ( !processStatus.isFailure() ) {
ATH_MSG_DEBUG(" "<< (*firstTool)->name() << " executed successfully ");
ATH_MSG_DEBUG(" "<< tool->name() << " executed successfully ");
ATH_MSG_DEBUG(" Roi: " << roiDescriptor->roiId()
<< " Tau eta: " << p_tau->eta() << " Tau phi: " << p_tau->phi()
<< " Tau pT : "<< p_tau->pt());
}
else {
ATH_MSG_DEBUG(" "<< (*firstTool)->name() << " execution failed ");
ATH_MSG_DEBUG(" "<< tool->name() << " execution failed ");
break;
}
++firstTool;
}
//check status
......@@ -450,16 +411,6 @@ StatusCode TrigTauRecMergedMT::execute()
<< " Tau pT : "<< p_tau->pt());
}
// loop over end tools
ToolHandleArray<ITauToolBase> ::iterator p_itET = m_endtools.begin();
ToolHandleArray<ITauToolBase> ::iterator p_itETE = m_endtools.end();
for (; p_itET != p_itETE; ++p_itET ) {
ATH_MSG_VERBOSE("Invoking endTool " << ( *p_itET )->name() );
processStatus = ( *p_itET )->execute( *p_tau);
if( processStatus.isFailure() ) break;
}
// Get L1 RoiDescriptor
SG::ReadHandle< TrigRoiDescriptorCollection > L1roisHandle = SG::makeHandle( m_L1RoIKey, ctx );
......@@ -524,10 +475,10 @@ StatusCode TrigTauRecMergedMT::execute()
// call eventFinalize on the booked tau tools
for ( firstTool = m_tools.begin(); firstTool != lastTool; firstTool++ ) {
processStatus = (*firstTool)->eventFinalize();
for (const auto& tool : m_tools) {
processStatus = tool->eventFinalize();
if( processStatus != StatusCode :: SUCCESS ) {
ATH_MSG_DEBUG("tool "<<(*firstTool)->name()<< "failed in eventFinalize");
ATH_MSG_DEBUG("tool "<< tool->name()<< "failed in eventFinalize");
return StatusCode::FAILURE;
}
}
......@@ -544,13 +495,13 @@ StatusCode TrigTauRecMergedMT::execute()
ATH_MSG_DEBUG("Recorded a tau container: HLT_TrigTauRecMergedMT");
ATH_MSG_DEBUG("the tau object has been registered in the tau container");
SG::WriteHandle<xAOD::TauTrackContainer> tauTrackHandle( m_trigtauTrkOutKey );
SG::WriteHandle<xAOD::TauTrackContainer> tauTrackHandle(m_trigtauTrkOutKey, ctx);
ATH_MSG_DEBUG(" write: " << tauTrackHandle.key() << " = " << "..." );
ATH_CHECK(tauTrackHandle.record(std::unique_ptr<xAOD::TauTrackContainer>(pTrackContainer),
std::unique_ptr<xAOD::TauTrackAuxContainer>(pTrackAuxContainer)));
// Write final taujets container
SG::WriteHandle<xAOD::TauJetContainer> outputTauHandle(m_trigtauRecOutKey);
SG::WriteHandle<xAOD::TauJetContainer> outputTauHandle(m_trigtauRecOutKey, ctx);
ATH_CHECK(outputTauHandle.record(std::unique_ptr<xAOD::TauJetContainer>(pContainer),
std::unique_ptr<xAOD::TauJetAuxContainer>(pAuxContainer)));
......
......@@ -13,19 +13,18 @@
#include "GaudiKernel/ServiceHandle.h"
// Base class
#include "AthenaBaseComps/AthAlgorithm.h"
#include "AthenaBaseComps/AthReentrantAlgorithm.h"
#include "StoreGate/ReadHandleKey.h"
#include "StoreGate/WriteHandleKey.h"
#include "AthenaMonitoringKernel/GenericMonitoringTool.h"
#include <vector>
#include "tauRecTools/ITauToolBase.h"
#include "BeamSpotConditionsData/BeamSpotData.h"
#include "TrigSteeringEvent/TrigRoiDescriptor.h"
class TrigTauRecMergedMT: public AthAlgorithm {
class TrigTauRecMergedMT: public AthReentrantAlgorithm {
public:
......@@ -34,15 +33,16 @@ class TrigTauRecMergedMT: public AthAlgorithm {
virtual StatusCode initialize() override;
virtual StatusCode finalize() override;
virtual StatusCode execute() override;
virtual StatusCode execute(const EventContext& ctx) const override;
private:
template<class T, class U, class V> StatusCode deepCopy(T*& containerOut, U*& containerStoreOut, const V* dummyContainerType,
const T*& oldContainer);
private:
void setEmptyTauTrack( xAOD::TauJet* tauJet,
xAOD::TauTrackContainer* tauTrackContainer );
template<class T, class U, class V> StatusCode deepCopy(T*& containerOut,
U*& containerStoreOut,
const V* dummyContainerType,
const T*& oldContainer) const;
enum TAUEFCALOMON{
NoROIDescr=0,
......@@ -62,15 +62,11 @@ class TrigTauRecMergedMT: public AthAlgorithm {
NoVtxCont=1
};
/** internal tool store */
ToolHandleArray<ITauToolBase> m_tools;
/** internal tool store */
ToolHandleArray<ITauToolBase> m_endtools;
const ToolHandleArray<ITauToolBase> m_tools{this, "Tools", {}, "List of ITauToolBase tools"};
// Monitoring tool
ToolHandle< GenericMonitoringTool > m_monTool { this, "MonTool", "", "Monitoring tool" };