ATLAS Offline Software
InDetCosmicScoringTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include "TrkTrack/Track.h"
11 #include "CLHEP/GenericFunctions/CumulativeChiSquare.hh"
12 #include <vector>
13 
14 //---------------------------------------------------------------------------------------------------------------------
15 
17  const std::string& n,
18  const IInterface* p ) :
19  AthAlgTool(t,n,p)
20 {
21  declareInterface<Trk::ITrackScoringTool>(this);
22 }
23 
25 {
26  if (!track.trackSummary()) {
27  ATH_MSG_FATAL("Track without a summary");
28  }
29  ATH_MSG_VERBOSE( "Track has TrackSummary "<< *track.trackSummary() );
31  ATH_MSG_DEBUG( "Track has Score: "<<score );
32  return score;
33 }
34 
35 //---------------------------------------------------------------------------------------------------------------------
36 
38 {
39 
40  if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Summary for track: " << trackSummary << endmsg;
41 
42  if (!track.fitQuality()){
43  msg(MSG::WARNING) << "No fit quality! Track info=" << track.info().dumpInfo() << endmsg;
44  return Trk::TrackScore(track.measurementsOnTrack()->size());
45  }
46  else {
47  int pixelhits = trackSummary.get(Trk::numberOfPixelHits);
48  int scthits = trackSummary.get(Trk::numberOfSCTHits);
49  int trthits = trackSummary.get(Trk::numberOfTRTHits);
50 
51  int nWeightedClusters = 2 * pixelhits + scthits;
52 
53  if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "pixelhits: " << pixelhits << "; scthits: " << scthits
54  << "; trthits: " << trthits << "; nWeightedClusters: " << nWeightedClusters << endmsg;
55 
56  if ((nWeightedClusters >= m_nWeightedClustersMin) and (trthits >= m_minTRTHits)){
57  // calculate track score only if min number of hits
58  int tubehits=0;
59  for (const auto *i : *track.measurementsOnTrack()){
60  if (dynamic_cast<const InDet::TRT_DriftCircleOnTrack*>(i)){
61  double error=sqrt(i->localCovariance()(0,0));
62  if (error>1) tubehits++;
63 
64 
65  }
66  }
67  int hitscore = 0;
68  if (m_nWeightedClustersMin > 0) hitscore = 10 * nWeightedClusters + trthits;
69  else hitscore = 10 * (pixelhits + scthits) + trthits;
70 
71  double fitscore = 0;
72  if (track.fitQuality()->numberDoF() > 0) fitscore = 0.0001*track.fitQuality()->chiSquared()
73  / track.fitQuality()->numberDoF();
74 
75  if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "track score: " << hitscore - 0.25*tubehits - fitscore << endmsg;
76  return Trk::TrackScore (hitscore - 0.25*tubehits - fitscore);
77 
78  }
79  else return Trk::TrackScore( 0 );
80  }
81 }
82 
83 //---------------------------------------------------------------------------------------------------------------------
84 
Trk::numberOfPixelHits
@ numberOfPixelHits
number of pixel layers on track with absence of hits
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:57
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
TrackParameters.h
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
AthCommonMsg< AlgTool >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
InDet::TRT_DriftCircleOnTrack
Definition: TRT_DriftCircleOnTrack.h:53
Track.h
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:731
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
Trk::numberOfSCTHits
@ numberOfSCTHits
number of SCT holes
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:71
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
Trk::TrackScore
float TrackScore
Definition: TrackScore.h:10
TrackSummary.h
TRT_DriftCircleOnTrack.h
InDet::InDetCosmicScoringTool::score
virtual Trk::TrackScore score(const Trk::Track &track, bool checkBasicSel) const override
create a score based on how good the passed track is
Definition: InDetCosmicScoringTool.cxx:24
Trk::numberOfTRTHits
@ numberOfTRTHits
number of TRT outliers
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:79
Trk::TrackSummary
A summary of the information contained by a track.
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:287
InDet::InDetCosmicScoringTool::InDetCosmicScoringTool
InDetCosmicScoringTool(const std::string &, const std::string &, const IInterface *)
Definition: InDetCosmicScoringTool.cxx:16
InDet::InDetCosmicScoringTool::m_nWeightedClustersMin
IntegerProperty m_nWeightedClustersMin
Definition: InDetCosmicScoringTool.h:48
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
InDet::InDetCosmicScoringTool::m_minTRTHits
IntegerProperty m_minTRTHits
Definition: InDetCosmicScoringTool.h:49
InDet::InDetCosmicScoringTool::simpleScore
virtual Trk::TrackScore simpleScore(const Trk::Track &track, const Trk::TrackSummary &trackSum) const override
create a score based on how good the passed TrackSummary is
Definition: InDetCosmicScoringTool.cxx:37
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
Trk::TrackSummary::get
int get(const SummaryType &type) const
returns the summary information for the passed SummaryType.
AthAlgTool
Definition: AthAlgTool.h:26
FitQuality.h
error
Definition: IImpactPoint3dEstimator.h:70
InDetCosmicScoringTool.h