ATLAS Offline Software
Loading...
Searching...
No Matches
PhotonTruthAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5// $Id$
12
13
14#include "PhotonTruthAlg.h"
15#include "PhotonTruthTool.h"
17#include "xAODEgamma/Photon.h"
19
20
21namespace D3PD {
22
23
24PhotonTruthAlg::PhotonTruthAlg (const std::string& name,
25 ISvcLocator* svcloc)
26 : AthAlgorithm (name, svcloc),
27 m_truthTool ("D3PD::PhotonTruthTool", this),
28 m_photonGetter (this)
29{
30 declareProperty ("AuxPrefix", m_auxPrefix,
31 "Prefix to add to aux data items.");
32 declareProperty ("TruthTool", m_truthTool,
33 "Photon truth analysis tool instance.");
34 declareProperty ("PhotonGetter", m_photonGetter,
35 "Getter instance for the input photon objects.");
36 declareProperty ("AllowMissing", m_allowMissing = false,
37 "If true, don't complain if input objects are missing.");
38}
39
40
45{
46 CHECK( AthAlgorithm::initialize() );
47 CHECK( m_truthTool.retrieve() );
48 CHECK( m_photonGetter.retrieve() );
49 CHECK( m_photonGetter->configureD3PD<xAOD::Photon>() );
50 return StatusCode::SUCCESS;
51}
52
53
58{
59#define DECOR(TYPE,N) xAOD::Photon::Decorator<TYPE> N (m_auxPrefix + #N)
60 DECOR(bool, truth_isConv);
61 DECOR(float, truth_Rconv);
62 DECOR(float, truth_zconv);
63 DECOR(bool, truth_isPhotonFromHardProc);
64 DECOR(bool, truth_isFromHardProc);
65 DECOR(bool, truth_isBrem);
66#undef DECOR
67
69 while (const xAOD::Photon* g =
71 {
72 const xAOD::TruthParticle* p = m_truthTool->toTruthParticle (*g);
73
74 truth_isConv(*g) = m_truthTool->getMCConv (p,
75 truth_Rconv(*g),
76 truth_zconv(*g));
77
78 truth_isPhotonFromHardProc(*g) = m_truthTool->isPromptPhotonMC(p);
79 truth_isFromHardProc(*g) = m_truthTool->isPromptParticleMC(p);
80
81 truth_isBrem(*g) = !truth_isPhotonFromHardProc(*g) && m_truthTool->isQuarkBremMC(p) ;
82
83 m_photonGetter->releaseElement (g);
84 }
85
86 return StatusCode::SUCCESS;
87}
88
89
90} // namespace D3PD
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
Abstract interface to get a collection of objects and iterate over it.
Analyze GenParticle's matching photons and make UD decorations.
Helpers to categorize photon TruthParticle's.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
virtual StatusCode execute()
Standard Gaudi execute method.
ToolHandle< ICollectionGetterTool > m_photonGetter
Property: Getter for input photon objects.
bool m_allowMissing
Property: If true, don't complain if input objects are missing.
PhotonTruthAlg(const std::string &name, ISvcLocator *svcloc)
Standard Gaudi algorithm constructor.
ToolHandle< PhotonTruthTool > m_truthTool
Property: Truth analysis tool.
virtual StatusCode initialize()
Standard Gaudi initialize method.
std::string m_auxPrefix
Property: Prefix to add to aux data items.
#define DECOR(TYPE, N)
Block filler tool for noisy FEB information.
TruthParticle_v1 TruthParticle
Typedef to implementation.
Photon_v1 Photon
Definition of the current "egamma version".