ATLAS Offline Software
Loading...
Searching...
No Matches
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();
108 m_d->attach(this);
109 }
110}
MuonChamberState m_muonChamberState
VP1GeoFlags::VOLSTATE m_state
bool haveParentsNotExpanded() const
VolumeHandle * m_parent
const unsigned m_nchildren
const int m_childNumber
VolumeHandle * parent()
int childNumber() const

◆ ~VolumeHandle()

VolumeHandle::~VolumeHandle ( )
virtual

Definition at line 113 of file VolumeHandle.cxx.

114{
115 if (m_d->commondata) {
117 m_d->commondata->removeZappedVolumesFromGui(this);
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}
void setState(const VP1GeoFlags::VOLSTATE &state)
bool childrenAreInitialised() const
VolumeHandleList m_children
VolumeHandleList::iterator VolumeHandleListItr

◆ 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}
VP1GeoFlags::VOLSTATE state() const

◆ attachAllContractedChildren()

void VolumeHandle::attachAllContractedChildren ( )
private

Definition at line 422 of file VolumeHandle.cxx.

422 {
423
424 if (!m_nchildren)
425 return;
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}
void initialiseChildren()

◆ 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{
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 {
461 parent_pV = m_d->commondata->geoPVConstLinkOfTreeTopsMother();
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 std::optional<int> Qint = av.getId();
473 return Qint ? *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;
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:
253 m_d->nodesep->addChild(VP1LinAlgUtils::toSoTransform(m_d->accumTrans));
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);
295 m_d->attachsepHelper = m_d->commondata->phiSectorManager()->getSepHelperForNode(m_d->commondata->subSystemFlag(), iphi);
296 m_d->attachlabelSepHelper = m_d->commondata->phiSectorManager()->getLabelSepHelperForNode(m_d->commondata->subSystemFlag(), iphi);
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);
304 m_d->attachsepHelper = m_d->commondata->phiSectorManager()->registerVolumeAroundZAxis( m_d->commondata->subSystemFlag(), sw, m_d->accumTrans );
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)
311 m_d->commondata->registerNodeSepForVolumeHandle(m_d->nodesep,this);
312
313 //VP1Msg::messageDebug("VolumeHandle::ensureBuildNodeSep() - DONE.");
314}
#define M_PI
static SoTransform * toSoTransform(const HepGeom::Transform3D &, SoTransform *t=0)
static void messageDebug(const QString &)
Definition VP1Msg.cxx:39
HepGeom::Transform3D EigenTransformToCLHEP(const Amg::Transform3D &eigenTransf)
Converts an Eigen-based Amg::Transform3D into a CLHEP-based HepGeom::Transform3D.

◆ 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}
bool isEther() const
unsigned nChildren() const

◆ geoMaterial()

const GeoMaterial * VolumeHandle::geoMaterial ( ) const

Definition at line 507 of file VolumeHandle.cxx.

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

◆ 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}
QString getName() const

◆ 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}
static VolState getChildStates(const VolumeHandle *theclass)

◆ 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}
static void transformToMatrix(SoTransform *xf, SbMatrix &result)
VolumeHandle(VolumeHandleSharedData *, VolumeHandle *parent, const GeoPVConstLink &, int childNumber, const MuonChamberState &mcs=NONMUONCHAMBER, const SbMatrix &accumTrans=SbMatrix())
bool isInMuonChamber() const

◆ 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}
bool isMuonChamber() const
const GeoMaterial * geoMaterial() const

◆ isInitialisedAndHasNonStandardShape()

bool VolumeHandle::isInitialisedAndHasNonStandardShape ( ) const

Definition at line 656 of file VolumeHandle.cxx.

657{
659 return m_d->nodesep ? Imp::hasNonStandardShapeChildren(m_d->nodesep) : false;
660}
static void initAllCustomClasses()
static bool hasNonStandardShapeChildren(const SoGroup *g)

◆ 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}
#define y
#define x
#define z

◆ 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
211 mat = m_d->commondata->fallBackTopLevelMaterial();
212 if (mat) {
213 m_d->material = mat;
214 m_d->material->ref();
215 return m_d->material;
216 }
217
218 if (m_parent) {
219 m_d->material = m_parent->material();
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

◆ 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:
364 m_state = state;
365 if (oldstate==VP1GeoFlags::ZAPPED)
366 m_d->commondata->removeZappedVolumesFromGui(this);
367 else if (state==VP1GeoFlags::ZAPPED)
368 m_d->commondata->addZappedVolumeToGui(this);
369
370 //Only thing left is visibility updates (i.e. attachment to 3D scenegraph).
371
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}
void attachAllContractedChildren()
VolumeHandle * topLevelParent()
void detachAllContractedChildren()

◆ 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
676 m_d->attachlabelSepHelper->largeChangesBegin();
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
733 m_d->attachlabelSepHelper->largeChangesEnd();
734}
virtual QString muonChamberT0(unsigned int=0) const
virtual QString getDescriptiveName() const
row
Appending html table to final .html summary file.
output
Definition merge.py:16

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: