ATLAS Offline Software
BuildTruthTaus.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // Local include(s)
9 
10 // Core include(s):
11 #include "AthLinks/ElementLink.h"
12 
13 // EDM include(s):
14 #include "xAODTruth/TruthVertex.h"
16 
18 
19 // Tool include(s)
21 
22 using namespace TauAnalysisTools;
23 
24 //=================================PUBLIC-PART==================================
25 //______________________________________________________________________________
26 BuildTruthTaus::BuildTruthTaus( const std::string& name )
27  : AsgMetadataTool(name)
28  , m_tMCTruthClassifier("MCTruthClassifier", this)
29 {
30  declareProperty( "WriteInvisibleFourMomentum", m_bWriteInvisibleFourMomentum = false);
31  declareProperty( "WriteVisibleChargedFourMomentum", m_bWriteVisibleChargedFourMomentum = false);
32  declareProperty( "WriteVisibleNeutralFourMomentum", m_bWriteVisibleNeutralFourMomentum = false);
33  declareProperty( "WriteDecayModeVector", m_bWriteDecayModeVector = true);
34  declareProperty( "WriteVertices", m_bWriteVertices = true);
35 }
36 
37 //______________________________________________________________________________
39 {
40  if (!m_truthMatchingMode) ATH_MSG_INFO( "Initializing BuildTruthTaus, will generate " << m_truthTauOutputContainer.key() << " from " << m_truthParticleContainer.key() << " container" );
41  else ATH_MSG_INFO( "Initializing BuildTruthTaus in truth matching mode, using input container " << m_truthTauInputContainer.key() );
42 
43  // input containers
49  // output container
51 
52  // The following properties are only available in athena
53 #ifndef XAOD_ANALYSIS
54  ATH_CHECK(m_tMCTruthClassifier.setProperty("ParticleCaloExtensionTool", ""));
55  ATH_CHECK(m_tMCTruthClassifier.setProperty("TruthInConeTool", ""));
56 #endif
57 
60 
61  // drop at earliest occasion
63 
64  return StatusCode::SUCCESS;
65 }
66 
67 
69 {
71 }
72 
73 
75 {
76  return retrieveTruthTaus (dynamic_cast<TruthTausEvent&> (truthTausEvent));
77 }
78 
79 
80 StatusCode BuildTruthTaus::retrieveTruthTaus(TruthTausEvent& truthTausEvent) const
81 {
82  const EventContext& ctx = Gaudi::Hive::currentContext();
83 
86  if (!truthElectronsHandle.isValid()) {
87  ATH_MSG_ERROR ("Could not retrieve " << truthElectronsHandle.key());
88  return StatusCode::FAILURE;
89  }
90  truthTausEvent.m_xTruthElectronContainerConst = truthElectronsHandle.cptr();
91  }
92  else {
93  ATH_MSG_WARNING("Truth electron container is not available, won't perform matching to truth electrons");
94  }
95 
96  if (!m_truthMuonContainer.empty()) {
98  if (!truthMuonsHandle.isValid()) {
99  ATH_MSG_ERROR ("Could not retrieve " << truthMuonsHandle.key());
100  return StatusCode::FAILURE;
101  }
102  truthTausEvent.m_xTruthMuonContainerConst = truthMuonsHandle.cptr();
103  }
104  else {
105  ATH_MSG_WARNING("Truth muon container is not available, won't perform matching to truth muons");
106  }
107 
108  if (!m_truthJetContainer.empty()) {
110  if (!truthJetsHandle.isValid()) {
111  ATH_MSG_ERROR ("Could not retrieve " << truthJetsHandle.key());
112  return StatusCode::FAILURE;
113  }
114  truthTausEvent.m_xTruthJetContainerConst = truthJetsHandle.cptr();
115  }
116  else {
117  ATH_MSG_WARNING("Truth jet container is not available, won't perform matching to truth jets");
118  }
119 
120  // if TruthTaus container exists, retrieve it, else build it from TruthParticles
121  if (m_truthMatchingMode) {
123  if (!truthTausHandle.isValid()) {
124  ATH_MSG_ERROR ("Could not retrieve " << truthTausHandle.key());
125  return StatusCode::FAILURE;
126  }
127  truthTausEvent.m_xTruthTauContainerConst = truthTausHandle.cptr();
128  }
129  else {
131  if (!truthParticlesHandle.isValid()) {
132  ATH_MSG_ERROR ("Could not retrieve " << truthParticlesHandle.key());
133  return StatusCode::FAILURE;
134  }
135  truthTausEvent.m_xTruthParticleContainer = truthParticlesHandle.cptr();
136 
137  auto truthTausOutput = std::make_unique<xAOD::TruthParticleContainer>();
138  auto truthTausOutputAux = std::make_unique<xAOD::TruthParticleAuxContainer>();
139  truthTausOutput->setStore(truthTausOutputAux.get());
140  truthTausEvent.m_xTruthTauContainer = truthTausOutput.get();
141 
142  ATH_CHECK( buildTruthTausFromTruthParticles(truthTausEvent) );
143 
144  auto writeHandle = SG::makeHandle(m_truthTauOutputContainer, ctx);
145  ATH_CHECK(writeHandle.record(std::move(truthTausOutput), std::move(truthTausOutputAux)));
146  }
147 
148  return StatusCode::SUCCESS;
149 }
150 
151 //=================================PRIVATE-PART=================================
152 //______________________________________________________________________________
153 //______________________________________________________________________________
155 BuildTruthTaus::buildTruthTausFromTruthParticles(TruthTausEvent& truthTausEvent) const
156 {
157  for (auto xTruthParticle : *truthTausEvent.m_xTruthParticleContainer)
158  {
159  if ( xTruthParticle->isTau() )
160  {
161  xAOD::TruthParticle* xTruthTau = new xAOD::TruthParticle();
162  xTruthTau->makePrivateStore( *xTruthParticle );
163 
164  if ( examineTruthTau(*xTruthTau).isFailure() )
165  {
166  delete xTruthTau;
167  continue;
168  }
169 
170  // Run classification
171  std::pair<MCTruthPartClassifier::ParticleType, MCTruthPartClassifier::ParticleOrigin> pClassification = m_tMCTruthClassifier->particleTruthClassifier(xTruthTau);
172  static const SG::AuxElement::Accessor<unsigned int> decClassifierParticleType("classifierParticleType");
173  static const SG::AuxElement::Accessor<unsigned int> decClassifierParticleOrigin("classifierParticleOrigin");
174  decClassifierParticleType(*xTruthTau) = pClassification.first;
175  decClassifierParticleOrigin(*xTruthTau) = pClassification.second;
176 
177  // create link to the original TruthParticle
178  ElementLink < xAOD::TruthParticleContainer > lTruthParticleLink(xTruthParticle, *truthTausEvent.m_xTruthParticleContainer);
179  static const SG::AuxElement::Accessor<ElementLink< xAOD::TruthParticleContainer > > accOriginalTruthParticle("originalTruthParticle");
180  accOriginalTruthParticle(*xTruthTau) = lTruthParticleLink;
181 
182  truthTausEvent.m_xTruthTauContainer->push_back(xTruthTau);
183  }
184  }
185  return StatusCode::SUCCESS;
186 }
187 
188 //______________________________________________________________________________
190 {
191  // skip this tau if it has no decay vertex, should not happen
192  if ( !xTruthParticle.hasDecayVtx() )
193  return StatusCode::FAILURE;
194 
195  ATH_MSG_VERBOSE("looking for charged daughters of a truth tau");
196 
197  TauTruthInfo truthInfo;
198 
199  const xAOD::TruthVertex* xDecayVertex = xTruthParticle.decayVtx();
200  if (xDecayVertex == nullptr)
201  return StatusCode::FAILURE;
202  for ( size_t iOutgoingParticle = 0; iOutgoingParticle < xDecayVertex->nOutgoingParticles(); ++iOutgoingParticle )
203  {
204  const xAOD::TruthParticle* xTruthDaughter = xDecayVertex->outgoingParticle(iOutgoingParticle);
205  if (xTruthDaughter == nullptr)
206  {
207  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.");
208  return StatusCode::FAILURE;
209  }
210 
211  // if tau decays into tau this is not a proper tau decay
212  if ( xTruthDaughter->isTau() )
213  {
214  ATH_MSG_VERBOSE("Tau decays into a tau itself -> skip this decay");
215  return StatusCode::FAILURE;
216  }
217  }
218 
219  examineTruthTauDecay(xTruthParticle, truthInfo).ignore();
220 
221  if (truthInfo.m_bIsHadronicTau)
222  ATH_MSG_VERBOSE(truthInfo.m_iNChargedDaughters << " prong hadronic truth tau was found with uniqueID "<<HepMC::uniqueID(xTruthParticle));
223  else
224  ATH_MSG_VERBOSE(truthInfo.m_iNChargedDaughters << " prong leptonic truth tau was found with uniqueID "<<HepMC::uniqueID(xTruthParticle));
225  if ( truthInfo.m_iNChargedDaughters%2 == 0 )
226  {
227  ATH_MSG_WARNING("found tau with even multiplicity: " << truthInfo.m_iNChargedDaughters);
228  printDecay(xTruthParticle);
229  }
230 
231  static const SG::AuxElement::Decorator<double> decPtVis("pt_vis");
232  static const SG::AuxElement::Decorator<double> decEtaVis("eta_vis");
233  static const SG::AuxElement::Decorator<double> decPhiVis("phi_vis");
234  static const SG::AuxElement::Decorator<double> decMVis("m_vis");
235 
236  static const SG::AuxElement::Decorator<size_t> decNumCharged("numCharged");
237  static const SG::AuxElement::Decorator<size_t> decNumChargedPion("numChargedPion");
238  static const SG::AuxElement::Decorator<size_t> decNumNeutral("numNeutral");
239  static const SG::AuxElement::Decorator<size_t> decNumNeutralPion("numNeutralPion");
240 
241  decPtVis(xTruthParticle) = truthInfo.m_vTruthVisTLV.Pt();
242  decEtaVis(xTruthParticle) = truthInfo.m_vTruthVisTLV.Eta();
243  decPhiVis(xTruthParticle) = truthInfo.m_vTruthVisTLV.Phi();
244  decMVis(xTruthParticle) = truthInfo.m_vTruthVisTLV.M();
245 
246  decNumCharged(xTruthParticle) = truthInfo.m_iNChargedDaughters;
247  decNumChargedPion(xTruthParticle) = truthInfo.m_iNChargedPions;
248  decNumNeutral(xTruthParticle) = truthInfo.m_iNNeutralPions+truthInfo.m_iNNeutralOthers;
249  decNumNeutralPion(xTruthParticle) = truthInfo.m_iNNeutralPions;
250 
251  static const SG::AuxElement::Decorator<char> decIsHadronicTau("IsHadronicTau");
252  decIsHadronicTau(xTruthParticle) = (char)truthInfo.m_bIsHadronicTau;
253 
255  {
256  TLorentzVector vTruthInvisTLV = xTruthParticle.p4() - truthInfo.m_vTruthVisTLV;
257  static const SG::AuxElement::Decorator<double> decPtInvis("pt_invis");
258  static const SG::AuxElement::Decorator<double> decEtaInvis("eta_invis");
259  static const SG::AuxElement::Decorator<double> decPhiInvis("phi_invis");
260  static const SG::AuxElement::Decorator<double> decMInvis("m_invis");
261  decPtInvis(xTruthParticle) = vTruthInvisTLV.Pt();
262  decEtaInvis(xTruthParticle) = vTruthInvisTLV.Eta();
263  decPhiInvis(xTruthParticle) = vTruthInvisTLV.Phi();
264  decMInvis(xTruthParticle) = vTruthInvisTLV.M();
265  }
266 
268  {
269  static const SG::AuxElement::Decorator<double> decPtVisCharged("pt_vis_charged");
270  static const SG::AuxElement::Decorator<double> decEtaVisCharged("eta_vis_charged");
271  static const SG::AuxElement::Decorator<double> decPhiVisCharged("phi_vis_charged");
272  static const SG::AuxElement::Decorator<double> decMVisCharged("m_vis_charged");
273  decPtVisCharged(xTruthParticle) = truthInfo.m_vTruthVisTLVCharged.Pt();
274  decEtaVisCharged(xTruthParticle) = truthInfo.m_vTruthVisTLVCharged.Eta();
275  decPhiVisCharged(xTruthParticle) = truthInfo.m_vTruthVisTLVCharged.Phi();
276  decMVisCharged(xTruthParticle) = truthInfo.m_vTruthVisTLVCharged.M();
277  }
278 
280  {
281  static const SG::AuxElement::Decorator<double> decPtVisNeutral("pt_vis_neutral");
282  static const SG::AuxElement::Decorator<double> decEtaVisNeutral("eta_vis_neutral");
283  static const SG::AuxElement::Decorator<double> decPhiVisNeutral("phi_vis_neutral");
284  static const SG::AuxElement::Decorator<double> decMVisNeutral("m_vis_neutral");
285  decPtVisNeutral(xTruthParticle) = truthInfo.m_vTruthVisTLVNeutral.Pt();
286  decEtaVisNeutral(xTruthParticle) = truthInfo.m_vTruthVisTLVNeutral.Eta();
287  decPhiVisNeutral(xTruthParticle) = truthInfo.m_vTruthVisTLVNeutral.Phi();
288  decMVisNeutral(xTruthParticle) = truthInfo.m_vTruthVisTLVNeutral.M();
289  }
290 
292  {
293  static const SG::AuxElement::Decorator<std::vector<int> > decDecayModeVector("DecayModeVector");
294  decDecayModeVector(xTruthParticle) = truthInfo.m_vDecayMode;
295  }
296 
297  if ( m_bWriteVertices )
298  {
299  // tau decay vertex
300  static const SG::AuxElement::Decorator<double> decDecayVertexX("decay_vertex_x");
301  static const SG::AuxElement::Decorator<double> decDecayVertexY("decay_vertex_y");
302  static const SG::AuxElement::Decorator<double> decDecayVertexZ("decay_vertex_z");
303 
304  decDecayVertexX(xTruthParticle) = truthInfo.m_vDecayVertex.X();
305  decDecayVertexY(xTruthParticle) = truthInfo.m_vDecayVertex.Y();
306  decDecayVertexZ(xTruthParticle) = truthInfo.m_vDecayVertex.Z();
307 
308  // tau production vertex
309  static const SG::AuxElement::Decorator<double> decProdVertexX("prod_vertex_x");
310  static const SG::AuxElement::Decorator<double> decProdVertexY("prod_vertex_y");
311  static const SG::AuxElement::Decorator<double> decProdVertexZ("prod_vertex_z");
312 
313  decProdVertexX(xTruthParticle) = truthInfo.m_vProdVertex.X();
314  decProdVertexY(xTruthParticle) = truthInfo.m_vProdVertex.Y();
315  decProdVertexZ(xTruthParticle) = truthInfo.m_vProdVertex.Z();
316  }
317 
318  return StatusCode::SUCCESS;
319 }
320 
321 //______________________________________________________________________________
323  TauTruthInfo& truthInfo) const
324 {
325  // get vertex and check if it exists
326  const xAOD::TruthVertex* xDecayVertex = xTruthParticle.decayVtx();
327  if (!xDecayVertex)
328  return StatusCode::SUCCESS;
329 
330  truthInfo.m_vDecayVertex.SetXYZ(xDecayVertex->x(),xDecayVertex->y(),xDecayVertex->z());
331 
332  if (xTruthParticle.hasProdVtx() ) {
333  const xAOD::TruthVertex* xProdVertex = xTruthParticle.prodVtx();
334  truthInfo.m_vProdVertex.SetXYZ(xProdVertex->x(),xProdVertex->y(),xProdVertex->z());
335  } else {
336  truthInfo.m_vProdVertex.SetXYZ(-1234,-1234,-1234);
337  }
338 
339  for ( size_t iOutgoingParticle = 0; iOutgoingParticle < xDecayVertex->nOutgoingParticles(); ++iOutgoingParticle )
340  {
341  const xAOD::TruthParticle* xTruthDaughter = xDecayVertex->outgoingParticle(iOutgoingParticle);
342  if (xTruthDaughter == nullptr)
343  {
344  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.");
345  return StatusCode::FAILURE;
346  }
347 
348  int iAbsPdgId = xTruthDaughter->absPdgId();
349  int iPdgId = xTruthDaughter->pdgId();
350 
351  // look at decay of unstable particles
352  if (MC::isDecayed(xTruthDaughter) || xTruthDaughter->status() == HepMC::HERWIG7INTERMEDIATESTATUS || xTruthDaughter->status() == HepMC::SPECIALSTATUS)
353  {
354  if ( iAbsPdgId != 111 && iAbsPdgId != 311 && iAbsPdgId != 310 && iAbsPdgId != 130 )
355  {
356  examineTruthTauDecay(*xTruthDaughter, truthInfo).ignore();
357  continue;
358  }
359  }
360 
361  // only process stable particles
362  if (!MC::isStable(xTruthDaughter) && !MC::isDecayed(xTruthDaughter))
363  continue;
364 
365  // add pdgID to vector for decay mode classification
366  truthInfo.m_vDecayMode.push_back(iPdgId);
367 
368  // if tau decays leptonically, indicated by an electron/muon neutrino then
369  // it is not a hadronic decay
370  if ( xTruthDaughter->isHadron() )
371  truthInfo.m_bIsHadronicTau = true;
372 
373  // ignore neutrinos for further progress
374  if ( xTruthDaughter->isNeutrino() )
375  {
376  ATH_MSG_VERBOSE("found neutrino decay particle with PdgId "<<iPdgId);
377  continue;
378  }
379 
380  // add momentum of non-neutrino particle to visible momentum
381  truthInfo.m_vTruthVisTLV += xTruthDaughter->p4();
383  if ( xTruthDaughter->isCharged() )
384  truthInfo.m_vTruthVisTLVCharged += xTruthDaughter->p4();
386  if ( xTruthDaughter->isNeutral() )
387  truthInfo.m_vTruthVisTLVNeutral += xTruthDaughter->p4();
388 
389  // only count charged decay particles
390  if ( xTruthDaughter->isCharged() )
391  {
392  ATH_MSG_VERBOSE("found charged decay particle with PdgId "<<iPdgId);
393  truthInfo.m_iNChargedDaughters++;
394  // count charged pions
395  if (iAbsPdgId==211) truthInfo.m_iNChargedPions++;
396  else truthInfo.m_iNChargedOthers++;
397  }
398  else
399  {
400  ATH_MSG_VERBOSE("found neutral decay particle with PdgId "<<iPdgId);
401  // count neutral pions
402  if (iAbsPdgId==111) truthInfo.m_iNNeutralPions++;
403  else truthInfo.m_iNNeutralOthers++;
404  }
405  }
406  return StatusCode::SUCCESS;
407 }
408 
409 void BuildTruthTaus::printDecay(const xAOD::TruthParticle& xTruthParticle, int depth) const
410 {
411  // loop over all decay particles, print their kinematic and other properties
412 
413  const xAOD::TruthVertex* xDecayVertex = xTruthParticle.decayVtx();
414  if (xDecayVertex == nullptr)
415  return;
416 
417  for ( size_t iOutgoingParticle = 0; iOutgoingParticle < xDecayVertex->nOutgoingParticles(); ++iOutgoingParticle )
418  {
419  const xAOD::TruthParticle* xTruthDaughter = xDecayVertex->outgoingParticle(iOutgoingParticle);
420  if (xTruthDaughter == nullptr)
421  {
422  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.");
423  return;
424  }
425  ATH_MSG_WARNING("depth "<<depth
426  <<" e "<<xTruthDaughter->e()
427  <<" eta "<<xTruthDaughter->p4().Eta()
428  <<" phi "<<xTruthDaughter->p4().Phi()
429  <<" pdgid "<<xTruthDaughter->pdgId()
430  <<" status "<<xTruthDaughter->status()
431  <<" uniqueID "<<HepMC::uniqueID(xTruthDaughter));
432  printDecay(*xTruthDaughter, depth+1);
433  }
434 }
TauAnalysisTools::BuildTruthTaus::examineTruthTau
StatusCode examineTruthTau(const xAOD::TruthParticle &xTruthParticle) const
Definition: BuildTruthTaus.cxx:189
asg::AnaToolHandle::initialize
StatusCode initialize()
initialize the tool
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:78
TauAnalysisTools
Definition: TruthCollectionMakerTau.h:16
TauAnalysisTools::BuildTruthTaus::TauTruthInfo::m_vTruthVisTLV
TLorentzVector m_vTruthVisTLV
Definition: BuildTruthTaus.h:86
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_tMCTruthClassifier
asg::AnaToolHandle< IMCTruthClassifier > m_tMCTruthClassifier
Definition: BuildTruthTaus.h:128
TauAnalysisTools::BuildTruthTaus::m_truthElectronContainer
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthElectronContainer
Definition: BuildTruthTaus.h:115
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
TauAnalysisTools::BuildTruthTaus::TauTruthInfo
Definition: BuildTruthTaus.h:75
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
TauAnalysisTools::BuildTruthTaus::m_bWriteDecayModeVector
bool m_bWriteDecayModeVector
Definition: BuildTruthTaus.h:125
TauAnalysisTools::BuildTruthTaus::TauTruthInfo::m_vDecayVertex
TVector3 m_vDecayVertex
Definition: BuildTruthTaus.h:91
TauAnalysisTools::BuildTruthTaus::printDecay
void printDecay(const xAOD::TruthParticle &xTruthParticle, int depth=0) const
Definition: BuildTruthTaus.cxx:409
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:66
TauAnalysisTools::IBuildTruthTaus::ITruthTausEvent
Declare the interface that the class provides.
Definition: IBuildTruthTaus.h:35
TauAnalysisTools::BuildTruthTaus::m_bWriteVisibleNeutralFourMomentum
bool m_bWriteVisibleNeutralFourMomentum
Definition: BuildTruthTaus.h:124
TauAnalysisTools::BuildTruthTaus::TauTruthInfo::m_iNNeutralPions
size_t m_iNNeutralPions
Definition: BuildTruthTaus.h:77
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
TauAnalysisTools::BuildTruthTaus::TauTruthInfo::m_bIsHadronicTau
bool m_bIsHadronicTau
Definition: BuildTruthTaus.h:83
initialize
void initialize()
Definition: run_EoverP.cxx:894
TauAnalysisTools::BuildTruthTaus::retrieveTruthTaus
virtual StatusCode retrieveTruthTaus() override
Definition: BuildTruthTaus.cxx:68
xAOD::char
char
Definition: TrigDecision_v1.cxx:38
TauAnalysisTools::BuildTruthTaus::TauTruthInfo::m_vDecayMode
std::vector< int > m_vDecayMode
Definition: BuildTruthTaus.h:81
TauAnalysisTools::BuildTruthTaus::TauTruthInfo::m_vTruthVisTLVCharged
TLorentzVector m_vTruthVisTLVCharged
Definition: BuildTruthTaus.h:87
TauAnalysisTools::BuildTruthTaus::m_bWriteVisibleChargedFourMomentum
bool m_bWriteVisibleChargedFourMomentum
Definition: BuildTruthTaus.h:123
TauAnalysisTools::BuildTruthTaus::m_truthTauOutputContainer
SG::WriteHandleKey< xAOD::TruthParticleContainer > m_truthTauOutputContainer
Definition: BuildTruthTaus.h:119
TauAnalysisTools::BuildTruthTaus::m_bWriteInvisibleFourMomentum
bool m_bWriteInvisibleFourMomentum
Definition: BuildTruthTaus.h:122
TauAnalysisTools::BuildTruthTaus::m_truthMatchingMode
bool m_truthMatchingMode
Definition: BuildTruthTaus.h:121
MCTruthClassifier.h
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
ASG_MAKE_ANA_TOOL
#define ASG_MAKE_ANA_TOOL(handle, type)
create the tool in the given tool handle
Definition: AnaToolHandle.h:690
asg::AnaToolHandle::setProperty
StatusCode setProperty(const std::string &property, const T2 &value)
set the given property of the tool.
xAOD::TruthVertex_v1::y
float y() const
Vertex y displacement.
TauAnalysisTools::BuildTruthTaus::m_bWriteVertices
bool m_bWriteVertices
Definition: BuildTruthTaus.h:126
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:269
TauAnalysisTools::BuildTruthTaus::TauTruthInfo::m_vProdVertex
TVector3 m_vProdVertex
Definition: BuildTruthTaus.h:92
xAOD::TruthParticle_v1::hasDecayVtx
bool hasDecayVtx() const
Check for a decay vertex on this particle.
HepMC::SPECIALSTATUS
constexpr int SPECIALSTATUS
Constant that the meaning of which is currently lost, to be recovered...
Definition: MagicNumbers.h:41
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::Decorator
Helper class to provide type-safe access to aux data.
Definition: Decorator.h:58
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:108
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:41
xAOD::TruthParticle
TruthParticle_v1 TruthParticle
Typedef to implementation.
Definition: Event/xAOD/xAODTruth/xAODTruth/TruthParticle.h:15
xAOD::TruthParticle_v1::hasProdVtx
bool hasProdVtx() const
Check for a production vertex on this particle.
Definition: TruthParticle_v1.cxx:74
HepMC::uniqueID
int uniqueID(const T &p)
Definition: MagicNumbers.h:113
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:76
TauAnalysisTools::BuildTruthTaus::buildTruthTausFromTruthParticles
StatusCode buildTruthTausFromTruthParticles(TruthTausEvent &truthTausEvent) const
Definition: BuildTruthTaus.cxx:155
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
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:80
xAOD::TruthVertex_v1
Class describing a truth vertex in the MC record.
Definition: TruthVertex_v1.h:41
TauAnalysisTools::BuildTruthTaus::m_truthTausEvent
TruthTausEvent m_truthTausEvent
Definition: BuildTruthTaus.h:105
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
MagicNumbers.h
ReadHandle.h
Handle class for reading from StoreGate.
TauAnalysisTools::BuildTruthTaus::m_truthTauInputContainer
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthTauInputContainer
Definition: BuildTruthTaus.h:113
SG::AuxElement::makePrivateStore
void makePrivateStore()
Create a new (empty) private store for this object.
Definition: AuxElement.cxx:172
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:88
EventInfo.h
MCTruthClassifier
Definition: MCTruthClassifier.h:56
xAOD::TruthVertex_v1::x
float x() const
Vertex x displacement.
TauAnalysisTools::BuildTruthTaus::m_truthJetContainer
SG::ReadHandleKey< xAOD::JetContainer > m_truthJetContainer
Definition: BuildTruthTaus.h:117
xAOD::TruthParticle_v1::status
int status() const
Status code.
MC::isStable
bool isStable(const T &p)
Definition: HepMCHelpers.h:30
IMCTruthClassifier::particleTruthClassifier
virtual std::pair< MCTruthPartClassifier::ParticleType, MCTruthPartClassifier::ParticleOrigin > particleTruthClassifier(const xAOD::TruthParticle *, MCTruthPartClassifier::Info *info=nullptr) const =0
TauAnalysisTools::BuildTruthTaus::m_truthMuonContainer
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthMuonContainer
Definition: BuildTruthTaus.h:116
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
MC::isDecayed
bool isDecayed(const T &p)
Definition: HepMCHelpers.h:29
xAOD::TruthVertex_v1::z
float z() const
Vertex longitudinal distance along the beam line form the origin.
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:569
HepMC::HERWIG7INTERMEDIATESTATUS
constexpr int HERWIG7INTERMEDIATESTATUS
Definition: MagicNumbers.h:44
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
TauAnalysisTools::BuildTruthTaus::TauTruthInfo::m_iNNeutralOthers
size_t m_iNNeutralOthers
Definition: BuildTruthTaus.h:79
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:80
TauAnalysisTools::BuildTruthTaus::m_truthParticleContainer
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthParticleContainer
Definition: BuildTruthTaus.h:114
xAOD::TruthParticle_v1::p4
virtual FourMom_t p4() const override final
The full 4-momentum of the particle.
Definition: TruthParticle_v1.cxx:196
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:322
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:121
xAOD::TruthParticle_v1::isHadron
bool isHadron() const
Whether the particle is a hadron.