ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
ISF::KeepChildrenTruthStrategy Class Referencefinal

#include <KeepChildrenTruthStrategy.h>

Inheritance diagram for ISF::KeepChildrenTruthStrategy:
Collaboration diagram for ISF::KeepChildrenTruthStrategy:

Public Member Functions

 KeepChildrenTruthStrategy (const std::string &t, const std::string &n, const IInterface *p)
 Constructor with parameters. More...
 
 ~KeepChildrenTruthStrategy ()
 Destructor. More...
 
StatusCode initialize () override
 
bool pass (ITruthIncident &incident) const override
 true if the ITruthStrategy implementation applies to the given ITruthIncident More...
 
virtual bool appliesToRegion (unsigned short) const override
 true if the strategy applies to this region More...
 

Private Attributes

VertexTypesVector m_vertexTypesVector
 vertex type (physics code) checks More...
 
VertexTypesSet m_vertexTypes
 optimized for search More...
 
bool m_doVertexRangeCheck
 
int m_vertexTypeRangeLow
 
int m_vertexTypeRangeHigh
 
unsigned m_vertexTypeRangeLength
 
int m_passProcessCategory
 
bool m_bsmParent
 Apply to BSM parents. More...
 
PDGCodesVector m_parentPdgCodesVector
 PDG code checks. More...
 
PDGCodesSet m_parentPdgCodes
 optimized for search More...
 

Detailed Description

A modifier for the purposes of truth strategies defining cases in which we should keep all the children of an interaction.

Author
Zach.Marshall -at- cern.ch

Definition at line 35 of file KeepChildrenTruthStrategy.h.

Constructor & Destructor Documentation

◆ KeepChildrenTruthStrategy()

ISF::KeepChildrenTruthStrategy::KeepChildrenTruthStrategy ( const std::string &  t,
const std::string &  n,
const IInterface *  p 
)

Constructor with parameters.

Constructor.

Definition at line 21 of file KeepChildrenTruthStrategy.cxx.

22  : base_class(t,n,p)
24  , m_vertexTypes()
25  , m_doVertexRangeCheck(false)
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 }

◆ ~KeepChildrenTruthStrategy()

ISF::KeepChildrenTruthStrategy::~KeepChildrenTruthStrategy ( )

Destructor.

Definition at line 45 of file KeepChildrenTruthStrategy.cxx.

46 {
47 }

Member Function Documentation

◆ appliesToRegion()

bool ISF::KeepChildrenTruthStrategy::appliesToRegion ( unsigned short  ) const
overridevirtual

true if the strategy applies to this region

Definition at line 112 of file KeepChildrenTruthStrategy.cxx.

113 {
114  // This applies to all regions, since it is only a modifier
115  return true;
116 }

◆ initialize()

StatusCode ISF::KeepChildrenTruthStrategy::initialize ( )
override

Definition at line 50 of file KeepChildrenTruthStrategy.cxx.

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 }

◆ pass()

bool ISF::KeepChildrenTruthStrategy::pass ( ITruthIncident incident) const
override

true if the ITruthStrategy implementation applies to the given ITruthIncident

Definition at line 75 of file KeepChildrenTruthStrategy.cxx.

75  {
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){
105  ti.setChildPassedFilters(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 }

Member Data Documentation

◆ m_bsmParent

bool ISF::KeepChildrenTruthStrategy::m_bsmParent
private

Apply to BSM parents.

Definition at line 63 of file KeepChildrenTruthStrategy.h.

◆ m_doVertexRangeCheck

bool ISF::KeepChildrenTruthStrategy::m_doVertexRangeCheck
private

Definition at line 58 of file KeepChildrenTruthStrategy.h.

◆ m_parentPdgCodes

PDGCodesSet ISF::KeepChildrenTruthStrategy::m_parentPdgCodes
private

optimized for search

Definition at line 66 of file KeepChildrenTruthStrategy.h.

◆ m_parentPdgCodesVector

PDGCodesVector ISF::KeepChildrenTruthStrategy::m_parentPdgCodesVector
private

PDG code checks.

Python property

Definition at line 65 of file KeepChildrenTruthStrategy.h.

◆ m_passProcessCategory

int ISF::KeepChildrenTruthStrategy::m_passProcessCategory
private

Definition at line 62 of file KeepChildrenTruthStrategy.h.

◆ m_vertexTypeRangeHigh

int ISF::KeepChildrenTruthStrategy::m_vertexTypeRangeHigh
private

Definition at line 60 of file KeepChildrenTruthStrategy.h.

◆ m_vertexTypeRangeLength

unsigned ISF::KeepChildrenTruthStrategy::m_vertexTypeRangeLength
private

Definition at line 61 of file KeepChildrenTruthStrategy.h.

◆ m_vertexTypeRangeLow

int ISF::KeepChildrenTruthStrategy::m_vertexTypeRangeLow
private

Definition at line 59 of file KeepChildrenTruthStrategy.h.

◆ m_vertexTypes

VertexTypesSet ISF::KeepChildrenTruthStrategy::m_vertexTypes
private

optimized for search

Definition at line 57 of file KeepChildrenTruthStrategy.h.

◆ m_vertexTypesVector

VertexTypesVector ISF::KeepChildrenTruthStrategy::m_vertexTypesVector
private

vertex type (physics code) checks

Python property

Definition at line 56 of file KeepChildrenTruthStrategy.h.


The documentation for this class was generated from the following files:
isBSM
bool isBSM(const T &p)
APID: graviton and all Higgs extensions are BSM.
Definition: AtlasPID.h:591
ISF::KeepChildrenTruthStrategy::m_doVertexRangeCheck
bool m_doVertexRangeCheck
Definition: KeepChildrenTruthStrategy.h:58
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
ISF::KeepChildrenTruthStrategy::m_vertexTypeRangeLength
unsigned m_vertexTypeRangeLength
Definition: KeepChildrenTruthStrategy.h:61
ISF::KeepChildrenTruthStrategy::m_passProcessCategory
int m_passProcessCategory
Definition: KeepChildrenTruthStrategy.h:62
xAOD::unsigned
unsigned
Definition: RingSetConf_v1.cxx:662
ISF::KeepChildrenTruthStrategy::m_vertexTypes
VertexTypesSet m_vertexTypes
optimized for search
Definition: KeepChildrenTruthStrategy.h:57
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:731
ISF::KeepChildrenTruthStrategy::m_parentPdgCodes
PDGCodesSet m_parentPdgCodes
optimized for search
Definition: KeepChildrenTruthStrategy.h:66
ISF::KeepChildrenTruthStrategy::m_bsmParent
bool m_bsmParent
Apply to BSM parents.
Definition: KeepChildrenTruthStrategy.h:63
ISF::KeepChildrenTruthStrategy::m_parentPdgCodesVector
PDGCodesVector m_parentPdgCodesVector
PDG code checks.
Definition: KeepChildrenTruthStrategy.h:65
ISF::KeepChildrenTruthStrategy::m_vertexTypeRangeHigh
int m_vertexTypeRangeHigh
Definition: KeepChildrenTruthStrategy.h:60
ISF::KeepChildrenTruthStrategy::m_vertexTypesVector
VertexTypesVector m_vertexTypesVector
vertex type (physics code) checks
Definition: KeepChildrenTruthStrategy.h:56
ISF::KeepChildrenTruthStrategy::m_vertexTypeRangeLow
int m_vertexTypeRangeLow
Definition: KeepChildrenTruthStrategy.h:59