ATLAS Offline Software
Generators
GeneratorFilters
src
xAODPhotonFilter.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// Will pass if there are the specified number of photons with pT and eta in the specified range
6
#include "
GeneratorFilters/xAODPhotonFilter.h
"
7
#include "
xAODTruth/TruthParticle.h
"
8
#include "
xAODTruth/TruthParticleContainer.h
"
9
#include "
xAODTruth/TruthParticleAuxContainer.h
"
10
#include "
TruthUtils/HepMCHelpers.h
"
11
12
xAODPhotonFilter::xAODPhotonFilter
(
const
std::string&
name
, ISvcLocator* pSvcLocator)
13
:
GenFilter
(
name
, pSvcLocator)
14
{
15
declareProperty
(
"PtMin"
,
m_Ptmin
= 10000.);
16
declareProperty
(
"PtMax"
,
m_Ptmax
= 100000000.);
17
declareProperty
(
"EtaCut"
,
m_EtaRange
= 2.50);
18
declareProperty
(
"NPhotons"
,
m_NPhotons
= 2);
19
20
// Backward compatibility aliases
21
declareProperty
(
"Ptcut"
,
m_Ptmin
= 10000.);
22
}
23
24
25
StatusCode
xAODPhotonFilter::filterEvent
() {
26
27
// Retrieve Photon container
28
const
xAOD::TruthParticleContainer
* xTruthParticleContainer;
29
if
(
evtStore
()->
retrieve
(xTruthParticleContainer,
"TruthPhotons"
).isFailure()) {
30
ATH_MSG_ERROR
(
"No TruthParticle collection with name "
<<
"TruthPhotons"
<<
" found in StoreGate!"
);
31
return
StatusCode::FAILURE;
32
}
33
34
int
NPhotons = 0;
35
unsigned
int
nParticles = xTruthParticleContainer->
size
();
36
for
(
unsigned
int
iPart=0; iPart<nParticles; ++iPart) {
37
const
xAOD::TruthParticle
*
part
= (*xTruthParticleContainer)[iPart];
38
39
if
(
MC::isStable
(
part
) &&
MC::isPhoton
(
part
))
//photon
40
if
(
part
->pt()>=
m_Ptmin
&&
part
->pt()<
m_Ptmax
&&
part
->abseta() <=
m_EtaRange
)
41
{
42
NPhotons++;
43
if
(NPhotons >=
m_NPhotons
)
44
{
45
setFilterPassed(
true
);
46
return
StatusCode::SUCCESS;
47
}
48
}
49
50
}
51
setFilterPassed(
false
);
52
return
StatusCode::SUCCESS;
53
54
}
LArG4FSStartPointFilter.part
part
Definition:
LArG4FSStartPointFilter.py:21
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition:
PyKernel.py:110
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition:
AthCommonDataStore.h:145
TruthParticleContainer.h
xAODPhotonFilter::filterEvent
virtual StatusCode filterEvent()
Definition:
xAODPhotonFilter.cxx:25
TruthParticleAuxContainer.h
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition:
AthCommonDataStore.h:85
GenFilter
Base class for event generator filtering modules.
Definition:
GenFilter.h:30
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition:
AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition:
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAODPhotonFilter::m_EtaRange
double m_EtaRange
Definition:
xAODPhotonFilter.h:23
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition:
TruthParticle_v1.h:41
DataVector
Derived DataVector<T>.
Definition:
DataVector.h:581
name
std::string name
Definition:
Control/AthContainers/Root/debug.cxx:195
xAODPhotonFilter::m_NPhotons
int m_NPhotons
Definition:
xAODPhotonFilter.h:24
xAODPhotonFilter.h
MC::isStable
bool isStable(const T &p)
Definition:
HepMCHelpers.h:30
xAOD::EgammaHelpers::isPhoton
bool isPhoton(const xAOD::Egamma *eg)
is the object a photon
Definition:
EgammaxAODHelpers.cxx:21
xAODPhotonFilter::m_Ptmax
double m_Ptmax
Definition:
xAODPhotonFilter.h:22
TruthParticle.h
xAODPhotonFilter::m_Ptmin
double m_Ptmin
Definition:
xAODPhotonFilter.h:21
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
xAODPhotonFilter::xAODPhotonFilter
xAODPhotonFilter(const std::string &name, ISvcLocator *pSvcLocator)
Definition:
xAODPhotonFilter.cxx:12
HepMCHelpers.h
Generated on Fri Jul 5 2024 21:33:06 for ATLAS Offline Software by
1.8.18