ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
ISF
ISF_HepMC
ISF_HepMC_Tools
src
KeepChildrenTruthStrategy.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// class header include
6
#include "
KeepChildrenTruthStrategy.h
"
7
8
// ISF includes
9
#include "
ISF_Event/ITruthIncident.h
"
10
#include "
ISF_Event/ISFParticle.h
"
11
12
// For BSM helper
13
#include "
TruthUtils/HepMCHelpers.h
"
14
15
17
ISF::KeepChildrenTruthStrategy::KeepChildrenTruthStrategy
(
const
std::string& t,
const
std::string& n,
const
IInterface* p)
18
: base_class(t,n,p)
19
{
20
}
21
22
// Athena algtool's Hooks
23
StatusCode
ISF::KeepChildrenTruthStrategy::initialize
()
24
{
25
ATH_MSG_VERBOSE
(
"Initializing ..."
);
26
27
// VertexTypeRanges:
28
//
29
// check whether user input makes sense:
30
if
(
m_vertexTypeRangeHigh
<
m_vertexTypeRangeLow
) {
31
ATH_MSG_ERROR
(
"The given parameter VertexTypeRangeLow is bigger than VertexTypeRangeHigh. ABORT"
);
32
return
StatusCode::FAILURE;
33
}
34
// the length of the given vertex type range
35
m_vertexTypeRangeLength
= unsigned(
m_vertexTypeRangeHigh
-
m_vertexTypeRangeLow
) + 1;
36
// if neither lower now upper range limit given, disable range check
37
m_doVertexRangeCheck
=
m_vertexTypeRangeLow
&&
m_vertexTypeRangeHigh
;
38
39
// fill PDG code std::set used for optimized search
40
m_parentPdgCodes
.insert(
m_parentPdgCodesVector
.begin(),
m_parentPdgCodesVector
.end());
41
42
// fill vertex type std::set used for optimized search
43
m_vertexTypes
.insert(
m_vertexTypesVector
.begin(),
m_vertexTypesVector
.end());
44
45
return
StatusCode::SUCCESS;
46
}
47
48
bool
ISF::KeepChildrenTruthStrategy::pass
(
ITruthIncident
& ti)
const
{
49
50
// check whether parent PDG code matches with any of the given ones
51
// Could require BSM parents and hit BSM, or give a list and be on the list
52
// Or require neither and apply to everything
53
if
( !( (
m_bsmParent
&&
MC::isBSM
(abs(ti.
parentPdgCode
()))) ||
// BSM parent and parent is BSM
54
(
m_parentPdgCodes
.size() &&
m_parentPdgCodes
.find(ti.
parentPdgCode
())==
m_parentPdgCodes
.end()) ||
// Explicit list and parent in the list
55
(!
m_bsmParent
&& !
m_parentPdgCodes
.size()) ) ){
// Neither BSM parent nor explicit list -- allow all
56
return
false
;
57
}
58
59
// vertex type check
60
// ----
61
int
vxtype = ti.
physicsProcessCode
();
62
int
processCategory = ti.
physicsProcessCategory
();
// == G4ProcessType
63
if
((processCategory!=
m_passProcessCategory
&&
m_passProcessCategory
!=0) &&
// Not in the category we were after
64
(
m_doVertexRangeCheck
||
m_vertexTypes
.size()) ){
// Should do the category check
65
// (part 1) vxtype in given range?: this is a small performance trick (only one comparison operator to check if within range)
66
// -> exactly equivalent to: m_doVertexRangeCheck && (m_vertexTypeLow<=vxtype) && (vxtype<=m_vertexTypeRangeHigh)
67
bool
vtxTypeRangePassed =
m_doVertexRangeCheck
&& ( unsigned(vxtype-
m_vertexTypeRangeLow
) <
m_vertexTypeRangeLength
);
68
// (part 2) if not in range or range check disabled, check whether vxtype
69
// std::set contains the given vertex type
70
if
( (!vtxTypeRangePassed) && (
m_vertexTypes
.find(vxtype)==
m_vertexTypes
.end()) ) {
71
// vxtype not registered -> not passed
72
return
false
;
73
}
74
}
75
76
// all cuts passed. Save all children.
77
for
(
unsigned
short
i=0;i<ti.
numberOfChildren
();++i){
78
ti.
setChildPassedFilters
(i);
79
}
80
81
// This strategy does not cause the *saving* of a vertex -- it only changes the strategy for the children
82
return
false
;
83
}
84
85
bool
ISF::KeepChildrenTruthStrategy::appliesToRegion
(
unsigned
short
)
const
86
{
87
// This applies to all regions, since it is only a modifier
88
return
true
;
89
}
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
HepMCHelpers.h
ATLAS-specific HepMC functions.
ISFParticle.h
ITruthIncident.h
KeepChildrenTruthStrategy.h
ISF::ITruthIncident
ISF interface class for TruthIncidents.
Definition
ITruthIncident.h:45
ISF::ITruthIncident::physicsProcessCategory
virtual int physicsProcessCategory() const =0
Return category of the physics process represented by the truth incident (eg hadronic,...
ISF::ITruthIncident::physicsProcessCode
virtual int physicsProcessCode() const =0
Return specific physics process code of the truth incident (eg ionisation, bremsstrahlung,...
ISF::ITruthIncident::parentPdgCode
virtual int parentPdgCode() const =0
Return the PDG Code of the parent particle.
ISF::ITruthIncident::setChildPassedFilters
void setChildPassedFilters(unsigned short index)
Record that a particular child passed a check.
Definition
ITruthIncident.h:181
ISF::ITruthIncident::numberOfChildren
unsigned short numberOfChildren() const
Return total number of child particles.
Definition
ITruthIncident.h:139
ISF::KeepChildrenTruthStrategy::m_vertexTypes
VertexTypesSet m_vertexTypes
optimized for search
Definition
KeepChildrenTruthStrategy.h:53
ISF::KeepChildrenTruthStrategy::initialize
virtual StatusCode initialize() override final
Definition
KeepChildrenTruthStrategy.cxx:23
ISF::KeepChildrenTruthStrategy::KeepChildrenTruthStrategy
KeepChildrenTruthStrategy(const std::string &t, const std::string &n, const IInterface *p)
Constructor with parameters.
Definition
KeepChildrenTruthStrategy.cxx:17
ISF::KeepChildrenTruthStrategy::m_parentPdgCodesVector
Gaudi::Property< PDGCodesVector > m_parentPdgCodesVector
PDG code checks.
Definition
KeepChildrenTruthStrategy.h:61
ISF::KeepChildrenTruthStrategy::m_vertexTypeRangeLow
Gaudi::Property< int > m_vertexTypeRangeLow
Definition
KeepChildrenTruthStrategy.h:55
ISF::KeepChildrenTruthStrategy::m_bsmParent
Gaudi::Property< bool > m_bsmParent
Apply to BSM parents.
Definition
KeepChildrenTruthStrategy.h:59
ISF::KeepChildrenTruthStrategy::pass
virtual bool pass(ITruthIncident &incident) const override final
true if the ITruthStrategy implementation applies to the given ITruthIncident
Definition
KeepChildrenTruthStrategy.cxx:48
ISF::KeepChildrenTruthStrategy::appliesToRegion
virtual bool appliesToRegion(unsigned short) const override final
true if the strategy applies to this region
Definition
KeepChildrenTruthStrategy.cxx:85
ISF::KeepChildrenTruthStrategy::m_vertexTypesVector
Gaudi::Property< VertexTypesVector > m_vertexTypesVector
vertex type (physics code) checks
Definition
KeepChildrenTruthStrategy.h:52
ISF::KeepChildrenTruthStrategy::m_parentPdgCodes
PDGCodesSet m_parentPdgCodes
optimized for search
Definition
KeepChildrenTruthStrategy.h:62
ISF::KeepChildrenTruthStrategy::m_vertexTypeRangeHigh
Gaudi::Property< int > m_vertexTypeRangeHigh
Definition
KeepChildrenTruthStrategy.h:56
ISF::KeepChildrenTruthStrategy::m_passProcessCategory
Gaudi::Property< int > m_passProcessCategory
Definition
KeepChildrenTruthStrategy.h:58
ISF::KeepChildrenTruthStrategy::m_vertexTypeRangeLength
unsigned m_vertexTypeRangeLength
Definition
KeepChildrenTruthStrategy.h:57
ISF::KeepChildrenTruthStrategy::m_doVertexRangeCheck
bool m_doVertexRangeCheck
Definition
KeepChildrenTruthStrategy.h:54
MC::isBSM
bool isBSM(const T &p)
APID: graviton and all Higgs extensions are BSM.
Definition
HepMCHelpers.h:853
Generated on
for ATLAS Offline Software by
1.17.0