ATLAS Offline Software
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
VolumeHandle Class Reference

#include <VolumeHandle.h>

Inheritance diagram for VolumeHandle:
Collaboration diagram for VolumeHandle:

Classes

class  Imp
 

Public Types

enum  MuonChamberState { NONMUONCHAMBER, MUONCHAMBERCHILD, MUONCHAMBER, MUONCHAMBER_DIRTY }
 
typedef std::vector< VolumeHandle * > VolumeHandleList
 
typedef VolumeHandleList::iterator VolumeHandleListItr
 
typedef VolumeHandleList::const_iterator VolumeHandleListConstItr
 

Public Member Functions

bool isInMuonChamber () const
 
bool isMuonChamber () const
 
void setMuonChamberDirty (bool)
 
bool muonChamberDirty () const
 
MuonChamberState muonChamberState () const
 
 VolumeHandle (VolumeHandleSharedData *, VolumeHandle *parent, const GeoPVConstLink &, int childNumber, const MuonChamberState &mcs=NONMUONCHAMBER, const SbMatrix &accumTrans=SbMatrix())
 
virtual ~VolumeHandle ()
 
void initialiseChildren ()
 
bool childrenAreInitialised () const
 
unsigned nChildren () const
 
SoMaterial * material ()
 
QString getName () const
 
int copyNumber () const
 
quint32 hashID () const
 
GeoPVConstLink geoPVConstLink () const
 
const GeoMaterial * geoMaterial () const
 
std::string getNameStdString () const
 
bool hasName (const std::string &) const
 
const SbMatrix & getGlobalTransformToVolume () const
 
SbMatrix getLocalTransformToVolume () const
 
bool isPositiveZ () const
 
VolumeHandleparent ()
 
VolumeHandletopLevelParent ()
 
VolumeHandleListItr childrenBegin ()
 
VolumeHandleListItr childrenEnd ()
 
VolumeHandlechild (int index) const
 
int childNumber () const
 
VP1GeoFlags::VOLSTATE state () const
 
void setState (const VP1GeoFlags::VOLSTATE &state)
 
void reset ()
 
bool isAttached () const
 
void contractDaughtersRecursively ()
 
bool isEther () const
 
void expandMothersRecursivelyToNonEther ()
 
bool isInitialisedAndHasNonStandardShape () const
 
SoSeparator * nodeSoSeparator () const
 
void ensureBuildNodeSep ()
 
void updateLabels ()
 
QByteArray getPersistifiableState () const
 
void applyPersistifiableState (QByteArray)
 
VP1GeoFlags::SubSystemFlag subsystem () const
 
virtual QString getDescriptiveName () const
 
virtual QString muonChamberT0 (unsigned int=0) const
 

Private Member Functions

 VolumeHandle (const VolumeHandle &)
 
VolumeHandleoperator= (const VolumeHandle &)
 
bool haveParentsNotExpanded () const
 
void attachAllContractedChildren ()
 
void detachAllContractedChildren ()
 

Private Attributes

Impm_d
 
const int m_childNumber
 
const unsigned m_nchildren
 
MuonChamberState m_muonChamberState
 
VolumeHandlem_parent
 
VolumeHandleList m_children
 
VP1GeoFlags::VOLSTATE m_state
 

Detailed Description

Definition at line 21 of file VolumeHandle.h.

Member Typedef Documentation

◆ VolumeHandleList

Definition at line 64 of file VolumeHandle.h.

◆ VolumeHandleListConstItr

typedef VolumeHandleList::const_iterator VolumeHandle::VolumeHandleListConstItr

Definition at line 66 of file VolumeHandle.h.

◆ VolumeHandleListItr

typedef VolumeHandleList::iterator VolumeHandle::VolumeHandleListItr

Definition at line 65 of file VolumeHandle.h.

Member Enumeration Documentation

◆ MuonChamberState

Enumerator
NONMUONCHAMBER 
MUONCHAMBERCHILD 
MUONCHAMBER 
MUONCHAMBER_DIRTY 

Definition at line 24 of file VolumeHandle.h.

24  { NONMUONCHAMBER,//Default
25  MUONCHAMBERCHILD,//Top-level parent is muon chamber
26  MUONCHAMBER,//Muon chamber, adjusted to event data
27  MUONCHAMBER_DIRTY };//Muon chamber, not adjusted to event data

Constructor & Destructor Documentation

◆ VolumeHandle() [1/2]

VolumeHandle::VolumeHandle ( VolumeHandleSharedData cd,
VolumeHandle parent,
const GeoPVConstLink &  pV,
int  childNumber,
const MuonChamberState mcs = NONMUONCHAMBER,
const SbMatrix &  accumTrans = SbMatrix() 
)

Definition at line 97 of file VolumeHandle.cxx.

98  : m_d(new Imp(cd,pV,accumTrans)), m_childNumber(childNumber), m_nchildren(childNumber>=0?pV->getNChildVols():0), m_muonChamberState(mcs), m_parent(parent),
100 {
101  // std::cout<<"VolumeHandle ctor for "<<this<<" with parent="<<parent<<" and GeoPVConstLink @"<<&pV<<std::endl;
102  //commondata might be 0 in the special case where VolumeHandle is
103  //used as a base class for other reasons inside
104  //VolumeTreeModel. Just make sure we dont crash in that case.
105  if (cd) {
106  cd->ref();
107  if (!haveParentsNotExpanded())
108  m_d->attach(this);
109  }
110 }

◆ ~VolumeHandle()

VolumeHandle::~VolumeHandle ( )
virtual

Definition at line 113 of file VolumeHandle.cxx.

114 {
115  if (m_d->commondata) {
118  if (childrenAreInitialised()) {
120  for (it = m_children.begin(); it!=itE; ++it)
121  delete *it;
122  m_children.clear();
123  }
124  if (m_d->material)
125  m_d->material->unref();
126  if (m_d->nodesep)
127  m_d->nodesep->unref();
128  if (m_d->label_sep)
129  m_d->label_sep->unref();
130  m_d->commondata->unref();
131  }
132  delete m_d;
133 }

◆ VolumeHandle() [2/2]

VolumeHandle::VolumeHandle ( const VolumeHandle )
private

Member Function Documentation

◆ applyPersistifiableState()

void VolumeHandle::applyPersistifiableState ( QByteArray  ba)

Definition at line 556 of file VolumeHandle.cxx.

557 {
558  QBuffer buffer(&ba);
559  buffer.open(QIODevice::ReadOnly);
560  QDataStream state(&buffer);
561  qint32 version;
562  state >> version;
563  if (version!=0)
564  return;//We ignore wrong versions silently here.
565  qint32 st;
566  state >> st;
568  if (st == 2)
569  newstate = VP1GeoFlags::ZAPPED;
570  else if (st == 1)
571  newstate = VP1GeoFlags::EXPANDED;
572 
573  Imp::VolState vs;
574  state >> vs;
575  buffer.close();
576 
577  if (newstate==VP1GeoFlags::EXPANDED) {
579  m_d->applyChildStates(vs,this);
580  }
581  setState(newstate);
582 }

◆ attachAllContractedChildren()

void VolumeHandle::attachAllContractedChildren ( )
private

Definition at line 422 of file VolumeHandle.cxx.

422  {
423 
424  if (!m_nchildren)
425  return;
426  if (!childrenAreInitialised())
428 
429  VolumeHandleListItr childItrE = m_children.end();
430  for (VolumeHandleListItr childItr = m_children.begin(); childItr!=childItrE; ++childItr) {
431  if ((*childItr)->state()==VP1GeoFlags::CONTRACTED)
432  (*childItr)->m_d->attach(*childItr);
433  else if ((*childItr)->state()==VP1GeoFlags::EXPANDED)
434  (*childItr)->attachAllContractedChildren();
435  }
436 }

◆ child()

VolumeHandle * VolumeHandle::child ( int  index) const
inline

Definition at line 150 of file VolumeHandle.h.

150 { return m_children.at(index); }

◆ childNumber()

int VolumeHandle::childNumber ( ) const
inline

Definition at line 151 of file VolumeHandle.h.

151 { return m_childNumber; }

◆ childrenAreInitialised()

bool VolumeHandle::childrenAreInitialised ( ) const
inline

Definition at line 146 of file VolumeHandle.h.

146 { return m_children.size()==m_nchildren; }

◆ childrenBegin()

VolumeHandle::VolumeHandleListItr VolumeHandle::childrenBegin ( )
inline

Definition at line 147 of file VolumeHandle.h.

147 { return m_children.begin(); }

◆ childrenEnd()

VolumeHandle::VolumeHandleListItr VolumeHandle::childrenEnd ( )
inline

Definition at line 148 of file VolumeHandle.h.

148 { return m_children.end(); }

◆ contractDaughtersRecursively()

void VolumeHandle::contractDaughtersRecursively ( )

Definition at line 403 of file VolumeHandle.cxx.

404 {
405  if (!childrenAreInitialised())
406  return;//Fine to abort since children starts in contracted state
407  //if initialised at a later time.
408  VolumeHandleListItr childItrE = m_children.end();
409  for (VolumeHandleListItr childItr = m_children.begin(); childItr!=childItrE; ++childItr) {
410  (*childItr)->setState(VP1GeoFlags::CONTRACTED);
411  (*childItr)->contractDaughtersRecursively();
412  }
413 }

◆ copyNumber()

int VolumeHandle::copyNumber ( ) const

Definition at line 455 of file VolumeHandle.cxx.

456 {
457  GeoPVConstLink parent_pV;
458  if (m_parent) {
459  parent_pV = m_parent->geoPVConstLink();
460  } else {
462  if (parent_pV==m_d->pV) {
463  //To follow historical behaviour, we always assume that
464  //tree-tops (in the GeoModel sense) have a copy number of 0.
465  return 0;
466  }
467  }
468  GeoVolumeCursor av(parent_pV);
469  int i(0);//We need to check the childNumber since volumes in a replica have same volume link
470  while (!av.atEnd()) {
471  if (m_childNumber==i&&m_d->pV==av.getVolume()) {
472  Query<int> Qint = av.getId();
473  return Qint.isValid() ? int(Qint) : -1;//-1 for "Invalid"
474  }
475  av.next();
476  ++i;
477  }
478  return -2;//error
479 }

◆ detachAllContractedChildren()

void VolumeHandle::detachAllContractedChildren ( )
private

Definition at line 439 of file VolumeHandle.cxx.

439  {
440  if (!m_nchildren)
441  return;
442  if (!childrenAreInitialised())
443  return;//Since children not initialised won't have been attached!
444 
445  VolumeHandleListItr childItrE = m_children.end();
446  for (VolumeHandleListItr childItr = m_children.begin(); childItr!=childItrE; ++childItr) {
447  if ((*childItr)->state()==VP1GeoFlags::CONTRACTED)
448  (*childItr)->m_d->detach();
449  else if ((*childItr)->state()==VP1GeoFlags::EXPANDED)
450  (*childItr)->detachAllContractedChildren();
451  }
452 }

◆ ensureBuildNodeSep()

void VolumeHandle::ensureBuildNodeSep ( )

Definition at line 238 of file VolumeHandle.cxx.

239 {
240  VP1Msg::messageDebug("VolumeHandle::ensureBuildNodeSep()");
241  if (m_d->nodesep && m_d->label_sep)
242  return;
243 
244  m_d->label_sep = new SoSeparator;
245  m_d->label_sep->ref();
246 
247  m_d->nodesep = new SoSeparator;//FIXME: rendercaching??
248  // m_d->nodesep->renderCaching.setValue(SoSeparator::ON);
249  // m_d->nodesep->boundingBoxCaching.setValue(SoSeparator::ON);
250  m_d->nodesep->ref();//Since we are keeping it around irrespective of whether it is attached or not.
251 
252  //Transform:
254 
255  //VP1Msg::messageDebug("calling toShapeNode()...");
256  SoNode * shape = m_d->commondata->toShapeNode(m_d->pV);//NB: Ignore contained transformation of GeoShapeShifts.
257  if (!shape) {
258  m_d->nodesep->removeAllChildren();
259  std::cout << "Geomsys/VolumeHandle Error: Null shape!!!"<<std::endl;
260  return;
261  }
262 
263  //What phi sector do we belong in?
264  int iphi = m_d->commondata->phiSectorManager()->getVolumeType(m_d->accumTrans, shape);
265 
266  if (iphi >= -1 ) {
267  //VP1Msg::messageDebug("Cylinders [iphi >= -1]...");
268  //Substitute shapes that are essentially cylinders with such. This
269  //can be done safely since this tube won't need
270  //phi-slicing and is done to gain render performance.
271  if ( m_d->pV->getLogVol()->getShape()->typeID()==GeoTube::getClassTypeID() )
272  {
273  //VP1Msg::messageDebug("GeoTube...");
274  const GeoTube * geotube = static_cast<const GeoTube*>(m_d->pV->getLogVol()->getShape());
275  if (geotube->getRMin()==0.0)
276  shape = m_d->commondata->getSoCylinderOrientedLikeGeoTube(geotube->getRMax(),geotube->getZHalfLength());
277  }
278  else if ( m_d->pV->getLogVol()->getShape()->typeID()==GeoTubs::getClassTypeID() )
279  {
280  //VP1Msg::messageDebug("GeoTubs...");
281  const GeoTubs * geotubs = static_cast<const GeoTubs*>(m_d->pV->getLogVol()->getShape());
282  if (geotubs->getRMin()==0.0 && geotubs->getDPhi() >= 2*M_PI-1.0e-6)
283  shape = m_d->commondata->getSoCylinderOrientedLikeGeoTube(geotubs->getRMax(),geotubs->getZHalfLength());
284  }
285  }
286 
287  //In the case of a GeoShapeShift we add its contained transformation here:
288  //Fixme: Remember to use this extra transformation for phisector cuts also!
289  if (m_d->pV->getLogVol()->getShape()->typeID()==GeoShapeShift::getClassTypeID())
290  m_d->nodesep->addChild(VP1LinAlgUtils::toSoTransform(Amg::EigenTransformToCLHEP(dynamic_cast<const GeoShapeShift*>(m_d->pV->getLogVol()->getShape())->getX())));
291 
292  //Add shape child(ren) and get the separator (helper) where we attach the nodesep when volume is visible:
293  if (iphi >= -1) {
294  m_d->nodesep->addChild(shape);
297  } else {
298  SoSwitch * sw = new SoSwitch;
299  sw->addChild(shape);
300  SoSeparator * sep_slicedvols = new SoSeparator;
301  sw->addChild(sep_slicedvols);
302  sw->whichChild = 0;
303  m_d->nodesep->addChild(sw);
305  //FIXME - what about labels?
306  }
307 
308  //Register shape to volume handle connection (for user interactions):
309  //NB: "shape" might be shared between several volumes, so we use the separator above for the actual link!
310  //(this must be done last as it also sets outline defaults)
312 
313  //VP1Msg::messageDebug("VolumeHandle::ensureBuildNodeSep() - DONE.");
314 }

◆ expandMothersRecursivelyToNonEther()

void VolumeHandle::expandMothersRecursivelyToNonEther ( )

Definition at line 518 of file VolumeHandle.cxx.

518  {
519  //std::cout<<"VolumeHandle::expandMothersRecursivelyToNonEther() for "<<this->getNameStdString() << " [" <<this<< "]" << " - n. children: " << nChildren() << std::endl;
520 
521  if (!nChildren()||!isEther()) {
522  //VP1Msg::messageDebug("====> no children or not 'Ether' material. Skipping & returning.");
523  return;
524  }
525 
528  VolumeHandleListItr childItrE = m_children.end();
529  for (VolumeHandleListItr childItr = m_children.begin(); childItr!=childItrE; ++childItr) {
530  //std::cout << "\t-->expanding child " << (*childItr)->getNameStdString() << " - " << (*childItr) << std::endl ;
531  (*childItr)->expandMothersRecursivelyToNonEther();
532  }
534  //std::cout<<"VolumeHandle::expandMothersRecursivelyToNonEther() for "<<this->getNameStdString() << " [" <<this<< "]" <<" DONE.\n\n"<<std::endl;
535 
536 }

◆ geoMaterial()

const GeoMaterial * VolumeHandle::geoMaterial ( ) const

Definition at line 507 of file VolumeHandle.cxx.

507  {
508  return geoPVConstLink()->getLogVol()->getMaterial();
509 }

◆ geoPVConstLink()

GeoPVConstLink VolumeHandle::geoPVConstLink ( ) const

Definition at line 163 of file VolumeHandle.cxx.

164 {
165  return m_d->pV;
166 }

◆ getDescriptiveName()

QString VolumeHandle::getDescriptiveName ( ) const
inlinevirtual

Reimplemented in MuonVolumeHandle.

Definition at line 162 of file VolumeHandle.h.

162  {
163  QString name = getName();
164  name.remove("_Station");
165  return name;
166 }

◆ getGlobalTransformToVolume()

const SbMatrix & VolumeHandle::getGlobalTransformToVolume ( ) const

Definition at line 489 of file VolumeHandle.cxx.

489  {
490  return m_d->accumTrans;
491 }

◆ getLocalTransformToVolume()

SbMatrix VolumeHandle::getLocalTransformToVolume ( ) const

Definition at line 494 of file VolumeHandle.cxx.

494  {
495  if (!m_parent)
496  return m_d->accumTrans;
497  return m_parent->getGlobalTransformToVolume().inverse().multRight(m_d->accumTrans);
498 }

◆ getName()

QString VolumeHandle::getName ( ) const

Definition at line 169 of file VolumeHandle.cxx.

170 {
171  return m_d->pV->getLogVol()->getName().c_str();
172 }

◆ getNameStdString()

std::string VolumeHandle::getNameStdString ( ) const

Definition at line 175 of file VolumeHandle.cxx.

176 {
177  return m_d->pV->getLogVol()->getName();
178 }

◆ getPersistifiableState()

QByteArray VolumeHandle::getPersistifiableState ( ) const

Definition at line 539 of file VolumeHandle.cxx.

540 {
541  QByteArray ba;
542  QBuffer buffer(&ba);
543  buffer.open(QIODevice::WriteOnly);
544 
545  QDataStream out(&buffer);
546  out << (qint32)0;//version
548  out << Imp::getChildStates(this);
549 
550  buffer.close();
551  return ba;
552 
553 }

◆ hashID()

quint32 VolumeHandle::hashID ( ) const

Definition at line 482 of file VolumeHandle.cxx.

483 {
484  // return qHash( QPair<QString,quint32>(getName(),copyNumber()));//NOT UNIQUE!!
485  return qHash( QPair<QString,quint32>(getName(),childNumber()));
486 }

◆ hasName()

bool VolumeHandle::hasName ( const std::string &  n) const

Definition at line 181 of file VolumeHandle.cxx.

182 {
183  return m_d->pV->getLogVol()->getName() == n;
184 }

◆ haveParentsNotExpanded()

bool VolumeHandle::haveParentsNotExpanded ( ) const
private

Definition at line 416 of file VolumeHandle.cxx.

417 {
418  return m_parent ? ( m_parent->state()==VP1GeoFlags::EXPANDED ? m_parent->haveParentsNotExpanded() : true ) : false;
419 }

◆ initialiseChildren()

void VolumeHandle::initialiseChildren ( )

Definition at line 136 of file VolumeHandle.cxx.

137 {
139  return;
140 
141  assert(m_nchildren);
142 
143  //Loop over children:
144  m_children.reserve(m_nchildren);
145  unsigned ichild(0);
146  GeoVolumeCursor av(m_d->pV);
147  while (!av.atEnd()) {
148 
149  //Add transformation between parent and child to find the complete transformation of the child:
150  SbMatrix matr;
152  matr.multRight(m_d->accumTrans);
153  m_children.push_back(new VolumeHandle(m_d->commondata,this,av.getVolume(),ichild++,(isInMuonChamber()?MUONCHAMBERCHILD:NONMUONCHAMBER),matr));
154  //std::cout << "initialised: " << av.getName() << " - " << m_children.back()->getName().toStdString() << " - " << m_children.back() << std::endl;
155  av.next();
156  }
157 
158  assert(ichild==m_nchildren&&m_children.size()==m_nchildren);
159 
160 }

◆ isAttached()

bool VolumeHandle::isAttached ( ) const

Definition at line 501 of file VolumeHandle.cxx.

502 {
503  return m_d->isattached;
504 }

◆ isEther()

bool VolumeHandle::isEther ( ) const

Definition at line 512 of file VolumeHandle.cxx.

513 {
514  return !isMuonChamber() && QString(geoMaterial()->getName().c_str()).endsWith("Ether");
515 }

◆ isInitialisedAndHasNonStandardShape()

bool VolumeHandle::isInitialisedAndHasNonStandardShape ( ) const

Definition at line 656 of file VolumeHandle.cxx.

◆ isInMuonChamber()

bool VolumeHandle::isInMuonChamber ( ) const
inline

Definition at line 153 of file VolumeHandle.h.

◆ isMuonChamber()

bool VolumeHandle::isMuonChamber ( ) const
inline

Definition at line 154 of file VolumeHandle.h.

◆ isPositiveZ()

bool VolumeHandle::isPositiveZ ( ) const

Definition at line 663 of file VolumeHandle.cxx.

664 {
665  SbVec3f dir;
666  m_d->accumTrans.multDirMatrix(SbVec3f(0,0,1),dir);
667  float x,y,z;
668  dir.getValue(x,y,z);
669  return z>0;
670 }

◆ material()

SoMaterial * VolumeHandle::material ( )

Definition at line 187 of file VolumeHandle.cxx.

188 {
189  if (m_d->material)
190  return m_d->material;
191 
192  //First see if the "databases" of volumes/material know about this volume:
193 
194  SoMaterial * mat = m_d->commondata->volVisAttributes()->get(m_d->pV->getLogVol()->getName());
195  if (mat) {
196  m_d->material = mat;
197  m_d->material->ref();
198  return m_d->material;
199  }
200  mat = m_d->commondata->matVisAttributes()->get(m_d->pV->getLogVol()->getMaterial()->getName());
201  if (mat) {
202  m_d->material = mat;
203  m_d->material->ref();
204  return m_d->material;
205  }
206 
207  //Apparently not. We now have two ways of finding a material: We can
208  //take a system dependent fallback material, or we can take the
209  //material of the parent.
210 
212  if (mat) {
213  m_d->material = mat;
214  m_d->material->ref();
215  return m_d->material;
216  }
217 
218  if (m_parent) {
220  assert(m_d->material);
221  m_d->material->ref();
222  return m_d->material;
223  }
224 
225  m_d->material = m_d->commondata->matVisAttributes()->get("DEFAULT");
226  assert(m_d->material);
227  m_d->material->ref();
228  return m_d->material;
229 }

◆ muonChamberDirty()

bool VolumeHandle::muonChamberDirty ( ) const
inline

Definition at line 157 of file VolumeHandle.h.

◆ muonChamberState()

VolumeHandle::MuonChamberState VolumeHandle::muonChamberState ( ) const
inline

Definition at line 155 of file VolumeHandle.h.

155 { return m_muonChamberState; }

◆ muonChamberT0()

QString VolumeHandle::muonChamberT0 ( unsigned int  = 0) const
inlinevirtual

Reimplemented in MuonVolumeHandle.

Definition at line 168 of file VolumeHandle.h.

168  {
169  return QString();
170 }

◆ nChildren()

unsigned VolumeHandle::nChildren ( ) const
inline

Definition at line 149 of file VolumeHandle.h.

149 { return m_nchildren; }

◆ nodeSoSeparator()

SoSeparator * VolumeHandle::nodeSoSeparator ( ) const

Definition at line 232 of file VolumeHandle.cxx.

233 {
234  return m_d->nodesep;
235 }

◆ operator=()

VolumeHandle& VolumeHandle::operator= ( const VolumeHandle )
private

◆ parent()

VolumeHandle * VolumeHandle::parent ( )
inline

Definition at line 144 of file VolumeHandle.h.

144 { return m_parent; }

◆ reset()

void VolumeHandle::reset ( )
inline

Definition at line 158 of file VolumeHandle.h.

◆ setMuonChamberDirty()

void VolumeHandle::setMuonChamberDirty ( bool  b)
inline

Definition at line 156 of file VolumeHandle.h.

◆ setState()

void VolumeHandle::setState ( const VP1GeoFlags::VOLSTATE state)

Definition at line 350 of file VolumeHandle.cxx.

351 {
352  if (m_state==state)
353  return;
354 
355  //Mark muon chamber as dirty.
356  if (isInMuonChamber()) {
358  if (tp->m_muonChamberState == MUONCHAMBER)
359  tp->m_muonChamberState = MUONCHAMBER_DIRTY;
360  }
361 
362  //Update state flag and presence in GUI lists:
363  VP1GeoFlags::VOLSTATE oldstate = m_state;
364  m_state = state;
365  if (oldstate==VP1GeoFlags::ZAPPED)
367  else if (state==VP1GeoFlags::ZAPPED)
369 
370  //Only thing left is visibility updates (i.e. attachment to 3D scenegraph).
371 
372  if (haveParentsNotExpanded()) {
373  //No visibility updates necessary
374  assert(!m_d->isattached);
375  return;
376  }
377 
378  //We might need visibility updates. Which ones depend on the
379  //particular change of state:
380 
382  // VP1GeoFlags::EXPANDED/VP1GeoFlags::ZAPPED -> VP1GeoFlags::CONTRACTED: Show this and hide all children.
383  m_d->attach(this);
385  } else if (state==VP1GeoFlags::EXPANDED) {
386  // VP1GeoFlags::CONTRACTED -> VP1GeoFlags::EXPANDED: Hide this. Allow children to be shown.
387  // VP1GeoFlags::ZAPPED -> VP1GeoFlags::EXPANDED: Allow children to be shown.
388  if (oldstate==VP1GeoFlags::CONTRACTED)
389  m_d->detach();
391  } else {
392  assert(state==VP1GeoFlags::ZAPPED);
393  // VP1GeoFlags::CONTRACTED -> VP1GeoFlags::ZAPPED: Hide this.
394  // VP1GeoFlags::EXPANDED -> VP1GeoFlags::ZAPPED: Hide all children.
395  if (oldstate==VP1GeoFlags::CONTRACTED)
396  m_d->detach();
397  else
399  }
400 }

◆ state()

VP1GeoFlags::VOLSTATE VolumeHandle::state ( ) const
inline

Definition at line 152 of file VolumeHandle.h.

152 { return m_state; }

◆ subsystem()

VP1GeoFlags::SubSystemFlag VolumeHandle::subsystem ( ) const

Definition at line 585 of file VolumeHandle.cxx.

586 {
587  return m_d->commondata->subSystemFlag();
588 }

◆ topLevelParent()

VolumeHandle * VolumeHandle::topLevelParent ( )
inline

Definition at line 145 of file VolumeHandle.h.

145 { return m_parent ? m_parent->topLevelParent() : this; }

◆ updateLabels()

void VolumeHandle::updateLabels ( )

Definition at line 672 of file VolumeHandle.cxx.

672  {
673  int labels = m_d->commondata->controller()->labels();
674  QList<int> offsets = m_d->commondata->controller()->labelPosOffset();
675 
677 
678  if ( m_d->labels != labels || m_d->labelsPosOffsets != offsets){
679  m_d->labels = labels;
680  m_d->labelsPosOffsets = offsets;
681  m_d->label_sep->removeAllChildren ();
682 
683  SoText2 *labelText = new SoText2;
684  labelText->ref();
685  QStringList text;
686  if (labels&0x1){
687  QString name = getDescriptiveName();
688  text << name;
689  }
690 
691  // only one label selected - must be better way to do this!
692  bool singleLabel = (labels&0x2 && !(labels&0x4) && !(labels&0x8))
693  || (labels&0x4 && !(labels&0x2) && !(labels&0x8))
694  || (labels&0x8 && !(labels&0x2) && !(labels&0x4));
695  if (isInMuonChamber() && labels&0xE){
696  for (unsigned int i=0; i<3 ;++i){
697  // Check to see which label we use.
698  unsigned int mask=1<<(i+1);
699  if (!(labels&mask)) continue; // bits 1,2,3 are used for labels
700 
701  QString output;
702  if ( singleLabel ) {
703  output+="t0=";
704  } else {
705  if (i==0) output+="Moore t0=";
706  if (i==1) output+="Mboy t0=";
707  if (i==2) output+="<unknown>=";
708  }
709  output += muonChamberT0(i);
710  text << output;
711  }
712  }
713 
714  unsigned int row=0;
715  for(const QString& str : text){
716  QByteArray array = str.toLatin1();
717  labelText->string.set1Value(row++,array.data());
718  }
719 
720  SoTransform *labelTranslate = VP1LinAlgUtils::toSoTransform(m_d->accumTrans);
721  assert(labelTranslate!=0);
722  float offScale=10.0;
723  float labx,laby,labz;
724  labelTranslate->translation.getValue().getValue(labx,laby,labz);
725 // std::cout <<getNameStdString()<<" offsets (x,y,z)=("<<offsets[0]<<","<<offsets[1]<<","<<offsets[2]<<")"<<std::endl;
726 
727  labelTranslate->translation.setValue(labx+(offsets[0]*offScale),laby+(offsets[1]*offScale),labz+(offsets[2]*offScale));
728 
729  m_d->label_sep->addChild(labelTranslate);
730  m_d->label_sep->addChild(labelText);
731  }
732 
734 }

Member Data Documentation

◆ m_childNumber

const int VolumeHandle::m_childNumber
private

Definition at line 127 of file VolumeHandle.h.

◆ m_children

VolumeHandleList VolumeHandle::m_children
private

Definition at line 132 of file VolumeHandle.h.

◆ m_d

Imp* VolumeHandle::m_d
private

Definition at line 124 of file VolumeHandle.h.

◆ m_muonChamberState

MuonChamberState VolumeHandle::m_muonChamberState
private

Definition at line 129 of file VolumeHandle.h.

◆ m_nchildren

const unsigned VolumeHandle::m_nchildren
private

Definition at line 128 of file VolumeHandle.h.

◆ m_parent

VolumeHandle* VolumeHandle::m_parent
private

Definition at line 131 of file VolumeHandle.h.

◆ m_state

VP1GeoFlags::VOLSTATE VolumeHandle::m_state
private

Definition at line 133 of file VolumeHandle.h.


The documentation for this class was generated from the following files:
VolumeHandleSharedData::fallBackTopLevelMaterial
SoMaterial * fallBackTopLevelMaterial() const
Definition: VolumeHandleSharedData.cxx:105
query_example.row
row
Definition: query_example.py:24
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
VolumeHandle::Imp::detach
void detach()
Definition: VolumeHandle.cxx:337
VolumeHandle::muonChamberT0
virtual QString muonChamberT0(unsigned int=0) const
Definition: VolumeHandle.h:168
VolumeHandle::isInMuonChamber
bool isInMuonChamber() const
Definition: VolumeHandle.h:153
VolumeHandle::Imp::material
SoMaterial * material
Definition: VolumeHandle.cxx:61
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
VP1GeoFlags::EXPANDED
@ EXPANDED
Definition: VP1GeoFlags.h:88
PhiSectorManager::getSepHelperForNode
VP1ExtraSepLayerHelper * getSepHelperForNode(VP1GeoFlags::SubSystemFlag flag, int iphi)
Definition: PhiSectorManager.cxx:92
index
Definition: index.py:1
VolumeHandle::Imp::hasNonStandardShapeChildren
static bool hasNonStandardShapeChildren(const SoGroup *g)
Definition: VolumeHandle.cxx:637
VolumeHandle::setState
void setState(const VP1GeoFlags::VOLSTATE &state)
Definition: VolumeHandle.cxx:350
mat
GeoMaterial * mat
Definition: LArDetectorConstructionTBEC.cxx:55
VolumeHandle::material
SoMaterial * material()
Definition: VolumeHandle.cxx:187
VolumeHandle::geoMaterial
const GeoMaterial * geoMaterial() const
Definition: VolumeHandle.cxx:507
VolumeHandle::attachAllContractedChildren
void attachAllContractedChildren()
Definition: VolumeHandle.cxx:422
plotBeamSpotCompare.x2
x2
Definition: plotBeamSpotCompare.py:218
VolumeHandle::topLevelParent
VolumeHandle * topLevelParent()
Definition: VolumeHandle.h:145
skel.it
it
Definition: skel.GENtoEVGEN.py:396
VolumeHandle::Imp::attach
void attach(VolumeHandle *vh)
Definition: VolumeHandle.cxx:317
VolumeHandle::MUONCHAMBER_DIRTY
@ MUONCHAMBER_DIRTY
Definition: VolumeHandle.h:27
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
M_PI
#define M_PI
Definition: ActiveFraction.h:11
VolumeHandle::geoPVConstLink
GeoPVConstLink geoPVConstLink() const
Definition: VolumeHandle.cxx:163
ParticleTest.tp
tp
Definition: ParticleTest.py:25
VolumeHandleSharedData::volVisAttributes
VolVisAttributes * volVisAttributes() const
Definition: VolumeHandleSharedData.cxx:99
VolumeHandle::Imp::isattached
bool isattached
Definition: VolumeHandle.cxx:66
VolumeHandle::m_parent
VolumeHandle * m_parent
Definition: VolumeHandle.h:131
VolumeHandle::m_children
VolumeHandleList m_children
Definition: VolumeHandle.h:132
VolumeHandle::m_d
Imp * m_d
Definition: VolumeHandle.h:124
VolumeHandle::isMuonChamber
bool isMuonChamber() const
Definition: VolumeHandle.h:154
VolumeHandle::parent
VolumeHandle * parent()
Definition: VolumeHandle.h:144
x
#define x
VolumeHandle::childrenAreInitialised
bool childrenAreInitialised() const
Definition: VolumeHandle.h:146
python.utils.AtlRunQueryLookup.mask
string mask
Definition: AtlRunQueryLookup.py:460
TruthTest.itE
itE
Definition: TruthTest.py:25
VolumeHandleSharedData::unref
void unref()
Definition: VolumeHandleSharedData.cxx:85
PhiSectorManager::getVolumeType
int getVolumeType(const SbMatrix &transform, SoNode *shape) const
Definition: PhiSectorManager.cxx:215
PhiSectorManager::registerVolumeAroundZAxis
VP1ExtraSepLayerHelper * registerVolumeAroundZAxis(VP1GeoFlags::SubSystemFlag flag, SoSwitch *sw, const SbMatrix &tranformation)
Definition: PhiSectorManager.cxx:144
VP1HEPVisUtils::initAllCustomClasses
static void initAllCustomClasses()
Definition: VP1HEPVisUtils.cxx:317
VolumeHandleSharedData::phiSectorManager
PhiSectorManager * phiSectorManager() const
Definition: VolumeHandleSharedData.cxx:117
VolumeHandle::detachAllContractedChildren
void detachAllContractedChildren()
Definition: VolumeHandle.cxx:439
VolumeHandle::Imp::getChildStates
static VolState getChildStates(const VolumeHandle *theclass)
Definition: VolumeHandle.cxx:591
beamspotnt.labels
list labels
Definition: bin/beamspotnt.py:1447
createCoolChannelIdFile.buffer
buffer
Definition: createCoolChannelIdFile.py:12
VolumeHandle::Imp::applyChildStates
static void applyChildStates(const VolState &, VolumeHandle *theclass)
Definition: VolumeHandle.cxx:608
VolumeHandleSharedData::registerNodeSepForVolumeHandle
void registerNodeSepForVolumeHandle(SoSeparator *, VolumeHandle *)
Definition: VolumeHandleSharedData.cxx:129
lumiFormat.i
int i
Definition: lumiFormat.py:85
z
#define z
VolumeHandle::Imp::labels
int labels
Definition: VolumeHandle.cxx:63
beamspotman.n
n
Definition: beamspotman.py:731
VolumeHandle::Imp::commondata
VolumeHandleSharedData * commondata
Definition: VolumeHandle.cxx:53
VolumeHandle::m_state
VP1GeoFlags::VOLSTATE m_state
Definition: VolumeHandle.h:133
VolumeHandle::m_muonChamberState
MuonChamberState m_muonChamberState
Definition: VolumeHandle.h:129
VP1ExtraSepLayerHelper::largeChangesEnd
void largeChangesEnd()
Definition: VP1ExtraSepLayerHelper.cxx:156
VolumeHandle::Imp::nodesep
SoSeparator * nodesep
Definition: VolumeHandle.cxx:60
VolumeHandle::VolumeHandle
VolumeHandle(VolumeHandleSharedData *, VolumeHandle *parent, const GeoPVConstLink &, int childNumber, const MuonChamberState &mcs=NONMUONCHAMBER, const SbMatrix &accumTrans=SbMatrix())
Definition: VolumeHandle.cxx:97
VP1ExtraSepLayerHelper::largeChangesBegin
void largeChangesBegin()
Definition: VP1ExtraSepLayerHelper.cxx:135
VP1GeoFlags::VOLSTATE
VOLSTATE
Definition: VP1GeoFlags.h:87
VolumeHandle::Imp::label_sep
SoSeparator * label_sep
Definition: VolumeHandle.cxx:62
VolumeHandle::initialiseChildren
void initialiseChildren()
Definition: VolumeHandle.cxx:136
VolumeHandleSharedData::geoPVConstLinkOfTreeTopsMother
GeoPVConstLink geoPVConstLinkOfTreeTopsMother() const
Definition: VolumeHandleSharedData.cxx:213
VolumeHandle::nChildren
unsigned nChildren() const
Definition: VolumeHandle.h:149
VolumeHandle::Imp::pV
GeoPVConstLink pV
Definition: VolumeHandle.cxx:54
VolumeHandle::isEther
bool isEther() const
Definition: VolumeHandle.cxx:512
VolumeHandle
Definition: VolumeHandle.h:21
beamspotman.dir
string dir
Definition: beamspotman.py:623
lumiFormat.array
array
Definition: lumiFormat.py:91
merge.output
output
Definition: merge.py:17
VolumeHandle::haveParentsNotExpanded
bool haveParentsNotExpanded() const
Definition: VolumeHandle.cxx:416
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
VP1LinAlgUtils::transformToMatrix
static void transformToMatrix(SoTransform *xf, SbMatrix &result)
Definition: VP1LinAlgUtils.cxx:101
VolumeHandle::childNumber
int childNumber() const
Definition: VolumeHandle.h:151
VolumeHandle::Imp::attachsepHelper
VP1ExtraSepLayerHelper * attachsepHelper
Definition: VolumeHandle.cxx:57
VolumeHandle::getName
QString getName() const
Definition: VolumeHandle.cxx:169
VolumeHandleSharedData::subSystemFlag
VP1GeoFlags::SubSystemFlag subSystemFlag() const
Definition: VolumeHandleSharedData.cxx:111
VolumeHandleSharedData::removeZappedVolumesFromGui
void removeZappedVolumesFromGui(VolumeHandle *)
Definition: VolumeHandleSharedData.cxx:225
PhiSectorManager::getLabelSepHelperForNode
VP1ExtraSepLayerHelper * getLabelSepHelperForNode(VP1GeoFlags::SubSystemFlag flag, int iphi)
Addition to handle label separators, in exactly the same way as getSepHelperForNode(....
Definition: PhiSectorManager.cxx:118
VP1GeoFlags::ZAPPED
@ ZAPPED
Definition: VP1GeoFlags.h:89
get_generator_info.version
version
Definition: get_generator_info.py:33
VP1Msg::messageDebug
static void messageDebug(const QString &)
Definition: VP1Msg.cxx:39
y
#define y
VolumeHandleSharedData::addZappedVolumeToGui
void addZappedVolumeToGui(VolumeHandle *)
Definition: VolumeHandleSharedData.cxx:219
Amg::EigenTransformToCLHEP
HepGeom::Transform3D EigenTransformToCLHEP(const Amg::Transform3D &eigenTransf)
Converts an Eigen-based Amg::Transform3D into a CLHEP-based HepGeom::Transform3D.
Definition: CLHEPtoEigenConverter.h:120
VolumeHandle::MUONCHAMBERCHILD
@ MUONCHAMBERCHILD
Definition: VolumeHandle.h:25
VolumeHandle::VolumeHandleListItr
VolumeHandleList::iterator VolumeHandleListItr
Definition: VolumeHandle.h:65
VolumeHandle::state
VP1GeoFlags::VOLSTATE state() const
Definition: VolumeHandle.h:152
VolumeHandle::Imp::accumTrans
const SbMatrix accumTrans
Definition: VolumeHandle.cxx:55
VolumeHandle::Imp::attachlabelSepHelper
VP1ExtraSepLayerHelper * attachlabelSepHelper
Definition: VolumeHandle.cxx:58
calibdata.cd
cd
Definition: calibdata.py:51
VolumeHandle::m_childNumber
const int m_childNumber
Definition: VolumeHandle.h:127
makeTransCanvas.text
text
Definition: makeTransCanvas.py:11
GeoSysController::labels
int labels() const
Definition: GeoSysController.cxx:520
VolumeHandle::Imp::labelsPosOffsets
QList< int > labelsPosOffsets
Definition: VolumeHandle.cxx:64
str
Definition: BTagTrackIpAccessor.cxx:11
VolumeHandleSharedData::controller
GeoSysController * controller() const
Definition: VolumeHandleSharedData.cxx:123
VolumeHandle::MUONCHAMBER
@ MUONCHAMBER
Definition: VolumeHandle.h:26
VolumeHandleSharedData::toShapeNode
SoNode * toShapeNode(const GeoPVConstLink &pV)
Definition: VolumeHandleSharedData.cxx:163
VolumeHandle::NONMUONCHAMBER
@ NONMUONCHAMBER
Definition: VolumeHandle.h:24
GeoSysController::labelPosOffset
QList< int > labelPosOffset()
Offset in x,y,z.
Definition: GeoSysController.cxx:531
VisAttributes::get
SoMaterial * get(const std::string &name) const
Definition: VisAttributes.cxx:113
VolumeHandleSharedData::getSoCylinderOrientedLikeGeoTube
SoNode * getSoCylinderOrientedLikeGeoTube(const double &radius, const double &halfLength)
Definition: VolumeHandleSharedData.cxx:191
VP1LinAlgUtils::toSoTransform
static SoTransform * toSoTransform(const HepGeom::Transform3D &, SoTransform *t=0)
Definition: VP1LinAlgUtils.cxx:40
VolumeHandle::m_nchildren
const unsigned m_nchildren
Definition: VolumeHandle.h:128
VolumeHandle::getGlobalTransformToVolume
const SbMatrix & getGlobalTransformToVolume() const
Definition: VolumeHandle.cxx:489
VolumeHandle::getDescriptiveName
virtual QString getDescriptiveName() const
Definition: VolumeHandle.h:162
VolumeHandleSharedData::matVisAttributes
MatVisAttributes * matVisAttributes() const
Definition: VolumeHandleSharedData.cxx:93
VP1GeoFlags::CONTRACTED
@ CONTRACTED
Definition: VP1GeoFlags.h:87
VolumeHandle::contractDaughtersRecursively
void contractDaughtersRecursively()
Definition: VolumeHandle.cxx:403