ATLAS Offline Software
Loading...
Searching...
No Matches
TrackHandleBase.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5
7// //
8// Header file for class TrackHandleBase //
9// //
10// Description: Base class for track handles. //
11// //
12// Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
13// Initial version: February 2008 //
14// //
16
17#ifndef TRACKHANDLEBASE_H
18#define TRACKHANDLEBASE_H
19
21
23
24// GeoModel
26//
27#include "GeoModelKernel/GeoVPhysVol.h"
28
29#include <QStringList>
30#include <QTreeWidgetItem>
31#include <memory>
32#include <vector>
33#include <set>
34#include <optional>
35#include <QList>
36#include <QFlags>
37
38
43class SoMaterial;
44class SoNode;
45class TrackLODHandle;
46
47namespace Trk {
48 class Track;
49 class FitQuality;
50 class RIO_OnTrack;
51}
52
53namespace MuonGM {
55}
56
58public:
59
60 static int numberOfInstances();
61
63 virtual ~TrackHandleBase();
64
65 TrackSysCommonData * common() const;
66
67 void setVisible(bool);
68 bool visible() const { return m_visible; }
70 const std::set<GeoPVConstLink>& touchedMuonChambers() const;
71 void update3DObjects(bool invalidatePropagatedPoints = false, float maxR=0.0);
74 void updateMaterial();
77 SoMaterial * currentMaterial() const { return m_currentmaterial; }
78
79 QStringList baseInfo() const;
82 virtual QStringList clicked() const = 0;
83
84 virtual Amg::Vector3D momentum() const { return Amg::Vector3D(0,0,0); }
85 virtual std::optional<Amg::Vector3D> startPoint() const;
86 virtual std::optional<Amg::Vector3D> endPoint() const;
87 virtual int pdgCode() const { return 0; }
88
89 //Default implementation of the following two methods will based on
90 //pdgCode(). In the case of charge(), if it can't be determined
91 //based on pdgCode(), and attempt will be made by looking at the
92 //first track parameters charge (if a Trk::Track is
93 //provided). Override in case the charge/mass can be determined, but
94 //the pdg code not. (or if there is a faster way to get the charge than by constructing the Trk::Track first).
95 //
96 //NB: update: it is the calculateCharge() method which must be reimplemented for the charge!
97 double charge() const;//Returns unknown() in case of trouble.
98 virtual double mass() const;//Returns unknown() in case of trouble.
99
100 bool hasCharge() const { return charge()!=unknown(); }
101 bool hasMass() const { return mass()!=unknown(); }
102
103 static double unknown() { return -999.0; }
104
105 virtual bool hasSubSystemHitInfo() const { return false; }
106 virtual bool isRun4EDM() const { return false; }
107 virtual bool isIDTrack() const ;
108 virtual unsigned getNPixelHits() const { return 0; }
109 virtual unsigned getNSCTHits() const { return 0; }
110 virtual unsigned getNTRTHits() const { return 0; }
111 virtual unsigned getNMuonHits() const { return (getNMDTHits()+getNRPCHits()+getNTGCHits()+getNCSCHits()+getNMMHits()+getNsTGCHits()); }
112 virtual unsigned getNMuonPhiHits() const { return 0; }
113 virtual unsigned getNMDTHits() const { return 0; }
114 virtual unsigned getNRPCHits() const { return 0; }
115 virtual unsigned getNTGCHits() const { return 0; }
116 virtual unsigned getNCSCHits() const { return 0; }
117 virtual unsigned getNMMHits() const { return 0; }
118 virtual unsigned getNsTGCHits() const { return 0; }
119 virtual unsigned getNMuonPrecisionHits() const { return getNMDTHits() + getNCSCHits(); } // This should really only count eta csc hits.
120 virtual const Trk::FitQuality* getFitQuality() const {return nullptr;}
122
123 QList<AssociatedObjectHandleBase*> getVisibleMeasurements() const;
124 TrackCommonFlags::TSOSPartsFlags shownTSOSParts() const;
125 TrackCommonFlags::TSOSPartsFlags customColouredTSOSParts() const;
126
127 std::vector< Amg::Vector3D > * hackGetPointsPropagated();
128
129 virtual QString shortInfo() const { return QString("Not yet implemented"); }
130 virtual QString type() const { return QString("Not yet implemented"); }
131
132 // Object browser code
133 // @TODO revisit this once plan for more general approach is completed.
134 virtual void fillObjectBrowser(QList<QTreeWidgetItem *>& list);
135 virtual void updateObjectBrowser(){};
136 QTreeWidgetItem* browserTreeItem() const ;
137
138protected:
139
140 virtual double calculateCharge() const;
141
142 //Ways of providing path information:
143 // * Provide a Trk::Track
144 // * Provide a vector of Amg::Vector3D (this precludes extrapolation) // BEFORE EIGEN MIGRATION WAS: HepGeom::Point3D<double>'s
145 //
146 //Override exactly one of the two following methods, in order to
147 //provide path information. It will be called exactly once and the
148 //derived class destructor will be responsible of any necessary
149 //memory cleanup of the returned objects:
150 virtual const Trk::Track * provide_pathInfoTrkTrack() const { return nullptr; };
151 // virtual const std::vector< HepGeom::Point3D<double> > * provide_pathInfoPoints() const { return 0; }
152 virtual const std::vector< Amg::Vector3D > * provide_pathInfoPoints() { return nullptr; }
153
156
158 void registerTouchedMuonChamber(const GeoPVConstLink&) const;
159
160 virtual void visibleStateChanged();
161 virtual void currentMaterialChanged() {};
162
163 const QList<AssociatedObjectHandleBase*>& getAllAscObjHandles() const;
164
165 virtual bool containsDetElement(const QString&) const {return false; }
166private:
167
168 // It is illegal to copy/assign a TrackHandleBase:
171
173 class Imp;
175
176
177 //Here for inlining:
180 SoMaterial * m_currentmaterial;
181 void clearLine();
182 void registerTrack();
183
187 void setShownTSOSParts(TrackCommonFlags::TSOSPartsFlags f);
188 void setCustomColouredTSOSParts(TrackCommonFlags::TSOSPartsFlags f);
189
190 //For associated objects:
192 friend class TrackCollHandleBase; // Troels: maybe not needed...
193 /*** Returns the attachment handle for the given region index and crossover value.
194 * @param regionIndex: The region index is used to determine the region of the attachment in the detector.
195 * @param crossoverval: The crossover value is used to determine the level of detail of the track.
196 **/
197 AssocObjAttachmentHandle * getAttachmentHandle(int regionIndex, const double& crossoverval);
198protected:
200 virtual void ensureInitTSOSs(std::unique_ptr<std::vector<AssociatedObjectHandleBase*>>&);
201};
202
204public:
205 void attachNodes( SoNode*simple, SoNode*detailed, bool unpickable );
206 void setPickableStateOfNodes( SoNode*simple, SoNode*detailed, bool unpickable );
207 void detachNodes( SoNode*simple, SoNode*detailed );
208private:
209 friend class TrackHandleBase;//The life of these classes are entirely owned by TrackHandleBase.
210 friend class TrackHandleBase::Imp;//The life of these classes are entirely owned by TrackHandleBase.
217 class Imp;
219};
220
221
222#endif
AssocObjAttachmentHandle & operator=(const AssocObjAttachmentHandle &)
void attachNodes(SoNode *simple, SoNode *detailed, bool unpickable)
AssocObjAttachmentHandle(TrackLODHandle *, TrackHandleBase *)
void setPickableStateOfNodes(SoNode *simple, SoNode *detailed, bool unpickable)
Will attach if not currently attached.
AssocObjAttachmentHandle(const AssocObjAttachmentHandle &)
void detachNodes(SoNode *simple, SoNode *detailed)
Base class for the XxxReadoutElement, with Xxx = Mdt, Rpc, Tgc, Csc.
void registerTouchedMuonChamber(const GeoPVConstLink &) const
If not earlier, touched muon chambers must me registered at latest when this method is invoked.
virtual void currentMaterialChanged()
virtual QString shortInfo() const
returns mom and hit information about track
void setCustomColouredTSOSParts(TrackCommonFlags::TSOSPartsFlags f)
TrackCommonFlags::TSOSPartsFlags customColouredTSOSParts() const
QList< AssociatedObjectHandleBase * > getVisibleMeasurements() const
virtual const Trk::Track * provide_pathInfoTrkTrack() const
void updateShapes_TSOSWithMaterialEffects()
virtual int pdgCode() const
0 means unknown
const std::set< GeoPVConstLink > & touchedMuonChambers() const
virtual void fillObjectBrowser(QList< QTreeWidgetItem * > &list)
Called in child classes.
virtual unsigned getNMuonPhiHits() const
The number of phi hits is part of hit counts below (i.e.
virtual double calculateCharge() const
virtual unsigned getNTRTHits() const
virtual unsigned getNMDTHits() const
bool hasMass() const
virtual void visibleStateChanged()
override if need to take action in this case.
static double unknown()
QTreeWidgetItem * browserTreeItem() const
virtual unsigned getNMMHits() const
friend class TrackCollHandleBase
virtual bool isRun4EDM() const
friend class AssociatedObjectHandleBase
AssocObjAttachmentHandle * getAttachmentHandle(int regionIndex, const double &crossoverval)
friend class AssocObjAttachmentHandle
TrackHandleBase(TrackCollHandleBase *)
void setVisible(bool)
use by the collection handle.
virtual std::optional< Amg::Vector3D > startPoint() const
returns 0 if can't find start point.
virtual void ensureTouchedMuonChambersInitialised() const
TrackHandleBase & operator=(const TrackHandleBase &)
virtual Trk::ParticleHypothesis extrapolationParticleHypothesis() const
Default implementation of this next method bases hypothesis on pdgCode() and charge():
virtual unsigned getNSCTHits() const
virtual std::optional< Amg::Vector3D > endPoint() const
returns 0 if can't find start point.
virtual double mass() const
virtual bool containsDetElement(const QString &) const
void updateShapes_TSOSWithErrors()
TrackCommonFlags::TSOSPartsFlags shownTSOSParts() const
virtual unsigned getNTGCHits() const
SoMaterial * currentMaterial() const
virtual unsigned getNCSCHits() const
virtual void ensureInitTSOSs(std::unique_ptr< std::vector< AssociatedObjectHandleBase * > > &)
Ensure that the TSOSs are initialized.
virtual unsigned getNMuonPrecisionHits() const
void updateShapes_TSOSWithMeasurements()
virtual void updateObjectBrowser()
virtual bool hasSubSystemHitInfo() const
QStringList baseInfo() const
virtual const MuonGM::MuonReadoutElement * getMuonReadoutElement(const Trk::RIO_OnTrack &mb) const
virtual unsigned getNRPCHits() const
double charge() const
virtual QStringList clicked() const =0
Called when user selects the node (stringlist is displayed in messagebox).
virtual Amg::Vector3D momentum() const
void setShownTSOSParts(TrackCommonFlags::TSOSPartsFlags f)
virtual const std::vector< Amg::Vector3D > * provide_pathInfoPoints()
virtual bool isIDTrack() const
virtual const Trk::FitQuality * getFitQuality() const
bool visible() const
virtual unsigned getNMuonHits() const
void updateRandomColourTransparencyAndBrightness()
virtual unsigned getNsTGCHits() const
TrackCollHandleBase * collHandle() const
std::vector< Amg::Vector3D > * hackGetPointsPropagated()
FIXME.
SoMaterial * m_currentmaterial
bool hasCharge() const
TrackSysCommonData * common() const
static int numberOfInstances()
virtual unsigned getNPixelHits() const
const QList< AssociatedObjectHandleBase * > & getAllAscObjHandles() const
override if need to take action in this case.
void update3DObjects(bool invalidatePropagatedPoints=false, float maxR=0.0)
virtual QString type() const
return very short word with type (maybe link with collection type?)
TrackCollHandleBase * m_collhandle
TrackHandleBase(const TrackHandleBase &)
void registerAssocObject(AssociatedObjectHandleBase *)
Trackhandle assumes ownership.
Class to represent and store fit qualities from track reconstruction in terms of and number of degre...
Definition FitQuality.h:97
Class to handle RIO On Tracks ROT) for InDet and Muons, it inherits from the common MeasurementBase.
Definition RIO_OnTrack.h:70
Eigen::Matrix< double, 3, 1 > Vector3D
Ensure that the Athena extensions are properly loaded.
Definition GeoMuonHits.h:27
Ensure that the ATLAS eigen extensions are properly loaded.
ParticleHypothesis
Enumeration for Particle hypothesis respecting the interaction with material.