18#include <Inventor/C/errors/debugerror.h>
19#include <Inventor/nodes/SoSeparator.h>
20#include <Inventor/nodes/SoTransform.h>
21#include <Inventor/nodes/SoMaterial.h>
56 return m_d->sepSimple;
62 return m_d->sepDetailed;
69 m_d->colhandle = colhandle;
72 m_d->currentmaterial = 0;
73 m_d->sephelper_lod_detail = 0;
74 m_d->sephelper_lod_simple = 0;
82 m_d->sepDetailed->unref();
84 m_d->sepSimple->unref();
85 if (
m_d->currentmaterial)
86 m_d->currentmaterial->unref();
95 SoTransform * transform(0);
109 transform =
static_cast<SoTransform*
>(
sepDetailed->getChild(0));
137 SoNode* shape_simple(0), * shape_detailed(0);
138 theclass->
buildShapes(shape_simple, shape_detailed);
142 shape_detailed = shape_simple;
166 if (!
m_d->currentmaterial)
170 SoMaterial * newmat =
m_d->determineMaterial(
this);
172 if (newmat!=
m_d->currentmaterial) {
173 m_d->detach3DObjects();
174 m_d->currentmaterial->unref();
175 m_d->currentmaterial = newmat;
176 m_d->attach3DObjects(
this);
182 m_d->currentmaterial->unref();
183 m_d->currentmaterial = 0;
230 return m_d->colhandle;
241 m_d->colhandle->incrementNShownHandles();
244 if (!
m_d->sepSimple||!
m_d->sepDetailed)
245 m_d->rebuild3DObjects(
this);
247 m_d->attach3DObjects(
this);
249 m_d->colhandle->decrementNShownHandles();
252 m_d->detach3DObjects();
260 m_d->rebuild3DObjects(
this);
263 if (
m_d->sepDetailed) {
264 m_d->sepDetailed->unref();
265 m_d->sepDetailed = 0;
267 if (
m_d->sepSimple) {
268 m_d->sepSimple->unref();
280 return QStringList(
"Null PRD");
281 std::ostringstream os;
283 return QString(os.str().c_str()).split(
"\n");
324 if (
m_d->sepDetailed&&
m_d->sepDetailed->getNumChildren()>0) {
328 SoTransform * transform =
static_cast<SoTransform*
>(
m_d->sepDetailed->getChild(0));
330 transform->translation.getValue().getValue(tx,ty,tz);
333 transform->rotation.getValue().getValue(so_rotaxis, so_rotangle);
335 so_rotaxis.getValue(rx,ry,
rz);
343 std::cout<<
"VP1 PRDHandleBase Warning: getTransform_CLHEP called at inopportune moment!!"<<std::endl;
349 return Amg::Transform3D::Identity();
376 std::cerr<<
"PRDHandleBase::createTransform() No prd!"<<std::endl;
377 return new SoTransform;
390 if ((theHitGPos)[0]!=(theHitGPos)[0] || (theHitGPos)[1]!=(theHitGPos)[1] || (theHitGPos)[2]!=(theHitGPos)[2]){
391 std::cerr<<
"PRDHandleBase::createTransform() NaN in globalposition"<<std::endl;
393 theHitTransform->translation.setValue((theHitGPos)[0], (theHitGPos)[1], (theHitGPos)[2]);
394 return theHitTransform;
400 double hlw =
colhandle->highLightWeight();
404 std::map<SoMaterial*,double> materials;
410 for (
unsigned i = 0; i <
ts->tracks.size(); ++i) {
415 std::cout<<
"PRDHandleBase ERROR: Did not find track material!"<<std::endl;
420 for (
unsigned i = 0; i <
ts->segments.size(); ++i) {
425 std::cout<<
"PRDHandleBase ERROR: Did not find segment material (2)!"<<std::endl;
428 if (hlw>0.0&&
colhandle->highLightOutliers()) {
430 if (
colhandle->colourByTracks()&&!
ts->tracks_outliers.empty()) {
432 materials[
colhandle->highLightMaterial()] =
ts->tracks_outliers.size();
434 for (
unsigned i = 0; i <
ts->tracks_outliers.size(); ++i) {
437 materials[mat]=1.0/(hlw+1.0);
439 std::cout<<
"PRDHandleBase ERROR: Did not find track material (3)!"<<std::endl;
441 materials[
colhandle->highLightMaterial()] =
ts->tracks_outliers.size()*hlw/(hlw+1.0);
447 for (
unsigned i = 0; i <
ts->tracks_outliers.size(); ++i) {
452 std::cout<<
"PRDHandleBase ERROR: Did not find track material (4)!"<<std::endl;
456 unsigned ntrackssegments= (
colhandle->colourByTracks()?
ts->tracks.size()+
ts->tracks_outliers.size():0)
457 +(
colhandle->colourBySegments()?
ts->segments.size():0);
459 materials[
colhandle->highLightMaterial()] = hlw*ntrackssegments;
462 if (!materials.empty())
SoNode * getShapeNode_Point()
SoMaterial * currentmaterial
SoMaterial * determineMaterial(PRDHandleBase *)
void attach3DObjects(PRDHandleBase *)
VP1ExtraSepLayerHelper * sephelper_lod_simple
static Amg::Vector3D positionPRD(const Trk::PrepRawData *prd)
void rebuild3DObjects(PRDHandleBase *)
PRDCollHandleBase * colhandle
SoSeparator * sepDetailed
VP1ExtraSepLayerHelper * sephelper_lod_detail
virtual const Trk::PrepRawData * getSecondPRD() const
virtual const Trk::PrepRawData * getPRD() const =0
PRDSysCommonData * m_common
virtual bool transformUsesSurfacePositionOnly() const
virtual void buildShapes(SoNode *&shape_simple, SoNode *&shape_detailed)=0
virtual int regionIndex()
SoSeparator * sepDetailed() const
virtual SoTransform * createTransform() const
Amg::Transform3D getTransform_CLHEP() const
Amg::Vector3D positionPRD() const
virtual QStringList clicked() const
PRDHandleBase(PRDCollHandleBase *)
PRDSysCommonData * common() const
virtual bool inMuonChamber() const
virtual bool highLight() const
PRDCollHandleBase * collHandle() const
virtual Amg::Vector3D center() const
virtual GeoPVConstLink parentMuonChamberPV() const
Amg::Vector3D positionSecondPRD() const
SoSeparator * sepSimple() const
TouchedMuonChamberHelper * touchedMuonChamberHelper() const
HitsSoNodeManager * nodeManager() const
PRDTrackSegmentHelper * trackAndSegmentHelper() const
VP1SoMaterialMixer * materialMixer() const
void registerTransform2Handle(SoTransform *transform, PRDHandleBase *handle)
SoMaterial * trackMaterial(const Trk::Track *) const
const TracksAndSegments * tracksAndSegments(const Trk::PrepRawData *)
SoMaterial * segmentMaterial(const Trk::Segment *) const
void decrementNumberOfObjectsForPV(const GeoPVConstLink &chamberPV)
void incrementNumberOfObjectsForPV(const GeoPVConstLink &chamberPV)
virtual const TrkDetElementBase * detectorElement() const =0
return the detector element corresponding to this PRD The pointer will be zero if the det el is not d...
const Amg::Vector2D & localPosition() const
return the local position reference
Identifier identify() const
return the identifier
Abstract Base Class for tracking surfaces.
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
const Amg::Vector3D & center() const
Returns the center position of the Surface.
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.
virtual const Surface & surface() const =0
Return surface associated with this detector element.
static SoTransform * toSoTransform(const HepGeom::Transform3D &, SoTransform *t=0)
SoMaterial * getMixedMaterial(const std::set< SoMaterial * > &)
Amg::Vector3D getTranslationVectorFromTransform(const Amg::Transform3D &tr)
Get the Translation vector out of a Transformation.
Eigen::Quaternion< double > Rotation3D
Eigen::Affine3d Transform3D
Amg::Rotation3D getRotation3DfromAngleAxis(double angle, Amg::Vector3D &axis)
get a AngleAxis from an angle and an axis.
Eigen::Matrix< double, 3, 1 > Vector3D
Eigen::Translation< double, 3 > Translation3D