76 #include <Inventor/nodes/SoLineSet.h>
77 #include <Inventor/nodes/SoSeparator.h>
78 #include <Inventor/nodes/SoVertexProperty.h>
79 #include <Inventor/nodes/SoPointSet.h>
80 #include <Inventor/nodes/SoCamera.h>
81 #include <Inventor/nodes/SoCylinder.h>
82 #include <Inventor/nodes/SoMaterial.h>
83 #include <Inventor/nodes/SoRotationXYZ.h>
84 #include <Inventor/nodes/SoTransform.h>
85 #include <Inventor/nodes/SoTranslation.h>
86 #include <Inventor/nodes/SoSphere.h>
96 unsigned indexOfPointOnTrack )
99 m_indexOfPointOnTrack(indexOfPointOnTrack),
101 m_objBrowseTree(nullptr)
179 VP1Msg::message(
"AscObj_TSOS::approxCenter() WARNING: Failed to determine"
180 " position from either params or surface");
189 return static_cast<int>(
c.z()/
l)
190 +1000*
static_cast<int>(
c.y()/
l)
191 +1000000*
static_cast<int>(
c.x()/
l);
202 const double& maxTrans )
const
213 for (
size_t i = 0;
i<
points->size();
i++)
232 if (imin+1 <
points->size() && imin >= 1)
236 smin = std::abs(tm - 0.5) < std::abs(
tp - 0.5) ? sm : sp;
237 }
else if (imin+1 >=
points->size() && imin >= 1 )
248 VP1Msg::message(
"AscObj_TSOS::getZTranslationTube: <2 points returned by trackHandle!");
252 if (std::abs(smin) > maxTrans)
254 double sign = smin > 0 ? 1.0 : -1.0;
255 smin =
sign*maxTrans;
258 SoTranslation * trans =
new SoTranslation;
259 trans->translation.setValue(0,0,smin);
267 double paramValue = 0;
275 VP1Msg::message(
" No ROT or cROT in AscObj_TSOS::deviationFromMeasurement(const bool& absolute)!");
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 ) )
292 if (not atas)
return std::nan(
"");
294 paramValue = std::abs(localposMeas[
Trk::locR]);
303 return absolute ? std::abs( rioValue - paramValue ) : std::abs( rioValue - paramValue )/
sigma;
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 ) )
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;
340 if (not dcot)
return;
343 SoSeparator *
sep =
new SoSeparator;
344 SoMaterial *
mat =
new SoMaterial;
346 mat->diffuseColor.setValue(1,0,0);
348 mat->diffuseColor.setValue(0,1,0);
351 shape_detailed->addChild(
sep);
356 if (not dcot)
return;
359 SoSeparator *
sep =
new SoSeparator;
360 SoMaterial *
mat =
new SoMaterial;
362 mat->diffuseColor.setValue(1,0,0);
364 mat->diffuseColor.setValue(0,1,0);
367 shape_detailed->addChild(
sep);
373 shape_detailed->addChild(
line);
379 SoSeparator*&shape_detailed,
380 bool showPars,
bool showParsErrors,
bool showSurfaces)
383 Q_ASSERT(trackParams);
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);
406 SoPointSet *
points =
new SoPointSet;
407 SoVertexProperty * vertices2 =
new SoVertexProperty;
408 vertices2->vertex.set1Value(0,
p1.x(),
p1.y(),
p1.z());
410 line->vertexProperty = vertices;
411 points->vertexProperty = vertices2;
417 SoSeparator *
sep =
new SoSeparator;
421 shape_simple->addChild(
sep);
422 shape_detailed->addChild(
sep);
424 shape_simple->addChild(
line);
425 shape_simple->addChild(
points);
426 shape_detailed->addChild(
line);
427 shape_detailed->addChild(
points);
431 if ( showParsErrors ){
433 shape_detailed->addChild(theHitTransform);
435 if (trackParams->covariance())
442 if (per||atas||aap||aad){
443 const Amg::Vector2D& localPos = atas ? atas->localPosition() : (per ? per->localPosition() : (aap ? aap->localPosition() : aad->localPosition()));
445 addErrors(trackParams->
associatedSurface(), *trackParams->covariance(), localPos,
p1, showSurfaces, shape_simple, shape_detailed,
false,
false);
455 const Amg::Vector2D& localPos,
const Amg::Vector3D&
p1,
bool showSurfaces, SoSeparator* shape_simple, SoSeparator* shape_detailed,
bool force1D,
bool applyLocalTrans )
462 const bool settingsDRAWZERRCIRCLES = settingsDRAWCYLINDER;
465 SoSeparator * errSimple =
new SoSeparator;
466 SoSeparator * errDetailed =
new SoSeparator;
472 errSimple->addChild(
mat );
473 errDetailed->addChild(
mat );
491 if (applyLocalTrans) {
492 SoTranslation * theTransform =
new SoTranslation;
495 theTransform->translation.setValue(locPosTmp->x(),locPosTmp->y(),0.0);
497 errSimple->addChild(theTransform);
498 errDetailed->addChild(theTransform);
500 VP1Msg::message(
"AscObj_TSOS::addErrors - failed to get tmp position");
508 shape_simple->addChild( errSimple );
509 shape_detailed->addChild( errDetailed );
510 }
else if ( strSurf || perSurf) {
513 if (applyLocalTrans){
515 errSimple->addChild(theTransform);
516 errDetailed->addChild(theTransform);
518 VP1ErrorUtils::errorAtStraightLineSurface(errSimple, errDetailed, tmpCovMat, localPos, &theSurface, settingsSIGMASCALE, settingsDRAWZERRCIRCLES, settingsDRAWCYLINDER,
npoints, force1D,
false);
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");
536 static int ignoreECModules=-1;
537 if (ignoreECModules==-1)
543 if (ignoreECModules) {
548 double abscostheta = std::abs(
cos(angle_z_normal));
549 if (abscostheta>0.707)
return;
557 SoNode * nodeToAddSimple = theSurfSepSimple;
558 SoNode * nodeToAdd = theSurfSep;
562 if (theSurfSep->getTypeId().isDerivedFrom(SoSeparator::getClassTypeId())) {
563 static_cast<SoSeparator*
>(theSurfSepSimple)->insertChild(
mat,0);
564 static_cast<SoSeparator*
>(theSurfSep)->insertChild(
mat,0);
566 SoSeparator * sepSimple =
new SoSeparator;
567 sepSimple->addChild(
mat);
568 sepSimple->addChild(theSurfSepSimple);
569 nodeToAddSimple = sepSimple;
570 SoSeparator *
sep =
new SoSeparator;
572 sep->addChild(theSurfSep);
577 shape_simple->addChild(nodeToAddSimple);
578 shape_detailed->addChild(nodeToAdd);
580 VP1Msg::message(
"AscObj_TSOS::addSurfaceToShapes WARNING: Got null shape.");
587 const double settingsForceOnTrack =
false;
590 SoSeparator * matSepSimple =
new SoSeparator;
591 SoSeparator * matSepDetailed =
new SoSeparator;
598 SoTranslation * theTransform =
new SoTranslation;
599 theTransform->translation.setValue(
p1.x(),
p1.y(),
p1.z());
600 matSepSimple->addChild(theTransform);
601 matSepDetailed->addChild(theTransform);
605 VP1Msg::message(
"AscObj_TSOS::addMaterialEffectsToShapes WARNING: Has neither surface or parameter to get position!");
607 if (settingsForceOnTrack) {
608 VP1Msg::message(
"AscObj_TSOS::addMaterialEffectsToShapes WARNING: settingsForceOnTrack not implemented");
615 matSepSimple->addChild(theTransform);
616 matSepDetailed->addChild(theTransform);
624 matSepSimple->addChild(
mat);
625 matSepDetailed->addChild(
mat);
631 matSepSimple->addChild(point);
634 matSepDetailed->addChild(point);
644 SoSphere * meotSphere =
new SoSphere;
646 matSepDetailed->addChild(meotSphere);
648 matSepDetailed->addChild(point);
654 shape_simple->addChild(matSepSimple);
655 shape_detailed->addChild(matSepDetailed);
660 SoSeparator*&shape_detailed,
687 shape_simple->addChild(
mat);
688 shape_detailed->addChild(
mat);
701 theTransform->translation.getValue().getValue(
x,
y,zShift);
702 shape_simple->addChild(theTransform);
703 shape_detailed->addChild(theTransform);
707 SoTranslation * theTransform =
new SoTranslation;
708 theTransform->translation.setValue(0,0,-zShift);
709 shape_simple->addChild(theTransform);
710 shape_detailed->addChild(theTransform);
736 VP1Msg::message(
"WARNING: ROT has inconsistent dimensions between cov matrix and local parameters. Forcing to 1D.");
743 shape_simple, shape_detailed, force1D,
true);
750 SoSeparator*&shape_detailed)
760 shape_simple->addChild(
mat);
761 shape_detailed->addChild(
mat);
764 shape_simple->addChild(
mat);
765 shape_detailed->addChild(
mat);
768 if (
common()->controller()->drawMeasGlobalPositions()){
774 SoTranslation * theTransform =
new SoTranslation;
783 theTransform->translation.setValue( locPos.x(), locPos.y(), locPos.z());
794 SoSeparator * gpSep =
new SoSeparator;
796 gpSep->addChild(theTransform);
798 shape_detailed->addChild(gpSep);
805 if (showcRioOnTrack){
808 SoSeparator * rotSepSimple =
new SoSeparator;
809 SoSeparator * rotSepDetailed =
new SoSeparator;
815 shape_detailed->addChild(rotSepDetailed);
816 shape_simple->addChild(rotSepSimple);
822 shape_detailed->addChild( transparent );
826 if (!rot) {
VP1Msg::message(
"WARNING: cROT has empty max prob ROT. Aborting.");
return;}
836 if ( (!tgcDetEl) && (!rpcDetEl)) {
VP1Msg::message(
"WARNING: most prob ROT from cROT has Unknown DE type. Aborting."); std::cout<<*rot<<std::endl;
return;}
849 for (
unsigned int n = 0;
n < nrio;
n++)
851 if (
n==maxProb)
continue;
856 if (!rot) {
VP1Msg::message(
"WARNING: cROT has empty ROT. Skipping.");
continue;}
877 SoSeparator * rotSepSimple =
new SoSeparator;
878 SoSeparator * rotSepDetailed =
new SoSeparator;
892 SoTranslation * theTransform =
new SoTranslation;
893 theTransform->translation.setValue( locPos.x(), locPos.y(), locPos.z());
894 rotSepDetailed->addChild(theTransform);
895 rotSepSimple->addChild(theTransform);
904 shape_simple->addChild(rotSepSimple);
905 shape_detailed->addChild(rotSepDetailed);
916 SoSeparator*&shape_detailed)
919 shape_simple =
new SoSeparator;
921 shape_detailed =
new SoSeparator;
953 if (!
surface()) {
VP1Msg::message(
"AscObj_TSOS::addTransformToSurface: WARNING: TSOS without Surface! Unable to get transform!");
return;}
965 SoTransform* theHitTransform=
nullptr;
989 VP1Msg::message(
"AscObj_TSOS::addTransformToSurface: WARNING: Unknown type of ROT.");
997 if (!theHitTransform) {
998 VP1Msg::message(
"AscObj_TSOS::addTransformToSurface: WARNING: Unable to build transform");
1001 shape_simple->addChild(theHitTransform);
1002 shape_detailed->addChild(theHitTransform);
1007 SoSeparator*&shape_detailed)
1025 SoSeparator* param_simple=
new SoSeparator;
1026 SoSeparator* param_detailed=
new SoSeparator;
1027 if (showPars||showParsErrors)
1029 shape_simple->addChild(param_simple);
1030 shape_detailed->addChild(param_detailed);
1032 if (showMaterialEffects)
1044 SoSeparator* meas_simple=
new SoSeparator;
1045 SoSeparator* meas_detailed=
new SoSeparator;
1046 if (
rioOnTrack() && (showRioOnTrack||showMeasErrors))
1048 if (showCompetingRioOnTrack)
1050 shape_simple->addChild(meas_simple);
1051 shape_detailed->addChild(meas_detailed);
1071 l <<
"ERROR: This associated object handle has a NULL TSOS pointer!!";
1082 for (
int i = 0;
i < (
list.size()-1); ){
1092 bool showDeviationsFromMeasurements =
true;
1093 if ( showDeviationsFromMeasurements
1107 for (
int i = 0;
i < (
list.size()-1); ){
1118 for (
int i = 0;
i < (
list.size()-1); ){
1128 for (
int i = 0;
i < (
list.size()-1); ){
1135 l <<
" ===== TrackStateOnSurface =====";
1136 std::ostringstream
s2;
1138 l << QString(
s2.str().c_str()).split(
'\n');
1141 l <<
" ===== Surface =====";
1142 std::ostringstream
s;
1144 l << QString(
s.str().c_str()).split(
'\n');
1151 if (trkObjBrowseritem){
1156 QTreeWidget* trkObjBrowser = trkObjBrowseritem->treeWidget();
1157 trkObjBrowser->setCurrentItem(me);
1158 trkObjBrowser->scrollToItem(me);
1171 if (trkObjBrowseritem){
1176 QFont itemFont = me->font(1);
1180 me->setFlags(Qt::ItemFlags());
1181 itemFont.setStrikeOut(
true);
1185 me->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
1186 itemFont.setStrikeOut(
false);
1223 if (
common()->controller()->orientAndZoomOnSingleSelection() )
1250 if ( plaSurf || perSurf )
1255 SbVec3f lookat0 = SbVec3f(-
u[0],-
u[1],-
u[2]);
1268 }
else if ( strSurf )
1270 SbVec3f lookat0 = SbVec3f(0,0,1);
1274 rot.multVec(lookat0,lookat0);
1279 SbRotation camrot = (*it)->orientation.getValue();
1280 SbVec3f cameraDir = SbVec3f(0,0,-1);
1281 camrot.multVec(cameraDir,cameraDir);
1283 lookat1 = cameraDir.dot(lookat0) > 0 ? lookat0 : -lookat0;