ATLAS Offline Software
Loading...
Searching...
No Matches
AscObj_TSOS Class Reference

#include <AscObj_TSOS.h>

Inheritance diagram for AscObj_TSOS:
Collaboration diagram for AscObj_TSOS:

Public Types

enum  PICKSTYLE { UNPICKABLE , ALL , COMPONENTS }

Public Member Functions

 AscObj_TSOS (TrackHandleBase *, const Trk::TrackStateOnSurface *, unsigned indexOfPointOnTrack)
void setDistToNextPar (const double &)
void buildShapes (SoSeparator *&shape_simple, SoSeparator *&shape_detailed)
QStringList clicked ()
void zoomView ()
 Depending on the controller settings, will attempt to zoom the view to this TSOS, for example in click()
bool isShortMeasurement ()
 Return true if TRT/MDT & shortened mode is on, false otherwise.
virtual void setVisible (bool)
virtual TrackCommonFlags::TSOSPartsFlags parts () const
const Trk::MeasurementBasemeasurement () const
const Trk::Surfacesurface () const
const Trk::RIO_OnTrackrioOnTrack () const
const Trk::CompetingRIOsOnTrackcompetingRIOsOnTrack () const
const Trk::TrackStateOnSurfacetrackStateOnSurface () const
Amg::Vector3D approxCenter () const
virtual bool initiatesOwnZooms () const
virtual QTreeWidgetItem * browserTreeItem () const
virtual void setBrowserTreeItem (QTreeWidgetItem *obt)
virtual unsigned nParts () const
bool hasParameters () const
bool hasParError () const
bool hasError () const
bool hasMaterialEffect () const
bool hasSurface () const
bool hasMeasurement () const
TrackSysCommonDatacommon () const
void setPickable (PICKSTYLE)
PICKSTYLE pickStyle () const
bool visible () const
void toggleVisible ()
TrackHandleBasetrackHandle () const
void update3DObjects ()
SoSeparator * shapeSimple () const
SoSeparator * shapeDetailed () const

Static Public Member Functions

static int numberOfInstances ()

Protected Member Functions

int regionIndex () const
double lodCrossOverValue () const

Private Member Functions

virtual ~AscObj_TSOS ()
double deviationFromMeasurement (const bool &absolute=false)
void addDeviationFromMeasurementInfoToShapes (SoSeparator *&shape_simple, SoSeparator *&shape_detailed)
void addTransformToSurface (SoSeparator *&shape_simple, SoSeparator *&shape_detailed)
void addTrackParamInfoToShapes (SoSeparator *&shape_simple, SoSeparator *&shape_detailed, bool showPars, bool showParsErrors, bool showSurfaces)
void addErrors (const Trk::Surface &theSurface, const AmgSymMatrix(5)&tmpCovMat, const Amg::Vector2D &localPos, const Amg::Vector3D &p1, bool showSurfaces, SoSeparator *shape_simple, SoSeparator *shape_detailed, bool force1D, bool applyLocalTrans)
void addRIO_OnTrackInfoToShapes (SoSeparator *&shape_simple, SoSeparator *&shape_detailed, const Trk::RIO_OnTrack *rio, bool blockDrawingOfGP=false)
void addCompetingRIO_OnTrackInfoToShapes (SoSeparator *&shape_simple, SoSeparator *&shape_detailed)
void addSurfaceToShapes (SoSeparator *&shape_simple, SoSeparator *&shape_detailed)
void addMaterialEffectsToShapes (SoSeparator *&shape_simple, SoSeparator *&shape_detailed)
SoTranslation * getZTranslationTube (const Trk::Surface *, const double &maxTrans) const
void registerShapes (SoSeparator *simple, SoSeparator *detailed)
void unregisterShapes (SoSeparator *simple, SoSeparator *detailed)
AssocObjAttachmentHandlegetAttachmentHandle ()

Static Private Member Functions

static void ensureInitSeps (SoSeparator *&shape_simple, SoSeparator *&shape_detailed)

Private Attributes

const Trk::TrackStateOnSurfacem_tsos
TrackCommonFlags::TSOSPartsFlags m_parts
unsigned m_indexOfPointOnTrack
double m_distToNextPar
QTreeWidgetItem * m_objBrowseTree
HitToSoNode m_hitToSoNode
Impm_d
TrackHandleBasem_trackHandle
bool m_visible
PICKSTYLE m_pickStyle

Detailed Description

Definition at line 45 of file AscObj_TSOS.h.

Member Enumeration Documentation

◆ PICKSTYLE

Constructor & Destructor Documentation

◆ AscObj_TSOS()

AscObj_TSOS::AscObj_TSOS ( TrackHandleBase * track,
const Trk::TrackStateOnSurface * tsos,
unsigned indexOfPointOnTrack )

Definition at line 94 of file AscObj_TSOS.cxx.

97 : AssociatedObjectHandleBase(track), m_tsos(tsos),
99 m_indexOfPointOnTrack(indexOfPointOnTrack),
100 m_distToNextPar(-1),
101 m_objBrowseTree(nullptr)
102{
104
105 const Trk::Surface * surf(nullptr);
106
108
109 if (m_tsos->trackParameters()) {
111 if (dynamic_cast<const Trk::TrackParameters *>(m_tsos->trackParameters())) {
114 }
115 else {
117 }
118 }
119 surf = &(m_tsos->trackParameters()->associatedSurface());
120 }
121
122 if (measurement()) {
124 if (rioOnTrack()) {
127 else
129 } else if (competingRIOsOnTrack()) {
132 else
134 } else
135 VP1Msg::messageDebug("Warning: Ignoring measurement which is not a (competing) rio on track.");
136 if (!surf) surf = &(measurement()->associatedSurface());
137 }
138 const Trk::MaterialEffectsBase* matEff = m_tsos->materialEffectsOnTrack();
139 if (matEff) {
140 const Trk::MaterialEffectsOnTrack * meot = dynamic_cast<const Trk::MaterialEffectsOnTrack * >(matEff);
141 if (meot) {
142 if (meot->energyLoss()&&meot->energyLoss()->deltaE()!=0)
144 else
146 } else {
147 if (dynamic_cast<const Trk::EstimatedBremOnTrack * >(matEff))
148 VP1Msg::messageDebug("Warning: Ignoring EstimatedBremOnTrack.");
149 else
150 VP1Msg::messageDebug("Warning: Ignoring material effect which is not MaterialEffectsOnTrack.");
151 }
152 if (!surf)
153 surf = &(matEff->associatedSurface());
154 }
155 if (surf) {
156 if (surf->associatedDetectorElement())
158 else
160
161 }
162}
QTreeWidgetItem * m_objBrowseTree
Definition AscObj_TSOS.h:86
double m_distToNextPar
Definition AscObj_TSOS.h:85
unsigned m_indexOfPointOnTrack
Definition AscObj_TSOS.h:84
const Trk::TrackStateOnSurface * m_tsos
Definition AscObj_TSOS.h:82
TrackCommonFlags::TSOSPartsFlags m_parts
Definition AscObj_TSOS.h:83
const Trk::RIO_OnTrack * rioOnTrack() const
const Trk::MeasurementBase * measurement() const
const Trk::CompetingRIOsOnTrack * competingRIOsOnTrack() const
static void initClass()
@ TSOS_MeasCompetingRioOnTrackOutlier
bit 7
@ TSOS_MeasRioOnTrackOutlier
bit 6
@ TSOS_MeasRioOnTrackNotOutlier
bit 4
@ TSOS_TrackParsErrorsNotPerigee
bit 1
@ TSOS_MeasCompetingRioOnTrackNotOutlier
bit 5
@ TSOS_TrackParsErrorsPerigee
bit 2
@ TSOS_MaterialEffectsWithNoDeltaE
bit 12
double deltaE() const
returns the
const Surface & associatedSurface() const
returns the surface to which these m.eff. are associated.
const EnergyLoss * energyLoss() const
returns the energy loss object.
virtual const Surface & associatedSurface() const =0
Interface method to get the associated Surface.
@ Perigee
This represents a perigee, and so will contain a Perigee object only.
@ Outlier
This TSoS contains an outlier, that is, it contains a MeasurementBase/RIO_OnTrack which was not used ...
@ Hole
A hole on the track - this is defined in the following way.
static void messageDebug(const QString &)
Definition VP1Msg.cxx:39
ParametersBase< TrackParametersDim, Charged > TrackParameters

Member Function Documentation

◆ addCompetingRIO_OnTrackInfoToShapes()

void AscObj_TSOS::addCompetingRIO_OnTrackInfoToShapes ( SoSeparator *& shape_simple,
SoSeparator *& shape_detailed )
private

Definition at line 749 of file AscObj_TSOS.cxx.

751{
752 // std::cout<<"addCompetingRIO_OnTrackInfoToShapes"<<std::endl;
753 const Trk::CompetingRIOsOnTrack * crio = competingRIOsOnTrack();
754
755 ensureInitSeps(shape_simple,shape_detailed);
756
757 //Possibly a custom colour
759 SoMaterial * mat = common()->controller()->customMatMeasurements();
760 shape_simple->addChild(mat);
761 shape_detailed->addChild(mat);
762 } else if (m_parts & trackHandle()->customColouredTSOSParts()&TrackCommonFlags::TSOS_MeasCompetingRioOnTrackOutlier) {
763 SoMaterial * mat = common()->controller()->customMatMeasurementsOutliers();
764 shape_simple->addChild(mat);
765 shape_detailed->addChild(mat);
766 }
767
768 if (common()->controller()->drawMeasGlobalPositions()){
769 // std::cout<<"cROT - showing globalpositions."<<std::endl;
770
771 // if (surface()!=crio->rioOnTrack(crio->indexOfMaxAssignProb ())->associatedSurface())
772 // VP1Msg::message("AscObj_TSOS::addCompetingRIO_OnTrackInfoToShapes WARNING: cROT surface doesn't match one from surface()") ;
773//Draw cross marking global position of the rio on track
774 SoTranslation * theTransform = new SoTranslation;
776 // std::cout<<"globalPOS=("<<crio->globalPosition().x()<<","<<crio->globalPosition().y()<<","<<crio->globalPosition().z()<<")"<<std::endl;
777 // std::cout<<"associatedSurf centre =("<<crio->associatedSurface().center().x()<<","<<crio->associatedSurface().center().y()<<","<<crio->associatedSurface().center().z()<<")"<<std::endl;
778 // std::cout<<"offset=("<<offset.x()<<","<<offset.y()<<","<<offset.z()<<")"<<std::endl;
779 // theTransform->translation.setValue( offset.x(), offset.y(), offset.z());
780
781
782 Amg::Vector3D locPos = (crio->associatedSurface().transform().rotation().inverse())*(offset);
783 theTransform->translation.setValue( locPos.x(), locPos.y(), locPos.z());
784 // std::cout<<"the GP Transform=("<<locPos.x()<<","<<locPos.y()<<","<<locPos.z()<<")"<<std::endl;
785
786 // double xoff= crio->localParameters().get(Trk::loc1);
787 // double yoff= crio->localParameters().get(Trk::loc2);
788 // double zoff= globalpos.z()-surface().center().z();
789 // theTransform->translation.setValue(xoff,yoff,0.0);
790 // SoTranslation * theTransformBack = new SoTranslation;
791 // theTransformBack->translation.setValue(-locPos.x(), -locPos.y(), -locPos.z());
792 // std::cout<<"theTransformBack="<<Amg::toString(*theTransformBack)<<std::endl;
793
794 SoSeparator * gpSep = new SoSeparator;
795
796 gpSep->addChild(theTransform);
797 gpSep->addChild(common()->nodeManager().getShapeNode_Cross(50));
798 shape_detailed->addChild(gpSep);
799 }
800
801 //Draw all contained rio on tracks
802 TrackCommonFlags::TSOSPartsFlags f(trackHandle()->shownTSOSParts()&m_parts);
803 const bool showcRioOnTrack(f & TrackCommonFlags::TSOS_AnyMeasurement);
804
805 if (showcRioOnTrack){
806
807 // FIXME - shouldn't need to use so many seps, but having problems with transformations.
808 SoSeparator * rotSepSimple = new SoSeparator;
809 SoSeparator * rotSepDetailed = new SoSeparator;
810
811 // std::cout<<"addCompetingRIO_OnTrackInfoToShapes: About to draw most probable ROT"<<std::endl;
812 unsigned int maxProb = crio->indexOfMaxAssignProb ();
813 // std::cout<<"Drawing maxProb ["<<maxProb<<"] strip "<<std::endl;
814 addRIO_OnTrackInfoToShapes(rotSepSimple,rotSepDetailed, &(crio->rioOnTrack(maxProb)), true);
815 shape_detailed->addChild(rotSepDetailed);
816 shape_simple->addChild(rotSepSimple);
817
818 // std::cout<<"addCompetingRIO_OnTrackInfoToShapes: Done drawing most probable"<<std::endl;
819
820 SoTransparency * transparent = new SoTransparency;
821 transparent->transparency.setValue(0.5);
822 shape_detailed->addChild( transparent );
823
824 const Trk::RIO_OnTrack* rot = &(crio->rioOnTrack(maxProb));
825 //if (rot==0 || rot == NULL) { VP1Msg::message("WARNING: cROT max prob ROT is NULL. Aborting."); return;}
826 if (!rot) { VP1Msg::message("WARNING: cROT has empty max prob ROT. Aborting."); return;}
827 // Now, last position drawn was that of strip pos for most probable ROT. So take this as basis.
828 if (!rot->detectorElement()) { VP1Msg::message("WARNING: most prob ROT from cROT has empty DE. Aborting."); return;}
829
830 const MuonGM::TgcReadoutElement* tgcDetEl =
831 dynamic_cast<const MuonGM::TgcReadoutElement*>(rot->detectorElement());
832 const MuonGM::RpcReadoutElement* rpcDetEl =
833 dynamic_cast<const MuonGM::RpcReadoutElement*>(rot->detectorElement());
834
835 // FIXME - could do all this a bit more elegantly with templates
836 if ( (!tgcDetEl) && (!rpcDetEl)) { VP1Msg::message("WARNING: most prob ROT from cROT has Unknown DE type. Aborting."); std::cout<<*rot<<std::endl;return;}
837
838 // Amg::Vector3D lastPos,currPos;
839 // if (tgcDetEl){
840 // lastPos = tgcDetEl->stripPos(rot->identify());
841 // } else {
842 // lastPos = rpcDetEl->stripPos(rot->identify());
843 // }
844
845 const Trk::Surface* lastSurf=&(crio->rioOnTrack(maxProb).associatedSurface());
846
847 // std::cout<<"lastSurf = ("<<*lastSurf<<") for most prob="<<rot->identify().get_compact()<<std::endl;
848 unsigned int nrio = crio->numberOfContainedROTs();
849 for (unsigned int n = 0; n < nrio; n++)
850 {
851 if (n==maxProb) continue; // already drawn.
852 // std::cout<<"Strip #"<<n<<std::endl;
853 const Trk::RIO_OnTrack* rot = &(crio->rioOnTrack(n));
854
855 // SoTranslation * theTransform = new SoTranslation;
856 if (!rot) { VP1Msg::message("WARNING: cROT has empty ROT. Skipping."); continue;}
857
858 // Now do offset from last strip pos, to new one (for strips on different layers, this will include a zoffset)
859 // const MuonGM::TgcReadoutElement* tgcDetEl =
860 // dynamic_cast<const MuonGM::TgcReadoutElement*>(rot->detectorElement());
861 // const MuonGM::RpcReadoutElement* rpcDetEl =
862 // dynamic_cast<const MuonGM::RpcReadoutElement*>(rot->detectorElement());
863 //
864 // // FIXME - could do all this a bit more elegantly with templates
865 //
866 // if ( (!tgcDetEl) && (!rpcDetEl)) { VP1Msg::message("WARNING: ROT from cROT has Unknown DE type. Skipping."); std::cout<<*rot<<std::endl; continue;}
867 //
868 // if (tgcDetEl){
869 // currPos = tgcDetEl->stripPos(rot->identify());
870 // } else {
871 // currPos = rpcDetEl->stripPos(rot->identify());
872 // }
873 // Amg::Vector3D offset = currPos - lastPos;
874 // Amg::Vector3D<double> locPos = (rot->associatedSurface().transform().inverse())*(offset);
875 // theTransform->translation.setValue( locPos.x(), locPos.y(), locPos.z());
876 // lastPos=currPos;
877 SoSeparator * rotSepSimple = new SoSeparator;
878 SoSeparator * rotSepDetailed = new SoSeparator;
879
880 if ( &(rot->associatedSurface ())!=lastSurf) {
881 // std::cout<<"New surface!"<<std::endl;
882 // Do transformation to centre of new surface, especially important if there is a zoffset.
883 // NB we're assuming that the surfaces are aligned! Might not be entirely safe, but really should be!
884 // (I hate cROTs)
885 Amg::Vector3D offset = rot->associatedSurface().center() - lastSurf->center();
886 // std::cout<<"new surf offset = "<<Amg::toString(offset)<<std::endl;
887
888 // lastSurf = &(rot->associatedSurface());
889 Amg::Vector3D locPos = (rot->associatedSurface().transform().rotation().inverse())*(offset);
890 // std::cout<<"new surf locPos = "<<Amg::toString(locPos)<<std::endl;
891
892 SoTranslation * theTransform = new SoTranslation;
893 theTransform->translation.setValue( locPos.x(), locPos.y(), locPos.z());
894 rotSepDetailed->addChild(theTransform);
895 rotSepSimple->addChild(theTransform);
896 }
897 // lastSurf = &(rot->associatedSurface());
898
899 // rotSepDetailed->addChild(theTransform);
900 // rotSepSimple->addChild(theTransform);
901
902
903 m_hitToSoNode.buildStripShapes(crio->rioOnTrack(n),rotSepSimple,rotSepDetailed,true);
904 shape_simple->addChild(rotSepSimple);
905 shape_detailed->addChild(rotSepDetailed);
906 // back to centre
907
908 // std::cout<<"Rot "<<n<<" Done"<<std::endl;
909
910 }
911 }
912}
void addRIO_OnTrackInfoToShapes(SoSeparator *&shape_simple, SoSeparator *&shape_detailed, const Trk::RIO_OnTrack *rio, bool blockDrawingOfGP=false)
HitToSoNode m_hitToSoNode
static void ensureInitSeps(SoSeparator *&shape_simple, SoSeparator *&shape_detailed)
TrackSysCommonData * common() const
TrackHandleBase * trackHandle() const
SoSFFloat transparency
TrackSystemController * controller() const
SoMaterial * customMatMeasurementsOutliers() const
SoMaterial * customMatMeasurements() const
virtual unsigned int numberOfContainedROTs() const =0
Number of RIO_OnTracks to be contained by this CompetingRIOsOnTrack.
unsigned int indexOfMaxAssignProb() const
Index of the ROT with the highest assignment probability.
virtual const RIO_OnTrack & rioOnTrack(unsigned int) const =0
returns the RIO_OnTrack (also known as ROT) objects depending on the integer.
virtual const Amg::Vector3D & globalPosition() const =0
Interface method to get the global Position.
virtual const TrkDetElementBase * detectorElement() const =0
returns the detector element, assoicated with the PRD of this class
virtual const Surface & associatedSurface() const override=0
returns the surface for the local to global transformation
const Amg::Vector3D & center() const
Returns the center position of the Surface.
static void message(const QString &, IVP1System *sys=0)
Definition VP1Msg.cxx:30
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Eigen::Matrix< double, 3, 1 > Vector3D

◆ addDeviationFromMeasurementInfoToShapes()

void AscObj_TSOS::addDeviationFromMeasurementInfoToShapes ( SoSeparator *& shape_simple,
SoSeparator *& shape_detailed )
private

Definition at line 306 of file AscObj_TSOS.cxx.

307{
308 const Trk::RIO_OnTrack* rio = rioOnTrack();
309 Identifier id = rio->identify();
310 const AtlasDetectorID * idhelper = VP1DetInfo::atlasIDHelper();
311 //FIXME: should we check for idhelper before?
312 const bool isTRT = idhelper && idhelper->is_indet(id) && idhelper->is_trt(id);
313 const bool isMDT = idhelper && idhelper->is_muon(id) && idhelper->is_mdt(id);
314 if ( idhelper && ( isTRT||isMDT ) )
315 {
316 const Trk::Surface& theSurface = rio->associatedSurface();
317 const Amg::Vector3D origo = theSurface.localToGlobal(Amg::Vector2D(0,0));
318 const Amg::Vector3D unitz = theSurface.localToGlobal(Amg::Vector2D(0,1));
319 const Amg::Vector3D& point = m_tsos->trackParameters()->position(); //FIXME: use the one from rio when it is fixed.
320 //const Amg::Vector3D& point = rio->globalPosition();
321 //this is currently returning a position on the z-axis which is wrong. Re-enable this feature
322 //when this is fixed
323
324 //Get the point 'pointMeas' on the measurement z-axis which is closest to the point 'point'
325 double s;
326 VP1LinAlgUtils::distPointLineParam( point, origo, unitz, s );
327 const Amg::Vector3D pointMeas = origo + s*(unitz - origo);
328
329 SoLineSet * line = new SoLineSet();
330 SoVertexProperty * vertices = new SoVertexProperty();
331 vertices->vertex.set1Value(0,point.x(),point.y(),point.z());
332 vertices->vertex.set1Value(1,pointMeas.x(),pointMeas.y(),pointMeas.z());
333 line->numVertices = 2;
334 line->vertexProperty = vertices;
335
336 //colour according to side() (left=red, right=green)
337 if (isTRT)
338 {
339 const InDet::TRT_DriftCircleOnTrack * dcot = dynamic_cast<const InDet::TRT_DriftCircleOnTrack *>(rio);
340 if (not dcot) return;
341 if (dcot->side()!=Trk::NONE)
342 {
343 SoSeparator * sep = new SoSeparator;
344 SoMaterial * mat = new SoMaterial;
345 if (dcot->side()==Trk::LEFT)
346 mat->diffuseColor.setValue(1,0,0);
347 else //(dcot->side()==Trk::RIGHT)
348 mat->diffuseColor.setValue(0,1,0);
349 sep->addChild(mat);
350 sep->addChild(line);
351 shape_detailed->addChild(sep);
352 return;
353 }
354 } else if (isMDT){
355 const Muon::MdtDriftCircleOnTrack * dcot = dynamic_cast<const Muon::MdtDriftCircleOnTrack *>(rio);
356 if (not dcot) return;
357 if (dcot->side()!=Trk::NONE)
358 {
359 SoSeparator * sep = new SoSeparator;
360 SoMaterial * mat = new SoMaterial;
361 if (dcot->side()==Trk::LEFT)
362 mat->diffuseColor.setValue(1,0,0);
363 else //(dcot->side()==Trk::RIGHT)
364 mat->diffuseColor.setValue(0,1,0);
365 sep->addChild(mat);
366 sep->addChild(line);
367 shape_detailed->addChild(sep);
368 return;
369 }
370 }
371
372 ensureInitSeps(shape_simple,shape_detailed);
373 shape_detailed->addChild(line);
374 }
375}
bool is_mdt(Identifier id) const
bool is_indet(Identifier id) const
bool is_muon(Identifier id) const
bool is_trt(Identifier id) const
Identifier identify() const
return the identifier -extends MeasurementBase
virtual void localToGlobal(const Amg::Vector2D &locp, const Amg::Vector3D &mom, Amg::Vector3D &glob) const =0
Specified by each surface type: LocalToGlobal method without dynamic memory allocation.
static const AtlasDetectorID * atlasIDHelper()
static void distPointLineParam(const Amg::Vector3D &point, const Amg::Vector3D &point0, const Amg::Vector3D &point1, double &s)
Eigen::Matrix< double, 2, 1 > Vector2D
@ LEFT
the drift radius is negative (see Trk::AtaStraightLine)
@ NONE
it was not possible to determine the which side of the straw the track passed;

◆ addErrors()

void AscObj_TSOS::addErrors ( const Trk::Surface & theSurface,
const AmgSymMatrix(5)& tmpCovMat,
const Amg::Vector2D & localPos,
const Amg::Vector3D & p1,
bool showSurfaces,
SoSeparator * shape_simple,
SoSeparator * shape_detailed,
bool force1D,
bool applyLocalTrans )
private

Definition at line 454 of file AscObj_TSOS.cxx.

456{
457 VP1Msg::messageVerbose("addErrors");
458 if (applyLocalTrans) VP1Msg::messageVerbose("applyLocalTrans");
459
460 //Fixme: get from collhandle:!!
461 const bool settingsDRAWCYLINDER = common()->controller()->parTubeErrorsDrawCylinders();
462 const bool settingsDRAWZERRCIRCLES = settingsDRAWCYLINDER;
463 const double settingsSIGMASCALE = common()->controller()->nStdDevForParamErrors();
464
465 SoSeparator * errSimple = new SoSeparator;
466 SoSeparator * errDetailed = new SoSeparator;
467
468 //Possibly a custom colour
469 if (trackHandle()->customColouredTSOSParts()&TrackCommonFlags::TSOS_AnyParsErrors) {
470 // FIXME - what about meas errors?
471 SoMaterial * mat = common()->controller()->customMatParameterErrors();
472 errSimple->addChild( mat );
473 errDetailed->addChild( mat );
474 }
475 // SoTransparency * transparent = new SoTransparency;
476 // transparent->transparency.setValue(0.5);
477 // errSimple->addChild( transparent );
478 // errDetailed->addChild( transparent );
479
481 // Check for type of associated surface
482 // const Trk::Surface * theSurface = trackParams->associatedSurface();
483 const Trk::CylinderSurface * cylSurf = dynamic_cast<const Trk::CylinderSurface *>(&theSurface);
484 const Trk::DiscSurface * disSurf = dynamic_cast<const Trk::DiscSurface *>(&theSurface);
485 const Trk::PerigeeSurface * perSurf = dynamic_cast<const Trk::PerigeeSurface *>(&theSurface);
486 const Trk::PlaneSurface * plaSurf = dynamic_cast<const Trk::PlaneSurface *>(&theSurface);
487 const Trk::StraightLineSurface * strSurf = dynamic_cast<const Trk::StraightLineSurface *>(&theSurface);
488 if ( plaSurf ) /* Plane Surface */
489 {
490 // Shift from Surface centre to correct position
491 if (applyLocalTrans) {
492 SoTranslation * theTransform = new SoTranslation;
493 std::optional<Amg::Vector2D> locPosTmp = surface()->globalToLocal(p1);
494 if (locPosTmp) {
495 theTransform->translation.setValue(locPosTmp->x(),locPosTmp->y(),0.0);
496 // std::cout<<"applyLocalTrans & Offset=("<<locPosTmp->x()<<","<<locPosTmp->y()<<std::endl;
497 errSimple->addChild(theTransform);
498 errDetailed->addChild(theTransform);
499 } else {
500 VP1Msg::message("AscObj_TSOS::addErrors - failed to get tmp position");
501 }
502 }
503
504 VP1Msg::messageVerbose("Plane surf error of size:"+QString::number(tmpCovMat.rows()));
505 if (force1D) VP1Msg::messageVerbose("Forcing 1D");
506 VP1ErrorUtils::errorAtPlaneSurface(errSimple, errDetailed, tmpCovMat, &theSurface, p1, settingsSIGMASCALE, npoints, showSurfaces, force1D, false );
507 ensureInitSeps(shape_simple,shape_detailed);
508 shape_simple->addChild( errSimple );
509 shape_detailed->addChild( errDetailed );
510 } else if ( strSurf || perSurf) {
511 /* Straight Line Surface or perigee surface*/
512 // Shift from Surface centre to correct position
513 if (applyLocalTrans){
514 SoTranslation * theTransform = getZTranslationTube(&theSurface,10000.0);
515 errSimple->addChild(theTransform);
516 errDetailed->addChild(theTransform);
517 }
518 VP1ErrorUtils::errorAtStraightLineSurface(errSimple, errDetailed, tmpCovMat, localPos, &theSurface, settingsSIGMASCALE, settingsDRAWZERRCIRCLES, settingsDRAWCYLINDER, npoints, force1D, false);
519 ensureInitSeps(shape_simple,shape_detailed);
520 shape_simple->addChild( errSimple );
521 shape_detailed->addChild( errDetailed );
522 } else if ( cylSurf ) {
523 VP1Msg::message("WARNING: Visualisation of errors on Cylinder Surface not implemented");
524 } else if ( disSurf ) {
525 VP1Msg::message("WARNING: Visualisation of errors on Disc Surface not implemented");
526 }
527 VP1Msg::messageVerbose("leaving addErrors");
528}
SoTranslation * getZTranslationTube(const Trk::Surface *, const double &maxTrans) const
const Trk::Surface * surface() const
SoMaterial * customMatParameterErrors() const
virtual bool globalToLocal(const Amg::Vector3D &glob, const Amg::Vector3D &mom, Amg::Vector2D &loc) const =0
Specified by each surface type: GlobalToLocal method without dynamic memory allocation - boolean chec...
static void errorAtPlaneSurface(SoSeparator *errSimple, SoSeparator *errDetailed, const AmgSymMatrix(5)&tmpCovMat, const Trk::Surface *theSurface, const Amg::Vector3D &p1, const double &nStdDev=3.0, int numNodes=12, const bool &moveToSurface=false, const bool &force1D=false, const bool &addTransform=true)
static void errorAtStraightLineSurface(SoSeparator *errSimple, SoSeparator *errDetailed, const AmgSymMatrix(5)&tmpcovmat, const Amg::Vector2D &localPos, const Trk::Surface *theSurface, const double &nStdDev=3.0, const bool &drawZErrCircles=false, const bool &drawCylinder=false, int numNodes=12, const bool &force1D=false, const bool &addTransform=true)
static void messageVerbose(const QString &)
Definition VP1Msg.cxx:84

◆ addMaterialEffectsToShapes()

void AscObj_TSOS::addMaterialEffectsToShapes ( SoSeparator *& shape_simple,
SoSeparator *& shape_detailed )
private

Definition at line 585 of file AscObj_TSOS.cxx.

586{
587 const double settingsForceOnTrack = false;
588
589 ensureInitSeps(shape_simple,shape_detailed);
590 SoSeparator * matSepSimple = new SoSeparator;
591 SoSeparator * matSepDetailed = new SoSeparator;
592
593 //1) Transformation.
594
595 if (m_tsos->trackParameters()) {
596 //Put on position of track parameter
597 Amg::Vector3D p1(m_tsos->trackParameters()->position());//point
598 SoTranslation * theTransform = new SoTranslation;
599 theTransform->translation.setValue(p1.x(),p1.y(),p1.z());
600 matSepSimple->addChild(theTransform);
601 matSepDetailed->addChild(theTransform);
602 } else {
603 const Trk::Surface * surf = surface();
604 if (!surf) {
605 VP1Msg::message("AscObj_TSOS::addMaterialEffectsToShapes WARNING: Has neither surface or parameter to get position!");
606 } else {
607 if (settingsForceOnTrack) {
608 VP1Msg::message("AscObj_TSOS::addMaterialEffectsToShapes WARNING: settingsForceOnTrack not implemented");
609
610 //Take position from surface and somehow constrain it onto the line.
611 //(Fixme... same kind of treatment as in the "short tubes"... how?).
612 } else {
613 //Take center of surface if present.
614 SoTransform * theTransform = VP1LinAlgUtils::toSoTransform(surf->transform());
615 matSepSimple->addChild(theTransform);
616 matSepDetailed->addChild(theTransform);
617 }
618 }
619 }
620 //2) Possibly a custom colour
621
622 if (trackHandle()->customColouredTSOSParts()&TrackCommonFlags::TSOS_AnyMaterialEffects) {
623 SoMaterial * mat = common()->controller()->customMatMaterialEffects();
624 matSepSimple->addChild(mat);
625 matSepDetailed->addChild(mat);
626 }
627
628 //3) The shape
629
630 SoPointSet * point = common()->singlePoint();
631 matSepSimple->addChild(point);
632
634 matSepDetailed->addChild(point);
635 } else {
636 const Trk::MaterialEffectsBase* matEff = m_tsos->materialEffectsOnTrack();
637 const Trk::MaterialEffectsOnTrack* matEffOnTrk = dynamic_cast<const Trk::MaterialEffectsOnTrack*>(matEff);
638 if (matEffOnTrk){
639 const double absDeltaE = std::abs(matEffOnTrk->energyLoss()->deltaE());
640 const double radius(absDeltaE > 1*CLHEP::eV ? 5.0*exp(log(absDeltaE/CLHEP::MeV)/3.0) : 0);//\propto cube root
641 //TK: radius used to be: 5.0*sqrt(absDE), but we want sphere volume \propto deltaE
642 const double scale = common()->controller()->materialEffectsOnTrackScale();
643 if (scale * radius > 0.1) {
644 SoSphere * meotSphere = new SoSphere;
645 meotSphere->radius.setValue( scale * radius );
646 matSepDetailed->addChild(meotSphere);
647 } else {
648 matSepDetailed->addChild(point);
649 }
650 }
651 }
652
653 //Attach:
654 shape_simple->addChild(matSepSimple);
655 shape_detailed->addChild(matSepDetailed);
656}
SoPointSet * singlePoint() const
SoMaterial * customMatMaterialEffects() const
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
static SoTransform * toSoTransform(const HepGeom::Transform3D &, SoTransform *t=0)

◆ addRIO_OnTrackInfoToShapes()

void AscObj_TSOS::addRIO_OnTrackInfoToShapes ( SoSeparator *& shape_simple,
SoSeparator *& shape_detailed,
const Trk::RIO_OnTrack * rio,
bool blockDrawingOfGP = false )
private

Definition at line 659 of file AscObj_TSOS.cxx.

662{
663 // VP1Msg::messageVerbose("AscObj_TSOS::addRIO_OnTrackInfoToShapes() start");
664
665 if (!rio) { return;}
666// Identifier id = rio->identify();
667
668 ensureInitSeps(shape_simple,shape_detailed);
669
670 TrackCommonFlags::TSOSPartsFlags f(trackHandle()->shownTSOSParts()&m_parts);
671 const bool showMeas(f & TrackCommonFlags::TSOS_AnyMeasurement);
672 const bool showMeasErrors(f & TrackCommonFlags::TSOS_MeasError);
673
675 // std::cout<<">>>>>>>>>>> addRIO_OnTrackInfoToShapes: Have measurement of type: "<<static_cast<unsigned int>(type)<<" & showRioOnTrack="<<showMeas<<std::endl;
676 if (showMeas){
677 // std::pair<SoSeparator*, std::vector<SoNode*> > detailed_nodes, simple_nodes;
678 // handle colouring
679 // VP1Msg::message(m_objToType.name(*rio));
680
681 if (m_parts & trackHandle()->customColouredTSOSParts()&TrackCommonFlags::TSOS_AnyMeasRioOnTrack) {
682 SoMaterial * mat;
685 else
687 shape_simple->addChild(mat);
688 shape_detailed->addChild(mat);
689 }
690
693 if (isStrip)
694 m_hitToSoNode.buildStripShapes(*rio,shape_simple,shape_detailed,blockDrawingOfGP); // transforms to localPos (i.e. assumes in surface frame)
695 else {
696 if (isDC) {
697 float zShift=0.0;
698 if (isShortMeasurement()){
699 SoTranslation * theTransform = getZTranslationTube(&(rio->associatedSurface ()),10000.0);
700 float x,y; // dummy
701 theTransform->translation.getValue().getValue(x,y,zShift);
702 shape_simple->addChild(theTransform);
703 shape_detailed->addChild(theTransform);
704 }
705 m_hitToSoNode.buildTubeShapes(*rio,shape_simple,shape_detailed,blockDrawingOfGP,isShortMeasurement()?common()->controller()->measurementsShorttubesScale():0.0, false);
706 if (isShortMeasurement()){
707 SoTranslation * theTransform = new SoTranslation;
708 theTransform->translation.setValue(0,0,-zShift);
709 shape_simple->addChild(theTransform);
710 shape_detailed->addChild(theTransform);
711 }
712 }
713 }
714 }
715
716//Errors
717 if (showMeasErrors){
718 const Trk::LocalParameters & locParams = rio->localParameters () ;
719// VP1Msg::message( "Trying to draw measurement errors for ROT with id="+QString::number(rio->identify().get_compact())+" locparams have dim="+QString::number(locParams.dimension())+", locellmat="+QString::number(rio->localErrorMatrix().covariance().num_row()));
720 VP1Msg::message( "Trying to draw measurement errors for ROT with id="+QString::number(rio->identify().get_compact())+" locparams have dim="+QString::number(locParams.dimension())+", locellmat="+QString::number(rio->localCovariance().rows()));
721
722 Amg::Vector2D localPos;
723 /*
724 * see:
725 * Tracking/TrkEvent/TrkEventPrimitives/trunk/TrkEventPrimitives/LocalParameters.h
726 * Tracking/TrkEvent/TrkEventPrimitives/trunk/src/LocalParameters.cxx
727 */
728 if (locParams.contains(Trk::loc1)) {
729 localPos( locParams.get(Trk::loc1), locParams.contains(Trk::loc2) ? locParams.get(Trk::loc2) : 0 );
730 } else{
731 VP1Msg::message( "WARNING: locParams.contains(Trk::loc1) is FALSE!!");
732 }
733
734 bool force1D=false;
735 if (locParams.dimension ()!=rio->localCovariance().rows()){
736 VP1Msg::message( "WARNING: ROT has inconsistent dimensions between cov matrix and local parameters. Forcing to 1D.");
737 force1D=true;
738 }
739 force1D=true; //FIXME!
740
741 // last parameter sets whether we do a local shift.
742 addErrors(rio->associatedSurface(), rio->localCovariance(), localPos, rio->globalPosition(), false,
743 shape_simple, shape_detailed, force1D, true);
744 VP1Msg::message( "Done with measurement errors");
745 }
746}
#define y
#define x
void addErrors(const Trk::Surface &theSurface, const AmgSymMatrix(5)&tmpCovMat, const Amg::Vector2D &localPos, const Amg::Vector3D &p1, bool showSurfaces, SoSeparator *shape_simple, SoSeparator *shape_detailed, bool force1D, bool applyLocalTrans)
bool isShortMeasurement()
Return true if TRT/MDT & shortened mode is on, false otherwise.
value_type get_compact() const
Get the compact id.
static MeasurementType type(const Trk::PrepRawData *prd)
bool contains(ParamDefs par) const
The simple check for the clients whether the parameter is contained.
double get(ParamDefs par) const
Retrieve specified parameter (const version).
int dimension() const
Dimension of this localParameters() vector.
const LocalParameters & localParameters() const
Interface method to get the LocalParameters.
const Amg::MatrixX & localCovariance() const
Interface method to get the localError.
virtual const Amg::Vector3D & globalPosition() const override=0
Interface method to get the global Position.
@ loc2
generic first and second local coordinate
Definition ParamDefs.h:35
@ loc1
Definition ParamDefs.h:34

◆ addSurfaceToShapes()

void AscObj_TSOS::addSurfaceToShapes ( SoSeparator *& shape_simple,
SoSeparator *& shape_detailed )
private

Definition at line 531 of file AscObj_TSOS.cxx.

532{
533 // static int ignoreTubes=-1;
534 // if (ignoreTubes==-1)
535 // ignoreTubes = VP1QtUtils::environmentVariableIsOn("VP1_TRKSYS_NEVERSHOWTUBESURFACES") ? 1 : 0;
536 static int ignoreECModules=-1;
537 if (ignoreECModules==-1)
538 ignoreECModules = VP1QtUtils::environmentVariableIsOn("VP1_TRKSYS_NEVERSHOW_ENDCAPMODULES") ? 1 : 0;
539
540 if (common()->controller()->hideTubeSurfaces() &&dynamic_cast<const Trk::StraightLineSurface*>(surface()))
541 return;
542
543 if (ignoreECModules) {
544 const Trk::PlaneSurface* ps = dynamic_cast<const Trk::PlaneSurface*>(surface());
545 if (ps) {
546 Amg::Vector3D z(0.0,0.0,1.0);
547 double angle_z_normal = Amg::angle(z, ps->normal());
548 double abscostheta = std::abs(cos(angle_z_normal));
549 if (abscostheta>0.707) return;
550 }
551 }
552
553 SurfaceToSoNode surfCnv;//fixme: check if need in common()
554 SoNode* theSurfSepSimple = surfCnv.translateSurface(*(surface()),true);
555 SoNode* theSurfSep = surfCnv.translateSurface(*(surface()));
556 if (theSurfSep) {
557 SoNode * nodeToAddSimple = theSurfSepSimple;
558 SoNode * nodeToAdd = theSurfSep;
559 ensureInitSeps(shape_simple,shape_detailed);
560 if (trackHandle()->customColouredTSOSParts()&TrackCommonFlags::TSOS_AnySurface) {
561 SoMaterial * mat = common()->controller()->customMatSurfaces();
562 if (theSurfSep->getTypeId().isDerivedFrom(SoSeparator::getClassTypeId())) {
563 static_cast<SoSeparator*>(theSurfSepSimple)->insertChild(mat,0);
564 static_cast<SoSeparator*>(theSurfSep)->insertChild(mat,0);
565 } else {
566 SoSeparator * sepSimple = new SoSeparator;
567 sepSimple->addChild(mat);
568 sepSimple->addChild(theSurfSepSimple);
569 nodeToAddSimple = sepSimple;
570 SoSeparator * sep = new SoSeparator;
571 sep->addChild(mat);
572 sep->addChild(theSurfSep);
573 nodeToAdd = sep;
574 }
575 }
576// shape_simple->addChild(nodeToAdd); //todo: check this. I changed nodeToAdd to nodeToAddSimple
577 shape_simple->addChild(nodeToAddSimple);
578 shape_detailed->addChild(nodeToAdd);
579 } else {
580 VP1Msg::message("AscObj_TSOS::addSurfaceToShapes WARNING: Got null shape.");
581 }
582}
#define z
SoNode * translateSurface(const Trk::Surface &sf, const bool &simple=false) const
SoMaterial * customMatSurfaces() const
static bool environmentVariableIsOn(const QString &name)
double angle(const Amg::Vector3D &v1, const Amg::Vector3D &v2)
calculates the opening angle between two vectors

◆ addTrackParamInfoToShapes()

void AscObj_TSOS::addTrackParamInfoToShapes ( SoSeparator *& shape_simple,
SoSeparator *& shape_detailed,
bool showPars,
bool showParsErrors,
bool showSurfaces )
private

Definition at line 378 of file AscObj_TSOS.cxx.

381{
382 const Trk::TrackParameters* trackParams = m_tsos->trackParameters();
383 Q_ASSERT(trackParams);
384 ensureInitSeps(shape_simple,shape_detailed);
385
386 Amg::Vector3D p1(trackParams->position());//point
387
388 if (showPars) {
389
390// Trk::GlobalMomentum u(trackParams->momentum().unit());//mom direction
391 Amg::Vector3D u(trackParams->momentum().unit());//mom direction
392
393 double length = 5*CLHEP::cm;
394 if (m_distToNextPar>0)
395 length = std::min(m_distToNextPar*0.75,length);
397
398 //Line:
399 SoLineSet * line = new SoLineSet();
400 SoVertexProperty * vertices = new SoVertexProperty();
401 vertices->vertex.set1Value(0,p1.x(),p1.y(),p1.z());
402 vertices->vertex.set1Value(1,p2.x(),p2.y(),p2.z());
403 line->numVertices.set1Value(0,2);
404
405 //Point:
406 SoPointSet * points = new SoPointSet;
407 SoVertexProperty * vertices2 = new SoVertexProperty;
408 vertices2->vertex.set1Value(0,p1.x(),p1.y(),p1.z());
409 points->numPoints=1;
410 line->vertexProperty = vertices;
411 points->vertexProperty = vertices2;
412
414 if (trackHandle()->customColouredTSOSParts()&TrackCommonFlags::TSOS_TrackPars
415 || (isHole&&(trackHandle()->customColouredTSOSParts() & TrackCommonFlags::TSOS_Hole) ) ) {
417 SoSeparator * sep = new SoSeparator;
418 sep->addChild(mat);
419 sep->addChild(line);
420 sep->addChild(points);
421 shape_simple->addChild(sep);
422 shape_detailed->addChild(sep);
423 } else {
424 shape_simple->addChild(line);
425 shape_simple->addChild(points);
426 shape_detailed->addChild(line);
427 shape_detailed->addChild(points);
428 }
429 }
430
431 if ( showParsErrors ){
432 SoTransform* theHitTransform = VP1LinAlgUtils::toSoTransform(surface()->transform()); // FIXME - remove if working in local coords
433 shape_detailed->addChild(theHitTransform);
434 // Need to cast in order to get error Matrix
435 if (trackParams->covariance()) // Only draw error if point is a measurement
436 {
437 // fixme! This is really ugly - can't be cast to a base class? MeasuredTrackParameters doesn't know LP.
438 const Trk::AtaStraightLine * atas = dynamic_cast<const Trk::AtaStraightLine *>(trackParams);
439 const Trk::Perigee * per = dynamic_cast<const Trk::Perigee *>(trackParams);
440 const Trk::AtaPlane * aap = dynamic_cast<const Trk::AtaPlane *>(trackParams);
441 const Trk::AtaDisc * aad = dynamic_cast<const Trk::AtaDisc *>(trackParams);
442 if (per||atas||aap||aad){
443 const Amg::Vector2D& localPos = atas ? atas->localPosition() : (per ? per->localPosition() : (aap ? aap->localPosition() : aad->localPosition()));
444// addErrors(*(trackParams->associatedSurface()), meas->localErrorMatrix().covariance(), localPos, p1, showSurfaces, shape_simple, shape_detailed, false, false); //FIXME - last parameter false when working in correct local coords
445 addErrors(trackParams->associatedSurface(), *trackParams->covariance(), localPos, p1, showSurfaces, shape_simple, shape_detailed, false, false); //FIXME - last parameter false when working in correct local coords
446 } else {
447 VP1Msg::messageVerbose("Not a supported parameter for errors: ");
448 // std::cout<<(*trackParams)<<std::endl;
449 }
450 }
451 }
452}
double length(const pvec &v)
SoMaterial * customMatParameters() const
SoMaterial * customMatHoleParameters() const
const Amg::Vector3D & momentum() const
Access method for the momentum.
const Amg::Vector3D & position() const
Access method for the position.
virtual const Surface & associatedSurface() const override=0
Access to the Surface associated to the Parameters.
Amg::Vector2D localPosition() const
Access method for the local coordinates, local parameter definitions differ for each surface type.
ParametersT< TrackParametersDim, Charged, DiscSurface > AtaDisc
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
ParametersT< TrackParametersDim, Charged, StraightLineSurface > AtaStraightLine
@ u
Enums for curvilinear frames.
Definition ParamDefs.h:77
ParametersT< TrackParametersDim, Charged, PlaneSurface > AtaPlane

◆ addTransformToSurface()

void AscObj_TSOS::addTransformToSurface ( SoSeparator *& shape_simple,
SoSeparator *& shape_detailed )
private

Definition at line 949 of file AscObj_TSOS.cxx.

949 {
950 // SurfaceToSoNode surfCnv;//fixme: check if need in common()
951 // SoNode* theSurfSepSimple = surfCnv.translateSurface(*(surface()),true);
952 // SoNode* theSurfSep = surfCnv.translateSurface(*(surface()));
953 if (!surface()) {VP1Msg::message( "AscObj_TSOS::addTransformToSurface: WARNING: TSOS without Surface! Unable to get transform!");return;}
954
955 // This is all a bit complicated, and can probably be cleaned up. The point is that TGCs need to be handled specially, or we could just use
956 // surface(), I think.
957
959 if (surface()->associatedDetectorElement()) type= TrkObjToString::type(surface()->associatedDetectorElement());
960
961// const Trk::RIO_OnTrack* rio = rioOnTrack() ? rioOnTrack() : competingRIOsOnTrack() ? competingRIOsOnTrack()->rioOnTrack(competingRIOsOnTrack()->indexOfMaxAssignProb()) : 0;
962 const Trk::RIO_OnTrack* rio = rioOnTrack() ? rioOnTrack() : competingRIOsOnTrack() ? &(competingRIOsOnTrack()->rioOnTrack(competingRIOsOnTrack()->indexOfMaxAssignProb())) : nullptr;
963 if (type==TrkObjToString::Unknown && rio) type=TrkObjToString::type(rio);
964
965 SoTransform* theHitTransform=nullptr;
966 if (rio) {
968 // std::cout<<"Got ROT of type"<<static_cast<unsigned int>(type)<<std::endl;
969 switch (type) {
978 {
979 theHitTransform=m_hitToSoNode.createTransform(*rio, true);
980 break;
981 }
983 {
984 theHitTransform=m_hitToSoNode.createTGC_Transform(*rio, true);
985 break;
986 }
987 default:
988 {
989 VP1Msg::message( "AscObj_TSOS::addTransformToSurface: WARNING: Unknown type of ROT.");
990 // std::cout<<"ROT: "<<*rio<<std::endl;
991 }
992 }
993 } else {
994 if (hasSurface() ) theHitTransform = VP1LinAlgUtils::toSoTransform(surface()->transform());
995 }
996
997 if (!theHitTransform) {
998 VP1Msg::message( "AscObj_TSOS::addTransformToSurface: WARNING: Unable to build transform");
999 return;
1000 }
1001 shape_simple->addChild(theHitTransform);
1002 shape_detailed->addChild(theHitTransform);
1003}

◆ approxCenter()

Amg::Vector3D AscObj_TSOS::approxCenter ( ) const

Definition at line 173 of file AscObj_TSOS.cxx.

174{
175 if (hasParameters())
176 return m_tsos->trackParameters()->position();
177 if (hasSurface())
178 return surface()->center();
179 VP1Msg::message("AscObj_TSOS::approxCenter() WARNING: Failed to determine"
180 " position from either params or surface");
181 return Amg::Vector3D(0,0,0);
182}

◆ browserTreeItem()

virtual QTreeWidgetItem * AscObj_TSOS::browserTreeItem ( ) const
inlinevirtual

Definition at line 73 of file AscObj_TSOS.h.

73{return m_objBrowseTree;}

◆ buildShapes()

void AscObj_TSOS::buildShapes ( SoSeparator *& shape_simple,
SoSeparator *& shape_detailed )
virtual

bool showDeviationsFromMeasurements = false;//Fixme (and see below) if ( showDeviationsFromMeasurements && hasParameters() && rioOnTrack() && dynamic_cast<const Trk::TrackParameters *>(m_tsos->trackParameters()) ) addDeviationFromMeasurementInfoToShapes(shape_simple,shape_detailed);

Implements AssociatedObjectHandleBase.

Definition at line 1006 of file AscObj_TSOS.cxx.

1008{
1009 VP1Msg::messageVerbose("AscObj_TSOS::buildShapes() start");
1010
1011 TrackCommonFlags::TSOSPartsFlags f(trackHandle()->shownTSOSParts()&m_parts);
1013 return;
1014 const bool showPars(f & TrackCommonFlags::TSOS_TrackPars);
1015 const bool showParsErrors(f & TrackCommonFlags::TSOS_AnyParsErrors);
1016 const bool showRioOnTrack(f & TrackCommonFlags::TSOS_AnyMeasRioOnTrack);
1017 const bool showCompetingRioOnTrack(f & TrackCommonFlags::TSOS_AnyMeasCompetingRioOnTrack);
1018 const bool showSurfaces(f & TrackCommonFlags::TSOS_AnySurface);
1019 const bool showMaterialEffects(f & TrackCommonFlags::TSOS_AnyMaterialEffects);
1020 const bool showMeasErrors(f & TrackCommonFlags::TSOS_MeasError);
1021
1022 ensureInitSeps(shape_simple,shape_detailed);
1023
1024 // FIXME - would like to simplify this and use transform returned from surface, but means internal changes below
1025 SoSeparator* param_simple= new SoSeparator;
1026 SoSeparator* param_detailed= new SoSeparator;
1027 if (showPars||showParsErrors)
1028 addTrackParamInfoToShapes(param_simple,param_detailed,showPars,showParsErrors,showSurfaces);
1029 shape_simple->addChild(param_simple);
1030 shape_detailed->addChild(param_detailed);
1031
1032 if (showMaterialEffects)
1033 addMaterialEffectsToShapes( shape_simple, shape_detailed);
1034
1035 if (showSurfaces)
1036 addSurfaceToShapes( shape_simple, shape_detailed);
1037
1038 // Transform to centre of surface. All other seps will (eventually) hang from this.
1039 // TGCs are special, in that the position returned is that of the strip, due to rotation
1040 addTransformToSurface(shape_simple,shape_detailed);
1041
1042 // Measurements are a bit different and create a sep outside addRIO_OnTrackInfoToShapes, because addRIO_OnTrackInfoToShapes is used
1043 // by addCompetingRIO_OnTrackInfoToShapes too
1044 SoSeparator* meas_simple= new SoSeparator;
1045 SoSeparator* meas_detailed= new SoSeparator;
1046 if (rioOnTrack() && (showRioOnTrack||showMeasErrors))
1047 addRIO_OnTrackInfoToShapes(meas_simple,meas_detailed,rioOnTrack(), !(common()->controller()->drawMeasGlobalPositions()));
1048 if (showCompetingRioOnTrack)
1049 addCompetingRIO_OnTrackInfoToShapes(meas_simple,meas_detailed); // FIXME - handle cROT errors too.
1050 shape_simple->addChild(meas_simple);
1051 shape_detailed->addChild(meas_detailed);
1052
1053 //Currently this doesn't do much as rio->globalPosition() returns a position
1054 //along the axis!
1062 VP1Msg::messageVerbose("AscObj_TSOS::buildShapes() end");
1063
1064}
void addSurfaceToShapes(SoSeparator *&shape_simple, SoSeparator *&shape_detailed)
void addCompetingRIO_OnTrackInfoToShapes(SoSeparator *&shape_simple, SoSeparator *&shape_detailed)
void addTransformToSurface(SoSeparator *&shape_simple, SoSeparator *&shape_detailed)
void addMaterialEffectsToShapes(SoSeparator *&shape_simple, SoSeparator *&shape_detailed)
void addTrackParamInfoToShapes(SoSeparator *&shape_simple, SoSeparator *&shape_detailed, bool showPars, bool showParsErrors, bool showSurfaces)

◆ clicked()

QStringList AscObj_TSOS::clicked ( )
virtual

Implements AssociatedObjectHandleBase.

Definition at line 1067 of file AscObj_TSOS.cxx.

1068{
1069 QStringList l;
1070 if (!m_tsos) {
1071 l << "ERROR: This associated object handle has a NULL TSOS pointer!!";
1072 return l;
1073 }
1074
1075
1076 l << "---"<<"Track State On Surface #"+VP1Msg::str(m_indexOfPointOnTrack)+":";
1077
1078 if (hasParameters())
1079 {
1080 l << "----> "+TrkObjToString::name(*(m_tsos->trackParameters()));
1081 QStringList list = TrkObjToString::fullInfo( *(m_tsos->trackParameters()) );
1082 for (int i = 0; i < (list.size()-1); ){
1083 l<< (list.at(i)+QString(" = ")+list.at(i+1) );
1084 i+=2;
1085 }
1086 // l << " -> Position (x,y,z) [CLHEP::mm]: "+VP1Msg::str(m_tsos->trackParameters()->position()/CLHEP::mm);
1087 // l << " -> Momentum (Px,Py,Pz) [MeV]: "+VP1Msg::str(m_tsos->trackParameters()->momentum()/MeV) + ", |P| [GeV]: "+VP1Msg::str(m_tsos->trackParameters()->momentum().mag()/GeV);
1088 // l << " -> Momentum (Pt) [GeV]: "+VP1Msg::str(m_tsos->trackParameters()->momentum().perp()/GeV);
1089 //FIXME: parameter errors
1090 }
1091
1092 bool showDeviationsFromMeasurements = true;//Fixme (and see above)
1093 if ( showDeviationsFromMeasurements
1094 && hasParameters()
1095 && (rioOnTrack() || competingRIOsOnTrack() )
1096 && dynamic_cast<const Trk::TrackParameters *>(m_tsos->trackParameters()) )
1097 {
1099 l << " -> Std deviations from measurement: " + VP1Msg::str(deviationFromMeasurement()) + " (Outlier)";
1100 else
1101 l << " -> Std deviations from measurement: " + VP1Msg::str(deviationFromMeasurement());
1102 }
1103
1104 if (m_tsos->measurementOnTrack()){
1105 l << "----> "+TrkObjToString::name(*(m_tsos->measurementOnTrack()));
1106 QStringList list = TrkObjToString::fullInfo( *(m_tsos->measurementOnTrack()) );
1107 for (int i = 0; i < (list.size()-1); ){
1108 l<< (list.at(i)+QString(" = ")+list.at(i+1) );
1109 i+=2;
1110 }
1111 }
1112
1113
1114 if (m_tsos->fitQualityOnSurface())
1115 {
1116 l << "----> "+TrkObjToString::name((m_tsos->fitQualityOnSurface()));
1117 QStringList list = TrkObjToString::fullInfo( (m_tsos->fitQualityOnSurface()) );
1118 for (int i = 0; i < (list.size()-1); ){
1119 l<< (list.at(i)+QString(" = ")+list.at(i+1) );
1120 i+=2;
1121 }
1122 }
1123
1124 if (m_tsos->materialEffectsOnTrack())
1125 {
1126 l << "----> "+TrkObjToString::name(*(m_tsos->materialEffectsOnTrack())) ;
1127 QStringList list = TrkObjToString::fullInfo( *(m_tsos->materialEffectsOnTrack()) );
1128 for (int i = 0; i < (list.size()-1); ){
1129 l<< (list.at(i)+QString(" = ")+list.at(i+1) );
1130 i+=2;
1131 }
1132 }
1133
1134 if (common()->controller()->printVerboseInfoOnSingleSelection()) {
1135 l << " ===== TrackStateOnSurface =====";
1136 std::ostringstream s2;
1137 s2 << *m_tsos;
1138 l << QString(s2.str().c_str()).split('\n');
1139
1140 if (surface()) {
1141 l << " ===== Surface =====";
1142 std::ostringstream s;
1143 s << *(surface());
1144 l << QString(s.str().c_str()).split('\n');
1145 s << "Identfier:"<<surface()->associatedDetectorElementIdentifier();
1146 }
1147 }
1148
1149 // Object browser stuff m_indexOfPointOnTrack
1150 QTreeWidgetItem* trkObjBrowseritem = trackHandle()->browserTreeItem();
1151 if (trkObjBrowseritem){
1152 QTreeWidgetItem* me = trkObjBrowseritem->child(m_indexOfPointOnTrack); // I hope!
1153 if (!me) {
1154 VP1Msg::messageVerbose("ERROR! Can't find AscObj_TSOS item in track obj browser.");
1155 } else {
1156 QTreeWidget* trkObjBrowser = trkObjBrowseritem->treeWidget();
1157 trkObjBrowser->setCurrentItem(me);
1158 trkObjBrowser->scrollToItem(me);
1159 }
1160 }
1161
1162 zoomView(); // depending on controller settings, zoom view
1163
1164 return l;
1165}
double deviationFromMeasurement(const bool &absolute=false)
void zoomView()
Depending on the controller settings, will attempt to zoom the view to this TSOS, for example in clic...
QTreeWidgetItem * browserTreeItem() const
static QString name(const Trk::MeasurementBase &mb)
static QStringList fullInfo(const Trk::MeasurementBase &tp)
Returns list of key, value, key, value etc.
Identifier associatedDetectorElementIdentifier() const
return Identifier of the associated Detector Element
static QString str(const QString &s)
Definition VP1String.h:49
l
Printing final latex table to .tex output file.
list(name, path='/')
Definition histSizes.py:38

◆ common()

TrackSysCommonData * AssociatedObjectHandleBase::common ( ) const
inherited

Definition at line 105 of file AssociatedObjectHandleBase.cxx.

106{
107 return m_trackHandle->common();
108}

◆ competingRIOsOnTrack()

const Trk::CompetingRIOsOnTrack * AscObj_TSOS::competingRIOsOnTrack ( ) const

Definition at line 931 of file AscObj_TSOS.cxx.

932{
933 return dynamic_cast<const Trk::CompetingRIOsOnTrack *>(m_tsos->measurementOnTrack());
934}

◆ deviationFromMeasurement()

double AscObj_TSOS::deviationFromMeasurement ( const bool & absolute = false)
private

Definition at line 264 of file AscObj_TSOS.cxx.

265{
266 double rioValue = 0;
267 double paramValue = 0;
268 double sigma = 1;
269
270 const Trk::RIO_OnTrack* rio = rioOnTrack();
271 if (!rio && competingRIOsOnTrack()!=nullptr ) {
272 // must be crot
273 rio = &(competingRIOsOnTrack()->rioOnTrack(competingRIOsOnTrack()->indexOfMaxAssignProb () ));
274 } else {
275 VP1Msg::message(" No ROT or cROT in AscObj_TSOS::deviationFromMeasurement(const bool& absolute)!");
276 return 0.0;
277 }
278 Identifier id = rio->identify();
279 const AtlasDetectorID * idhelper = VP1DetInfo::atlasIDHelper();
280 //FIXME: should we check for idhelper before?
281 const bool isTRT = idhelper && idhelper->is_indet(id) && idhelper->is_trt(id);
282 const bool isMDT = idhelper && idhelper->is_muon(id) && idhelper->is_mdt(id);
283 if ( idhelper && ( isTRT||isMDT ) )
284 {
285 //Value from the measurement
286 rioValue = std::abs(rio->localParameters().get(Trk::driftRadius));
287
288 //Value from the track
289 const Trk::TrackParameters* trackParams = m_tsos->trackParameters();
290 const Trk::TrackParameters * meas = dynamic_cast<const Trk::TrackParameters *>(trackParams);
291 const Trk::AtaStraightLine * atas = dynamic_cast<const Trk::AtaStraightLine *>(meas);
292 if (not atas) return std::nan("");
293 const Amg::Vector2D& localposMeas = atas->localPosition();
294 paramValue = std::abs(localposMeas[Trk::locR]);
295
296 if (!absolute)
297 {
298 const AmgSymMatrix(5) covmat = *(meas->covariance());
299 sigma = sqrt( covmat(0,0) );
300 }
301 }
302
303 return absolute ? std::abs( rioValue - paramValue ) : std::abs( rioValue - paramValue )/sigma;
304}
#define AmgSymMatrix(dim)
@ driftRadius
trt, straws
Definition ParamDefs.h:53
@ locR
Definition ParamDefs.h:44

◆ ensureInitSeps()

void AscObj_TSOS::ensureInitSeps ( SoSeparator *& shape_simple,
SoSeparator *& shape_detailed )
staticprivate

Definition at line 915 of file AscObj_TSOS.cxx.

917{
918 if (!shape_simple)
919 shape_simple = new SoSeparator;
920 if (!shape_detailed)
921 shape_detailed = new SoSeparator;
922}

◆ getAttachmentHandle()

AssocObjAttachmentHandle * AssociatedObjectHandleBase::getAttachmentHandle ( )
privateinherited

Definition at line 155 of file AssociatedObjectHandleBase.cxx.

156{
157 return m_trackHandle->getAttachmentHandle(regionIndex(), lodCrossOverValue());
158}
virtual double lodCrossOverValue() const

◆ getZTranslationTube()

SoTranslation * AscObj_TSOS::getZTranslationTube ( const Trk::Surface * theSurface,
const double & maxTrans ) const
private

Definition at line 201 of file AscObj_TSOS.cxx.

203{
204 const Amg::Vector3D origo = theSurface->localToGlobal(Amg::Vector2D(0,0));
205 const Amg::Vector3D unitz = theSurface->localToGlobal(Amg::Vector2D(0,1));
206
207 std::vector< Amg::Vector3D > * points = trackHandle()->hackGetPointsPropagated();//FIXME
208
209 double min = std::numeric_limits<double>::max();
210 double smin=0;
211 size_t imin=0;
212 //First we find the point in PointsPropageted closest to the line.
213 for ( size_t i = 0; i<points->size(); i++)
214 {
215 double s;
216 double dist = VP1LinAlgUtils::distPointLine2( (*points)[i], origo, unitz, s );
217 if (dist < min)
218 {
219 min = dist;
220 imin = i;
221 }
222 }
223
224 if (points->size()>1 ){
225 // FIXME - don't think we should ever really need this test. EJWM.
226
227 //Then we get the parameters on the forward and backward lines giving the points with
228 //the shortest distances.
229 //We then use the line which has the parameter closest to 0.5 which means that it
230 //is inside the part of the line between this point and the next/previous
231 double sp,tp,sm,tm;
232 if (imin+1 < points->size() && imin >= 1)
233 {
234 VP1LinAlgUtils::distLineLineParam((*points).at(imin),(*points).at(imin+1),origo,unitz,tp,sp);
235 VP1LinAlgUtils::distLineLineParam((*points).at(imin-1),(*points).at(imin),origo,unitz,tm,sm);
236 smin = std::abs(tm - 0.5) < std::abs(tp - 0.5) ? sm : sp;
237 } else if (imin+1 >= points->size() && imin >= 1 )
238 {
239 VP1LinAlgUtils::distLineLineParam((*points).at(imin-1),(*points).at(imin),origo,unitz,tm,sm);
240 smin = sm;
241 } else
242 {
243 VP1LinAlgUtils::distLineLineParam((*points).at(imin),(*points).at(imin+1),origo,unitz,tp,sp);
244 smin = sp;
245 }
246 } else {
247 // probably something is wrong!
248 VP1Msg::message("AscObj_TSOS::getZTranslationTube: <2 points returned by trackHandle!");
249 }
250
251 //Ensure that we do not get out of bounds, preserve sign of translation.
252 if (std::abs(smin) > maxTrans)
253 {
254 double sign = smin > 0 ? 1.0 : -1.0;
255 smin = sign*maxTrans;
256 }
257
258 SoTranslation * trans = new SoTranslation;
259 trans->translation.setValue(0,0,smin);
260
261 return trans;
262}
static Double_t sp
int sign(int a)
#define min(a, b)
Definition cfImp.cxx:40
std::vector< Amg::Vector3D > * hackGetPointsPropagated()
FIXME.
static void distLineLineParam(const Amg::Vector3D &point0, const Amg::Vector3D &point1, const Amg::Vector3D &point2, const Amg::Vector3D &point3, double &s, double &t)
static double distPointLine2(const Amg::Vector3D &point, const Amg::Vector3D &point0, const Amg::Vector3D &point1, double &s)

◆ hasError()

bool AssociatedObjectHandleBase::hasError ( ) const
inlineinherited

Definition at line 50 of file AssociatedObjectHandleBase.h.

virtual TrackCommonFlags::TSOSPartsFlags parts() const

◆ hasMaterialEffect()

bool AssociatedObjectHandleBase::hasMaterialEffect ( ) const
inlineinherited

Definition at line 51 of file AssociatedObjectHandleBase.h.

◆ hasMeasurement()

bool AssociatedObjectHandleBase::hasMeasurement ( ) const
inlineinherited

Definition at line 53 of file AssociatedObjectHandleBase.h.

◆ hasParameters()

bool AssociatedObjectHandleBase::hasParameters ( ) const
inlineinherited

Definition at line 48 of file AssociatedObjectHandleBase.h.

◆ hasParError()

bool AssociatedObjectHandleBase::hasParError ( ) const
inlineinherited

Definition at line 49 of file AssociatedObjectHandleBase.h.

◆ hasSurface()

bool AssociatedObjectHandleBase::hasSurface ( ) const
inlineinherited

Definition at line 52 of file AssociatedObjectHandleBase.h.

◆ initiatesOwnZooms()

virtual bool AscObj_TSOS::initiatesOwnZooms ( ) const
inlinevirtual

Reimplemented from AssociatedObjectHandleBase.

Definition at line 71 of file AscObj_TSOS.h.

71{ return true; }

◆ isShortMeasurement()

bool AscObj_TSOS::isShortMeasurement ( )

Return true if TRT/MDT & shortened mode is on, false otherwise.

Definition at line 1194 of file AscObj_TSOS.cxx.

1194 {
1195 bool isShortMeasurement;
1196
1197 // FIXME! Duplication with clicked()
1198 const Trk::RIO_OnTrack* rio = rioOnTrack();
1199 if (!rio && competingRIOsOnTrack()){
1200 rio = &(competingRIOsOnTrack()->rioOnTrack(competingRIOsOnTrack()->indexOfMaxAssignProb()));
1201 }
1202
1204 bool isTRT = (type==TrkObjToString::TRT);
1205 bool isMDT = (type==TrkObjToString::MDT);
1206
1207 if (rio)
1208 {
1209 const bool settingsShort = (isTRT?common()->controller()->useShortTRTMeasurements()
1210 :isMDT&&common()->controller()->useShortMDTMeasurements());
1211 const bool showRioOnTrack(trackHandle()->shownTSOSParts()&m_parts & TrackCommonFlags::TSOS_AnyMeasRioOnTrack);
1212 isShortMeasurement = (settingsShort && showRioOnTrack);
1213 } else
1214 {
1215 isShortMeasurement = false;
1216 }
1217 return isShortMeasurement;
1218}

◆ lodCrossOverValue()

double AscObj_TSOS::lodCrossOverValue ( ) const
inlineprotectedvirtual

Reimplemented from AssociatedObjectHandleBase.

Definition at line 78 of file AscObj_TSOS.h.

78{return 1000; }

◆ measurement()

const Trk::MeasurementBase * AscObj_TSOS::measurement ( ) const

Definition at line 195 of file AscObj_TSOS.cxx.

196{
197 return m_tsos->measurementOnTrack();
198}

◆ nParts()

virtual unsigned AssociatedObjectHandleBase::nParts ( ) const
inlinevirtualinherited

Definition at line 47 of file AssociatedObjectHandleBase.h.

47{ return 1; }

◆ numberOfInstances()

int AssociatedObjectHandleBase::numberOfInstances ( )
staticinherited

Definition at line 130 of file AssociatedObjectHandleBase.cxx.

◆ parts()

virtual TrackCommonFlags::TSOSPartsFlags AscObj_TSOS::parts ( ) const
inlinevirtual

Reimplemented from AssociatedObjectHandleBase.

Definition at line 59 of file AscObj_TSOS.h.

59{ return m_parts; }

◆ pickStyle()

PICKSTYLE AssociatedObjectHandleBase::pickStyle ( ) const
inlineinherited

Definition at line 59 of file AssociatedObjectHandleBase.h.

◆ regionIndex()

int AscObj_TSOS::regionIndex ( ) const
protectedvirtual

Reimplemented from AssociatedObjectHandleBase.

Definition at line 185 of file AscObj_TSOS.cxx.

186{
188 static const double l=30.0*CLHEP::cm;
189 return static_cast<int>(c.z()/l)
190 +1000*static_cast<int>(c.y()/l)
191 +1000000*static_cast<int>(c.x()/l);
192}
Amg::Vector3D approxCenter() const

◆ registerShapes()

void AssociatedObjectHandleBase::registerShapes ( SoSeparator * simple,
SoSeparator * detailed )
privateinherited

Definition at line 93 of file AssociatedObjectHandleBase.cxx.

94{
95 m_trackHandle->collHandle()->common()->ascObjSelectionManager()->registerAscObj(simple,detailed,this);
96}

◆ rioOnTrack()

const Trk::RIO_OnTrack * AscObj_TSOS::rioOnTrack ( ) const

Definition at line 925 of file AscObj_TSOS.cxx.

926{
927 return dynamic_cast<const Trk::RIO_OnTrack *>(m_tsos->measurementOnTrack());
928}

◆ setBrowserTreeItem()

virtual void AscObj_TSOS::setBrowserTreeItem ( QTreeWidgetItem * obt)
inlinevirtual

Definition at line 74 of file AscObj_TSOS.h.

74{m_objBrowseTree=obt;}

◆ setDistToNextPar()

void AscObj_TSOS::setDistToNextPar ( const double & d)

Definition at line 165 of file AscObj_TSOS.cxx.

166{
167 //We assume this is called right after the constructor - so no need
168 //to update 3D objects.
170}

◆ setPickable()

void AssociatedObjectHandleBase::setPickable ( PICKSTYLE ps)
inherited

Definition at line 136 of file AssociatedObjectHandleBase.cxx.

137{
138 if (m_pickStyle==ps)
139 return;
141
142 //Fixme...
143
144}

◆ setVisible()

void AscObj_TSOS::setVisible ( bool vis)
virtual

Reimplemented from AssociatedObjectHandleBase.

Definition at line 1167 of file AscObj_TSOS.cxx.

1167 {
1169
1170 QTreeWidgetItem* trkObjBrowseritem = trackHandle()->browserTreeItem();
1171 if (trkObjBrowseritem){
1172 QTreeWidgetItem* me = trkObjBrowseritem->child(m_indexOfPointOnTrack); // I hope!
1173 if (!me) {
1174 VP1Msg::messageVerbose("ERROR! Can't find AscObj_TSOS item in track obj browser.");
1175 } else {
1176 QFont itemFont = me->font(1);
1177
1178 if (!visible()) {
1179 // std::cout<<"Hidden"<<std::endl;
1180 me->setFlags(Qt::ItemFlags()); // not selectable, not enabled
1181 itemFont.setStrikeOut(true);
1182
1183 } else {
1184 // std::cout<<"Vis"<<std::endl;
1185 me->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); // selectable, enabled
1186 itemFont.setStrikeOut(false);
1187
1188 }
1189 }
1190 }
1191}

◆ shapeDetailed()

SoSeparator * AssociatedObjectHandleBase::shapeDetailed ( ) const
inherited

Definition at line 206 of file AssociatedObjectHandleBase.cxx.

207{
208 return m_d->sep_detailed;
209}

◆ shapeSimple()

SoSeparator * AssociatedObjectHandleBase::shapeSimple ( ) const
inherited

Definition at line 200 of file AssociatedObjectHandleBase.cxx.

201{
202 return m_d->sep_simple;
203}

◆ surface()

const Trk::Surface * AscObj_TSOS::surface ( ) const

Definition at line 937 of file AscObj_TSOS.cxx.

938{
939 const Trk::Surface * surf(nullptr);
940 if (m_tsos->trackParameters())
941 surf = &(m_tsos->trackParameters()->associatedSurface());
942 if (!surf&&m_tsos->measurementOnTrack())
943 surf = &(m_tsos->measurementOnTrack()->associatedSurface());
944 if (!surf&&m_tsos->materialEffectsOnTrack())
945 surf = &(m_tsos->materialEffectsOnTrack()->associatedSurface());
946 return surf;
947}

◆ toggleVisible()

void AssociatedObjectHandleBase::toggleVisible ( )
inlineinherited

◆ trackHandle()

TrackHandleBase * AssociatedObjectHandleBase::trackHandle ( ) const
inlineinherited

Definition at line 64 of file AssociatedObjectHandleBase.h.

64{ return m_trackHandle; }

◆ trackStateOnSurface()

const Trk::TrackStateOnSurface * AscObj_TSOS::trackStateOnSurface ( ) const
inline

Definition at line 65 of file AscObj_TSOS.h.

65{return m_tsos;}

◆ unregisterShapes()

void AssociatedObjectHandleBase::unregisterShapes ( SoSeparator * simple,
SoSeparator * detailed )
privateinherited

Definition at line 99 of file AssociatedObjectHandleBase.cxx.

100{
101 m_trackHandle->collHandle()->common()->ascObjSelectionManager()->unregisterAscObj(simple,detailed);
102}

◆ update3DObjects()

void AssociatedObjectHandleBase::update3DObjects ( )
inherited

Definition at line 185 of file AssociatedObjectHandleBase.cxx.

186{
187 VP1Msg::messageVerbose("AssociatedObjectHandleBase update3DObjects.");
188
189 if (m_visible) {
190 m_d->detach();
191 m_d->ensureShapesErased(this);
192 m_d->ensureShapesBuild(this);
193 m_d->attach(this);
194 } else {
195 m_d->ensureShapesErased(this);
196 }
197}

◆ visible()

bool AssociatedObjectHandleBase::visible ( ) const
inlineinherited

Definition at line 61 of file AssociatedObjectHandleBase.h.

61{ return m_visible; }

◆ zoomView()

void AscObj_TSOS::zoomView ( )

Depending on the controller settings, will attempt to zoom the view to this TSOS, for example in click()

Definition at line 1220 of file AscObj_TSOS.cxx.

1220 {
1221 VP1Msg::messageVerbose("AscObj_TSOS::zoomView()");
1222
1223 if ( common()->controller()->orientAndZoomOnSingleSelection() )
1224 {
1225 const bool showParsErrors( trackHandle()->shownTSOSParts()&m_parts & TrackCommonFlags::TSOS_AnyParsErrors);
1226
1227
1228 if (!showParsErrors && !isShortMeasurement())
1229 { // Zoom without orientation
1230 VP1Msg::messageVerbose("AscObj_TSOS::zoomView() Zoom without orientation");
1231 std::set<SoCamera*> cameras = common()->system()->getCameraList();
1232 std::set<SoCamera*>::iterator it,itE = cameras.end();
1233 for (it=cameras.begin();it!=itE;++it) {
1234 if (common()->controller()->assocObjDetailLevel()==TrackCommonFlags::SIMPLE)
1235 {
1236 VP1CameraHelper::animatedZoomToSubTree(*it,common()->ascObjSelectionManager()->getAscObjAttachSep(),shapeSimple(),2.0,1.0);
1237 } else
1238 {
1239 VP1CameraHelper::animatedZoomToSubTree(*it,common()->ascObjSelectionManager()->getAscObjAttachSep(),shapeDetailed(),2.0,1.0);
1240 }
1241 }
1242 } else
1243 { // Zoom and orient (this is dependant of surface type)
1244 VP1Msg::messageVerbose("AscObj_TSOS::zoomView() Zoom and orient");
1245
1246 const Trk::Surface * theSurface = surface();
1247 const Trk::PerigeeSurface * perSurf = dynamic_cast<const Trk::PerigeeSurface *>(theSurface);
1248 const Trk::PlaneSurface * plaSurf = dynamic_cast<const Trk::PlaneSurface *>(theSurface);
1249 const Trk::StraightLineSurface * strSurf = dynamic_cast<const Trk::StraightLineSurface *>(theSurface);
1250 if ( plaSurf || perSurf )
1251 {
1252// Trk::GlobalMomentum u(m_tsos->trackParameters()->momentum().unit());
1253 Amg::Vector3D u(m_tsos->trackParameters()->momentum().unit());
1254
1255 SbVec3f lookat0 = SbVec3f(-u[0],-u[1],-u[2]);
1256
1257 std::set<SoCamera*> cameras = common()->system()->getCameraList();
1258 std::set<SoCamera*>::iterator it,itE = cameras.end();
1259 for (it=cameras.begin();it!=itE;++it) {
1260 if (common()->controller()->assocObjDetailLevel()==TrackCommonFlags::SIMPLE)
1261 {
1262 VP1CameraHelper::animatedZoomToSubTree(*it,common()->ascObjSelectionManager()->getAscObjAttachSep(),shapeSimple(),2.0,100.0,100.0,1.0,lookat0);
1263 } else
1264 {
1265 VP1CameraHelper::animatedZoomToSubTree(*it,common()->ascObjSelectionManager()->getAscObjAttachSep(),shapeDetailed(),2.0,100.0,100.0,1.0,lookat0);
1266 }
1267 }
1268 } else if ( strSurf )
1269 {
1270 SbVec3f lookat0 = SbVec3f(0,0,1);
1271 SbVec3f lookat1;
1272
1273 SbRotation rot = VP1LinAlgUtils::toSoTransform(theSurface->transform())->rotation.getValue();
1274 rot.multVec(lookat0,lookat0);
1275
1276 std::set<SoCamera*> cameras = common()->system()->getCameraList();
1277 std::set<SoCamera*>::iterator it,itE = cameras.end();
1278 for (it=cameras.begin();it!=itE;++it) {
1279 SbRotation camrot = (*it)->orientation.getValue();
1280 SbVec3f cameraDir = SbVec3f(0,0,-1);
1281 camrot.multVec(cameraDir,cameraDir);
1282
1283 lookat1 = cameraDir.dot(lookat0) > 0 ? lookat0 : -lookat0;
1284 if (common()->controller()->assocObjDetailLevel()==TrackCommonFlags::SIMPLE)
1285 {
1286 VP1CameraHelper::animatedZoomToSubTree(*it,common()->ascObjSelectionManager()->getAscObjAttachSep(),shapeSimple(),2.0,100.0,100.0,1.0,lookat1);
1287 } else
1288 {
1289 VP1CameraHelper::animatedZoomToSubTree(*it,common()->ascObjSelectionManager()->getAscObjAttachSep(),shapeDetailed(),2.0,100.0,100.0,1.0,lookat1);
1290 }
1291 }
1292 }
1293 }
1294 } else {
1295 VP1Msg::messageVerbose("AscObj_TSOS::zoomView() - zooming on selection not turned on.");
1296 }
1297}
CamList getCameraList()
VP1TrackSystem * system() const
static VP1CameraHelper * animatedZoomToSubTree(SoCamera *camera, SoGroup *sceneroot, SoNode *subtreeroot, double duration_in_secs=1.0, double clipVolPercent=100.0, double lastClipVolPercent=100.0, double slack=1.0, const SbVec3f &lookat=SbVec3f(999, 999, 999), const SbVec3f &upvec=SbVec3f(999, 999, 999), bool varySpeed=true, bool forceCircular=false)

◆ ~AscObj_TSOS()

virtual AscObj_TSOS::~AscObj_TSOS ( )
inlineprivatevirtual

Definition at line 81 of file AscObj_TSOS.h.

81{}//Private so it can only be deleted by TrackHandleBase

Member Data Documentation

◆ m_d

Imp* AssociatedObjectHandleBase::m_d
privateinherited

Definition at line 91 of file AssociatedObjectHandleBase.h.

◆ m_distToNextPar

double AscObj_TSOS::m_distToNextPar
private

Definition at line 85 of file AscObj_TSOS.h.

◆ m_hitToSoNode

HitToSoNode AscObj_TSOS::m_hitToSoNode
private

Definition at line 104 of file AscObj_TSOS.h.

◆ m_indexOfPointOnTrack

unsigned AscObj_TSOS::m_indexOfPointOnTrack
private

Definition at line 84 of file AscObj_TSOS.h.

◆ m_objBrowseTree

QTreeWidgetItem* AscObj_TSOS::m_objBrowseTree
private

Definition at line 86 of file AscObj_TSOS.h.

◆ m_parts

TrackCommonFlags::TSOSPartsFlags AscObj_TSOS::m_parts
private

Definition at line 83 of file AscObj_TSOS.h.

◆ m_pickStyle

PICKSTYLE AssociatedObjectHandleBase::m_pickStyle
privateinherited

Definition at line 95 of file AssociatedObjectHandleBase.h.

◆ m_trackHandle

TrackHandleBase* AssociatedObjectHandleBase::m_trackHandle
privateinherited

Definition at line 93 of file AssociatedObjectHandleBase.h.

◆ m_tsos

const Trk::TrackStateOnSurface* AscObj_TSOS::m_tsos
private

Definition at line 82 of file AscObj_TSOS.h.

◆ m_visible

bool AssociatedObjectHandleBase::m_visible
privateinherited

Definition at line 94 of file AssociatedObjectHandleBase.h.


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