ATLAS Offline Software
BuildTruthTaus.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // Local include(s)
11 
12 // Core include(s):
13 #include "AthLinks/ElementLink.h"
14 #include "AthContainers/Accessor.h"
15 
16 // EDM include(s):
17 #include "xAODTruth/TruthVertex.h"
19 
21 
22 using namespace TauAnalysisTools;
23 
24 //=================================PUBLIC-PART==================================
25 //______________________________________________________________________________
26 BuildTruthTaus::BuildTruthTaus( const std::string& name )
27  : AsgMetadataTool(name)
28 {
29 }
30 
31 //______________________________________________________________________________
33 {
34  if (!m_truthMatchingMode) {
35  ATH_MSG_INFO( "Initializing BuildTruthTaus, will generate " << m_truthTauOutputContainer.key() << " from " << m_truthParticleContainer.key() << " container" );
36  }
37  else {
38  ATH_MSG_INFO( "Initializing BuildTruthTaus in truth matching mode, using input container " << m_truthTauInputContainer.key() );
39  }
40 
41  // input containers
47 
48  // in truth matching mode, truth electron/muon/jet containers are optional but expected
49  if (m_truthMatchingMode) {
51  ATH_MSG_WARNING("Truth electron container is not available, won't perform matching to truth electrons");
52  }
54  ATH_MSG_WARNING("Truth muon container is not available, won't perform matching to truth muons");
55  }
56  if (m_truthJetContainer.empty()) {
57  ATH_MSG_WARNING("Truth jet container is not available, won't perform matching to truth jets");
58  }
59  }
60 
61  // output container
63 
64  // input decorations
69  // output decorations
75 
76  // drop at earliest occasion
78 
79  return StatusCode::SUCCESS;
80 }
81 
82 
84 {
86 }
87 
88 
90 {
91  return retrieveTruthTaus (dynamic_cast<TruthTausEvent&> (truthTausEvent));
92 }
93 
94 
95 StatusCode BuildTruthTaus::retrieveTruthTaus(TruthTausEvent& truthTausEvent) const
96 {
97  const EventContext& ctx = Gaudi::Hive::currentContext();
98 
99  // truth matching mode
100  if (m_truthMatchingMode) {
103  if (!truthElectronsHandle.isValid()) {
104  ATH_MSG_ERROR ("Could not retrieve " << truthElectronsHandle.key());
105  return StatusCode::FAILURE;
106  }
107  truthTausEvent.m_xTruthElectronContainerConst = truthElectronsHandle.cptr();
108  }
109 
110  if (!m_truthMuonContainer.empty()) {
112  if (!truthMuonsHandle.isValid()) {
113  ATH_MSG_ERROR ("Could not retrieve " << truthMuonsHandle.key());
114  return StatusCode::FAILURE;
115  }
116  truthTausEvent.m_xTruthMuonContainerConst = truthMuonsHandle.cptr();
117  }
118 
119  if (!m_truthJetContainer.empty()) {
121  if (!truthJetsHandle.isValid()) {
122  ATH_MSG_ERROR ("Could not retrieve " << truthJetsHandle.key());
123  return StatusCode::FAILURE;
124  }
125  truthTausEvent.m_xTruthJetContainerConst = truthJetsHandle.cptr();
126  }
127 
129  if (!truthTausHandle.isValid()) {
130  ATH_MSG_ERROR ("Could not retrieve " << truthTausHandle.key());
131  return StatusCode::FAILURE;
132  }
133  truthTausEvent.m_xTruthTauContainerConst = truthTausHandle.cptr();
134  }
135  // truth tau building mode
136  else {
138  if (!truthParticlesHandle.isValid()) {
139  ATH_MSG_ERROR ("Could not retrieve " << truthParticlesHandle.key());
140  return StatusCode::FAILURE;
141  }
142  truthTausEvent.m_xTruthParticleContainer = truthParticlesHandle.cptr();
143 
144  auto truthTausOutput = std::make_unique<xAOD::TruthParticleContainer>();
145  auto truthTausOutputAux = std::make_unique<xAOD::TruthParticleAuxContainer>();
146  truthTausOutput->setStore(truthTausOutputAux.get());
147  truthTausEvent.m_xTruthTauContainer = truthTausOutput.get();
148 
149  auto writeHandle = SG::makeHandle(m_truthTauOutputContainer, ctx);
150  ATH_CHECK(writeHandle.record(std::move(truthTausOutput), std::move(truthTausOutputAux)));
151 
152  ATH_CHECK( buildTruthTausFromTruthParticles(truthTausEvent, ctx) );
153  }
154 
155  return StatusCode::SUCCESS;
156 }
157 
158 //=================================PRIVATE-PART=================================
159 //______________________________________________________________________________
160 //______________________________________________________________________________
162 BuildTruthTaus::buildTruthTausFromTruthParticles(TruthTausEvent& truthTausEvent, const EventContext& ctx) const
163 {
168 
174 
175  for (auto xTruthParticle : *truthTausEvent.m_xTruthParticleContainer)
176  {
177  if ( xTruthParticle->isTau() )
178  {
179  auto xTruthTau = std::make_unique<xAOD::TruthParticle>();
180  xTruthTau->makePrivateStore( *xTruthParticle );
181 
182  if ( examineTruthTau(*xTruthTau).isFailure() )
183  {
184  continue;
185  }
186 
187  // adding decorations onto the truth tau requires that it is in the final Aux store
188  truthTausEvent.m_xTruthTauContainer->push_back(std::move(xTruthTau));
189  xAOD::TruthParticle* truthTau = truthTausEvent.m_xTruthTauContainer->back();
190 
191  // propagate MCTruthClassifier decorations
192  typeDecorator(*truthTau) = typeReadDecor(*xTruthParticle);
193  originDecorator(*truthTau) = originReadDecor(*xTruthParticle);
194  outcomeDecorator(*truthTau) = outcomeReadDecor(*xTruthParticle);
195  classificationDecorator(*truthTau) = classificationReadDecor(*xTruthParticle);
196 
197  // create link to the original TruthParticle
198  ElementLink < xAOD::TruthParticleContainer > lTruthParticleLink(xTruthParticle, *truthTausEvent.m_xTruthParticleContainer);
199  linkDecorator(*truthTau) = lTruthParticleLink;
200  }
201  }
202  return StatusCode::SUCCESS;
203 }
204 
205 //______________________________________________________________________________
207 {
208  // skip this tau if it has no decay vertex, should not happen
209  if ( !xTruthParticle.hasDecayVtx() )
210  return StatusCode::FAILURE;
211 
212  ATH_MSG_VERBOSE("looking for charged daughters of a truth tau");
213 
214  TauTruthInfo truthInfo;
215 
216  const xAOD::TruthVertex* xDecayVertex = xTruthParticle.decayVtx();
217  if (xDecayVertex == nullptr)
218  return StatusCode::FAILURE;
219  for ( size_t iOutgoingParticle = 0; iOutgoingParticle < xDecayVertex->nOutgoingParticles(); ++iOutgoingParticle )
220  {
221  const xAOD::TruthParticle* xTruthDaughter = xDecayVertex->outgoingParticle(iOutgoingParticle);
222  if (xTruthDaughter == nullptr)
223  {
224  ATH_MSG_ERROR("Truth daughter of tau decay was not found in "<< m_truthParticleContainer.key() <<" container. Please ensure that this container has the full tau decay information or produce the TruthTaus container in AtlasDerivation.");
225  return StatusCode::FAILURE;
226  }
227 
228  // if tau decays into tau this is not a proper tau decay
229  if ( xTruthDaughter->isTau() )
230  {
231  ATH_MSG_VERBOSE("Tau decays into a tau itself -> skip this decay");
232  return StatusCode::FAILURE;
233  }
234  }
235 
236  examineTruthTauDecay(xTruthParticle, truthInfo).ignore();
237 
238  if (truthInfo.m_bIsHadronicTau)
239  ATH_MSG_VERBOSE(truthInfo.m_iNChargedDaughters << " prong hadronic truth tau was found with uniqueID "<<HepMC::uniqueID(xTruthParticle));
240  else
241  ATH_MSG_VERBOSE(truthInfo.m_iNChargedDaughters << " prong leptonic truth tau was found with uniqueID "<<HepMC::uniqueID(xTruthParticle));
242  if ( truthInfo.m_iNChargedDaughters%2 == 0 )
243  {
244  ATH_MSG_WARNING("found tau with even multiplicity: " << truthInfo.m_iNChargedDaughters);
245  printDecay(xTruthParticle);
246  }
247 
248  static const SG::Decorator<double> decPtVis("pt_vis");
249  static const SG::Decorator<double> decEtaVis("eta_vis");
250  static const SG::Decorator<double> decPhiVis("phi_vis");
251  static const SG::Decorator<double> decMVis("m_vis");
252 
253  static const SG::Decorator<size_t> decNumCharged("numCharged");
254  static const SG::Decorator<size_t> decNumChargedPion("numChargedPion");
255  static const SG::Decorator<size_t> decNumNeutral("numNeutral");
256  static const SG::Decorator<size_t> decNumNeutralPion("numNeutralPion");
257 
258  decPtVis(xTruthParticle) = truthInfo.m_vTruthVisTLV.Pt();
259  decEtaVis(xTruthParticle) = truthInfo.m_vTruthVisTLV.Eta();
260  decPhiVis(xTruthParticle) = truthInfo.m_vTruthVisTLV.Phi();
261  decMVis(xTruthParticle) = truthInfo.m_vTruthVisTLV.M();
262 
263  decNumCharged(xTruthParticle) = truthInfo.m_iNChargedDaughters;
264  decNumChargedPion(xTruthParticle) = truthInfo.m_iNChargedPions;
265  decNumNeutral(xTruthParticle) = truthInfo.m_iNNeutralPions+truthInfo.m_iNNeutralOthers;
266  decNumNeutralPion(xTruthParticle) = truthInfo.m_iNNeutralPions;
267 
268  static const SG::Decorator<char> decIsHadronicTau("IsHadronicTau");
269  decIsHadronicTau(xTruthParticle) = (char)truthInfo.m_bIsHadronicTau;
270 
272  {
273  TLorentzVector vTruthInvisTLV = xTruthParticle.p4() - truthInfo.m_vTruthVisTLV;
274  static const SG::Decorator<double> decPtInvis("pt_invis");
275  static const SG::Decorator<double> decEtaInvis("eta_invis");
276  static const SG::Decorator<double> decPhiInvis("phi_invis");
277  static const SG::Decorator<double> decMInvis("m_invis");
278  decPtInvis(xTruthParticle) = vTruthInvisTLV.Pt();
279  decEtaInvis(xTruthParticle) = vTruthInvisTLV.Eta();
280  decPhiInvis(xTruthParticle) = vTruthInvisTLV.Phi();
281  decMInvis(xTruthParticle) = vTruthInvisTLV.M();
282  }
283 
285  {
286  static const SG::Decorator<double> decPtVisCharged("pt_vis_charged");
287  static const SG::Decorator<double> decEtaVisCharged("eta_vis_charged");
288  static const SG::Decorator<double> decPhiVisCharged("phi_vis_charged");
289  static const SG::Decorator<double> decMVisCharged("m_vis_charged");
290  decPtVisCharged(xTruthParticle) = truthInfo.m_vTruthVisTLVCharged.Pt();
291  decEtaVisCharged(xTruthParticle) = truthInfo.m_vTruthVisTLVCharged.Eta();
292  decPhiVisCharged(xTruthParticle) = truthInfo.m_vTruthVisTLVCharged.Phi();
293  decMVisCharged(xTruthParticle) = truthInfo.m_vTruthVisTLVCharged.M();
294  }
295 
297  {
298  static const SG::Decorator<double> decPtVisNeutral("pt_vis_neutral");
299  static const SG::Decorator<double> decEtaVisNeutral("eta_vis_neutral");
300  static const SG::Decorator<double> decPhiVisNeutral("phi_vis_neutral");
301  static const SG::Decorator<double> decMVisNeutral("m_vis_neutral");
302  decPtVisNeutral(xTruthParticle) = truthInfo.m_vTruthVisTLVNeutral.Pt();
303  decEtaVisNeutral(xTruthParticle) = truthInfo.m_vTruthVisTLVNeutral.Eta();
304  decPhiVisNeutral(xTruthParticle) = truthInfo.m_vTruthVisTLVNeutral.Phi();
305  decMVisNeutral(xTruthParticle) = truthInfo.m_vTruthVisTLVNeutral.M();
306  }
307 
309  {
310  static const SG::Decorator<std::vector<int> > decDecayModeVector("DecayModeVector");
311  decDecayModeVector(xTruthParticle) = truthInfo.m_vDecayMode;
312  }
313 
314  if ( m_bWriteVertices )
315  {
316  // tau decay vertex
317  static const SG::Decorator<float> decDecayVertexX("decay_vertex_x");
318  static const SG::Decorator<float> decDecayVertexY("decay_vertex_y");
319  static const SG::Decorator<float> decDecayVertexZ("decay_vertex_z");
320 
321  decDecayVertexX(xTruthParticle) = truthInfo.m_vDecayVertex.X();
322  decDecayVertexY(xTruthParticle) = truthInfo.m_vDecayVertex.Y();
323  decDecayVertexZ(xTruthParticle) = truthInfo.m_vDecayVertex.Z();
324 
325  // tau production vertex
326  static const SG::Decorator<float> decProdVertexX("prod_vertex_x");
327  static const SG::Decorator<float> decProdVertexY("prod_vertex_y");
328  static const SG::Decorator<float> decProdVertexZ("prod_vertex_z");
329 
330  decProdVertexX(xTruthParticle) = truthInfo.m_vProdVertex.X();
331  decProdVertexY(xTruthParticle) = truthInfo.m_vProdVertex.Y();
332  decProdVertexZ(xTruthParticle) = truthInfo.m_vProdVertex.Z();
333  }
334 
335  return StatusCode::SUCCESS;
336 }
337 
338 //______________________________________________________________________________
340  TauTruthInfo& truthInfo) const
341 {
342  // get vertex and check if it exists
343  const xAOD::TruthVertex* xDecayVertex = xTruthParticle.decayVtx();
344  if (!xDecayVertex)
345  return StatusCode::SUCCESS;
346 
347  truthInfo.m_vDecayVertex.SetXYZ(xDecayVertex->x(),xDecayVertex->y(),xDecayVertex->z());
348 
349  if (xTruthParticle.hasProdVtx() ) {
350  const xAOD::TruthVertex* xProdVertex = xTruthParticle.prodVtx();
351  truthInfo.m_vProdVertex.SetXYZ(xProdVertex->x(),xProdVertex->y(),xProdVertex->z());
352  } else {
353  truthInfo.m_vProdVertex.SetXYZ(-1234,-1234,-1234);
354  }
355 
356  for ( size_t iOutgoingParticle = 0; iOutgoingParticle < xDecayVertex->nOutgoingParticles(); ++iOutgoingParticle )
357  {
358  const xAOD::TruthParticle* xTruthDaughter = xDecayVertex->outgoingParticle(iOutgoingParticle);
359  if (xTruthDaughter == nullptr)
360  {
361  ATH_MSG_ERROR("Truth daughter of tau decay was not found in "<< m_truthParticleContainer.key() <<" container. Please ensure that this container has the full tau decay information or produce the TruthTaus container in AtlasDerivation.");
362  return StatusCode::FAILURE;
363  }
364 
365  int iAbsPdgId = xTruthDaughter->absPdgId();
366  int iPdgId = xTruthDaughter->pdgId();
367 
368  // look at decay of unstable particles
369  if (MC::isDecayed(xTruthDaughter) || !MC::isPhysical(xTruthDaughter))
370  {
371  if ( iAbsPdgId != 111 && iAbsPdgId != 311 && iAbsPdgId != 310 && iAbsPdgId != 130 )
372  {
373  examineTruthTauDecay(*xTruthDaughter, truthInfo).ignore();
374  continue;
375  }
376  }
377 
378  // only process stable particles
379  if (!MC::isStable(xTruthDaughter) && !MC::isDecayed(xTruthDaughter))
380  continue;
381 
382  // add pdgID to vector for decay mode classification
383  truthInfo.m_vDecayMode.push_back(iPdgId);
384 
385  // if tau decays leptonically, indicated by an electron/muon neutrino then
386  // it is not a hadronic decay
387  if ( xTruthDaughter->isHadron() )
388  truthInfo.m_bIsHadronicTau = true;
389 
390  // ignore neutrinos for further progress
391  if ( xTruthDaughter->isNeutrino() )
392  {
393  ATH_MSG_VERBOSE("found neutrino decay particle with PdgId "<<iPdgId);
394  continue;
395  }
396 
397  // add momentum of non-neutrino particle to visible momentum
398  truthInfo.m_vTruthVisTLV += xTruthDaughter->p4();
400  if ( xTruthDaughter->isCharged() )
401  truthInfo.m_vTruthVisTLVCharged += xTruthDaughter->p4();
403  if ( xTruthDaughter->isNeutral() )
404  truthInfo.m_vTruthVisTLVNeutral += xTruthDaughter->p4();
405 
406  // only count charged decay particles
407  if ( xTruthDaughter->isCharged() )
408  {
409  ATH_MSG_VERBOSE("found charged decay particle with PdgId "<<iPdgId);
410  truthInfo.m_iNChargedDaughters++;
411  // count charged pions
412  if (iAbsPdgId==211) truthInfo.m_iNChargedPions++;
413  else truthInfo.m_iNChargedOthers++;
414  }
415  else
416  {
417  ATH_MSG_VERBOSE("found neutral decay particle with PdgId "<<iPdgId);
418  // count neutral pions
419  if (iAbsPdgId==111) truthInfo.m_iNNeutralPions++;
420  else truthInfo.m_iNNeutralOthers++;
421  }
422  }
423  return StatusCode::SUCCESS;
424 }
425 
426 void BuildTruthTaus::printDecay(const xAOD::TruthParticle& xTruthParticle, int depth) const
427 {
428  // loop over all decay particles, print their kinematic and other properties
429 
430  const xAOD::TruthVertex* xDecayVertex = xTruthParticle.decayVtx();
431  if (xDecayVertex == nullptr)
432  return;
433 
434  for ( size_t iOutgoingParticle = 0; iOutgoingParticle < xDecayVertex->nOutgoingParticles(); ++iOutgoingParticle )
435  {
436  const xAOD::TruthParticle* xTruthDaughter = xDecayVertex->outgoingParticle(iOutgoingParticle);
437  if (xTruthDaughter == nullptr)
438  {
439  ATH_MSG_WARNING("Truth daughter of tau decay was not found in "<< m_truthParticleContainer.key() <<" container. Please ensure that this container has the full tau decay information or produce the TruthTaus container in AtlasDerivation.");
440  return;
441  }
442  ATH_MSG_WARNING("depth "<<depth
443  <<" e "<<xTruthDaughter->e()
444  <<" eta "<<xTruthDaughter->p4().Eta()
445  <<" phi "<<xTruthDaughter->p4().Phi()
446  <<" pdgid "<<xTruthDaughter->pdgId()
447  <<" status "<<xTruthDaughter->status()
448  <<" uniqueID "<<HepMC::uniqueID(xTruthDaughter));
449  printDecay(*xTruthDaughter, depth+1);
450  }
451 }
TauAnalysisTools::BuildTruthTaus::examineTruthTau
StatusCode examineTruthTau(const xAOD::TruthParticle &xTruthParticle) const
Definition: BuildTruthTaus.cxx:206
TauAnalysisTools::BuildTruthTaus::m_bWriteInvisibleFourMomentum
Gaudi::Property< bool > m_bWriteInvisibleFourMomentum
Definition: BuildTruthTaus.h:118
WriteHandle.h
Handle class for recording to StoreGate.
xAOD::TruthVertex_v1::nOutgoingParticles
size_t nOutgoingParticles() const
Get the number of outgoing particles.
TauAnalysisTools::BuildTruthTaus::TauTruthInfo::m_iNChargedOthers
size_t m_iNChargedOthers
Definition: BuildTruthTaus.h:83
TauAnalysisTools
Definition: TruthCollectionMakerTau.h:16
TauAnalysisTools::BuildTruthTaus::TauTruthInfo::m_vTruthVisTLV
TLorentzVector m_vTruthVisTLV
Definition: BuildTruthTaus.h:91
egammaParameters::depth
@ depth
pointing depth of the shower as calculated in egammaqgcld
Definition: egammaParamDefs.h:276
xAOD::TruthParticle_v1::absPdgId
int absPdgId() const
Absolute PDG ID code (often useful)
TauAnalysisTools::BuildTruthTaus::m_truthElectronContainer
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthElectronContainer
Definition: BuildTruthTaus.h:127
TauAnalysisTools::BuildTruthTaus::m_bWriteVertices
Gaudi::Property< bool > m_bWriteVertices
Definition: BuildTruthTaus.h:122
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
TauAnalysisTools::BuildTruthTaus::TauTruthInfo
Definition: BuildTruthTaus.h:80
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
TauAnalysisTools::BuildTruthTaus::TauTruthInfo::m_vDecayVertex
TVector3 m_vDecayVertex
Definition: BuildTruthTaus.h:96
TauAnalysisTools::BuildTruthTaus::printDecay
void printDecay(const xAOD::TruthParticle &xTruthParticle, int depth=0) const
Definition: BuildTruthTaus.cxx:426
TauAnalysisTools::IBuildTruthTaus::ITruthTausEvent
Declare the interface that the class provides.
Definition: IBuildTruthTaus.h:35
TauAnalysisTools::BuildTruthTaus::TauTruthInfo::m_iNNeutralPions
size_t m_iNNeutralPions
Definition: BuildTruthTaus.h:82
SG::ReadHandle< xAOD::TruthParticleContainer >
TauAnalysisTools::BuildTruthTaus::TauTruthInfo::m_bIsHadronicTau
bool m_bIsHadronicTau
Definition: BuildTruthTaus.h:88
initialize
void initialize()
Definition: run_EoverP.cxx:894
TauAnalysisTools::BuildTruthTaus::retrieveTruthTaus
virtual StatusCode retrieveTruthTaus() override
Definition: BuildTruthTaus.cxx:83
xAOD::char
char
Definition: TrigDecision_v1.cxx:38
TauAnalysisTools::BuildTruthTaus::TauTruthInfo::m_vDecayMode
std::vector< int > m_vDecayMode
Definition: BuildTruthTaus.h:86
TauAnalysisTools::BuildTruthTaus::TauTruthInfo::m_vTruthVisTLVCharged
TLorentzVector m_vTruthVisTLVCharged
Definition: BuildTruthTaus.h:92
TauAnalysisTools::BuildTruthTaus::m_truthTauOutputContainer
SG::WriteHandleKey< xAOD::TruthParticleContainer > m_truthTauOutputContainer
Definition: BuildTruthTaus.h:131
TauAnalysisTools::BuildTruthTaus::m_typeDecoratorKey
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_typeDecoratorKey
Definition: BuildTruthTaus.h:141
TauAnalysisTools::BuildTruthTaus::m_truthMatchingMode
bool m_truthMatchingMode
Definition: BuildTruthTaus.h:145
TauAnalysisTools::BuildTruthTaus::m_bWriteDecayModeVector
Gaudi::Property< bool > m_bWriteDecayModeVector
Definition: BuildTruthTaus.h:121
TauAnalysisTools::BuildTruthTaus::m_bWriteVisibleChargedFourMomentum
Gaudi::Property< bool > m_bWriteVisibleChargedFourMomentum
Definition: BuildTruthTaus.h:119
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
SG::VarHandleKey::empty
bool empty() const
Test if the key is blank.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:150
TauAnalysisTools::BuildTruthTaus::m_typeReadDecorKey
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer > m_typeReadDecorKey
Definition: BuildTruthTaus.h:135
xAOD::TruthVertex_v1::y
float y() const
Vertex y displacement.
TauAnalysisTools::BuildTruthTaus::m_classificationReadDecorKey
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer > m_classificationReadDecorKey
Definition: BuildTruthTaus.h:137
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:274
MC::isPhysical
bool isPhysical(const T &p)
Identify if the particle is physical, i.e. is stable or decayed.
Definition: HepMCHelpers.h:51
TauAnalysisTools::BuildTruthTaus::m_linkDecoratorKey
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_linkDecoratorKey
Definition: BuildTruthTaus.h:139
TauAnalysisTools::BuildTruthTaus::TauTruthInfo::m_vProdVertex
TVector3 m_vProdVertex
Definition: BuildTruthTaus.h:97
xAOD::TruthParticle_v1::hasDecayVtx
bool hasDecayVtx() const
Check for a decay vertex on this particle.
TauAnalysisTools::BuildTruthTaus::buildTruthTausFromTruthParticles
StatusCode buildTruthTausFromTruthParticles(TruthTausEvent &truthTausEvent, const EventContext &ctx) const
Definition: BuildTruthTaus.cxx:162
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
xAOD::TruthParticle_v1::e
virtual double e() const override final
The total energy of the particle.
SG::ReadDecorHandle
Handle class for reading a decoration on an object.
Definition: StoreGate/StoreGate/ReadDecorHandle.h:94
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition: Decorator.h:59
SG::ReadDecorHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TauAnalysisTools::BuildTruthTaus::m_bTruthTauAvailable
bool m_bTruthTauAvailable
Definition: BuildTruthTaus.h:113
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:37
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:100
xAOD::TruthParticle_v1::hasProdVtx
bool hasProdVtx() const
Check for a production vertex on this particle.
Definition: TruthParticle_v1.cxx:69
HepMC::uniqueID
int uniqueID(const T &p)
Definition: MagicNumbers.h:116
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
xAOD::TruthParticle_v1::isTau
bool isTau() const
Whether the particle is a tau (or antitau)
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
TauAnalysisTools::BuildTruthTaus::TauTruthInfo::m_iNChargedPions
size_t m_iNChargedPions
Definition: BuildTruthTaus.h:81
WriteDecorHandle.h
Handle class for adding a decoration to an object.
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
xAOD::TruthParticle_v1::isCharged
bool isCharged() const
Whether the particle is electrically charged.
BuildTruthTaus.h
TauAnalysisTools::BuildTruthTaus::m_originReadDecorKey
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer > m_originReadDecorKey
Definition: BuildTruthTaus.h:134
TruthVertex.h
xAOD::TruthParticle_v1::decayVtx
const TruthVertex_v1 * decayVtx() const
The decay vertex of this particle.
xAOD::TruthParticle_v1::prodVtx
const TruthVertex_v1 * prodVtx() const
The production vertex of this particle.
Definition: TruthParticle_v1.cxx:75
xAOD::TruthVertex_v1
Class describing a truth vertex in the MC record.
Definition: TruthVertex_v1.h:37
TauAnalysisTools::BuildTruthTaus::m_truthTausEvent
TruthTausEvent m_truthTausEvent
Definition: BuildTruthTaus.h:110
TauAnalysisTools::BuildTruthTaus::m_outcomeReadDecorKey
SG::ReadDecorHandleKey< xAOD::TruthParticleContainer > m_outcomeReadDecorKey
Definition: BuildTruthTaus.h:136
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
MagicNumbers.h
ReadHandle.h
Handle class for reading from StoreGate.
TauAnalysisTools::BuildTruthTaus::m_truthTauInputContainer
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthTauInputContainer
Definition: BuildTruthTaus.h:125
Accessor.h
Helper class to provide type-safe access to aux data.
SG::VarHandleBase::key
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx:64
TauAnalysisTools::BuildTruthTaus::TauTruthInfo::m_vTruthVisTLVNeutral
TLorentzVector m_vTruthVisTLVNeutral
Definition: BuildTruthTaus.h:93
EventInfo.h
xAOD::TruthVertex_v1::x
float x() const
Vertex x displacement.
TauAnalysisTools::BuildTruthTaus::m_classificationDecoratorKey
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_classificationDecoratorKey
Definition: BuildTruthTaus.h:143
TauAnalysisTools::BuildTruthTaus::m_truthJetContainer
SG::ReadHandleKey< xAOD::JetContainer > m_truthJetContainer
Definition: BuildTruthTaus.h:129
xAOD::TruthParticle_v1::status
int status() const
Status code.
MC::isStable
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
Definition: HepMCHelpers.h:45
SG::WriteDecorHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
TauAnalysisTools::BuildTruthTaus::m_truthMuonContainer
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthMuonContainer
Definition: BuildTruthTaus.h:128
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
MC::isDecayed
bool isDecayed(const T &p)
Identify if the particle decayed.
Definition: HepMCHelpers.h:42
xAOD::TruthVertex_v1::z
float z() const
Vertex longitudinal distance along the beam line form the origin.
ReadDecorHandle.h
Handle class for reading a decoration on an object.
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:567
TauAnalysisTools::BuildTruthTaus::m_outcomeDecoratorKey
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_outcomeDecoratorKey
Definition: BuildTruthTaus.h:142
TauAnalysisTools::BuildTruthTaus::m_bWriteVisibleNeutralFourMomentum
Gaudi::Property< bool > m_bWriteVisibleNeutralFourMomentum
Definition: BuildTruthTaus.h:120
TauAnalysisTools::BuildTruthTaus::TauTruthInfo::m_iNNeutralOthers
size_t m_iNNeutralOthers
Definition: BuildTruthTaus.h:84
xAOD::TruthParticle_v1::isNeutrino
bool isNeutrino() const
Whether the particle is a neutrino (or antineutrino)
TauAnalysisTools::BuildTruthTaus::TauTruthInfo::m_iNChargedDaughters
size_t m_iNChargedDaughters
Definition: BuildTruthTaus.h:85
TauAnalysisTools::BuildTruthTaus::m_truthParticleContainer
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthParticleContainer
Definition: BuildTruthTaus.h:126
TauAnalysisTools::BuildTruthTaus::m_originDecoratorKey
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_originDecoratorKey
Definition: BuildTruthTaus.h:140
xAOD::TruthParticle_v1::p4
virtual FourMom_t p4() const override final
The full 4-momentum of the particle.
Definition: TruthParticle_v1.cxx:191
xAOD::TruthParticle_v1::pdgId
int pdgId() const
PDG ID code.
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:30
TauAnalysisTools::BuildTruthTaus::examineTruthTauDecay
StatusCode examineTruthTauDecay(const xAOD::TruthParticle &xTruthParticle, TauTruthInfo &truthInfo) const
Definition: BuildTruthTaus.cxx:339
xAOD::TruthParticle_v1::isNeutral
bool isNeutral() const
Whether the particle is electrically neutral.
xAOD::TruthVertex_v1::outgoingParticle
const TruthParticle_v1 * outgoingParticle(size_t index) const
Get one of the outgoing particles.
Definition: TruthVertex_v1.cxx:120
xAOD::TruthParticle_v1::isHadron
bool isHadron() const
Whether the particle is a hadron.