ATLAS Offline Software
Generators
GeneratorFilters
src
xAODMultiLeptonFilter.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
#include "
GeneratorFilters/xAODMultiLeptonFilter.h
"
6
#include "
xAODTruth/TruthParticle.h
"
7
#include "
xAODTruth/TruthParticleContainer.h
"
8
#include "
xAODTruth/TruthParticleAuxContainer.h
"
9
#include "
TruthUtils/HepMCHelpers.h
"
10
11
xAODMultiLeptonFilter::xAODMultiLeptonFilter
(
const
std::string&
name
, ISvcLocator* pSvcLocator)
12
:
GenFilter
(
name
, pSvcLocator)
13
{
14
declareProperty
(
"Ptcut"
,
m_Ptmin
= 10000.);
15
declareProperty
(
"Etacut"
,
m_EtaRange
= 10.0);
16
declareProperty
(
"NLeptons"
,
m_NLeptons
= 4);
17
}
18
19
20
StatusCode
xAODMultiLeptonFilter::filterEvent
() {
21
22
// Retrieve TruthElectrons container
23
const
xAOD::TruthParticleContainer
* xTruthParticleContainerElectron;
24
if
(
evtStore
()->
retrieve
(xTruthParticleContainerElectron,
"TruthElectrons"
).isFailure()) {
25
ATH_MSG_ERROR
(
"No TruthParticle collection with name "
<<
"TruthElectrons"
<<
" found in StoreGate!"
);
26
return
StatusCode::FAILURE;
27
}
28
// Retrieve TruthMuons container
29
const
xAOD::TruthParticleContainer
* xTruthParticleContainerMuon;
30
if
(
evtStore
()->
retrieve
(xTruthParticleContainerMuon,
"TruthMuons"
).isFailure()) {
31
ATH_MSG_ERROR
(
"No TruthParticle collection with name "
<<
"TruthMuons"
<<
" found in StoreGate!"
);
32
return
StatusCode::FAILURE;
33
}
34
int
numLeptons = 0;
35
36
unsigned
int
nParticlesElectrons = xTruthParticleContainerElectron->
size
();
37
for
(
unsigned
int
iPart=0; iPart<nParticlesElectrons; ++iPart) {
38
const
xAOD::TruthParticle
*
part
= (*xTruthParticleContainerElectron)[iPart];
39
40
if
(
MC::isStable
(
part
) &&
MC::isElectron
(
part
))
//electron
41
if
(
part
->pt()>=
m_Ptmin
&&
part
->abseta() <=
m_EtaRange
)
42
{
43
numLeptons += 1;
44
if
(numLeptons >=
m_NLeptons
)
45
{
46
setFilterPassed(
true
);
47
return
StatusCode::SUCCESS;
48
}
49
}
50
}
51
52
unsigned
int
nParticlesMuons = xTruthParticleContainerMuon->
size
();
53
for
(
unsigned
int
iPart=0; iPart<nParticlesMuons; ++iPart) {
54
const
xAOD::TruthParticle
*
part
= (*xTruthParticleContainerMuon)[iPart];
55
56
if
(
MC::isStable
(
part
) &&
MC::isMuon
(
part
))
//Muon
57
if
(
part
->pt()>=
m_Ptmin
&&
part
->abseta() <=
m_EtaRange
)
58
{
59
numLeptons += 1;
60
if
(numLeptons >=
m_NLeptons
)
61
{
62
setFilterPassed(
true
);
63
return
StatusCode::SUCCESS;
64
}
65
}
66
}
67
68
setFilterPassed(
false
);
69
return
StatusCode::SUCCESS;
70
71
}
LArG4FSStartPointFilter.part
part
Definition:
LArG4FSStartPointFilter.py:21
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition:
PyKernel.py:110
xAODMultiLeptonFilter::filterEvent
virtual StatusCode filterEvent()
Definition:
xAODMultiLeptonFilter.cxx:20
xAODMultiLeptonFilter::m_EtaRange
double m_EtaRange
Definition:
xAODMultiLeptonFilter.h:19
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition:
AthCommonDataStore.h:145
TruthParticleContainer.h
xAODMultiLeptonFilter::m_Ptmin
double m_Ptmin
Definition:
xAODMultiLeptonFilter.h:18
xAODMultiLeptonFilter::m_NLeptons
int m_NLeptons
Definition:
xAODMultiLeptonFilter.h:20
xAODMultiLeptonFilter.h
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
xAOD::EgammaHelpers::isElectron
bool isElectron(const xAOD::Egamma *eg)
is the object an electron (not Fwd)
Definition:
EgammaxAODHelpers.cxx:12
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
xAODMultiLeptonFilter::xAODMultiLeptonFilter
xAODMultiLeptonFilter(const std::string &name, ISvcLocator *pSvcLocator)
Definition:
xAODMultiLeptonFilter.cxx:11
MC::isStable
bool isStable(const T &p)
Definition:
HepMCHelpers.h:30
TruthParticle.h
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
HepMCHelpers.h
isMuon
bool isMuon(const T &p)
Definition:
AtlasPID.h:145
Generated on Fri Jul 5 2024 21:33:05 for ATLAS Offline Software by
1.8.18