30#include <Inventor/nodes/SoTranslation.h>
31#include <Inventor/nodes/SoSeparator.h>
32#include <Inventor/nodes/SoSphere.h>
33#include <Inventor/nodes/SoPointSet.h>
34#include <Inventor/nodes/SoVertexProperty.h>
35#include <Inventor/nodes/SoMatrixTransform.h>
36#include <Inventor/nodes/SoMaterial.h>
37#include <Inventor/SbMatrix.h>
38#include <Inventor/SoPath.h>
46#include "GaudiKernel/SystemOfUnits.h"
54 QList<VP1StdCollection*> l;
72 QList<const Trk::Track*>& tracks,
73 QList<const Trk::TrackParticleBase*>& trackparticles);
85 m_sep->removeAllChildren();
89 m_sep =
new SoSeparator;
92 if (
m_sep->getNumChildren()>0)
93 m_sep->removeAllChildren();
96 m_sep->addChild ( mat );
160 r = (rand() /
static_cast<double>(RAND_MAX));
161 g = (rand() /
static_cast<double>(RAND_MAX));
162 b = (rand() /
static_cast<double>(RAND_MAX));
166 if ( (
r-1.0)*(
r-1.0)+g*g+b*b < r2*0.5 )
168 else if (
r*
r/(
r*
r+g*g+b*b) > 0.8 )
170 else if (
r*
r+g*g+b*b < r2*2.0 )
180 " not be selected such as to satisfy all separation criteria");
200 double r =
controller->reconVertexRepresentation();
202 SoPointSet * points =
new SoPointSet;
203 SoVertexProperty *
vertices =
new SoVertexProperty;
204 vertices->vertex.set1Value(0,pos.x(), pos.y(), pos.z());
206 points->vertexProperty.setValue(
vertices);
207 m_sep->addChild(points);
211 SoTranslation * translation =
new SoTranslation;
212 translation->translation.setValue ( pos.x(), pos.y(), pos.z() );
213 m_sep->addChild ( translation );
221 double a(errMat(0,0)), b(errMat(0,1)), c(errMat(0,2)),
222 d(errMat(1,1)), e(errMat(1,2)),
224 double det =
a*(d*f-e*e) + 2*b*c*e - d*c*c-f*b*b;
226 double sixthrootofdet = exp(log(det)/6.0);
227 double invdet = 1.0/sixthrootofdet;
234 SbMatrix sbMat(
a,b,c,0,
238 SoMatrixTransform * matTrans =
new SoMatrixTransform();
239 matTrans->matrix.setValue(sbMat);
240 m_sep->addChild (matTrans);
246 SoSphere * sphere =
new SoSphere;
247 sphere->radius = fabs(
r);
248 m_sep->addChild ( sphere );
277 m_d->theclass =
this;
278 m_d->controller = controller;
280 m_d->comboBox_colourby =
new QComboBox;
281 connect(controller,SIGNAL(reconVertexRepresentationChanged(
const double&)),
this,SLOT(
updateAllShapes()));
282 connect(controller,SIGNAL(reconCutAllowedTypesChanged(VertexCommonFlags::ReconVertexTypeFlags)),
this,SLOT(
recheckAllCuts()));
284 dynamic_cast<VP1VertexSystem*
>(controller->
systemBase()),SLOT(updateVertexToTracks(QList<std::pair<
const SoMaterial*,QList<const Trk::Track*> > >&)));
305 m_d->comboBox_colourby->setToolTip(
"Determine how vertices from this collection are coloured.");
309 m_d->comboBox_colourby->addItems(l);
310 m_d->comboBox_colourby->setCurrentIndex(0);
311 connect(
m_d->comboBox_colourby,SIGNAL(currentIndexChanged(
int)),
340 if (targetText!=
m_d->comboBox_colourby->currentText()) {
341 int i =
m_d->comboBox_colourby->findText(targetText);
342 if (i>=0&&i<m_d->comboBox_colourby->count()) {
343 bool save =
m_d->comboBox_colourby->blockSignals(
true);
344 m_d->comboBox_colourby->setCurrentIndex(i);
345 m_d->comboBox_colourby->blockSignals(save);
347 message(
"ERROR: Problems finding correct text in combo box");
355 QList<const Trk::Track*> tracks;
356 QList<const Trk::TrackParticleBase*> trackparticles;
357 QList< std::pair<const SoMaterial*, QList< const Trk::Track*> > > colAndTracks;
359 m_d->findAssociatedTracks(vh->
vertex(),tracks,trackparticles);
361 colAndTracks.append(std::pair<
const SoMaterial*, QList< const Trk::Track*> >(mat, tracks));
370 return QList<QWidget*>() <<
m_d->comboBox_colourby;
377 messageVerbose(
"Collection detail level combo box changed index");
392 QList<const Trk::Track*>& tracks,
393 QList<const Trk::TrackParticleBase*>& trackparticles)
396 trackparticles.clear();
400 const std::vector<Trk::VxTrackAtVertex*> * tmpVxTAVtx = vtx->
vxTrackAtVertex();
401 for ( std::vector<Trk::VxTrackAtVertex*>::const_iterator itr = tmpVxTAVtx->begin(); itr != tmpVxTAVtx->end(); ++itr) {
408 const Trk::TrackParticleBase * tp((linkToTrackParticle && linkToTrackParticle->isValid())?linkToTrackParticle->cachedElement():0);
416 if (linkToTrack && linkToTrack->isValid())
417 trk = linkToTrack->cachedElement();
422 trackparticles << tp;
439 QList<const Trk::Track*> tracks;
440 QList<const Trk::TrackParticleBase*> trackparticles;
441 QList< std::pair<const SoMaterial*, QList< const Trk::Track*> > > colAndTracks;
444 m_d->findAssociatedTracks(vh->
vertex(),tracks,trackparticles);
446 colAndTracks.append(std::pair<
const SoMaterial*, QList< const Trk::Track*> >(mat, tracks));
494 while (pickedPath->getLength()>3&&pickedPath->getNodeFromTail(0)->getTypeId()!=SoSeparator::getClassTypeId())
496 if (pickedPath->getNodeFromTail(0)->getTypeId()!=SoSeparator::getClassTypeId())
497 return QStringList() <<
"ERROR: Could not get vertex information for picked Node (1)";
498 SoSeparator * pickedSep =
static_cast<SoSeparator *
>(pickedPath->getNodeFromTail(0));
502 if (vh->
sep()==pickedSep) {
508 return QStringList() <<
"ERROR: Could not get vertex information for picked Node (1)";
512 if (
m_d->controller->printInfoOnClick()) {
515 l <<
"Reconstructed vertex from collection "+
text()+
":" ;
521 QList<const Trk::Track*> tracks;
522 QList<const Trk::TrackParticleBase*> trackparticles;
523 m_d->findAssociatedTracks(vtx,tracks,trackparticles);
525 if (
m_d->controller->printVerboseInfoOnClick()) {
526 l <<
"--#Trk::Track's: "+
str(tracks.count());
527 l <<
"--#Trk::TrackParticleBase's: "+
str(trackparticles.count());
528 l <<
"======== Dump ========";
529 std::ostringstream s;
531 l << QString(s.str().c_str()).split(
'\n');
532 l <<
"======================";
536 if (
m_d->controller->zoomOnClick()) {
538 std::set<SoCamera*>::iterator it,itE = cameras.end();
539 for (it=cameras.begin();it!=itE;++it)
554 QList< std::pair<const SoMaterial*, QList< const Trk::Track*> > > colAndTracks;
#define AmgSymMatrix(dim)
DataModel_detail::const_iterator< DataVector > const_iterator
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
void message(const QString &) const
An abstract class which is meant to represent an element link to the Trk::Track or Trk::TrackParticle...
AUTO - An Undocumented Tracking Object.
const Track * originalTrack() const
Return pointer to associated track.
const Amg::Vector3D & position() const
return position of vertex
std::vector< Trk::VxTrackAtVertex * > * vxTrackAtVertex(void)
Unconst pointer to the vector of tracks Required by some of the vertex fitters.
const Trk::RecVertex & recVertex(void) const
Returns a reference to reconstructed vertex.
virtual MsgStream & dump(MsgStream &sl) const
Output Method for MsgStream, to be overloaded by child classes.
static VP1CameraHelper * animatedZoomToPath(SoCamera *camera, SoGroup *sceneroot, SoPath *path, double duration_in_secs=1.0, double clipVolPercent=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)
void messageVerbose(const QString &) const
void message(const QString &) const
IVP1System * systemBase() const
QStringList getKeys() const
SoMaterial * material() const
virtual void largeChangesEnd()
virtual void init(VP1MaterialButtonBase *button=0)
SoSeparator * collSep() const
All 3D objects from this coll.
virtual void largeChangesBegin()
void visibilityChanged(bool)
VP1StdCollection(IVP1System *, const QString &helperClassName)
void updateShapes(VertexSysController *controller)
void ensureDetached(SoSeparator *collSep)
VP1VertexCollection * m_collHandle
VertexCommonFlags::ReconVertexTypeFlag type()
void rerandomiseRandomMaterial()
const Trk::VxCandidate * vertex() const
SoMaterial * m_randommaterial
SoMaterial * determineMaterial()
void actualBuildShape(VertexSysController *controller)
VP1VertexCollection * collHandle()
void ensureAttached(SoSeparator *collSep, VertexSysController *controller)
SoSeparator * sep() const
VertexHandle(const Trk::VxCandidate *v, VP1VertexCollection *collHandle)
const Trk::VxCandidate * m_vertex
static QString comboBoxEntry_ColourByRandom()
void recheckCut(VertexHandle *vh)
bool cut(VertexHandle *vh, VertexSysController *controller)
void findAssociatedTracks(const Trk::VxCandidate *vtx, QList< const Trk::Track * > &tracks, QList< const Trk::TrackParticleBase * > &trackparticles)
VertexSysController * controller
VP1VertexCollection * theclass
SoMaterial * m_randommaterial
static QString comboBoxEntry_ColourByCollection()
QList< VertexHandle * > vertices
QComboBox * comboBox_colourby
void colourByComboBoxItemChanged()
VP1VertexCollection(VertexSysController *controller, const QString &key)
void init(VP1MaterialButtonBase *mat=0)
QStringList infoOnClicked(SoPath *pickedPath)
void collVisibilityChanged(bool vis)
COLOURBY colourBy() const
virtual COLOURBY defaultColourBy() const
void setColourBy(COLOURBY)
virtual ~VP1VertexCollection()
void rerandomiseRandomVertexColours()
QString provideText() const
QList< QWidget * > provideExtraWidgetsForGuiRow() const
void assignDefaultMaterial(SoMaterial *) const
void tracksFromVertexChanged(QList< std::pair< const SoMaterial *, QList< const Trk::Track * > > > &)
static QList< VP1StdCollection * > createCollections(VertexSysController *controller)
Eigen::Matrix< double, 3, 1 > Vector3D
@ V0LambdaBar
Temporary addition for V0 LambdaBar.
@ V0Vtx
Vertex from V0 Decay.
@ ConvVtx
Converstion Vertex.
@ SecVtx
Secondary Vertex.
@ V0KShort
Temporary addition for KShort.
@ V0Lambda
Temporary addition for V0 Lambda.