ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
AnalysisCommon
FsrUtils
src
PhysicsAnalysis/AnalysisCommon/FsrUtils/src/ToolTester.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// EDM include(s):
6
#include "
xAODMuon/MuonContainer.h
"
7
#include "
xAODEgamma/PhotonContainer.h
"
8
#include "
xAODEgamma/ElectronContainer.h
"
9
10
// Local include(s):
11
#include "
ToolTester.h
"
12
#include "TLorentzVector.h"
13
14
namespace
FSR
{
15
16
ToolTester::ToolTester
(
const
std::string& name, ISvcLocator* svcLoc )
17
:
AthAlgorithm
( name, svcLoc ),
18
m_fsrTool
(
"FSR::FsrPhotonTool/FsrPhotonTool"
, this) {
19
//m_ntsvc("THistSvc/THistSvc", name),
20
//m_hist (0){
21
22
declareProperty
(
"SGMuonKey"
,
m_sgMuonKey
=
"Muons"
);
23
declareProperty
(
"SGPhotonKey"
,
m_sgPhotonKey
=
"Photons"
);
24
declareProperty
(
"SGElectronKey"
,
m_sgElectronKey
=
"Electrons"
);
25
declareProperty
(
"FsrPhotonTool"
,
m_fsrTool
);
26
}
27
28
StatusCode
ToolTester::initialize
() {
29
30
// Greet the user:
31
ATH_MSG_INFO
(
"SGMuonKey = "
<<
m_sgMuonKey
);
32
ATH_MSG_INFO
(
"SGPhotonKey = "
<<
m_sgPhotonKey
);
33
ATH_MSG_INFO
(
"SGElectronKey = "
<<
m_sgElectronKey
);
34
ATH_MSG_INFO
(
"FsrPhotonTool = "
<<
m_fsrTool
);
35
36
// Retrieve the tools:
37
ATH_CHECK
(
m_fsrTool
.retrieve() );
38
39
// Return gracefully:
40
return
StatusCode::SUCCESS;
41
}
42
43
StatusCode
ToolTester::execute
(
const
EventContext&
/*ctx*/
) {
44
45
// Retrieve the muons:
46
const
xAOD::MuonContainer
* muons = 0;
47
ATH_CHECK
(
evtStore
()->retrieve( muons,
m_sgMuonKey
) );
48
49
ATH_MSG_INFO
(
"Number of muons: "
<< muons->
size
() );
50
51
// Retrieve photons and electrons
52
xAOD::PhotonContainer
* phs = 0;
53
ATH_CHECK
(
evtStore
()->retrieve( phs,
m_sgPhotonKey
) );
54
ATH_MSG_DEBUG
(
"retrieved photons"
);
55
const
xAOD::ElectronContainer
* els = 0;
56
ATH_CHECK
(
evtStore
()->retrieve( els,
m_sgElectronKey
) );
57
ATH_MSG_DEBUG
(
"retrieved electrons"
);
58
59
std::vector<const xAOD::Muon*> selectedMuons;
60
double
tmp_energy = -999.;
61
double
fsr_energy = 0.;
62
TLorentzVector fsr_tlv;
63
// Loop over them:
64
//
65
xAOD::MuonContainer::const_iterator
mu_itr = muons->
begin
();
66
xAOD::MuonContainer::const_iterator
mu_end = muons->
end
();
67
for
( ; mu_itr != mu_end; ++mu_itr ) {
68
69
70
if
(
m_fsrTool
->getFsrPhoton(*mu_itr,
m_candidate
, phs, els) ==
CP::CorrectionCode::Ok
){
71
ATH_MSG_INFO
(
" FSR m_candidate found !!!!!!!! "
);
72
ATH_MSG_INFO
(
" container = "
<<
m_candidate
.container
73
//const xAOD::IParticle* particle;
74
<<
" deltaR = "
<<
m_candidate
.deltaR
75
<<
" Et = "
<<
m_candidate
.Et
76
<<
" f1 = "
<<
m_candidate
.f1
77
<<
" eta = "
<<
m_candidate
.eta
78
<<
" phi = "
<<
m_candidate
.phi
79
<<
" phIso = "
<<
m_candidate
.phIso
80
<<
" fsrtype = "
<<
m_candidate
.type
81
);
82
}
83
84
if
(
m_candidate
.container ==
"photon"
) {
85
if
(
const
xAOD::Photon
* photon =
dynamic_cast<
const
xAOD::Photon
*
>
(
m_candidate
.particle)){
86
fsr_energy = photon->e();
87
}
else
{
88
ATH_MSG_WARNING
(
"Could not cast to Photon "
);
89
}
90
}
else
if
(
m_candidate
.container ==
"electron"
) {
91
if
(
const
xAOD::Electron
* electron =
dynamic_cast<
const
xAOD::Electron
*
>
(
m_candidate
.particle)){
92
fsr_energy = electron->e();
93
}
else
{
94
ATH_MSG_WARNING
(
"Could not cast to Electron "
);
95
}
96
}
else
{
97
ATH_MSG_INFO
(
" FSR candidate particle is unknown "
);
98
}
99
if
( fsr_energy > tmp_energy ) {
100
tmp_energy = fsr_energy;
101
fsr_tlv.SetPtEtaPhiE(
m_candidate
.Et,
m_candidate
.eta,
m_candidate
.phi, fsr_energy);
102
}
103
104
}
105
106
// Return gracefully:
107
return
StatusCode::SUCCESS;
108
}
109
110
111
}
// namespace FSR
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x,...)
Definition
AthMsgStreamMacros.h:46
ATH_MSG_INFO
#define ATH_MSG_INFO(x,...)
Definition
AthMsgStreamMacros.h:45
ElectronContainer.h
PhotonContainer.h
MuonContainer.h
ToolTester.h
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthCommonAlgorithm< Gaudi::Algorithm >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
Definition
AthCommonDataStore.h:85
CP::CorrectionCode::Ok
@ Ok
The correction was done successfully.
Definition
CorrectionCode.h:38
DataVector< xAOD::Muon_v1 >::const_iterator
DataModel_detail::const_iterator< DataVector > const_iterator
Definition
DataVector.h:838
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
FSR::ToolTester::m_candidate
FsrCandidate m_candidate
Definition
PhysicsAnalysis/AnalysisCommon/FsrUtils/src/ToolTester.h:46
FSR::ToolTester::m_fsrTool
ToolHandle< IFsrPhotonTool > m_fsrTool
Connection to the fsr tool.
Definition
PhysicsAnalysis/AnalysisCommon/FsrUtils/src/ToolTester.h:44
FSR::ToolTester::initialize
virtual StatusCode initialize()
Function initialising the algorithm.
Definition
PhysicsAnalysis/AnalysisCommon/FsrUtils/src/ToolTester.cxx:28
FSR::ToolTester::execute
virtual StatusCode execute(const EventContext &ctx)
Function executing the algorithm.
Definition
PhysicsAnalysis/AnalysisCommon/FsrUtils/src/ToolTester.cxx:43
FSR::ToolTester::ToolTester
ToolTester(const std::string &name, ISvcLocator *svcLoc)
Regular Algorithm constructor.
Definition
PhysicsAnalysis/AnalysisCommon/FsrUtils/src/ToolTester.cxx:16
FSR::ToolTester::m_sgPhotonKey
std::string m_sgPhotonKey
Definition
PhysicsAnalysis/AnalysisCommon/FsrUtils/src/ToolTester.h:40
FSR::ToolTester::m_sgMuonKey
std::string m_sgMuonKey
StoreGate keys for the muon, photon and electron containers to investigate.
Definition
PhysicsAnalysis/AnalysisCommon/FsrUtils/src/ToolTester.h:39
FSR::ToolTester::m_sgElectronKey
std::string m_sgElectronKey
Definition
PhysicsAnalysis/AnalysisCommon/FsrUtils/src/ToolTester.h:41
FSR
Definition
FsrPhotonTool.h:25
xAOD::PhotonContainer
PhotonContainer_v1 PhotonContainer
Definition of the current "photon container version".
Definition
Event/xAOD/xAODEgamma/xAODEgamma/PhotonContainer.h:17
xAOD::ElectronContainer
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
Definition
Event/xAOD/xAODEgamma/xAODEgamma/ElectronContainer.h:17
xAOD::Photon
Photon_v1 Photon
Definition of the current "egamma version".
Definition
Event/xAOD/xAODEgamma/xAODEgamma/Photon.h:17
xAOD::MuonContainer
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
Definition
Event/xAOD/xAODMuon/xAODMuon/MuonContainer.h:14
xAOD::Electron
Electron_v1 Electron
Definition of the current "egamma version".
Definition
Event/xAOD/xAODEgamma/xAODEgamma/Electron.h:17
Generated on
for ATLAS Offline Software by
1.17.0