ATLAS Offline Software
Generators
GeneratorFilters
src
xAODMuonFilter.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/xAODMuonFilter.h
"
6
#include "
xAODTruth/TruthParticle.h
"
7
#include "
xAODTruth/TruthParticleContainer.h
"
8
#include "
xAODTruth/TruthParticleAuxContainer.h
"
9
#include "
TruthUtils/HepMCHelpers.h
"
10
11
xAODMuonFilter::xAODMuonFilter
(
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
}
17
18
19
StatusCode
xAODMuonFilter::filterEvent
() {
20
// Retrieve TruthMuons container
21
const
xAOD::TruthParticleContainer
* xTruthParticleContainer;
22
if
(
evtStore
()->
retrieve
(xTruthParticleContainer,
"TruthMuons"
).isFailure()) {
23
ATH_MSG_ERROR
(
"No TruthParticle collection with name "
<<
"TruthMuons"
<<
" found in StoreGate!"
);
24
return
StatusCode::FAILURE;
25
}
26
27
unsigned
int
nParticles = xTruthParticleContainer->
size
();
28
for
(
unsigned
int
iPart=0; iPart<nParticles; ++iPart) {
29
const
xAOD::TruthParticle
*
part
= (*xTruthParticleContainer)[iPart];
30
31
if
(
MC::isStable
(
part
) &&
MC::isMuon
(
part
))
//muon
32
if
(
part
->pt()>=
m_Ptmin
&&
part
->abseta() <=
m_EtaRange
)
33
return
StatusCode::SUCCESS;
34
}
35
setFilterPassed(
false
);
36
return
StatusCode::SUCCESS;
37
}
LArG4FSStartPointFilter.part
part
Definition:
LArG4FSStartPointFilter.py:21
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition:
PyKernel.py:110
xAODMuonFilter::xAODMuonFilter
xAODMuonFilter(const std::string &name, ISvcLocator *pSvcLocator)
Definition:
xAODMuonFilter.cxx:11
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition:
AthCommonDataStore.h:145
TruthParticleContainer.h
xAODMuonFilter.h
xAODMuonFilter::m_EtaRange
double m_EtaRange
Definition:
xAODMuonFilter.h:22
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::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
xAODMuonFilter::m_Ptmin
double m_Ptmin
Definition:
xAODMuonFilter.h:21
MC::isStable
bool isStable(const T &p)
Definition:
HepMCHelpers.h:30
xAODMuonFilter::filterEvent
virtual StatusCode filterEvent()
Definition:
xAODMuonFilter.cxx:19
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