ATLAS Offline Software
Loading...
Searching...
No Matches
KeepChildrenTruthStrategy.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
6// KeepChildrenTruthStrategy.cxx, (c) ATLAS Detector software
8
9// class header include
11
12// ISF includes
15
16// For BSM helper
18
19
21ISF::KeepChildrenTruthStrategy::KeepChildrenTruthStrategy(const std::string& t, const std::string& n, const IInterface* p)
22 : base_class(t,n,p)
30 , m_bsmParent(false)
33{
34 // if set to true, kinetic cuts are passed even if only child particles pass them
35 // (used for special cases such as de-excitation)
36 declareProperty("VertexTypes" , m_vertexTypesVector );
37 declareProperty("VertexTypeRangeLow" , m_vertexTypeRangeLow );
38 declareProperty("VertexTypeRangeHigh" , m_vertexTypeRangeHigh );
39 declareProperty("PassProcessCategory", m_passProcessCategory=9);
40 declareProperty("ParentPDGCodes" , m_parentPdgCodesVector );
41 declareProperty("BSMParent" , m_bsmParent );
42}
43
48
49// Athena algtool's Hooks
51{
52 ATH_MSG_VERBOSE("Initializing ...");
53
54 // VertexTypeRanges:
55 //
56 // check whether user input makes sense:
58 ATH_MSG_ERROR("The given parameter VertexTypeRangeLow is bigger than VertexTypeRangeHigh. ABORT");
59 return StatusCode::FAILURE;
60 }
61 // the length of the given vertex type range
63 // if neither lower now upper range limit given, disable range check
65
66 // fill PDG code std::set used for optimized search
68
69 // fill vertex type std::set used for optimized search
71
72 return StatusCode::SUCCESS;
73}
74
76
77 // check whether parent PDG code matches with any of the given ones
78 // Could require BSM parents and hit BSM, or give a list and be on the list
79 // Or require neither and apply to everything
80 if ( !( (m_bsmParent && MC::isBSM(abs(ti.parentPdgCode()))) || // BSM parent and parent is BSM
81 (m_parentPdgCodes.size() && m_parentPdgCodes.find(ti.parentPdgCode())==m_parentPdgCodes.end()) || // Explicit list and parent in the list
82 (!m_bsmParent && !m_parentPdgCodes.size()) ) ){ // Neither BSM parent nor explicit list -- allow all
83 return false;
84 }
85
86 // vertex type check
87 // ----
88 int vxtype = ti.physicsProcessCode();
89 int processCategory = ti.physicsProcessCategory(); // == G4ProcessType
90 if ((processCategory!=m_passProcessCategory && m_passProcessCategory!=0) && // Not in the category we were after
91 (m_doVertexRangeCheck || m_vertexTypes.size()) ){ // Should do the category check
92 // (part 1) vxtype in given range?: this is a small performance trick (only one comparison operator to check if within range)
93 // -> exactly equivalent to: m_doVertexRangeCheck && (m_vertexTypeLow<=vxtype) && (vxtype<=m_vertexTypeRangeHigh)
94 bool vtxTypeRangePassed = m_doVertexRangeCheck && ( unsigned(vxtype-m_vertexTypeRangeLow) < m_vertexTypeRangeLength );
95 // (part 2) if not in range or range check disabled, check whether vxtype
96 // std::set contains the given vertex type
97 if ( (!vtxTypeRangePassed) && (m_vertexTypes.find(vxtype)==m_vertexTypes.end()) ) {
98 // vxtype not registered -> not passed
99 return false;
100 }
101 }
102
103 // all cuts passed. Save all children.
104 for (unsigned short i=0;i<ti.numberOfChildren();++i){
106 }
107
108 // This strategy does not cause the *saving* of a vertex -- it only changes the strategy for the children
109 return false;
110}
111
113{
114 // This applies to all regions, since it is only a modifier
115 return true;
116}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
ATLAS-specific HepMC functions.
ISF interface class for TruthIncidents.
virtual int physicsProcessCategory() const =0
Return category of the physics process represented by the truth incident (eg hadronic,...
virtual int physicsProcessCode() const =0
Return specific physics process code of the truth incident (eg ionisation, bremsstrahlung,...
virtual int parentPdgCode() const =0
Return the PDG Code of the parent particle.
void setChildPassedFilters(unsigned short index)
Record that a particular child passed a check.
unsigned short numberOfChildren() const
Return total number of child particles.
VertexTypesSet m_vertexTypes
optimized for search
KeepChildrenTruthStrategy(const std::string &t, const std::string &n, const IInterface *p)
Constructor with parameters.
PDGCodesVector m_parentPdgCodesVector
PDG code checks.
VertexTypesVector m_vertexTypesVector
vertex type (physics code) checks
PDGCodesSet m_parentPdgCodes
optimized for search
virtual bool appliesToRegion(unsigned short) const override
true if the strategy applies to this region
bool pass(ITruthIncident &incident) const override
true if the ITruthStrategy implementation applies to the given ITruthIncident
bool isBSM(const T &p)
APID: graviton and all Higgs extensions are BSM.