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 ()
 Destructor.
virtual StatusCode initialize () override
virtual StatusCode finalize () override
virtual bool pass (ITruthIncident &incident) const override
 true if the ITruthStrategy implementation applies to the given ITruthIncident
virtual bool appliesToRegion (unsigned short geoID) const override

Private Attributes

bool m_useParentPt
 parent kinetic energy / transverse momentum cuts (pT is stored as pT^2 which allows for faster comparisons)
double m_parentPt2
 parent particle
double m_parentEkin
 parent particle
bool m_useChildPt
 child particle kinetic energy / transverse momentum cuts (pT is stored as pT^2 which allows for faster comparisons)
double m_childPt2
 pT momentum cut
double m_childEkin
 Ekin cut.
bool m_allowChildrenOrParentPass
 pass cuts if parent did not
VertexTypesVector m_vertexTypesVector
 vertex type (physics code) checks
VertexTypesSet m_vertexTypes
 optimized for search
bool m_doVertexRangeCheck
int m_vertexTypeRangeLow
int m_vertexTypeRangeHigh
unsigned m_vertexTypeRangeLength
PDGCodesVector m_parentPdgCodesVector
 PDG code checks.
PDGCodesSet m_parentPdgCodes
 optimized for search
IntegerArrayProperty m_regionListProperty

Detailed Description

A multi-purpose implementation of an ISF TruthStrategy.

Author
Elmar.Ritsch -at- cern.ch

Definition at line 35 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 17 of file GenericTruthStrategy.cxx.

17 :
18 base_class(t,n,p),
19 m_useParentPt(true),
20 m_parentPt2(-1.),
21 m_parentEkin(-1.),
22 m_useChildPt(true),
23 m_childPt2(-1.),
24 m_childEkin(-1.),
34{
35 // provide either a pT or Ekin cut for the parent and child particles respectively.
36 // if none are given for either type, it will not use pT or Ekin cuts
37 // (the Pt2 variables get squared in the initialize() method)
38 declareProperty("ParentMinPt" , m_parentPt2 );
39 declareProperty("ParentMinEkin" , m_parentEkin );
40 declareProperty("ChildMinPt" , m_childPt2 );
41 declareProperty("ChildMinEkin" , m_childEkin );
42 // if set to true, kinetic cuts are passed even if only child particles pass them
43 // (used for special cases such as de-excitation)
44 declareProperty("AllowChildrenOrParentPassKineticCuts" , m_allowChildrenOrParentPass );
45 declareProperty("VertexTypes" , m_vertexTypesVector );
46 declareProperty("VertexTypeRangeLow" , m_vertexTypeRangeLow );
47 declareProperty("VertexTypeRangeHigh" , m_vertexTypeRangeHigh );
48 declareProperty("ParentPDGCodes" , m_parentPdgCodesVector );
49 declareProperty("Regions" , m_regionListProperty );
50}
bool m_useChildPt
child particle kinetic energy / transverse momentum cuts (pT is stored as pT^2 which allows for faste...
bool m_allowChildrenOrParentPass
pass cuts if parent did not
IntegerArrayProperty m_regionListProperty
double m_childPt2
pT momentum cut
bool m_useParentPt
parent kinetic energy / transverse momentum cuts (pT is stored as pT^2 which allows for faster compar...
VertexTypesSet m_vertexTypes
optimized for search
double m_parentPt2
parent particle
VertexTypesVector m_vertexTypesVector
vertex type (physics code) checks
PDGCodesSet m_parentPdgCodes
optimized for search
PDGCodesVector m_parentPdgCodesVector
PDG code checks.
double m_parentEkin
parent particle

◆ ~GenericTruthStrategy()

ISF::GenericTruthStrategy::~GenericTruthStrategy ( )

Destructor.

Definition at line 53 of file GenericTruthStrategy.cxx.

54{
55}

Member Function Documentation

◆ appliesToRegion()

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

Definition at line 210 of file GenericTruthStrategy.cxx.

211{
212 return std::find( m_regionListProperty.begin(),
214 geoID ) != m_regionListProperty.end();
215}

◆ finalize()

StatusCode ISF::GenericTruthStrategy::finalize ( )
overridevirtual

Definition at line 138 of file GenericTruthStrategy.cxx.

139{
140 ATH_MSG_VERBOSE("Finalizing ...");
141 return StatusCode::SUCCESS;
142}
#define ATH_MSG_VERBOSE(x)

◆ initialize()

StatusCode ISF::GenericTruthStrategy::initialize ( )
overridevirtual

Definition at line 58 of file GenericTruthStrategy.cxx.

59{
60 ATH_MSG_VERBOSE("Initializing ...");
61
62 // (*) setup parent particle cuts
63 // -----
64 // (compute and store the squared cut parameters (faster comparisons))
65 // check whether the user input makes sense (error case)
66 if ( (m_parentPt2>=0.) && (m_parentEkin>=0.) ) {
67 ATH_MSG_ERROR("Both, pT and Ekin cuts are given for parent particles. Unclear which one to use! ABORT!");
68 return StatusCode::FAILURE;
69 }
70 // neither pT nor Energy cuts were given (never being used so far)
71 // -> enable pT cut and set it to 0.
72 else if ( (m_parentPt2<0.) && (m_parentEkin<0.) ) {
73 // we don't use a flag to disable energy/momentum checks, because
74 // all relevant truth strategies up to now do use such cuts
75 m_useParentPt = true;
76 m_parentPt2 = 0.;
77 m_parentEkin = 0.; // would not be needed actually
78 }
79 // either pT or Ekin cut is given (standard case)
80 else {
81 // enable pT cut if value given (greater than 0.):
84 }
85
86 // (*) setup child particle cuts
87 // -----
88 // (compute and store the squared cut parameters (faster comparisons))
89 // check whether the user input makes sense (error case)
90 if ( (m_childPt2>=0.) && (m_childEkin>=0.) ) {
91 ATH_MSG_ERROR("Both, pT and Ekin cuts are given for child particles. Unclear which one to use! ABORT!");
92 return StatusCode::FAILURE;
93 }
94 // neither pT nor Energy cuts were given (never being used so far)
95 // -> enable pT cut and set it to 0.
96 else if ( (m_childPt2<0.) && (m_childEkin<0.) ) {
97 // we don't use a flag to disable energy/momentum checks, because
98 // all relevant truth strategies up to now do use such cuts
99 m_useChildPt = true;
100 m_childPt2 = 0.;
101 m_childEkin = 0.; // would not be needed actually
102 }
103 // either pT or Ekin cut is given (standard case)
104 else {
105 // enable pT cut if value given (greater than 0.):
106 m_useChildPt = !(m_childPt2<0.);
108 }
109
110 // VertexTypeRanges:
111 //
112 // check whether user input makes sense:
114 ATH_MSG_ERROR("The given parameter VertexTypeRangeLow is bigger than VertexTypeRangeHigh. ABORT");
115 return StatusCode::FAILURE;
116 }
117 // the length of the given vertex type range
119 // if neither lower now upper range limit given, disable range check
121
122
123 // fill PDG code std::set used for optimized search
125
126 // fill vertex type std::set used for optimized search
128
129 for(auto region : m_regionListProperty.value()) {
130 if(region < AtlasDetDescr::fFirstAtlasRegion || region >= AtlasDetDescr::fNumAtlasRegions) {
131 ATH_MSG_ERROR("Unknown Region (" << region << ") specified. Please check your configuration.");
132 return StatusCode::FAILURE;
133 }
134 }
135 return StatusCode::SUCCESS;
136}
#define ATH_MSG_ERROR(x)

◆ pass()

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

true if the ITruthStrategy implementation applies to the given ITruthIncident

Definition at line 144 of file GenericTruthStrategy.cxx.

144 {
145
146 // (1.) momentum/energy check
147 // ----
148 //
149 {
150 // check whether parent particle passes cut or not
151 bool primFail = (m_useParentPt) ? (ti.parentPt2()<m_parentPt2)
152 : (ti.parentEkin()<m_parentEkin) ;
153
154
155 // if parent particle failed and strategy does not
156 // allow for child-only pass -> failed
157 if ( ( primFail && (!m_allowChildrenOrParentPass) ) ) {
158 return false;
159 }
160
161 // check child particles
162 bool secPass = m_useChildPt ? ti.childrenPt2Pass(m_childPt2)
163 : ti.childrenEkinPass(m_childEkin);
164
165 // if child particles do not pass cuts
166 if (!secPass) {
168 // child particles were required to pass cuts but did not
169 return false;
170 } else if (primFail) {
171 // neither parent nor child particles passed cuts
172 return false;
173 }
174 }
175
176 }
177
178
179 // (2.) parent particle PDG code check
180 // ----
181 // check whether parent PDG code matches with any of the given ones
182 if ( m_parentPdgCodes.size() &&
183 (m_parentPdgCodes.find(ti.parentPdgCode()) == m_parentPdgCodes.end()) ) {
184
185 // parent particle PDG code not found
186 return false;
187 }
188
189
190 // (3.) vertex type check
191 // ----
192 if ( m_doVertexRangeCheck || m_vertexTypes.size()) {
193 int vxtype = ti.physicsProcessCode();
194
195 // (3.1) vxtype in given range?: this is a small performance trick (only one comparison operator to check if within range)
196 // -> exactly equivalent to: m_doVertexRangeCheck && (m_vertexTypeLow<=vxtype) && (vxtype<=m_vertexTypeRangeHigh)
197 bool vtxTypeRangePassed = m_doVertexRangeCheck && ( unsigned(vxtype-m_vertexTypeRangeLow) < m_vertexTypeRangeLength );
198 // (3.2) if not in range or range check disabled, check whether vxtype
199 // std::set contains the given vertex type
200 if ( (!vtxTypeRangePassed) && (m_vertexTypes.find(vxtype)==m_vertexTypes.end()) ) {
201 // vxtype not registered -> not passed
202 return false;
203 }
204 }
205
206 // all cuts passed
207 return true;
208}

Member Data Documentation

◆ m_allowChildrenOrParentPass

bool ISF::GenericTruthStrategy::m_allowChildrenOrParentPass
private

pass cuts if parent did not

Definition at line 64 of file GenericTruthStrategy.h.

◆ m_childEkin

double ISF::GenericTruthStrategy::m_childEkin
private

Ekin cut.

Definition at line 63 of file GenericTruthStrategy.h.

◆ m_childPt2

double ISF::GenericTruthStrategy::m_childPt2
private

pT momentum cut

Definition at line 62 of file GenericTruthStrategy.h.

◆ m_doVertexRangeCheck

bool ISF::GenericTruthStrategy::m_doVertexRangeCheck
private

Definition at line 69 of file GenericTruthStrategy.h.

◆ m_parentEkin

double ISF::GenericTruthStrategy::m_parentEkin
private

parent particle

Definition at line 57 of file GenericTruthStrategy.h.

◆ m_parentPdgCodes

PDGCodesSet ISF::GenericTruthStrategy::m_parentPdgCodes
private

optimized for search

Definition at line 76 of file GenericTruthStrategy.h.

◆ m_parentPdgCodesVector

PDGCodesVector ISF::GenericTruthStrategy::m_parentPdgCodesVector
private

PDG code checks.

Python property

Definition at line 75 of file GenericTruthStrategy.h.

◆ m_parentPt2

double ISF::GenericTruthStrategy::m_parentPt2
private

parent particle

Definition at line 56 of file GenericTruthStrategy.h.

◆ m_regionListProperty

IntegerArrayProperty ISF::GenericTruthStrategy::m_regionListProperty
private

Definition at line 78 of file GenericTruthStrategy.h.

◆ m_useChildPt

bool ISF::GenericTruthStrategy::m_useChildPt
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.

◆ m_useParentPt

bool ISF::GenericTruthStrategy::m_useParentPt
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 55 of file GenericTruthStrategy.h.

◆ m_vertexTypeRangeHigh

int ISF::GenericTruthStrategy::m_vertexTypeRangeHigh
private

Definition at line 71 of file GenericTruthStrategy.h.

◆ m_vertexTypeRangeLength

unsigned ISF::GenericTruthStrategy::m_vertexTypeRangeLength
private

Definition at line 72 of file GenericTruthStrategy.h.

◆ m_vertexTypeRangeLow

int ISF::GenericTruthStrategy::m_vertexTypeRangeLow
private

Definition at line 70 of file GenericTruthStrategy.h.

◆ m_vertexTypes

VertexTypesSet ISF::GenericTruthStrategy::m_vertexTypes
private

optimized for search

Definition at line 68 of file GenericTruthStrategy.h.

◆ m_vertexTypesVector

VertexTypesVector ISF::GenericTruthStrategy::m_vertexTypesVector
private

vertex type (physics code) checks

Python property

Definition at line 67 of file GenericTruthStrategy.h.


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