ATLAS Offline Software
Tool_TauConstituentGetter.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
10 #include "xAODTau/TauJet.h"
11 #include "xAODPFlow/PFO.h"
12 
14  asg::AsgTool(name),
15  m_Tool_InformationStore("PanTau::Tool_InformationStore/Tool_InformationStore"),
16  m_Tool_InputConverter("PanTau::Tool_InputConverter/Tool_InputConverter", this)
17 {
18  declareProperty("Tool_InformationStore", m_Tool_InformationStore, "Link to tool with all information");
19  declareProperty("Tool_InputConverter", m_Tool_InputConverter, "Link to tool to convert into TauConstituents");
20  declareProperty("Tool_InformationStoreName", m_Tool_InformationStoreName, "Link to tool with all information");
21  declareProperty("Tool_InputConverterName", m_Tool_InputConverterName, "Link to tool to convert into TauConstituents");
22 }
23 
25 
27 
28  ATH_MSG_INFO(" initialize()");
29  m_init=true;
30 
31  ATH_CHECK( HelperFunctions::bindToolHandle( m_Tool_InformationStore, m_Tool_InformationStoreName ) );
32  ATH_CHECK( HelperFunctions::bindToolHandle( m_Tool_InputConverter, m_Tool_InputConverterName ) );
33 
34  ATH_CHECK( m_Tool_InformationStore.retrieve() );
35  ATH_CHECK( m_Tool_InputConverter.retrieve() );
36 
37  return StatusCode::SUCCESS;
38 }
39 
40 
45  std::vector<TauConstituent*>& outputConstituents,
46  const std::string& algName) const {
47 
48  if(algName != "CellBased") {
49  ATH_MSG_WARNING("Unknown input algorithm: " << algName << " -> Pantau BDT Training not done for this algorithm!");
50  return StatusCode::FAILURE;
51  }
52 
53  //loop over charged PFOs
54  for(unsigned int iChrgPFO=0; iChrgPFO<tauJet->nProtoChargedPFOs(); iChrgPFO++) {
55 
56  //convert to tau constituent
57  PanTau::TauConstituent* curConst = nullptr;
58  ATH_CHECK(m_Tool_InputConverter->ConvertToTauConstituent(tauJet->protoChargedPFO( iChrgPFO ), curConst, tauJet) );
59  if(curConst == nullptr) {
60  ATH_MSG_DEBUG("Problems converting charged PFO into tau constituent -> skip PFO");
61  continue;
62  }
63 
64  //add to list of tau constituents
65  outputConstituents.push_back(curConst);
66 
67  }//end loop over charged PFOs
68 
69  // Pi0 tagged PFOs are not collected!
70 
71  //loop over neutral PFOs
72  for(unsigned int iNeutPFO=0; iNeutPFO<tauJet->nProtoNeutralPFOs(); iNeutPFO++) {
73 
74  //convert to tau constituent
75  PanTau::TauConstituent* curConst = nullptr;
76  ATH_CHECK( m_Tool_InputConverter->ConvertToTauConstituent(tauJet->protoNeutralPFO( iNeutPFO ), curConst, tauJet) );
77  if(curConst == nullptr) {
78  ATH_MSG_DEBUG("Problems converting neutral PFO into tau constituent -> skip PFO");
79  continue;
80  }
81 
82  //add to list of tau constituents
83  outputConstituents.push_back(curConst);
84 
85  }//end loop over charged PFOs
86 
87  return StatusCode::SUCCESS;
88 }
PanTau::Tool_TauConstituentGetter::Tool_TauConstituentGetter
Tool_TauConstituentGetter(const std::string &name)
Definition: Tool_TauConstituentGetter.cxx:13
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
xAOD::TauJet_v3::nProtoNeutralPFOs
size_t nProtoNeutralPFOs() const
Get the number of cellbased_neutral PFO particles associated with this tau.
Definition: TauJet_v3.cxx:944
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
xAOD::JetAlgorithmType::algName
const std::string & algName(ID id)
Converts a JetAlgorithmType::ID into a string.
Definition: JetContainerInfo.cxx:67
PanTau::Tool_TauConstituentGetter::m_Tool_InformationStore
ToolHandle< PanTau::ITool_InformationStore > m_Tool_InformationStore
Definition: Tool_TauConstituentGetter.h:49
HelperFunctions.h
PanTau::Tool_TauConstituentGetter::~Tool_TauConstituentGetter
virtual ~Tool_TauConstituentGetter()
asg
Definition: DataHandleTestTool.h:28
xAOD::TauJet_v3::protoChargedPFO
const PFO * protoChargedPFO(size_t i) const
Get the pointer to a given cellbased_charged PFO associated with this tau.
Tool_InputConverter.h
TauConstituent.h
PanTau::Tool_TauConstituentGetter::GetTauConstituents
virtual StatusCode GetTauConstituents(const xAOD::TauJet *tauJet, std::vector< TauConstituent * > &outputList, const std::string &algName) const
Function to get the PFOs for a given TauJet object (Shots in each PFO etc are collected in "ConvertTo...
Definition: Tool_TauConstituentGetter.cxx:44
PFO.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
xAOD::TauJet_v3
Class describing a tau jet.
Definition: TauJet_v3.h:41
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
PanTau::HelperFunctions::bindToolHandle
static StatusCode bindToolHandle(ToolHandle< T > &, std::string)
Definition: Reconstruction/PanTau/PanTauAlgs/PanTauAlgs/HelperFunctions.h:60
PanTau::Tool_TauConstituentGetter::m_Tool_InputConverter
ToolHandle< PanTau::ITool_InputConverter > m_Tool_InputConverter
Definition: Tool_TauConstituentGetter.h:50
PanTau::Tool_TauConstituentGetter::initialize
virtual StatusCode initialize()
Dummy implementation of the initialisation function.
Definition: Tool_TauConstituentGetter.cxx:26
Tool_InformationStore.h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
TauJet.h
PanTau::Tool_TauConstituentGetter::m_Tool_InformationStoreName
std::string m_Tool_InformationStoreName
Definition: Tool_TauConstituentGetter.h:52
Tool_TauConstituentGetter.h
xAOD::TauJet_v3::protoNeutralPFO
const PFO * protoNeutralPFO(size_t i) const
Get the pointer to a given cellbased_neutral PFO associated with this tau.
xAOD::TauJet_v3::nProtoChargedPFOs
size_t nProtoChargedPFOs() const
Get the number of cellbased_charged PFO particles associated with this tau.
Definition: TauJet_v3.cxx:914
PanTau::TauConstituent
Definition: TauConstituent.h:25
PanTau::Tool_TauConstituentGetter::m_Tool_InputConverterName
std::string m_Tool_InputConverterName
Definition: Tool_TauConstituentGetter.h:53