ATLAS Offline Software
Loading...
Searching...
No Matches
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
6#include "GaudiKernel/MsgStream.h"
7
10
12
13
14
15namespace Analysis
16{
17
18BasicTrackGradeFactory::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
33
35{
36
37 std::vector<TrackGrade> myGrades;
38
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
50
51 return StatusCode::SUCCESS;
52}
53
55{
56 return StatusCode::SUCCESS;
57}
58
59
64
65
67{
68
69 bool sharedClass(false);
70
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
#define ATH_MSG_ERROR(x)
int m_nSharedPix
max. number of shared hits in B layer
StatusCode initialize()
AlgTool initailize method.
TrackGrade * getGrade(const xAOD::TrackParticle &track, const xAOD::IParticle::FourMom_t &) const
StatusCode finalize()
AlgTool finalize method.
virtual const TrackGradesDefinition & getTrackGradesDefinition() const
TrackGradesDefinition m_trackGradesDefinition
int m_nSharedBLayer
if false the following cuts are ignored
BasicTrackGradeFactory(const std::string &, const std::string &, const IInterface *)
int m_nSharedSct
max. number of shared hits in pixels
int m_nSharedSi
max. number of shared hits in SCT
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
TLorentzVector FourMom_t
Definition of the 4-momentum type.
The namespace of all packages in PhysicsAnalysis/JetTagging.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
@ numberOfInnermostPixelLayerSharedHits
number of Pixel 0th layer barrel hits shared by several tracks.
@ numberOfPixelSharedHits
number of Pixel all-layer hits shared by several tracks [unit8_t].
@ numberOfSCTSharedHits
number of SCT hits shared by several tracks [unit8_t].