15 {
16
17testAthenaPhotonAlg::testAthenaPhotonAlg(
const std::string& name, ISvcLocator* pSvcLocator ) :
AthAlgorithm(
name, pSvcLocator ), m_photonSF(
"CP::AsgPhotonEfficiencyCorrectionTool/AsgPhotonEfficiencyCorrectionTool",this){
18
19
20 declareProperty( "PhotonEfficiencyCorrectionTool", m_photonSF );
21}
22
23testAthenaPhotonAlg::~testAthenaPhotonAlg() = default;
24
25
28
30 return StatusCode::SUCCESS;
31}
32
35
37 return StatusCode::SUCCESS;
38}
39
40StatusCode testAthenaPhotonAlg::execute(
const EventContext& ) {
42
43
44
45
47
48
49
50 ATH_CHECK( evtStore()->retrieve( eventInfo) );
51
52
53
54
58 }
59 if(!isMC)
ATH_MSG_ERROR(
"This is data, no scale factors should be used on the data!");
60
61
62
63
65 ATH_CHECK( evtStore()->retrieve( photons,
"Photons") );
67
68
70
71
72 auto umyphotons = std::make_unique<xAOD::PhotonContainer>();
73 auto myphotonsAux = std::make_unique<xAOD::PhotonAuxContainer>();
74
75 umyphotons->setStore( myphotonsAux.get() );
76
77
78
80 ATH_CHECK( evtStore()->record(std::move(umyphotons),
"MyPhotons" ) );
81 ATH_CHECK( evtStore()->record(std::move(myphotonsAux),
"MyPhotonsAux" ) );
82
83
85
86
87
88 ATH_MSG_DEBUG(
" photon pt = " << ph->pt() <<
", photon eta = " << ph->eta() );
89
91 if(!m_photonSF->getEfficiencyScaleFactor(*ph,SF)){
93 continue;
94 }
95 if(!m_photonSF->getEfficiencyScaleFactorError(*ph,SFerr)){
97 continue;
98 }
99 ATH_MSG_DEBUG(
" photon SF = " << SF <<
", photon SF sys error = " << SFerr );
100
101
103 ATH_MSG_ERROR(
"PhotonEfficiencyCorrectionTool reported a CP::CorrectionCode::Error");
104 return StatusCode::FAILURE;
105 }
106
107
108 myphotons->
push_back(std::make_unique<xAOD::Photon>());
109 *(myphotons->
back()) = *ph;
110}
111
112 return StatusCode::SUCCESS;
113}
114}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_INFO(x,...)
Base class from which non-reentrant (not thread-safe) Athena algorithm classes should be derived.
@ Error
Some error happened during the object correction.
const T * back() const
Access the last element in the collection as an rvalue.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
bool eventType(EventType type) const
Check for one particular bitmask value.
@ IS_SIMULATION
true: simulation, false: data
::StatusCode StatusCode
StatusCode definition for legacy code.
const float SF[NF]
Cross sections for Fluor.
PhotonContainer_v1 PhotonContainer
Definition of the current "photon container version".
EventInfo_v1 EventInfo
Definition of the latest event info version.
ShallowCopyResult_t< T > shallowCopy(const T &cont, const EventContext &ctx)
Create a shallow copy of an existing container.
Photon_v1 Photon
Definition of the current "egamma version".