ATLAS Offline Software
Loading...
Searching...
No Matches
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
7
8// ISF includes
11
12// For BSM helper
14
15
17ISF::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
24{
25 ATH_MSG_VERBOSE("Initializing ...");
26
27 // VertexTypeRanges:
28 //
29 // check whether user input makes sense:
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
36 // if neither lower now upper range limit given, disable range check
38
39 // fill PDG code std::set used for optimized search
41
42 // fill vertex type std::set used for optimized search
44
45 return StatusCode::SUCCESS;
46}
47
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){
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
86{
87 // This applies to all regions, since it is only a modifier
88 return true;
89}
#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
virtual StatusCode initialize() override final
KeepChildrenTruthStrategy(const std::string &t, const std::string &n, const IInterface *p)
Constructor with parameters.
Gaudi::Property< PDGCodesVector > m_parentPdgCodesVector
PDG code checks.
Gaudi::Property< bool > m_bsmParent
Apply to BSM parents.
virtual bool pass(ITruthIncident &incident) const override final
true if the ITruthStrategy implementation applies to the given ITruthIncident
virtual bool appliesToRegion(unsigned short) const override final
true if the strategy applies to this region
Gaudi::Property< VertexTypesVector > m_vertexTypesVector
vertex type (physics code) checks
PDGCodesSet m_parentPdgCodes
optimized for search
bool isBSM(const T &p)
APID: graviton and all Higgs extensions are BSM.