17#include "ui_tracksystemcontrollerform.h"
26#include <Inventor/nodes/SoSeparator.h>
27#include <Inventor/nodes/SoLineSet.h>
28#include <Inventor/nodes/SoVertexProperty.h>
29#include <Inventor/nodes/SoSwitch.h>
34#include <QTextDocument>
35#include "GaudiKernel/SystemOfUnits.h"
43 "This is a temporary testing version of the basic 3D track display system.",
47 std::cout <<
"INFO :: TrackSystemDisplay -> constructor" << std::endl;
55 std::cout <<
"INFO :: TrackSystemDisplay -> building event scene graph" << std::endl;
61 message(
"ERROR :: Null storegate pointer received.");
66 std::string trackname=
"Tracks";
67 StatusCode status = sg->
retrieve(trackColl, trackname);
68 if (status != StatusCode::SUCCESS || !trackColl) {
69 message(
"ERROR :: Could not retrieve track collection (used key="+QString(trackname.c_str())+
")");
80 for(trackItr=trackColl->
begin(); trackItr!=trackItrEnd; ++trackItr) {
84 if(!params || params->size()<2)
87 SoVertexProperty *vertices =
new SoVertexProperty();
91 for(it=params->begin(); it!=itE; ++it) {
92 vertices->vertex.set1Value(iver++,(*it)->position().x(),(*it)->position().y(),(*it)->position().z());
95 SoLineSet * line =
new SoLineSet();
96 line->numVertices = iver;
97 line->vertexProperty = vertices;
99 SoSwitch * sw =
new SoSwitch();
100 double pt = params->front()->pT();
101 sw->whichChild = pt >
m_ptcut ? SO_SWITCH_ALL : SO_SWITCH_NONE;
120 message(
"ERROR :: No track information for selected node.");
126 if (!params || params->empty()) {
127 message(
"ERROR :: Track has no track parameters.");
132 QString title =
"TriggerDisplay - Track Parameters";
133 QList<QString> paraname, paravalue;
134 paraname << QString(
"|p|"); paravalue << QString::number(params->front()->momentum().mag()/Gaudi::Units::GeV)+
" GeV";
135 paraname << QString(
"pT"); paravalue << QString::number(params->front()->pT()/Gaudi::Units::GeV)+
" GeV";
136 paraname << QString(
"Q"); paravalue << QString::number(params->front()->charge());
137 paraname << QString(
"Eta"); paravalue << QString::number(params->front()->eta());
142 for (
CamListItr itCam = cameras.begin(); itCam!=cameras.end(); ++itCam) {
156 double totalenergy(0);
158 foreach (SoNode *
node, nodes) {
161 message(
"ERROR :: Does not have track information for all nodes");
167 if ( !params || params->empty() ) {
168 message(
"ERROR :: Track has no trackparameters");
172 total3mom += params->front()->momentum();
173 totalenergy += params->front()->momentum().mag();
177 double invmasssq = totalenergy*totalenergy - total3mom.mag2();
178 QString invmass_str = invmasssq>=0.0 ? QString::number(sqrt(invmasssq)/Gaudi::Units::GeV) :
"sqrt(-1)*"+QString::number(sqrt(-invmasssq)/Gaudi::Units::GeV);
179 QString title =
"Invariant Mass";
180 QList<QString> paraname, paravalue;
182 paraname << QString::number(nodes.count())+
" tracks";
183 paravalue << invmass_str+
" GeV";
192 QWidget * controller =
new QWidget(0);
193 Ui::TrackSystemControllerForm ui;
196 ui.setupUi(controller);
199 m_ptcut = ui.doubleSpinBox_ptcut->value()*Gaudi::Units::GeV;
200 connect(ui.doubleSpinBox_ptcut,SIGNAL(valueChanged(
double)),
this,SLOT(
ptCutChanged(
double)));
203 connect(ui.radioButton_select_single,SIGNAL(toggled(
bool)),
this,SLOT(
updateSelectionMode(
bool)));
220 QString
header =
"<html><head><link rel='stylesheet' type='text/css' href='format.css'></head><body>", footer =
"</body></html>";
221 QString css =
"#design { font-family: Courier New; font-size: 12px; margin: 0px; width: 100%; text-align: left; } #design th { font-size: 13px; font-weight: normal; padding: 2px; background: #ccc; border-top: 4px solid #000; border-bottom: 1px solid #fff; color: #000; } #design td { padding: 2px; background: #000; border-bottom: 1px solid #fff; color: #fff; border-top: 1px solid transparent; }";
222 QString table_b =
"<table id='design'>", table_e =
"</table>";
223 QString thead_b =
"<thead><tr><th COLSPAN=2>", thead_e =
"</th></tr></thead>";
224 QString tbody_b =
"<tbody>", tbody_e =
"</tbody>";
225 QString data_tr_b =
"<tr>", data_tr_e =
"</tr>";
226 QString data_td_b =
"<td>", data_td_e =
"</td>";
230 for(
int i=0; i<paraname.size(); ++i) {
231 data += data_tr_b+data_td_b+ paraname[i] +data_td_e;
232 data += data_td_b+ paravalue[i] +data_td_e+data_tr_e;
236 QTextDocument *doc =
new QTextDocument;
237 doc->addResource(QTextDocument::StyleSheetResource, QUrl(
"format.css"), css);
238 doc->setHtml(
header+table_b+thead_b+title+thead_e+tbody_b+
data+tbody_e+table_e+footer);
250 m_ptcut = ptcut*Gaudi::Units::GeV;
252 std::map<SoSwitch*,double>::iterator it, itE =
m_switchToPt.end();
254 it->first->whichChild = ( it->second>
m_ptcut ? SO_SWITCH_ALL : SO_SWITCH_NONE );
char data[hepevt_bytes_allocation_ATLAS]
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.
IVP13DSystemSimple(const QString &name, const QString &information, const QString &contact_info)
std::set< SoCamera * > CamList
virtual void deselectAll(SoCooperativeSelection *exception_sel=0)
void registerSelectionNode(SoCooperativeSelection *)
CamList::iterator CamListItr
void message(const QString &) const
The Athena Transient Store API.
StatusCode retrieve(const T *&ptr) const
Retrieve the default object into a const T*.
std::map< SoSwitch *, double > m_switchToPt
void printTrackInfo(QString title, QList< QString > paraname, QList< QString > paravalue)
void userChangedSelection(SoCooperativeSelection *, const QSet< SoNode * > &, QSet< SoPath * >)
SoCooperativeSelection * m_multiselection
void buildEventSceneGraph(StoreGateSvc *sg, SoSeparator *root)
void ptCutChanged(double)
void updateSelectionMode(bool single)
QWidget * buildController()
QTextBrowser * m_trackInfoDisplay
void userPickedNode(SoNode *pickedNode, SoPath *pickedPath)
std::map< SoNode *, const Trk::Track * > m_nodeToTrack
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)
Eigen::Matrix< double, 3, 1 > Vector3D
=============================================================================