ATLAS Offline Software
Loading...
Searching...
No Matches
InDetCosmicScoringTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 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 const Trk::TrackParameters* parm = track.trackParameters()->front();
27 if (std::abs(parm->parameters()[Trk::z0]) > m_maxZImp) {
28 ATH_MSG_DEBUG ("Track Z impact > "<<m_maxZImp<<", reject it");
29 return false;
30 }
31 return true;
32}
33
34Trk::TrackScore InDet::InDetCosmicScoringTool::score( const Trk::Track& track, bool /*checkBasicSel*/ ) const
35{
36 if (!track.trackSummary()) {
37 ATH_MSG_FATAL("Track without a summary");
38 }
39 ATH_MSG_VERBOSE( "Track has TrackSummary "<< *track.trackSummary() );
40 Trk::TrackScore score = Trk::TrackScore( simpleScore(track, *track.trackSummary()) );
41 ATH_MSG_DEBUG( "Track has Score: "<<score );
42 return score;
43}
44
45//---------------------------------------------------------------------------------------------------------------------
46
48{
49
50 if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Summary for track: " << trackSummary << endmsg;
51
52 if (!track.fitQuality()){
53 msg(MSG::WARNING) << "No fit quality! Track info=" << track.info().dumpInfo() << endmsg;
54 return Trk::TrackScore(track.measurementsOnTrack()->size());
55 }
56 else {
57 int pixelhits = trackSummary.get(Trk::numberOfPixelHits);
58 int scthits = trackSummary.get(Trk::numberOfSCTHits);
59 int trthits = trackSummary.get(Trk::numberOfTRTHits);
60
61 int nWeightedClusters = 2 * pixelhits + scthits;
62
63 if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "pixelhits: " << pixelhits << "; scthits: " << scthits
64 << "; trthits: " << trthits << "; nWeightedClusters: " << nWeightedClusters << endmsg;
65
66 if ((nWeightedClusters >= m_nWeightedClustersMin) and (trthits >= m_minTRTHits)){
67 // calculate track score only if min number of hits
68 int tubehits=0;
69 for (const auto *i : *track.measurementsOnTrack()){
70 if (dynamic_cast<const InDet::TRT_DriftCircleOnTrack*>(i)){
71 double error=sqrt(i->localCovariance()(0,0));
72 if (error>1) tubehits++;
73
74
75 }
76 }
77 int hitscore = 0;
78 if (m_nWeightedClustersMin > 0) hitscore = 10 * nWeightedClusters + trthits;
79 else hitscore = 10 * (pixelhits + scthits) + trthits;
80
81 double fitscore = 0;
82 if (track.fitQuality()->numberDoF() > 0) fitscore = 0.0001*track.fitQuality()->chiSquared()
83 / track.fitQuality()->numberDoF();
84
85 if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "track score: " << hitscore - 0.25*tubehits - fitscore << endmsg;
86 return Trk::TrackScore (hitscore - 0.25*tubehits - fitscore);
87
88 }
89 else return Trk::TrackScore( 0 );
90 }
91}
92
93//---------------------------------------------------------------------------------------------------------------------
94
#define endmsg
#define ATH_MSG_FATAL(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
bool msgLvl(const MSG::Level lvl) const
MsgStream & msg() const
virtual bool passBasicSelections(const Trk::Track &) const override
check track selections independent from TrackSummary
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
virtual Trk::TrackScore score(const Trk::Track &track, bool checkBasicSel) const override
create a score based on how good the passed track is
InDetCosmicScoringTool(const std::string &, const std::string &, const IInterface *)
Represents 'corrected' measurements from the TRT (for example, corrected for wire sag).
A summary of the information contained by a track.
int get(const SummaryType &type) const
returns the summary information for the passed SummaryType.
float TrackScore
Definition TrackScore.h:10
@ z0
Definition ParamDefs.h:64
ParametersBase< TrackParametersDim, Charged > TrackParameters
@ numberOfPixelHits
number of pixel layers on track with absence of hits