ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
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)

◆ detach3DObjects()

void PRDHandleBase::Imp::detach3DObjects ( )

◆ 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:
404  std::map<SoMaterial*,double> materials;
405  //-> Retrieve tracks/segments.
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 }

◆ 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 }

◆ 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) {
98  if (!sephelper_lod_detail) {
99  int idx = theclass->regionIndex();
101  }
102  detach3DObjects();
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 }

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:
PRDHandleBase::Imp::sephelper_lod_simple
VP1ExtraSepLayerHelper * sephelper_lod_simple
Definition: PRDHandleBase.cxx:48
PRDSysCommonData::materialMixer
VP1SoMaterialMixer * materialMixer() const
Definition: PRDSysCommonData.h:81
PRDCollHandleBase::ByTechOnly
@ ByTechOnly
Definition: PRDCollHandleBase.h:71
PRDCollHandleBase::colourBySegments
bool colourBySegments() const
Definition: PRDCollHandleBase.h:75
PRDHandleBase::Imp::sepSimple
SoSeparator * sepSimple
Definition: PRDHandleBase.cxx:45
PRDSysCommonData::registerTransform2Handle
void registerTransform2Handle(SoTransform *transform, PRDHandleBase *handle)
Definition: PRDSysCommonData.cxx:90
VP1StdCollection::material
SoMaterial * material() const
Definition: VP1StdCollection.cxx:220
PRDHandleBase::Imp::sepDetailed
SoSeparator * sepDetailed
Definition: PRDHandleBase.cxx:44
mat
GeoMaterial * mat
Definition: LArDetectorConstructionTBEC.cxx:55
VP1ExtraSepLayerHelper::addNodeUnderMaterial
void addNodeUnderMaterial(SoNode *, SoMaterial *)
Definition: VP1ExtraSepLayerHelper.cxx:190
VP1SoMaterialMixer::getMixedMaterial
SoMaterial * getMixedMaterial(const std::set< SoMaterial * > &)
Definition: VP1SoMaterialMixer.cxx:273
VP1ExtraSepLayerHelper::removeNodeUnderMaterial
void removeNodeUnderMaterial(SoNode *, SoMaterial *)
Definition: VP1ExtraSepLayerHelper.cxx:216
PRDHandleBase::Imp::attach3DObjects
void attach3DObjects(PRDHandleBase *)
Definition: PRDHandleBase.cxx:188
PRDHandleBase::createTransform
virtual SoTransform * createTransform() const
Definition: PRDHandleBase.cxx:371
PRDHandleBase::regionIndex
virtual int regionIndex()
Definition: PRDHandleBase.h:44
PRDHandleBase::common
PRDSysCommonData * common() const
Definition: PRDHandleBase.h:53
PRDHandleBase::m_visible
bool m_visible
Definition: PRDHandleBase.h:86
PRDHandleBase::Imp::currentmaterial
SoMaterial * currentmaterial
Definition: PRDHandleBase.cxx:46
PRDSysCommonData::nodeManager
HitsSoNodeManager * nodeManager() const
Definition: PRDSysCommonData.h:79
PRDCollHandleBase::getLODSeparators
void getLODSeparators(int index, VP1ExtraSepLayerHelper *&sephelper_detail, VP1ExtraSepLayerHelper *&sephelper_simple)
Definition: PRDCollHandleBase.cxx:472
lumiFormat.i
int i
Definition: lumiFormat.py:85
PRDTrackSegmentHelper::tracksAndSegments
const TracksAndSegments * tracksAndSegments(const Trk::PrepRawData *)
Definition: PRDTrackSegmentHelper.cxx:483
PRDHandleBase::Imp::colhandle
PRDCollHandleBase * colhandle
Definition: PRDHandleBase.cxx:36
PRDCollHandleBase::highLightWeight
double highLightWeight() const
Definition: PRDCollHandleBase.h:59
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
Trk::TrkDetElementBase::surface
virtual const Surface & surface() const =0
Return surface associated with this detector element.
PRDCollHandleBase::sephelperSimpleNodes
VP1ExtraSepLayerHelper * sephelperSimpleNodes() const
Definition: PRDCollHandleBase.cxx:406
Trk::PrepRawData::identify
Identifier identify() const
return the identifier
PRDHandleBase::getPRD
virtual const Trk::PrepRawData * getPRD() const =0
PRDHandleBase::Imp::detach3DObjects
void detach3DObjects()
Definition: PRDHandleBase.cxx:209
Trk::PrepRawData::localPosition
const Amg::Vector2D & localPosition() const
return the local position reference
PRDCollHandleBase::highLightOutliers
bool highLightOutliers() const
Definition: PRDCollHandleBase.cxx:619
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
PRDCollHandleBase::sephelperDetailedNodes
VP1ExtraSepLayerHelper * sephelperDetailedNodes() const
Definition: PRDCollHandleBase.cxx:400
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
PRDTrackSegmentHelper::segmentMaterial
SoMaterial * segmentMaterial(const Trk::Segment *) const
Definition: PRDTrackSegmentHelper.cxx:528
HitsSoNodeManager::getShapeNode_Point
SoNode * getShapeNode_Point()
Definition: HitsSoNodeManager.cxx:412
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
PRDSysCommonData::trackAndSegmentHelper
PRDTrackSegmentHelper * trackAndSegmentHelper() const
Definition: PRDSysCommonData.h:87
PRDHandleBase::highLight
virtual bool highLight() const
Definition: PRDHandleBase.h:45
PRDHandleBase::Imp::determineMaterial
SoMaterial * determineMaterial(PRDHandleBase *)
Definition: PRDHandleBase.cxx:398
PRDTrackSegmentHelper::trackMaterial
SoMaterial * trackMaterial(const Trk::Track *) const
Definition: PRDTrackSegmentHelper.cxx:521
python.CaloScaleNoiseConfig.ts
ts
Definition: CaloScaleNoiseConfig.py:86
PRDCollHandleBase::highLightMaterial
SoMaterial * highLightMaterial() const
Definition: PRDCollHandleBase.cxx:637
Trk::Surface
Definition: Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/Surface.h:75
PRDHandleBase::Imp::sephelper_lod_detail
VP1ExtraSepLayerHelper * sephelper_lod_detail
Definition: PRDHandleBase.cxx:47
PRDCollHandleBase::colourMethod
COLOURMETHOD colourMethod() const
Definition: PRDCollHandleBase.h:73
PRDCollHandleBase::colourByTracks
bool colourByTracks() const
Definition: PRDCollHandleBase.h:74
Trk::Surface::localToGlobal
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.
PRDTrackSegmentHelper::TracksAndSegments
Definition: PRDTrackSegmentHelper.h:52
Trk::PrepRawData::detectorElement
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...
PRDHandleBase::buildShapes
virtual void buildShapes(SoNode *&shape_simple, SoNode *&shape_detailed)=0