ATLAS Offline Software
Loading...
Searching...
No Matches
Trk::TrackSummary Class Referencefinal

A summary of the information contained by a track. More...

#include <TrackSummary.h>

Inheritance diagram for Trk::TrackSummary:
Collaboration diagram for Trk::TrackSummary:

Public Member Functions

 TrackSummary ()
 needed by POOL
 TrackSummary (const std::vector< int > &information, std::bitset< numberOfDetectorTypes > &hitPattern)
 ctor should probably only be called by TrkSummaryTool.
 TrackSummary (const TrackSummary &rhs)
 copy ctor
TrackSummaryoperator= (const TrackSummary &)
 assignment operator
 TrackSummary (TrackSummary &&rhs) noexcept=default
 Move ctor.
TrackSummaryoperator= (TrackSummary &&) noexcept=default
 Move assignment operator.
 ~TrackSummary ()
TrackSummaryoperator+= (const TrackSummary &ts)
 adds the values of the passed TrackSummary to this TrackSummary.
int get (const SummaryType &type) const
 returns the summary information for the passed SummaryType.
unsigned long getHitPattern () const
bool isHit (const DetectorType &type) const
 returns true if the detector type 'type' is hit.
const MuonTrackSummarymuonTrackSummary () const
 returns a pointer to the MuonTrackSummary if available
MuonTrackSummarymuonTrackSummary ()
 returns pointer to a modifiable (non-const) MuonTrackSummary if available
bool update (Trk::SummaryType type, int new_value)
 Update unset summary information.

Static Public Member Functions

static std::size_t numberOfInstantiations ()

Static Public Attributes

static const int SummaryTypeNotSet = -1
 Value set in the cxx file to -1.
static std::atomic_size_t s_numberOfInstantiations

Private Attributes

std::vector< int > m_information
 vector containing the persistent summary information.
unsigned long m_idHitPattern
 contains the 'hit pattern'
std::unique_ptr< MuonTrackSummarym_muonTrackSummary
 pointer to the MuonTrackSummary

Friends

class InDet::InDetTrackSummaryHelperTool
class Muon::MuonTrackSummaryHelperTool
class Trk::TrackSummaryTool
class ::TrackSummaryCnv_p1
class ::TrackSummaryCnv_p2

Detailed Description

A summary of the information contained by a track.

If there is information missing, or if I could add useful methods then let me know. I have deliberately tried to keep this as simple as possible, whilst allowing for future expansion.

A recent addition is the isHit() method. This is analogous to the old 'hit patterns' in that you can use it to check if a specific sub-detector element has been hit by the track.

For example, you could do: if (summary.isHit(Trk::pixelBarrel0) ) callSomething();

Please note that this class does NO error checking - i.e. it would be possible for someone to fill this object in an inconsistent manner and it would not be caught.

Author
Edwar.nosp@m.d.Mo.nosp@m.yse@c.nosp@m.ern..nosp@m.ch

Definition at line 286 of file Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h.

Constructor & Destructor Documentation

◆ TrackSummary() [1/4]

Trk::TrackSummary::TrackSummary ( )

needed by POOL

Definition at line 16 of file TrackSummary.cxx.

17 : Trk::ObjectCounter<Trk::TrackSummary>()
20 , m_muonTrackSummary(nullptr)
21{
22}
static const int SummaryTypeNotSet
Value set in the cxx file to -1.
std::unique_ptr< MuonTrackSummary > m_muonTrackSummary
pointer to the MuonTrackSummary
std::vector< int > m_information
vector containing the persistent summary information.

◆ TrackSummary() [2/4]

Trk::TrackSummary::TrackSummary ( const std::vector< int > & information,
std::bitset< numberOfDetectorTypes > & hitPattern )

ctor should probably only be called by TrkSummaryTool.

Parameters
informationThe vector passed should be complete i.e. it should be the size required by m_numSummaryTypes, and any undefined values should be set to -1. The vector should be filled using SummaryType to select the position of the information.
hitPatternthis bitset should be filled using the DetectorType enum. True indicates that a sub-detector was hit

Definition at line 24 of file TrackSummary.cxx.

26 : Trk::ObjectCounter<Trk::TrackSummary>()
27 , m_information(information)
28 , m_idHitPattern(hitPattern.to_ulong())
29 , m_muonTrackSummary(nullptr)
30{
31}

◆ TrackSummary() [3/4]

Trk::TrackSummary::TrackSummary ( const TrackSummary & rhs)

copy ctor

Definition at line 33 of file TrackSummary.cxx.

34 : Trk::ObjectCounter<Trk::TrackSummary>(rhs)
35 , m_information(rhs.m_information)
36 , m_idHitPattern(rhs.m_idHitPattern)
37{
38 if (rhs.m_muonTrackSummary) {
40 std::make_unique<MuonTrackSummary>(*rhs.m_muonTrackSummary);
41 } else {
42 m_muonTrackSummary = nullptr;
43 }
44}

◆ TrackSummary() [4/4]

Trk::TrackSummary::TrackSummary ( TrackSummary && rhs)
defaultnoexcept

Move ctor.

◆ ~TrackSummary()

Trk::TrackSummary::~TrackSummary ( )
default

Member Function Documentation

◆ get()

int Trk::TrackSummary::get ( const SummaryType & type) const

returns the summary information for the passed SummaryType.

Parameters
typeUse the provided enums to access it, i.e. by summary.get(numberOfPixelHits)
Returns
returns -1 if the enum is undefined (i.e. the information was not available in the Track, or (more likely) Trk::TrkTrackSummaryTool is not filling it yet)

◆ getHitPattern()

unsigned long Trk::TrackSummary::getHitPattern ( ) const

◆ isHit()

bool Trk::TrackSummary::isHit ( const DetectorType & type) const

returns true if the detector type 'type' is hit.

Parameters
typePlease use the DetectorType enum to access the information (the internal positions may change!)
Returns
true if sub-detector 'type' is hit

◆ muonTrackSummary() [1/2]

MuonTrackSummary * Trk::TrackSummary::muonTrackSummary ( )

returns pointer to a modifiable (non-const) MuonTrackSummary if available

◆ muonTrackSummary() [2/2]

const MuonTrackSummary * Trk::TrackSummary::muonTrackSummary ( ) const

returns a pointer to the MuonTrackSummary if available

◆ numberOfInstantiations()

std::size_t Trk::ObjectCounter< Trk::TrackSummary >::numberOfInstantiations ( )
inlinestaticinherited

Definition at line 25 of file TrkObjectCounter.h.

26 {
27#ifndef NDEBUG
28 return s_numberOfInstantiations.load();
29#endif
30 return 0;
31 }
Helper to enable counting number of instantiations in debug builds.

◆ operator+=()

Trk::TrackSummary & Trk::TrackSummary::operator+= ( const TrackSummary & ts)

adds the values of the passed TrackSummary to this TrackSummary.

Mainly intended for adding Muon and ID TrackSummaries, when making a combined Track for example WARNING: may not make much sense for e.g. Trk::numberOfContribPixelLayers

Definition at line 62 of file TrackSummary.cxx.

63{
64 if (this != &ts) {
65 for (int i = 0; i < numberOfTrackSummaryTypes; ++i) {
66 // if added number is <0, leave as is (this also catches the case where
67 // both are <0)
68 if (ts.m_information[i] < 0) {
69 continue;
70 }
71
72 if (m_information[i] < 0) {
74 }
75 m_information[i] += ts.m_information[i];
76 }
77 if (!m_muonTrackSummary) {
78 m_muonTrackSummary.reset(ts.m_muonTrackSummary
79 ? new MuonTrackSummary(*ts.m_muonTrackSummary)
80 : nullptr);
81 }
82 }
83 return *this;
84}
int ts
Definition globals.cxx:24

◆ operator=() [1/2]

Trk::TrackSummary & Trk::TrackSummary::operator= ( const TrackSummary & rhs)

assignment operator

Definition at line 47 of file TrackSummary.cxx.

48{
49 if (&rhs != this) {
50 m_information = rhs.m_information;
51 m_idHitPattern = rhs.m_idHitPattern;
52 m_muonTrackSummary.reset(rhs.m_muonTrackSummary
53 ? new MuonTrackSummary(*rhs.m_muonTrackSummary)
54 : nullptr);
55 }
56 return *this;
57}

◆ operator=() [2/2]

TrackSummary & Trk::TrackSummary::operator= ( TrackSummary && )
defaultnoexcept

Move assignment operator.

◆ update()

bool Trk::TrackSummary::update ( Trk::SummaryType type,
int new_value )

Update unset summary information.

Parameters
typethe type of the summary information to be updated.
new_valuethe value to be set for the given type.
Returns
false in case the information was set alread.

◆ ::TrackSummaryCnv_p1

◆ ::TrackSummaryCnv_p2

◆ InDet::InDetTrackSummaryHelperTool

◆ Muon::MuonTrackSummaryHelperTool

◆ Trk::TrackSummaryTool

Member Data Documentation

◆ m_idHitPattern

unsigned long Trk::TrackSummary::m_idHitPattern
private

contains the 'hit pattern'

Definition at line 367 of file Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h.

◆ m_information

std::vector<int> Trk::TrackSummary::m_information
private

vector containing the persistent summary information.

Definition at line 364 of file Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h.

◆ m_muonTrackSummary

std::unique_ptr<MuonTrackSummary> Trk::TrackSummary::m_muonTrackSummary
private

◆ s_numberOfInstantiations

std::atomic_size_t Trk::ObjectCounter< Trk::TrackSummary >::s_numberOfInstantiations
inlinestaticinherited

Definition at line 22 of file TrkObjectCounter.h.

◆ SummaryTypeNotSet

const int Trk::TrackSummary::SummaryTypeNotSet = -1
static

Value set in the cxx file to -1.

If any of the values returned by get(const SummaryType& type)==SummaryTypeNotSet then this means that the information has not been filled. i.e. ID information cannot be filled if the TrackSummaryTool does not have access to the InDetTrackSummaryHelperTool

Definition at line 297 of file Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h.


The documentation for this class was generated from the following files: