ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
TrkValidation
TrkValTools
src
PrimaryTruthClassifier.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
// PrimaryTruthClassifier.cxx
7
// Source file for class PrimaryTruthClassifier
9
// (c) ATLAS Detector software
11
12
#include "
TrkValTools/PrimaryTruthClassifier.h
"
13
#include "
TrkValEvent/TruthClassificationDefs.h
"
14
#include "CLHEP/Units/SystemOfUnits.h"
15
#include "
AtlasHepMC/GenVertex.h
"
16
17
Trk::PrimaryTruthClassifier::PrimaryTruthClassifier
(
const
std::string&
type
,
const
std::string& name,
const
IInterface* parent)
18
:
AthAlgTool
(
type
,name,parent),
19
m_maxRStartPrimary
( 25.0*
CLHEP
::mm),
20
m_maxZStartPrimary
( 200.0*
CLHEP
::mm),
21
m_minREndPrimary
( 400.0*
CLHEP
::mm),
22
m_minZEndPrimary
(2300.0*
CLHEP
::mm),
23
m_maxRStartSecondary
( 360.0*
CLHEP
::mm),
24
m_maxZStartSecondary
(2000.0*
CLHEP
::mm),
25
m_minREndSecondary
(1000.0*
CLHEP
::mm),
26
m_minZEndSecondary
(3200.0*
CLHEP
::mm)
27
{
28
declareInterface<ITrackTruthClassifier>(
this
);
29
30
declareProperty
(
"maxRStartPrimary"
,
m_maxRStartPrimary
);
31
declareProperty
(
"maxZStartPrimary"
,
m_maxZStartPrimary
);
32
declareProperty
(
"minREndPrimary"
,
m_minREndPrimary
);
33
declareProperty
(
"minZEndPrimary"
,
m_minZEndPrimary
);
34
declareProperty
(
"maxRStartSecondary"
,
m_maxRStartSecondary
);
35
declareProperty
(
"maxZStartSecondary"
,
m_maxZStartSecondary
);
36
declareProperty
(
"minREndSecondary"
,
m_minREndSecondary
);
37
declareProperty
(
"minZEndSecondary"
,
m_minZEndSecondary
);
38
39
}
40
44
StatusCode
Trk::PrimaryTruthClassifier::initialize
() {
45
ATH_MSG_INFO
(
"initialise successful in "
<<name() );
46
return
StatusCode::SUCCESS;
47
}
48
49
StatusCode
Trk::PrimaryTruthClassifier::finalize
() {
50
ATH_MSG_INFO
(
"starting finalize() in "
<< name() );
51
return
StatusCode::SUCCESS;
52
}
53
54
void
Trk::PrimaryTruthClassifier::initClassification
55
(
const
McEventCollection
&
/*SimTracks*/
,
56
const
std::vector<HepMC::ConstGenParticlePtr>*
/*genSignal*/
)
const
{
57
58
// nothing to prepare as local data at start of collection analysis
59
}
60
62
// classification from InDetRecStatistics
64
unsigned
int
Trk::PrimaryTruthClassifier::classify
(
HepMC::ConstGenParticlePtr
genParticle)
const
{
65
66
67
/* note on using HepMC::FourVector/3Vector against HepGeom::Point3D<double>: The versions from HepMC2 do not know
68
operator+, operator- etc. */
69
70
71
//classify as primary, secondary or truncated
72
bool
primary=
false
;
73
bool
secondary=
false
;
74
bool
truncated=
false
;
75
76
if
(genParticle->production_vertex()) {
77
HepMC::FourVector
startVertex = genParticle->production_vertex()->position();
78
79
// primary vertex inside innermost layer?
80
if
( fabs(startVertex.perp()) <
m_maxRStartPrimary
81
&& fabs(startVertex.z()) <
m_maxZStartPrimary
)
82
{
83
if
(genParticle->end_vertex() ==
nullptr
) {
84
primary=
true
;
85
}
else
{
86
HepMC::FourVector
endVertex = genParticle->end_vertex()->position();
87
if
( endVertex.perp() >
m_minREndPrimary
88
|| fabs(startVertex.z()) >
m_minZEndPrimary
)
89
primary=
true
;
else
truncated =
true
;
90
}
91
}
92
else
if
( startVertex.perp() <
m_maxRStartSecondary
&&
93
fabs(startVertex.z()) <
m_maxZStartSecondary
)
94
{
95
if
(genParticle->end_vertex() ==
nullptr
) {
96
secondary=
true
;
97
}
else
{
98
HepMC::FourVector
endVertex = genParticle->end_vertex()->position();
99
if
(endVertex.perp() >
m_minREndSecondary
100
|| fabs(endVertex.z()) >
m_minZEndSecondary
) {
101
secondary=
true
;
102
}
103
}
104
}
105
}
//end classification
106
107
if
(truncated)
return
Trk::TruthClassification::Truncated
;
108
if
(secondary)
return
Trk::TruthClassification::Secondary
;
109
if
(primary)
return
Trk::TruthClassification::Primary
;
110
ATH_MSG_DEBUG
(
"Could not classify this particle: "
<< genParticle );
111
return
Trk::TruthClassification::OutsideClassification
;
112
113
}
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
GenVertex.h
PrimaryTruthClassifier.h
TruthClassificationDefs.h
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
McEventCollection
This defines the McEventCollection, which is really just an ObjectVector of McEvent objectsFile: Gene...
Definition
McEventCollection.h:31
Trk::PrimaryTruthClassifier::m_minREndSecondary
float m_minREndSecondary
Definition
PrimaryTruthClassifier.h:63
Trk::PrimaryTruthClassifier::PrimaryTruthClassifier
PrimaryTruthClassifier(const std::string &type, const std::string &name, const IInterface *parent)
Definition
PrimaryTruthClassifier.cxx:17
Trk::PrimaryTruthClassifier::finalize
virtual StatusCode finalize()
Definition
PrimaryTruthClassifier.cxx:49
Trk::PrimaryTruthClassifier::m_minREndPrimary
float m_minREndPrimary
If track has end vertex, this is min R of end vertex to be considered primary.
Definition
PrimaryTruthClassifier.h:58
Trk::PrimaryTruthClassifier::m_minZEndPrimary
float m_minZEndPrimary
If track has end vertex, this is min Z of end vertex to be considered primary.
Definition
PrimaryTruthClassifier.h:60
Trk::PrimaryTruthClassifier::initialize
virtual StatusCode initialize()
initialize
Definition
PrimaryTruthClassifier.cxx:44
Trk::PrimaryTruthClassifier::m_maxRStartPrimary
float m_maxRStartPrimary
Max R of start vertex to be considered primary.
Definition
PrimaryTruthClassifier.h:55
Trk::PrimaryTruthClassifier::m_minZEndSecondary
float m_minZEndSecondary
Definition
PrimaryTruthClassifier.h:64
Trk::PrimaryTruthClassifier::initClassification
virtual void initClassification(const McEventCollection &, const std::vector< HepMC::ConstGenParticlePtr > *) const
explain
Definition
PrimaryTruthClassifier.cxx:55
Trk::PrimaryTruthClassifier::m_maxZStartSecondary
float m_maxZStartSecondary
Definition
PrimaryTruthClassifier.h:62
Trk::PrimaryTruthClassifier::m_maxRStartSecondary
float m_maxRStartSecondary
Definition
PrimaryTruthClassifier.h:61
Trk::PrimaryTruthClassifier::m_maxZStartPrimary
float m_maxZStartPrimary
Max Z of start vertex to be considered primary.
Definition
PrimaryTruthClassifier.h:56
Trk::PrimaryTruthClassifier::classify
virtual unsigned int classify(HepMC::ConstGenParticlePtr) const
Definition
PrimaryTruthClassifier.cxx:64
CLHEP
STD'S.
Definition
CaloNoiseCompCondAlg.h:57
HepMC::FourVector
HepMC3::FourVector FourVector
Definition
SimpleVector.h:11
HepMC::ConstGenParticlePtr
HepMC3::ConstGenParticlePtr ConstGenParticlePtr
Definition
GenParticle.h:20
Trk::TruthClassification::OutsideClassification
@ OutsideClassification
providing some well-defined error condition
Definition
TruthClassificationDefs.h:19
Trk::TruthClassification::Truncated
@ Truncated
Definition
TruthClassificationDefs.h:27
Trk::TruthClassification::Primary
@ Primary
Definition
TruthClassificationDefs.h:25
Trk::TruthClassification::Secondary
@ Secondary
Definition
TruthClassificationDefs.h:26
type
Generated on
for ATLAS Offline Software by
1.17.0