ATLAS Offline Software
PhysicsAnalysis
JetTagging
JetTagTools
src
BasicTrackGradeFactory.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
JetTagTools/BasicTrackGradeFactory.h
"
6
#include "GaudiKernel/MsgStream.h"
7
8
#include "
JetTagInfo/TrackGrade.h
"
9
#include "
JetTagInfo/TrackGradesDefinition.h
"
10
11
#include "
xAODTracking/TrackParticle.h
"
12
13
14
15
namespace
Analysis
16
{
17
18
BasicTrackGradeFactory::BasicTrackGradeFactory
(
const
std::string&
t
,
const
std::string&
n
,
const
IInterface*
p
) :
19
AthAlgTool
(
t
,
n
,
p
)
20
{
21
22
declareProperty
(
"useSharedHitInfo"
,
m_useSharedHitInfo
=
false
);
23
declareProperty
(
"nSharedBLayer"
,
m_nSharedBLayer
= 0);
24
declareProperty
(
"nSharedPix"
,
m_nSharedPix
= 0);
25
declareProperty
(
"nSharedSct"
,
m_nSharedSct
= 1);
26
declareProperty
(
"nSharedSi"
,
m_nSharedSi
= 999);
27
28
declareInterface<ITrackGradeFactory>(
this
);
29
}
30
31
BasicTrackGradeFactory::~BasicTrackGradeFactory
()
32
{}
33
34
StatusCode
BasicTrackGradeFactory::initialize
()
35
{
36
37
std::vector<TrackGrade> myGrades;
38
39
if
(!
m_useSharedHitInfo
)
40
{
41
myGrades.push_back(
TrackGrade
(0,std::string(
"Good"
)));
42
}
43
else
44
{
45
myGrades.push_back(
TrackGrade
(0,std::string(
"Good"
)));
46
myGrades.push_back(
TrackGrade
(1,std::string(
"Shared"
)));
47
}
48
49
m_trackGradesDefinition
=
TrackGradesDefinition
(myGrades);
50
51
return
StatusCode::SUCCESS;
52
}
53
54
StatusCode
BasicTrackGradeFactory::finalize
()
55
{
56
return
StatusCode::SUCCESS;
57
}
58
59
60
const
TrackGradesDefinition
&
BasicTrackGradeFactory::getTrackGradesDefinition
()
const
61
{
62
return
m_trackGradesDefinition
;
63
}
64
65
66
TrackGrade
*
BasicTrackGradeFactory::getGrade
(
const
xAOD::TrackParticle
&
track
,
const
xAOD::IParticle::FourMom_t
&)
const
67
{
68
69
bool
sharedClass(
false
);
70
71
if
(
m_useSharedHitInfo
)
72
{
73
74
uint8_t
nbs=0, nps=0, nss=0;
75
if
(!
track
.summaryValue(nbs,
xAOD::numberOfInnermostPixelLayerSharedHits
)){
76
ATH_MSG_ERROR
(
"#BTAG# Cannot retrieve numberOfBLayerSharedHists for TrackGrade!"
);
77
}
78
79
if
(!
track
.summaryValue(nps,
xAOD::numberOfPixelSharedHits
)){
80
ATH_MSG_ERROR
(
"#BTAG# Cannot retrieve numberOfPixelSharedHists for TrackGrade!"
);
81
}
82
83
if
(!
track
.summaryValue(nss,
xAOD::numberOfSCTSharedHits
)){
84
ATH_MSG_ERROR
(
"#BTAG# Cannot retrieve numberOfSCTSharedHists for TrackGrade!"
);
85
}
86
int
nsht = nps+nss ;
87
88
89
90
if
(nbs>
m_nSharedBLayer
) {
91
sharedClass =
true
;
92
}
93
if
(nps>
m_nSharedPix
) {
94
sharedClass =
true
;
95
}
96
if
(nss>
m_nSharedSct
) {
97
sharedClass =
true
;
98
}
99
if
(nsht>
m_nSharedSi
) {
100
sharedClass =
true
;
101
}
102
}
103
104
const
TrackGrade
* gradeToReturn(0);
105
106
if
(sharedClass)
107
{
108
// gradeToReturn=trackGradesDefinition.getGrade(std::string("Shared"));
109
gradeToReturn=
m_trackGradesDefinition
.
getGrade
(1);
110
}
111
else
112
{
113
// gradeToReturn=trackGradesDefinition.getGrade(std::string("Good"));
114
gradeToReturn=
m_trackGradesDefinition
.
getGrade
(0);
115
}
116
117
if
(gradeToReturn==0)
118
{
119
ATH_MSG_ERROR
(
"#BTAG# Grade not found. Internal error... "
);
120
return
nullptr
;
121
}
122
123
return
new
TrackGrade
(*gradeToReturn);
124
125
}
126
127
}
128
Analysis::BasicTrackGradeFactory::~BasicTrackGradeFactory
virtual ~BasicTrackGradeFactory()
Definition:
BasicTrackGradeFactory.cxx:31
Analysis::BasicTrackGradeFactory::finalize
StatusCode finalize()
AlgTool finalize method.
Definition:
BasicTrackGradeFactory.cxx:54
Analysis::TrackGrade
Definition:
TrackGrade.h:11
xAOD::numberOfSCTSharedHits
@ numberOfSCTSharedHits
number of SCT hits shared by several tracks [unit8_t].
Definition:
TrackingPrimitives.h:272
Analysis::BasicTrackGradeFactory::m_nSharedSi
int m_nSharedSi
max. number of shared hits in SCT
Definition:
BasicTrackGradeFactory.h:61
xAOD::uint8_t
uint8_t
Definition:
Muon_v1.cxx:557
Analysis::TrackGradesDefinition::getGrade
const TrackGrade * getGrade(const std::string &) const
Definition:
TrackGradesDefinition.cxx:59
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition:
AthCommonDataStore.h:145
Analysis::TrackGradesDefinition
Definition:
TrackGradesDefinition.h:15
Analysis::BasicTrackGradeFactory::BasicTrackGradeFactory
BasicTrackGradeFactory(const std::string &, const std::string &, const IInterface *)
Definition:
BasicTrackGradeFactory.cxx:18
read_hist_ntuple.t
t
Definition:
read_hist_ntuple.py:5
Analysis::BasicTrackGradeFactory::m_nSharedBLayer
int m_nSharedBLayer
if false the following cuts are ignored
Definition:
BasicTrackGradeFactory.h:58
Analysis::BasicTrackGradeFactory::m_useSharedHitInfo
bool m_useSharedHitInfo
Definition:
BasicTrackGradeFactory.h:57
Analysis::BasicTrackGradeFactory::initialize
StatusCode initialize()
AlgTool initailize method.
Definition:
BasicTrackGradeFactory.cxx:34
Analysis::BasicTrackGradeFactory::m_nSharedSct
int m_nSharedSct
max. number of shared hits in pixels
Definition:
BasicTrackGradeFactory.h:60
xAOD::IParticle::FourMom_t
TLorentzVector FourMom_t
Definition of the 4-momentum type.
Definition:
Event/xAOD/xAODBase/xAODBase/IParticle.h:69
xAOD::numberOfPixelSharedHits
@ numberOfPixelSharedHits
number of Pixel all-layer hits shared by several tracks [unit8_t].
Definition:
TrackingPrimitives.h:262
python.utils.AtlRunQueryDQUtils.p
p
Definition:
AtlRunQueryDQUtils.py:210
TrackGradesDefinition.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition:
AthMsgStreamMacros.h:33
beamspotman.n
n
Definition:
beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition:
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Analysis::BasicTrackGradeFactory::m_trackGradesDefinition
TrackGradesDefinition m_trackGradesDefinition
Definition:
BasicTrackGradeFactory.h:55
Analysis
The namespace of all packages in PhysicsAnalysis/JetTagging.
Definition:
BTaggingCnvAlg.h:20
Analysis::BasicTrackGradeFactory::getTrackGradesDefinition
virtual const TrackGradesDefinition & getTrackGradesDefinition() const
Definition:
BasicTrackGradeFactory.cxx:60
Analysis::BasicTrackGradeFactory::getGrade
TrackGrade * getGrade(const xAOD::TrackParticle &track, const xAOD::IParticle::FourMom_t &) const
Definition:
BasicTrackGradeFactory.cxx:66
TrackParticle.h
TrackGrade.h
xAOD::numberOfInnermostPixelLayerSharedHits
@ numberOfInnermostPixelLayerSharedHits
number of Pixel 0th layer barrel hits shared by several tracks.
Definition:
TrackingPrimitives.h:239
xAOD::track
@ track
Definition:
TrackingPrimitives.h:512
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition:
TrackParticle_v1.h:43
AthAlgTool
Definition:
AthAlgTool.h:26
Analysis::BasicTrackGradeFactory::m_nSharedPix
int m_nSharedPix
max. number of shared hits in B layer
Definition:
BasicTrackGradeFactory.h:59
BasicTrackGradeFactory.h
Generated on Fri Jan 10 2025 21:07:19 for ATLAS Offline Software by
1.8.18