ATLAS Offline Software
Loading...
Searching...
No Matches
PRDHandleBase::Imp Class Reference
Collaboration diagram for PRDHandleBase::Imp:

Public Member Functions

void rebuild3DObjects (PRDHandleBase *)
void attach3DObjects (PRDHandleBase *)
void detach3DObjects ()
SoMaterial * determineMaterial (PRDHandleBase *)

Static Public Member Functions

static Amg::Vector3D positionPRD (const Trk::PrepRawData *prd)

Public Attributes

PRDCollHandleBasecolhandle
SoSeparator * sepDetailed
SoSeparator * sepSimple
SoMaterial * currentmaterial
VP1ExtraSepLayerHelpersephelper_lod_detail
VP1ExtraSepLayerHelpersephelper_lod_simple

Detailed Description

Definition at line 34 of file PRDHandleBase.cxx.

Member Function Documentation

◆ attach3DObjects()

void PRDHandleBase::Imp::attach3DObjects ( PRDHandleBase * theclass)

Definition at line 188 of file PRDHandleBase.cxx.

189{
190 if (!currentmaterial) {
192 currentmaterial->ref();
193 }
194 if (sepDetailed) {
195 if (colhandle->sephelperDetailedNodes())
196 colhandle->sephelperDetailedNodes()->addNodeUnderMaterial(sepDetailed,currentmaterial);
198 sephelper_lod_detail->addNodeUnderMaterial(sepDetailed,currentmaterial);
199 }
200 if (sepSimple) {
201 if (colhandle->sephelperSimpleNodes())
202 colhandle->sephelperSimpleNodes()->addNodeUnderMaterial(sepSimple,currentmaterial);
204 sephelper_lod_simple->addNodeUnderMaterial(sepSimple,currentmaterial);
205 }
206}
SoMaterial * currentmaterial
SoMaterial * determineMaterial(PRDHandleBase *)
VP1ExtraSepLayerHelper * sephelper_lod_simple
SoSeparator * sepSimple
PRDCollHandleBase * colhandle
SoSeparator * sepDetailed
VP1ExtraSepLayerHelper * sephelper_lod_detail

◆ detach3DObjects()

void PRDHandleBase::Imp::detach3DObjects ( )

Definition at line 209 of file PRDHandleBase.cxx.

210{
211 if (!currentmaterial)
212 return;//Can never have been attached!
213 if (sepDetailed) {
214 if (colhandle->sephelperDetailedNodes())
215 colhandle->sephelperDetailedNodes()->removeNodeUnderMaterial(sepDetailed,currentmaterial);
217 sephelper_lod_detail->removeNodeUnderMaterial(sepDetailed,currentmaterial);
218 }
219 if (sepSimple) {
220 if (colhandle->sephelperSimpleNodes())
221 colhandle->sephelperSimpleNodes()->removeNodeUnderMaterial(sepSimple,currentmaterial);
223 sephelper_lod_simple->removeNodeUnderMaterial(sepSimple,currentmaterial);
224 }
225}

◆ determineMaterial()

SoMaterial * PRDHandleBase::Imp::determineMaterial ( PRDHandleBase * theclass)

Definition at line 398 of file PRDHandleBase.cxx.

399{
400 double hlw = colhandle->highLightWeight();
401 //Get most frequent special case (i.e. no highlighting ) out of the
402 //way first for efficiency:
403 if (colhandle->colourMethod()!=PRDCollHandleBase::ByTechOnly) {
404 std::map<SoMaterial*,double> materials;
405 //-> Retrieve tracks/segments.
406 const PRDTrackSegmentHelper::TracksAndSegments * ts = theclass->common()->trackAndSegmentHelper()->tracksAndSegments(theclass->getPRD());
407 if (ts) {
408 //-> Add all materials from tracks as appropriate
409 if (colhandle->colourByTracks()) {
410 for (unsigned i = 0; i < ts->tracks.size(); ++i) {
411 SoMaterial * mat = theclass->common()->trackAndSegmentHelper()->trackMaterial(ts->tracks[i]);
412 if (mat)
413 materials[mat]=1.0;
414 else
415 std::cout<< "PRDHandleBase ERROR: Did not find track material!"<<std::endl;
416 }
417 }
418 //-> Add all materials from segments as appropriate
419 if (colhandle->colourBySegments()) {
420 for (unsigned i = 0; i < ts->segments.size(); ++i) {
421 SoMaterial * mat = theclass->common()->trackAndSegmentHelper()->segmentMaterial(ts->segments[i]);
422 if (mat)
423 materials[mat]=1.0;
424 else
425 std::cout<< "PRDHandleBase ERROR: Did not find segment material (2)!"<<std::endl;
426 }
427 }
428 if (hlw>0.0&&colhandle->highLightOutliers()) {
429 //Add outliers (if colourbytracks) + a highlightmaterial, all with appropriate weights.
430 if (colhandle->colourByTracks()&&!ts->tracks_outliers.empty()) {
431 if (hlw>999.0) {
432 materials[colhandle->highLightMaterial()] = ts->tracks_outliers.size();
433 } else {
434 for (unsigned i = 0; i < ts->tracks_outliers.size(); ++i) {
435 SoMaterial * mat = theclass->common()->trackAndSegmentHelper()->trackMaterial(ts->tracks_outliers[i]);
436 if (mat)
437 materials[mat]=1.0/(hlw+1.0);
438 else
439 std::cout<< "PRDHandleBase ERROR: Did not find track material (3)!"<<std::endl;
440 }
441 materials[colhandle->highLightMaterial()] = ts->tracks_outliers.size()*hlw/(hlw+1.0);
442 }
443 }
444 } else {
445 //Just add materials from outliers - and see if we need highlighting also.
446 if (colhandle->colourByTracks()) {
447 for (unsigned i = 0; i < ts->tracks_outliers.size(); ++i) {
448 SoMaterial * mat = theclass->common()->trackAndSegmentHelper()->trackMaterial(ts->tracks_outliers[i]);
449 if (mat)
450 materials[mat]=1.0;
451 else
452 std::cout<< "PRDHandleBase ERROR: Did not find track material (4)!"<<std::endl;
453 }
454 }
455 if (hlw>0.0&&!colhandle->highLightOutliers()&&theclass->highLight()) {
456 unsigned ntrackssegments= (colhandle->colourByTracks()?ts->tracks.size()+ts->tracks_outliers.size():0)
457 +(colhandle->colourBySegments()?ts->segments.size():0);
458 if (ntrackssegments)
459 materials[colhandle->highLightMaterial()] = hlw*ntrackssegments;
460 }
461 }
462 if (!materials.empty())
463 return theclass->common()->materialMixer()->getMixedMaterial(materials);
464 }
465 }
466
467
468 //OK, just use the tech colour - and possibly some non-outlier-highlighting.
469 if (hlw>0.0&&!colhandle->highLightOutliers()&&theclass->highLight()) {
470 if (hlw>999.0)
471 return colhandle->highLightMaterial();
472 return theclass->common()->materialMixer()->getMixedMaterial(colhandle->highLightMaterial(),hlw,colhandle->material(),1.0);
473 } else {
474 return colhandle->material();
475 }
476}
virtual const Trk::PrepRawData * getPRD() const =0
PRDSysCommonData * common() const
virtual bool highLight() const
PRDTrackSegmentHelper * trackAndSegmentHelper() const
VP1SoMaterialMixer * materialMixer() const
SoMaterial * trackMaterial(const Trk::Track *) const
const TracksAndSegments * tracksAndSegments(const Trk::PrepRawData *)
SoMaterial * segmentMaterial(const Trk::Segment *) const
SoMaterial * getMixedMaterial(const std::set< SoMaterial * > &)
int ts
Definition globals.cxx:24

◆ positionPRD()

Amg::Vector3D PRDHandleBase::Imp::positionPRD ( const Trk::PrepRawData * prd)
static

Definition at line 288 of file PRDHandleBase.cxx.

289{
290 if (!prd)
291 return Amg::Vector3D(0,0,0);
292 if (!prd->detectorElement())
293 return Amg::Vector3D(0.0,0.0,0.0);
294 const Trk::Surface& theSurface = prd->detectorElement()->surface(prd->identify());
295
296 const Amg::Vector3D hitpos = theSurface.localToGlobal(prd->localPosition());
297
298 const Amg::Vector3D& pos(hitpos);
299 return pos;
300}
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
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.
Eigen::Matrix< double, 3, 1 > Vector3D

◆ rebuild3DObjects()

void PRDHandleBase::Imp::rebuild3DObjects ( PRDHandleBase * theclass)

Definition at line 92 of file PRDHandleBase.cxx.

93{
94 //Fixme:
95 SoTransform * transform(0);
96 //If visible and already build: Detach separators (and ensure we got the sephelpers):
97 if (theclass->m_visible) {
99 int idx = theclass->regionIndex();
101 }
103 }
104
105 //Ensure separators are built and with no children:
106 if (sepDetailed) {
107 //We might get transform from this one:
108 if (sepDetailed->getNumChildren()>0) {
109 transform = static_cast<SoTransform*>(sepDetailed->getChild(0));
110 transform->ref();
111 }
112 sepDetailed->removeAllChildren();
113 } else {
114 sepDetailed = new SoSeparator;
115 sepDetailed->ref();
116 // sepDetailed->renderCaching.setValue(SoSeparator::ON);
117 // sepDetailed->boundingBoxCaching.setValue(SoSeparator::ON);
118 }
119 if (sepSimple) {
120 sepSimple->removeAllChildren();
121 } else {
122 sepSimple = new SoSeparator;
123 // sepSimple->renderCaching.setValue(SoSeparator::ON);
124 // sepSimple->boundingBoxCaching.setValue(SoSeparator::ON);
125 sepSimple->ref();
126 }
127 //Attach transforms:
128 if (!transform) {
129 transform = theclass->createTransform();
130 transform->ref();
131 theclass->common()->registerTransform2Handle(transform,theclass);
132 }
133 sepDetailed->addChild(transform);//For efficiency it is important that this happens BEFORE buildShapes(..) is called.
134 sepSimple->addChild(transform);
135 transform->unref();
136
137 SoNode* shape_simple(0), * shape_detailed(0);
138 theclass->buildShapes(shape_simple, shape_detailed);
139 if (!shape_simple)
140 shape_simple = theclass->common()->nodeManager()->getShapeNode_Point();//Add single point as a stop-gap measure.
141 if (!shape_detailed)
142 shape_detailed = shape_simple;//Could not create detailed shape for some reason. Use simple shape instead.
143
144 sepSimple->addChild(shape_simple);
145 sepDetailed->addChild(shape_detailed);
146
147 //Attach if visible:
148 if (theclass->m_visible)
149 attach3DObjects(theclass);
150}
void attach3DObjects(PRDHandleBase *)
virtual void buildShapes(SoNode *&shape_simple, SoNode *&shape_detailed)=0
virtual int regionIndex()
virtual SoTransform * createTransform() const
HitsSoNodeManager * nodeManager() const
void registerTransform2Handle(SoTransform *transform, PRDHandleBase *handle)
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.

Member Data Documentation

◆ colhandle

PRDCollHandleBase* PRDHandleBase::Imp::colhandle

Definition at line 36 of file PRDHandleBase.cxx.

◆ currentmaterial

SoMaterial* PRDHandleBase::Imp::currentmaterial

Definition at line 46 of file PRDHandleBase.cxx.

◆ sepDetailed

SoSeparator* PRDHandleBase::Imp::sepDetailed

Definition at line 44 of file PRDHandleBase.cxx.

◆ sephelper_lod_detail

VP1ExtraSepLayerHelper* PRDHandleBase::Imp::sephelper_lod_detail

Definition at line 47 of file PRDHandleBase.cxx.

◆ sephelper_lod_simple

VP1ExtraSepLayerHelper* PRDHandleBase::Imp::sephelper_lod_simple

Definition at line 48 of file PRDHandleBase.cxx.

◆ sepSimple

SoSeparator* PRDHandleBase::Imp::sepSimple

Definition at line 45 of file PRDHandleBase.cxx.


The documentation for this class was generated from the following file: