16#include "ui_example4controllerform.h"
18#include <Inventor/nodes/SoSeparator.h>
19#include <Inventor/nodes/SoLineSet.h>
20#include <Inventor/nodes/SoVertexProperty.h>
21#include <Inventor/nodes/SoSwitch.h>
28#include "GaudiKernel/SystemOfUnits.h"
34 "This is an illustration of a very basic 3D system.\n"
35 "It transforms track information found in storegate"
36 " into 3D objects, displays track information upon selection, and has a controller which allows the user to set a pt cut on tracks.",
52 message(
"Error: Got null storegate pointer");
57 std::string trackname=
"Tracks";
58 StatusCode status = sg->
retrieve(trackColl, trackname);
59 if (status != StatusCode::SUCCESS || !trackColl) {
60 message(
"Error: Could not retrieve track collection (used key="+QString(trackname.c_str())+
")");
68 for ( trackItr = trackColl->
begin() ; trackItr != trackItrEnd; ++trackItr) {
73 if ( !params || params->size()<2 )
80 SoVertexProperty *vertices =
new SoVertexProperty();
84 for (it = params->begin();it!=itE;++it) {
85 vertices->vertex.set1Value(iver++,(*it)->position().x(),(*it)->position().y(),(*it)->position().z());
89 SoLineSet * line =
new SoLineSet();
90 line->numVertices = iver;
91 line->vertexProperty = vertices;
94 SoSwitch * sw =
new SoSwitch();
97 double pt = params->front()->pT();
98 sw->whichChild = pt >
m_ptcut ? SO_SWITCH_ALL : SO_SWITCH_NONE;
120 message(
"Error: Does not have track information for picked node");
126 if ( !params || params->empty() ) {
127 message(
"Error: Track has no trackparameters");
133 message(
" |p| = "+QString::number(params->front()->momentum().mag()/Gaudi::Units::GeV)+
" GeV");
134 message(
" pT = "+QString::number(params->front()->pT()/Gaudi::Units::GeV)+
" GeV");
135 message(
" Q = "+QString::number(params->front()->charge()));
136 message(
" eta = "+QString::number(params->front()->eta()));
143 QWidget * controller =
new QWidget(0);
144 Ui::Example4ControllerForm ui;
145 ui.setupUi(controller);
147 m_ptcut = ui.doubleSpinBox_ptcut->value()*Gaudi::Units::GeV;
148 connect(ui.doubleSpinBox_ptcut,SIGNAL(valueChanged(
double)),
this,SLOT(
ptCutChanged(
double)));
157 m_ptcut = ptcut*Gaudi::Units::GeV;
160 std::map<SoSwitch*,double>::iterator it, itE =
m_switchToPt.end();
162 it->first->whichChild = ( it->second>
m_ptcut ? SO_SWITCH_ALL : SO_SWITCH_NONE );
DataVector< Trk::Track > TrackCollection
This typedef represents a collection of Trk::Track objects.
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 ptCutChanged(double)
void buildEventSceneGraph(StoreGateSvc *sg, SoSeparator *root)
std::map< SoSwitch *, double > m_switchToPt
QWidget * buildController()
std::map< SoNode *, const Trk::Track * > m_nodeToTrack
void userPickedNode(SoNode *pickedNode, SoPath *pickedPath)
IVP13DSystemSimple(const QString &name, const QString &information, const QString &contact_info)
void message(const QString &) const
The Athena Transient Store API.
StatusCode retrieve(const T *&ptr) const
Retrieve the default object into a const T*.
=============================================================================