67 {
68
69 SG::ReadHandle<xAOD::TauJetContainer> tauInputHandle(
m_tauContainer, ctx);
70 if (!tauInputHandle.isValid()) {
71 ATH_MSG_ERROR(
"Could not retrieve TauJetContainer with key " << tauInputHandle.key());
72 return StatusCode::FAILURE;
73 }
75
76
77
79 SG::WriteHandle<xAOD::TauTrackContainer> outputTauTrackHandle;
82 ATH_CHECK(outputTauTrackHandle.
record(std::make_unique<xAOD::TauTrackContainer>(), std::make_unique<xAOD::TauTrackAuxContainer>()));
83 newTauTrkCon = outputTauTrackHandle.
ptr();
84 }
85
86
88 ATH_CHECK(outputTauHandle.record(std::make_unique<xAOD::TauJetContainer>(), std::make_unique<xAOD::TauJetAuxContainer>()));
90
91 static const SG::Accessor<ElementLink<xAOD::TauJetContainer>> acc_ori_tau_link("originalTauJet");
92 static const SG::Accessor<char> acc_modified("ModifiedInAOD");
93
95
97 *newTau = *tau;
98
99
100 ElementLink<xAOD::TauJetContainer> link_to_ori_tau;
102 acc_ori_tau_link(*newTau) = link_to_ori_tau;
103
104
105
106
107 if(newTauTrkCon) {
108
111
113 *newTauTrk = *tauTrk;
114
115
116 ElementLink<xAOD::TauTrackContainer> linkToTauTrack;
119 }
120 }
121
122
123 acc_modified(*newTau) = static_cast<char>(false);
124
125
128 if(
tool->execute(*newTau).isFailure())
break;
129 }
130
131
132
135 }
136 }
137
138
139
141 SG::ReadHandle<xAOD::CaloClusterContainer> pi0ClusterInHandle;
144 if(!pi0ClusterInHandle.
isValid()) {
145 ATH_MSG_ERROR (
"Could not retrieve HiveDataObj with key " << pi0ClusterInHandle.
key());
146 return StatusCode::FAILURE;
147 }
148 pi0ClusterContainer = pi0ClusterInHandle.
cptr();
149 }
150
151
153 SG::WriteHandle<xAOD::PFOContainer> chargedPFOHandle;
156 ATH_CHECK(chargedPFOHandle.
record(std::make_unique<xAOD::PFOContainer>(), std::make_unique<xAOD::PFOAuxContainer>()));
157 chargedPFOContainer = chargedPFOHandle.
ptr();
158 }
159
160
162 SG::WriteHandle<xAOD::PFOContainer> neutralPFOHandle;
165 ATH_CHECK(neutralPFOHandle.
record(std::make_unique<xAOD::PFOContainer>(), std::make_unique<xAOD::PFOAuxContainer>()));
166 neutralPFOContainer = neutralPFOHandle.
ptr();
167 }
168
169
171 SG::WriteHandle<xAOD::ParticleContainer> pi0Handle;
174 ATH_CHECK(pi0Handle.
record(std::make_unique<xAOD::ParticleContainer>(), std::make_unique<xAOD::ParticleAuxContainer>()));
175 pi0Container = pi0Handle.
ptr();
176 }
177
178
180 SG::WriteHandle<xAOD::PFOContainer> hadronicPFOHandle;
183 ATH_CHECK(hadronicPFOHandle.
record(std::make_unique<xAOD::PFOContainer>(), std::make_unique<xAOD::PFOAuxContainer>()));
184 hadronicClusterPFOContainer = hadronicPFOHandle.
ptr();
185 }
186
187
189 SG::WriteHandle<xAOD::VertexContainer> vertOutHandle;
192 ATH_CHECK(vertOutHandle.
record(std::make_unique<xAOD::VertexContainer>(), std::make_unique<xAOD::VertexAuxContainer>()));
193 pSecVtxContainer = vertOutHandle.
ptr();
194 }
195
196
197
202 if (
tool->type() ==
"TauPi0ClusterCreator")
203 sc =
tool->executePi0ClusterCreator(*pTau, *neutralPFOContainer, *hadronicClusterPFOContainer, *pi0ClusterContainer);
204 else if (
tool->type() ==
"TauVertexVariables")
205 sc =
tool->executeVertexVariables(*pTau, *pSecVtxContainer);
206 else if (
tool->type() ==
"TauPi0ClusterScaler")
207 sc =
tool->executePi0ClusterScaler(*pTau, *neutralPFOContainer, *chargedPFOContainer);
208 else if (
tool->type() ==
"TauPi0ScoreCalculator")
209 sc =
tool->executePi0nPFO(*pTau, *neutralPFOContainer);
210 else if (
tool->type() ==
"TauPi0Selector")
211 sc =
tool->executePi0nPFO(*pTau, *neutralPFOContainer);
212 else if (
tool->type() ==
"PanTau::PanTauProcessor")
213 sc =
tool->executePanTau(*pTau, *pi0Container, *neutralPFOContainer);
214 else if (
tool->type() ==
"tauRecTools::TauTrackRNNClassifier")
215 sc =
tool->executeTrackClassifier(*pTau, *newTauTrkCon);
216 else
217 sc =
tool->execute(*pTau);
218
219 if (
sc.isFailure())
break;
220 }
221 if (
sc.isSuccess())
ATH_MSG_VERBOSE(
"The tau candidate has been modified successfully by the invoked official tools.");
222 }
223
224 ATH_MSG_VERBOSE(
"The tau candidate container has been modified by the rest of the tools");
225 ATH_MSG_DEBUG(newTauCon->size() <<
" / " << pTauContainer->size() <<
" taus were modified");
226
227 return StatusCode::SUCCESS;
228}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
void pop_back()
Remove the last element from the collection.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
bool toContainedElement(BaseConstReference data, ElementType element, IProxyDict *sg=0)
Set from element pointer and a reference to the container (storable)
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
pointer_type ptr()
Dereference the pointer.
ToolHandleArray< ITauToolBase > m_modificationTools
SG::ReadHandleKey< xAOD::TauJetContainer > m_tauContainer
SG::WriteHandleKey< xAOD::TauJetContainer > m_tauOutContainer
SG::WriteHandleKey< xAOD::PFOContainer > m_neutralPFOOutputContainer
SG::WriteHandleKey< xAOD::ParticleContainer > m_pi0Container
ToolHandleArray< ITauToolBase > m_officialTools
SG::WriteHandleKey< xAOD::PFOContainer > m_chargedPFOOutputContainer
SG::WriteHandleKey< xAOD::PFOContainer > m_hadronicPFOOutputContainer
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_pi0ClusterInputContainer
SG::WriteHandleKey< xAOD::VertexContainer > m_vertexOutputContainer
SG::WriteHandleKey< xAOD::TauTrackContainer > m_tauTrackOutputContainer
void clearTauTrackLinks()
Remove all tracks from the tau.
void addTauTrackLink(const ElementLink< TauTrackContainer > &tr)
add a TauTrack to the tau
::StatusCode StatusCode
StatusCode definition for legacy code.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
PFOContainer_v1 PFOContainer
Definition of the current "pfo container version".
ParticleContainer_v1 ParticleContainer
Define the latest version of the particle class.
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
TauTrack_v1 TauTrack
Definition of the current version.
TauJet_v3 TauJet
Definition of the current "tau version".
TauTrackContainer_v1 TauTrackContainer
Definition of the current TauTrack container version.
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.
TauJetContainer_v3 TauJetContainer
Definition of the current "taujet container version".