ATLAS Offline Software
Loading...
Searching...
No Matches
TrackHandleBase.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 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 <vector>
32#include <set>
33#include <optional>
34#include <QList>
35#include <QFlags>
36
37
42class SoMaterial;
43class SoNode;
44class TrackLODHandle;
45
46namespace Trk {
47 class Track;
48 class FitQuality;
49 class RIO_OnTrack;
50}
51
52namespace MuonGM {
54}
55
57public:
58
59 static int numberOfInstances();
60
62 virtual ~TrackHandleBase();
63
64 TrackSysCommonData * common() const;
65
66 void setVisible(bool);
67 bool visible() const { return m_visible; }
69 const std::set<GeoPVConstLink>& touchedMuonChambers() const;
70 void update3DObjects(bool invalidatePropagatedPoints = false, float maxR=0.0);
73 void updateMaterial();
76 SoMaterial * currentMaterial() const { return m_currentmaterial; }
77
78 QStringList baseInfo() const;
81 virtual QStringList clicked() const = 0;
82
83 virtual Amg::Vector3D momentum() const { return Amg::Vector3D(0,0,0); }
84 virtual std::optional<Amg::Vector3D> startPoint() const;
85 virtual std::optional<Amg::Vector3D> endPoint() const;
86 virtual int pdgCode() const { return 0; }
87
88 //Default implementation of the following two methods will based on
89 //pdgCode(). In the case of charge(), if it can't be determined
90 //based on pdgCode(), and attempt will be made by looking at the
91 //first track parameters charge (if a Trk::Track is
92 //provided). Override in case the charge/mass can be determined, but
93 //the pdg code not. (or if there is a faster way to get the charge than by constructing the Trk::Track first).
94 //
95 //NB: update: it is the calculateCharge() method which must be reimplemented for the charge!
96 double charge() const;//Returns unknown() in case of trouble.
97 virtual double mass() const;//Returns unknown() in case of trouble.
98
99 bool hasCharge() const { return charge()!=unknown(); }
100 bool hasMass() const { return mass()!=unknown(); }
101
102 static double unknown() { return -999.0; }
103
104 virtual bool hasSubSystemHitInfo() const { return false; }
105 virtual bool isRun4EDM() const { return false; }
106 virtual bool isIDTrack() const ;
107 virtual unsigned getNPixelHits() const { return 0; }
108 virtual unsigned getNSCTHits() const { return 0; }
109 virtual unsigned getNTRTHits() const { return 0; }
110 virtual unsigned getNMuonHits() const { return (getNMDTHits()+getNRPCHits()+getNTGCHits()+getNCSCHits()+getNMMHits()+getNsTGCHits()); }
111 virtual unsigned getNMuonPhiHits() const { return 0; }
112 virtual unsigned getNMDTHits() const { return 0; }
113 virtual unsigned getNRPCHits() const { return 0; }
114 virtual unsigned getNTGCHits() const { return 0; }
115 virtual unsigned getNCSCHits() const { return 0; }
116 virtual unsigned getNMMHits() const { return 0; }
117 virtual unsigned getNsTGCHits() const { return 0; }
118 virtual unsigned getNMuonPrecisionHits() const { return getNMDTHits() + getNCSCHits(); } // This should really only count eta csc hits.
119 virtual const Trk::FitQuality* getFitQuality() const {return nullptr;}
121
122 QList<AssociatedObjectHandleBase*> getVisibleMeasurements() const;
123 TrackCommonFlags::TSOSPartsFlags shownTSOSParts() const;
124 TrackCommonFlags::TSOSPartsFlags customColouredTSOSParts() const;
125
126 std::vector< Amg::Vector3D > * hackGetPointsPropagated();
127
128 virtual QString shortInfo() const { return QString("Not yet implemented"); }
129 virtual QString type() const { return QString("Not yet implemented"); }
130
131 // Object browser code
132 // @TODO revisit this once plan for more general approach is completed.
133 virtual void fillObjectBrowser(QList<QTreeWidgetItem *>& list);
134 virtual void updateObjectBrowser(){};
135 QTreeWidgetItem* browserTreeItem() const ;
136
137protected:
138
139 virtual double calculateCharge() const;
140
141 //Ways of providing path information:
142 // * Provide a Trk::Track
143 // * Provide a vector of Amg::Vector3D (this precludes extrapolation) // BEFORE EIGEN MIGRATION WAS: HepGeom::Point3D<double>'s
144 //
145 //Override exactly one of the two following methods, in order to
146 //provide path information. It will be called exactly once and the
147 //derived class destructor will be responsible of any necessary
148 //memory cleanup of the returned objects:
149 virtual const Trk::Track * provide_pathInfoTrkTrack() const { return nullptr; };
150 // virtual const std::vector< HepGeom::Point3D<double> > * provide_pathInfoPoints() const { return 0; }
151 virtual const std::vector< Amg::Vector3D > * provide_pathInfoPoints() { return nullptr; }
152
155
157 void registerTouchedMuonChamber(const GeoPVConstLink&) const;
158
159 virtual void visibleStateChanged();
160 virtual void currentMaterialChanged() {};
161
162 const QList<AssociatedObjectHandleBase*>& getAllAscObjHandles() const;
163
164 virtual bool containsDetElement(const QString&) const {return false; }
165private:
166
167 // It is illegal to copy/assign a TrackHandleBase:
170
172 class Imp;
174
175
176 //Here for inlining:
179 SoMaterial * m_currentmaterial;
180 void clearLine();
181 void registerTrack();
182
186 void setShownTSOSParts(TrackCommonFlags::TSOSPartsFlags f);
187 void setCustomColouredTSOSParts(TrackCommonFlags::TSOSPartsFlags f);
188
189 //For associated objects:
191 friend class TrackCollHandleBase; // Troels: maybe not needed...
192 /*** Returns the attachment handle for the given region index and crossover value.
193 * @param regionIndex: The region index is used to determine the region of the attachment in the detector.
194 * @param crossoverval: The crossover value is used to determine the level of detail of the track.
195 **/
196 AssocObjAttachmentHandle * getAttachmentHandle(int regionIndex, const double& crossoverval);
197protected:
199 virtual void ensureInitTSOSs(std::vector<AssociatedObjectHandleBase*>*&);
200};
201
203public:
204 void attachNodes( SoNode*simple, SoNode*detailed, bool unpickable );
205 void setPickableStateOfNodes( SoNode*simple, SoNode*detailed, bool unpickable );
206 void detachNodes( SoNode*simple, SoNode*detailed );
207private:
208 friend class TrackHandleBase;//The life of these classes are entirely owned by TrackHandleBase.
209 friend class TrackHandleBase::Imp;//The life of these classes are entirely owned by TrackHandleBase.
216 class Imp;
218};
219
220
221#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 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
virtual void ensureInitTSOSs(std::vector< AssociatedObjectHandleBase * > *&)
Ensure that the TSOSs are initialized.
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.