ATLAS Offline Software
Loading...
Searching...
No Matches
ISF::GenericTruthStrategy Class Referencefinal

A multi-purpose implementation of an ISF TruthStrategy. More...

#include <GenericTruthStrategy.h>

Inheritance diagram for ISF::GenericTruthStrategy:
Collaboration diagram for ISF::GenericTruthStrategy:

Public Member Functions

 GenericTruthStrategy (const std::string &t, const std::string &n, const IInterface *p)
 Constructor with parameters.
 ~GenericTruthStrategy ()=default
 Destructor.
virtual StatusCode initialize () override final
virtual bool pass (ITruthIncident &incident) const override final
 true if the ITruthStrategy implementation applies to the given ITruthIncident
virtual bool appliesToRegion (unsigned short geoID) const override final

Private Attributes

bool m_useParentPt {true}
 parent kinetic energy / transverse momentum cuts (pT is stored as pT^2 which allows for faster comparisons)
double m_parentPt2 {-1.}
Gaudi::Property< double > m_parentPt {this, "ParentMinPt", -1.}
 parent particle
Gaudi::Property< double > m_parentEkin {this, "ParentMinEkin", -1.}
 parent particle
bool m_useChildPt {true}
 child particle kinetic energy / transverse momentum cuts (pT is stored as pT^2 which allows for faster comparisons)
double m_childPt2 {-1.}
Gaudi::Property< double > m_childPt {this, "ChildMinPt", -1.}
 pT momentum cut
Gaudi::Property< double > m_childEkin {this, "ChildMinEkin", -1.}
 Ekin cut.
Gaudi::Property< bool > m_allowChildrenOrParentPass {this, "AllowChildrenOrParentPassKineticCuts", false}
 pass cuts if parent did not
Gaudi::Property< VertexTypesVectorm_vertexTypesVector {this, "VertexTypes", 0}
 vertex type (physics code) checks
VertexTypesSet m_vertexTypes {}
 optimized for search
bool m_doVertexRangeCheck {false}
Gaudi::Property< int > m_vertexTypeRangeLow {this, "VertexTypeRangeLow", 0}
Gaudi::Property< int > m_vertexTypeRangeHigh {this, "VertexTypeRangeHigh", 0}
unsigned m_vertexTypeRangeLength {0}
Gaudi::Property< PDGCodesVectorm_parentPdgCodesVector {this, "ParentPDGCodes", 0}
 PDG code checks.
PDGCodesSet m_parentPdgCodes {}
 optimized for search
IntegerArrayProperty m_regionListProperty {this, "Regions", {}}

Detailed Description

A multi-purpose implementation of an ISF TruthStrategy.

Author
Elmar.Ritsch -at- cern.ch

Definition at line 31 of file GenericTruthStrategy.h.

Constructor & Destructor Documentation

◆ GenericTruthStrategy()

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

Constructor with parameters.

Constructor.

Definition at line 13 of file GenericTruthStrategy.cxx.

13 :
14 base_class(t,n,p)
15{
16}

◆ ~GenericTruthStrategy()

ISF::GenericTruthStrategy::~GenericTruthStrategy ( )
default

Destructor.

Member Function Documentation

◆ appliesToRegion()

bool ISF::GenericTruthStrategy::appliesToRegion ( unsigned short geoID) const
finaloverridevirtual

Definition at line 165 of file GenericTruthStrategy.cxx.

166{
167 return std::find( m_regionListProperty.begin(),
169 geoID ) != m_regionListProperty.end();
170}
IntegerArrayProperty m_regionListProperty

◆ initialize()

StatusCode ISF::GenericTruthStrategy::initialize ( )
finaloverridevirtual

Definition at line 19 of file GenericTruthStrategy.cxx.

20{
21 ATH_MSG_VERBOSE("Initializing ...");
22
23 // (*) setup parent particle cuts
24 // -----
25 // (compute and store the squared cut parameters (faster comparisons))
26 // check whether the user input makes sense (error case)
27 if ( (m_parentPt>=0.) && (m_parentEkin>=0.) ) {
28 ATH_MSG_ERROR("Both, pT and Ekin cuts are given for parent particles. Unclear which one to use! ABORT!");
29 return StatusCode::FAILURE;
30 }
31 // neither pT nor Energy cuts were given (never being used so far)
32 // -> enable pT cut and set it to 0.
33 else if ( (m_parentPt<0.) && (m_parentEkin<0.) ) {
34 // we don't use a flag to disable energy/momentum checks, because
35 // all relevant truth strategies up to now do use such cuts
36 m_useParentPt = true;
37 m_parentPt2 = 0.;
38 m_parentEkin = 0.; // would not be needed actually
39 }
40 // either pT or Ekin cut is given (standard case)
41 else {
42 // enable pT cut if value given (greater than 0.):
45 }
46
47 // (*) setup child particle cuts
48 // -----
49 // (compute and store the squared cut parameters (faster comparisons))
50 // check whether the user input makes sense (error case)
51 if ( (m_childPt>=0.) && (m_childEkin>=0.) ) {
52 ATH_MSG_ERROR("Both, pT and Ekin cuts are given for child particles. Unclear which one to use! ABORT!");
53 return StatusCode::FAILURE;
54 }
55 // neither pT nor Energy cuts were given (never being used so far)
56 // -> enable pT cut and set it to 0.
57 else if ( (m_childPt<0.) && (m_childEkin<0.) ) {
58 // we don't use a flag to disable energy/momentum checks, because
59 // all relevant truth strategies up to now do use such cuts
60 m_useChildPt = true;
61 m_childPt2 = 0.;
62 m_childEkin = 0.; // would not be needed actually
63 }
64 // either pT or Ekin cut is given (standard case)
65 else {
66 // enable pT cut if value given (greater than 0.):
67 m_useChildPt = !(m_childPt<0.);
69 }
70
71 // VertexTypeRanges:
72 //
73 // check whether user input makes sense:
75 ATH_MSG_ERROR("The given parameter VertexTypeRangeLow is bigger than VertexTypeRangeHigh. ABORT");
76 return StatusCode::FAILURE;
77 }
78 // the length of the given vertex type range
80 // if neither lower now upper range limit given, disable range check
82
83
84 // fill PDG code std::set used for optimized search
86
87 // fill vertex type std::set used for optimized search
89
90 for(auto region : m_regionListProperty.value()) {
91 if(region < AtlasDetDescr::fFirstAtlasRegion || region >= AtlasDetDescr::fNumAtlasRegions) {
92 ATH_MSG_ERROR("Unknown Region (" << region << ") specified. Please check your configuration.");
93 return StatusCode::FAILURE;
94 }
95 }
96 return StatusCode::SUCCESS;
97}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
Gaudi::Property< VertexTypesVector > m_vertexTypesVector
vertex type (physics code) checks
bool m_useChildPt
child particle kinetic energy / transverse momentum cuts (pT is stored as pT^2 which allows for faste...
bool m_useParentPt
parent kinetic energy / transverse momentum cuts (pT is stored as pT^2 which allows for faster compar...
Gaudi::Property< double > m_childEkin
Ekin cut.
VertexTypesSet m_vertexTypes
optimized for search
Gaudi::Property< double > m_childPt
pT momentum cut
Gaudi::Property< PDGCodesVector > m_parentPdgCodesVector
PDG code checks.
PDGCodesSet m_parentPdgCodes
optimized for search
Gaudi::Property< int > m_vertexTypeRangeLow
Gaudi::Property< double > m_parentPt
parent particle
Gaudi::Property< double > m_parentEkin
parent particle
Gaudi::Property< int > m_vertexTypeRangeHigh

◆ pass()

bool ISF::GenericTruthStrategy::pass ( ITruthIncident & incident) const
finaloverridevirtual

true if the ITruthStrategy implementation applies to the given ITruthIncident

Definition at line 99 of file GenericTruthStrategy.cxx.

99 {
100
101 // (1.) momentum/energy check
102 // ----
103 //
104 {
105 // check whether parent particle passes cut or not
106 bool primFail = (m_useParentPt) ? (ti.parentPt2()<m_parentPt2)
107 : (ti.parentEkin()<m_parentEkin) ;
108
109
110 // if parent particle failed and strategy does not
111 // allow for child-only pass -> failed
112 if ( ( primFail && (!m_allowChildrenOrParentPass) ) ) {
113 return false;
114 }
115
116 // check child particles
117 bool secPass = m_useChildPt ? ti.childrenPt2Pass(m_childPt2)
118 : ti.childrenEkinPass(m_childEkin);
119
120 // if child particles do not pass cuts
121 if (!secPass) {
123 // child particles were required to pass cuts but did not
124 return false;
125 } else if (primFail) {
126 // neither parent nor child particles passed cuts
127 return false;
128 }
129 }
130
131 }
132
133
134 // (2.) parent particle PDG code check
135 // ----
136 // check whether parent PDG code matches with any of the given ones
137 if ( m_parentPdgCodes.size() &&
138 (m_parentPdgCodes.find(ti.parentPdgCode()) == m_parentPdgCodes.end()) ) {
139
140 // parent particle PDG code not found
141 return false;
142 }
143
144
145 // (3.) vertex type check
146 // ----
147 if ( m_doVertexRangeCheck || m_vertexTypes.size()) {
148 int vxtype = ti.physicsProcessCode();
149
150 // (3.1) vxtype in given range?: this is a small performance trick (only one comparison operator to check if within range)
151 // -> exactly equivalent to: m_doVertexRangeCheck && (m_vertexTypeLow<=vxtype) && (vxtype<=m_vertexTypeRangeHigh)
152 bool vtxTypeRangePassed = m_doVertexRangeCheck && ( unsigned(vxtype-m_vertexTypeRangeLow) < m_vertexTypeRangeLength );
153 // (3.2) if not in range or range check disabled, check whether vxtype
154 // std::set contains the given vertex type
155 if ( (!vtxTypeRangePassed) && (m_vertexTypes.find(vxtype)==m_vertexTypes.end()) ) {
156 // vxtype not registered -> not passed
157 return false;
158 }
159 }
160
161 // all cuts passed
162 return true;
163}
Gaudi::Property< bool > m_allowChildrenOrParentPass
pass cuts if parent did not

Member Data Documentation

◆ m_allowChildrenOrParentPass

Gaudi::Property<bool> ISF::GenericTruthStrategy::m_allowChildrenOrParentPass {this, "AllowChildrenOrParentPassKineticCuts", false}
private

pass cuts if parent did not

Definition at line 65 of file GenericTruthStrategy.h.

65{this, "AllowChildrenOrParentPassKineticCuts", false};

◆ m_childEkin

Gaudi::Property<double> ISF::GenericTruthStrategy::m_childEkin {this, "ChildMinEkin", -1.}
private

Ekin cut.

Definition at line 64 of file GenericTruthStrategy.h.

64{this, "ChildMinEkin", -1.};

◆ m_childPt

Gaudi::Property<double> ISF::GenericTruthStrategy::m_childPt {this, "ChildMinPt", -1.}
private

pT momentum cut

Definition at line 63 of file GenericTruthStrategy.h.

63{this, "ChildMinPt", -1.};

◆ m_childPt2

double ISF::GenericTruthStrategy::m_childPt2 {-1.}
private

Definition at line 62 of file GenericTruthStrategy.h.

62{-1.};

◆ m_doVertexRangeCheck

bool ISF::GenericTruthStrategy::m_doVertexRangeCheck {false}
private

Definition at line 72 of file GenericTruthStrategy.h.

72{false};

◆ m_parentEkin

Gaudi::Property<double> ISF::GenericTruthStrategy::m_parentEkin {this, "ParentMinEkin", -1.}
private

parent particle

Definition at line 57 of file GenericTruthStrategy.h.

57{this, "ParentMinEkin", -1.};

◆ m_parentPdgCodes

PDGCodesSet ISF::GenericTruthStrategy::m_parentPdgCodes {}
private

optimized for search

Definition at line 79 of file GenericTruthStrategy.h.

79{};

◆ m_parentPdgCodesVector

Gaudi::Property<PDGCodesVector> ISF::GenericTruthStrategy::m_parentPdgCodesVector {this, "ParentPDGCodes", 0}
private

PDG code checks.

Python property

Definition at line 78 of file GenericTruthStrategy.h.

78{this, "ParentPDGCodes", 0};

◆ m_parentPt

Gaudi::Property<double> ISF::GenericTruthStrategy::m_parentPt {this, "ParentMinPt", -1.}
private

parent particle

Definition at line 56 of file GenericTruthStrategy.h.

56{this, "ParentMinPt", -1.};

◆ m_parentPt2

double ISF::GenericTruthStrategy::m_parentPt2 {-1.}
private

Definition at line 55 of file GenericTruthStrategy.h.

55{-1.};

◆ m_regionListProperty

IntegerArrayProperty ISF::GenericTruthStrategy::m_regionListProperty {this, "Regions", {}}
private

Definition at line 81 of file GenericTruthStrategy.h.

81{this, "Regions", {}};

◆ m_useChildPt

bool ISF::GenericTruthStrategy::m_useChildPt {true}
private

child particle kinetic energy / transverse momentum cuts (pT is stored as pT^2 which allows for faster comparisons)

use pT or Ekin cuts?

Definition at line 61 of file GenericTruthStrategy.h.

61{true};

◆ m_useParentPt

bool ISF::GenericTruthStrategy::m_useParentPt {true}
private

parent kinetic energy / transverse momentum cuts (pT is stored as pT^2 which allows for faster comparisons)

use pT or Ekin cuts?

Definition at line 54 of file GenericTruthStrategy.h.

54{true};

◆ m_vertexTypeRangeHigh

Gaudi::Property<int> ISF::GenericTruthStrategy::m_vertexTypeRangeHigh {this, "VertexTypeRangeHigh", 0}
private

Definition at line 74 of file GenericTruthStrategy.h.

74{this, "VertexTypeRangeHigh", 0};

◆ m_vertexTypeRangeLength

unsigned ISF::GenericTruthStrategy::m_vertexTypeRangeLength {0}
private

Definition at line 75 of file GenericTruthStrategy.h.

75{0};

◆ m_vertexTypeRangeLow

Gaudi::Property<int> ISF::GenericTruthStrategy::m_vertexTypeRangeLow {this, "VertexTypeRangeLow", 0}
private

Definition at line 73 of file GenericTruthStrategy.h.

73{this, "VertexTypeRangeLow", 0};

◆ m_vertexTypes

VertexTypesSet ISF::GenericTruthStrategy::m_vertexTypes {}
private

optimized for search

Definition at line 71 of file GenericTruthStrategy.h.

71{};

◆ m_vertexTypesVector

Gaudi::Property<VertexTypesVector> ISF::GenericTruthStrategy::m_vertexTypesVector {this, "VertexTypes", 0}
private

vertex type (physics code) checks

Python property

Definition at line 70 of file GenericTruthStrategy.h.

70{this, "VertexTypes", 0};

The documentation for this class was generated from the following files: