ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
graphics
VP1
VP1Systems
VP1GeometrySystems
VP1GeometrySystems
VolumeHandle.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#ifndef VOLUMEHANDLE_H
6
#define VOLUMEHANDLE_H
7
8
#include <vector>
9
10
#include "
VP1GeometrySystems/VP1GeoFlags.h
"
11
#include <QString>
12
13
//Only initialises child classes on demand. And even then their SoNodes are not initialised until they must be shown.
14
class
VolumeHandleSharedData
;
15
class
SoMaterial;
16
class
SoSeparator;
17
class
GeoMaterial;
18
#include <Inventor/C/errors/debugerror.h>
19
#include <Inventor/SbMatrix.h>
20
21
class
VolumeHandle
{
22
public
:
23
24
enum
MuonChamberState
{
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
28
inline
bool
isInMuonChamber
()
const
;
//Muon chamber volume or muon chamber offspring
29
inline
bool
isMuonChamber
()
const
;
//Muon chamber volume (top-level volume)
30
inline
void
setMuonChamberDirty
(
bool
);
//Don't call unless isMuonChamber()
31
inline
bool
muonChamberDirty
()
const
;
//if is a muon chamber volume which is dirty
32
inline
MuonChamberState
muonChamberState
()
const
;
33
34
VolumeHandle
(
VolumeHandleSharedData
* ,
VolumeHandle
*
parent
,
const
GeoPVConstLink&,
int
childNumber
,
35
const
MuonChamberState
& mcs =
NONMUONCHAMBER
,
const
SbMatrix& accumTrans = SbMatrix() );
36
37
virtual
~VolumeHandle
();
//lots of stuff to do here!
38
//Used (recursively) upon deletion (never delete before children are deleted).
39
void
initialiseChildren
();
40
inline
bool
childrenAreInitialised
()
const
;
//Always check this before getting the child list iterators
41
unsigned
nChildren
()
const
;
//Works even before children are initialised
42
43
SoMaterial *
material
();
44
45
//Information for printout:
46
QString
getName
()
const
;
47
int
copyNumber
()
const
;
//Returns -1 if doesnt have a valid copy number (because volume is not replicated), -2 in case of error.
48
quint32
hashID
()
const
;
//For vp1 persistification
49
50
GeoPVConstLink
geoPVConstLink
()
const
;
51
const
GeoMaterial *
geoMaterial
()
const
;
52
std::string
getNameStdString
()
const
;
53
54
bool
hasName
(
const
std::string&)
const
;
55
56
const
SbMatrix&
getGlobalTransformToVolume
()
const
;
//Transform from world to this volume.
57
SbMatrix
getLocalTransformToVolume
()
const
;
//Transform from mother (=world for treetops) to this volume.
58
59
bool
isPositiveZ
()
const
;
//Uses getGlobalTransformToVolume to figure out whether Z of the transformation.
60
62
// Navigation: //
64
typedef
std::vector<VolumeHandle *>
VolumeHandleList
;
65
typedef
VolumeHandleList::iterator
VolumeHandleListItr
;
66
typedef
VolumeHandleList::const_iterator
VolumeHandleListConstItr
;
67
68
inline
VolumeHandle
*
parent
();
//returns 0 if toplevel.
69
inline
VolumeHandle
*
topLevelParent
();
//goes up through parents and returns the toplevel one (returns itself if toplevel).
70
inline
VolumeHandleListItr
childrenBegin
();
//Dont use if not childrenAreInitialised().
71
inline
VolumeHandleListItr
childrenEnd
();
//Dont use if not childrenAreInitialised()
72
inline
VolumeHandle
*
child
(
int
index
)
const
;
//Will crash if out of range!
73
inline
int
childNumber
()
const
;
74
75
// void zoomToVolume(SoCamera*, SoSeparator * root);
76
// void ensureVisibleInTreeWidget();
77
78
inline
VP1GeoFlags::VOLSTATE
state
()
const
;
79
void
setState
(
const
VP1GeoFlags::VOLSTATE
&
state
);
80
void
reset
();
//Set state of volume and all daughters to contracted
81
bool
isAttached
()
const
;
82
void
contractDaughtersRecursively
();
83
84
bool
isEther
()
const
;
85
void
expandMothersRecursivelyToNonEther
();
//expands the tree down to volumes that are either not ether or without children
86
87
bool
isInitialisedAndHasNonStandardShape
()
const
;
//True if the 3D shape of this volume can not be represented by standard VRML nodes.
88
89
SoSeparator *
nodeSoSeparator
()
const
;
//Returns pointer to 3D representation of volume (null if not built yet).
90
void
ensureBuildNodeSep
();
91
92
//Convenience:
93
// void zap();
94
// void ensureVisible();
95
// void expandAllChildren(unsigned limit = 50);
96
97
// void ensureVisibleInTreeWidget();
98
// double mass() const;
99
// int copyNumber() const;
100
// ...
101
// Get SoNodes, pvconstlink, ...
102
103
void
updateLabels
();
104
105
QByteArray
getPersistifiableState
()
const
;
106
void
applyPersistifiableState
(QByteArray);
107
108
// Which subsystem I'm in?
109
VP1GeoFlags::SubSystemFlag
subsystem
()
const
;
110
111
// For labels
112
virtual
QString
getDescriptiveName
()
const
;
113
virtual
QString
muonChamberT0
(
unsigned
int
=0)
const
;
114
115
public
:
116
class
Imp
;
//For once this is declared public. This is to avoid
117
//problems with datastream operators.
118
private
:
119
120
// Illegal to copy/assign a VolumeHandle:
121
VolumeHandle
(
const
VolumeHandle
& );
122
VolumeHandle
&
operator=
(
const
VolumeHandle
& );
123
124
Imp
*
m_d
;
125
126
//Here for inline methods:
127
const
int
m_childNumber
;
//0 if the first child of parent, 1 if the second, etc.
128
const
unsigned
m_nchildren
;
//cached for efficiency.
129
MuonChamberState
m_muonChamberState
;
130
131
VolumeHandle
*
m_parent
;
132
VolumeHandleList
m_children
;
133
VP1GeoFlags::VOLSTATE
m_state
;
134
//Some of these could be moved to private implementation with some care:
135
bool
haveParentsNotExpanded
()
const
;
136
void
attachAllContractedChildren
();
//also checks children of expanded children (recursively).
137
void
detachAllContractedChildren
();
//also checks children of expanded children (recursively).
138
};
139
141
// INLINES //
143
144
inline
VolumeHandle
*
VolumeHandle::parent
() {
return
m_parent
; }
145
inline
VolumeHandle
*
VolumeHandle::topLevelParent
() {
return
m_parent
?
m_parent
->topLevelParent() :
this
; }
146
inline
bool
VolumeHandle::childrenAreInitialised
()
const
{
return
m_children
.size()==
m_nchildren
; }
147
inline
VolumeHandle::VolumeHandleListItr
VolumeHandle::childrenBegin
() {
return
m_children
.begin(); }
148
inline
VolumeHandle::VolumeHandleListItr
VolumeHandle::childrenEnd
() {
return
m_children
.end(); }
149
inline
unsigned
VolumeHandle::nChildren
()
const
{
return
m_nchildren
; }
150
inline
VolumeHandle
*
VolumeHandle::child
(
int
index
)
const
{
return
m_children
.at(
index
); }
151
inline
int
VolumeHandle::childNumber
()
const
{
return
m_childNumber
; }
152
inline
VP1GeoFlags::VOLSTATE
VolumeHandle::state
()
const
{
return
m_state
; }
153
inline
bool
VolumeHandle::isInMuonChamber
()
const
{
return
m_muonChamberState
!=
NONMUONCHAMBER
; }
154
inline
bool
VolumeHandle::isMuonChamber
()
const
{
return
m_muonChamberState
==
MUONCHAMBER
||
m_muonChamberState
==
MUONCHAMBER_DIRTY
; }
155
inline
VolumeHandle::MuonChamberState
VolumeHandle::muonChamberState
()
const
{
return
m_muonChamberState
; }
156
inline
void
VolumeHandle::setMuonChamberDirty
(
bool
b) {
if
(
isMuonChamber
())
m_muonChamberState
= b?
MUONCHAMBER_DIRTY
:
MUONCHAMBER
; }
157
inline
bool
VolumeHandle::muonChamberDirty
()
const
{
return
m_muonChamberState
==
MUONCHAMBER_DIRTY
; }
158
inline
void
VolumeHandle::reset
() {
159
setState
(
VP1GeoFlags::CONTRACTED
);
160
contractDaughtersRecursively
();
161
}
162
inline
QString
VolumeHandle::getDescriptiveName
()
const
{
163
QString name =
getName
();
164
name.remove(
"_Station"
);
165
return
name;
166
}
167
168
inline
QString
VolumeHandle::muonChamberT0
(
unsigned
int
)
const
{
169
return
QString();
170
}
171
172
173
#endif
VP1GeoFlags.h
VP1GeoFlags::SubSystemFlag
SubSystemFlag
Definition
VP1GeoFlags.h:30
VP1GeoFlags::VOLSTATE
VOLSTATE
Definition
VP1GeoFlags.h:87
VP1GeoFlags::CONTRACTED
@ CONTRACTED
Definition
VP1GeoFlags.h:87
VolumeHandleSharedData
Definition
VolumeHandleSharedData.h:25
VolumeHandle::Imp
Definition
VolumeHandle.cxx:48
VolumeHandle
Definition
VolumeHandle.h:21
VolumeHandle::setState
void setState(const VP1GeoFlags::VOLSTATE &state)
Definition
VolumeHandle.cxx:350
VolumeHandle::hasName
bool hasName(const std::string &) const
Definition
VolumeHandle.cxx:181
VolumeHandle::VolumeHandle
VolumeHandle(VolumeHandleSharedData *, VolumeHandle *parent, const GeoPVConstLink &, int childNumber, const MuonChamberState &mcs=NONMUONCHAMBER, const SbMatrix &accumTrans=SbMatrix())
Definition
VolumeHandle.cxx:97
VolumeHandle::isMuonChamber
bool isMuonChamber() const
Definition
VolumeHandle.h:154
VolumeHandle::childrenAreInitialised
bool childrenAreInitialised() const
Definition
VolumeHandle.h:146
VolumeHandle::~VolumeHandle
virtual ~VolumeHandle()
Definition
VolumeHandle.cxx:113
VolumeHandle::VolumeHandleListConstItr
VolumeHandleList::const_iterator VolumeHandleListConstItr
Definition
VolumeHandle.h:66
VolumeHandle::isPositiveZ
bool isPositiveZ() const
Definition
VolumeHandle.cxx:663
VolumeHandle::getGlobalTransformToVolume
const SbMatrix & getGlobalTransformToVolume() const
Definition
VolumeHandle.cxx:489
VolumeHandle::getNameStdString
std::string getNameStdString() const
Definition
VolumeHandle.cxx:175
VolumeHandle::attachAllContractedChildren
void attachAllContractedChildren()
Definition
VolumeHandle.cxx:422
VolumeHandle::state
VP1GeoFlags::VOLSTATE state() const
Definition
VolumeHandle.h:152
VolumeHandle::reset
void reset()
Definition
VolumeHandle.h:158
VolumeHandle::geoMaterial
const GeoMaterial * geoMaterial() const
Definition
VolumeHandle.cxx:507
VolumeHandle::operator=
VolumeHandle & operator=(const VolumeHandle &)
VolumeHandle::initialiseChildren
void initialiseChildren()
Definition
VolumeHandle.cxx:136
VolumeHandle::getName
QString getName() const
Definition
VolumeHandle.cxx:169
VolumeHandle::MuonChamberState
MuonChamberState
Definition
VolumeHandle.h:24
VolumeHandle::MUONCHAMBER_DIRTY
@ MUONCHAMBER_DIRTY
Definition
VolumeHandle.h:27
VolumeHandle::MUONCHAMBER
@ MUONCHAMBER
Definition
VolumeHandle.h:26
VolumeHandle::MUONCHAMBERCHILD
@ MUONCHAMBERCHILD
Definition
VolumeHandle.h:25
VolumeHandle::NONMUONCHAMBER
@ NONMUONCHAMBER
Definition
VolumeHandle.h:24
VolumeHandle::ensureBuildNodeSep
void ensureBuildNodeSep()
Definition
VolumeHandle.cxx:238
VolumeHandle::childrenBegin
VolumeHandleListItr childrenBegin()
Definition
VolumeHandle.h:147
VolumeHandle::m_muonChamberState
MuonChamberState m_muonChamberState
Definition
VolumeHandle.h:129
VolumeHandle::applyPersistifiableState
void applyPersistifiableState(QByteArray)
Definition
VolumeHandle.cxx:556
VolumeHandle::getLocalTransformToVolume
SbMatrix getLocalTransformToVolume() const
Definition
VolumeHandle.cxx:494
VolumeHandle::material
SoMaterial * material()
Definition
VolumeHandle.cxx:187
VolumeHandle::muonChamberT0
virtual QString muonChamberT0(unsigned int=0) const
Definition
VolumeHandle.h:168
VolumeHandle::childrenEnd
VolumeHandleListItr childrenEnd()
Definition
VolumeHandle.h:148
VolumeHandle::topLevelParent
VolumeHandle * topLevelParent()
Definition
VolumeHandle.h:145
VolumeHandle::isEther
bool isEther() const
Definition
VolumeHandle.cxx:512
VolumeHandle::VolumeHandle
VolumeHandle(const VolumeHandle &)
VolumeHandle::contractDaughtersRecursively
void contractDaughtersRecursively()
Definition
VolumeHandle.cxx:403
VolumeHandle::m_state
VP1GeoFlags::VOLSTATE m_state
Definition
VolumeHandle.h:133
VolumeHandle::isAttached
bool isAttached() const
Definition
VolumeHandle.cxx:501
VolumeHandle::nodeSoSeparator
SoSeparator * nodeSoSeparator() const
Definition
VolumeHandle.cxx:232
VolumeHandle::VolumeHandleList
std::vector< VolumeHandle * > VolumeHandleList
Definition
VolumeHandle.h:64
VolumeHandle::muonChamberDirty
bool muonChamberDirty() const
Definition
VolumeHandle.h:157
VolumeHandle::geoPVConstLink
GeoPVConstLink geoPVConstLink() const
Definition
VolumeHandle.cxx:163
VolumeHandle::m_d
Imp * m_d
Definition
VolumeHandle.h:124
VolumeHandle::haveParentsNotExpanded
bool haveParentsNotExpanded() const
Definition
VolumeHandle.cxx:416
VolumeHandle::isInitialisedAndHasNonStandardShape
bool isInitialisedAndHasNonStandardShape() const
Definition
VolumeHandle.cxx:656
VolumeHandle::copyNumber
int copyNumber() const
Definition
VolumeHandle.cxx:455
VolumeHandle::detachAllContractedChildren
void detachAllContractedChildren()
Definition
VolumeHandle.cxx:439
VolumeHandle::isInMuonChamber
bool isInMuonChamber() const
Definition
VolumeHandle.h:153
VolumeHandle::muonChamberState
MuonChamberState muonChamberState() const
Definition
VolumeHandle.h:155
VolumeHandle::m_parent
VolumeHandle * m_parent
Definition
VolumeHandle.h:131
VolumeHandle::setMuonChamberDirty
void setMuonChamberDirty(bool)
Definition
VolumeHandle.h:156
VolumeHandle::getDescriptiveName
virtual QString getDescriptiveName() const
Definition
VolumeHandle.h:162
VolumeHandle::m_children
VolumeHandleList m_children
Definition
VolumeHandle.h:132
VolumeHandle::expandMothersRecursivelyToNonEther
void expandMothersRecursivelyToNonEther()
Definition
VolumeHandle.cxx:518
VolumeHandle::updateLabels
void updateLabels()
Definition
VolumeHandle.cxx:672
VolumeHandle::VolumeHandleListItr
VolumeHandleList::iterator VolumeHandleListItr
Definition
VolumeHandle.h:65
VolumeHandle::m_nchildren
const unsigned m_nchildren
Definition
VolumeHandle.h:128
VolumeHandle::m_childNumber
const int m_childNumber
Definition
VolumeHandle.h:127
VolumeHandle::subsystem
VP1GeoFlags::SubSystemFlag subsystem() const
Definition
VolumeHandle.cxx:585
VolumeHandle::hashID
quint32 hashID() const
Definition
VolumeHandle.cxx:482
VolumeHandle::parent
VolumeHandle * parent()
Definition
VolumeHandle.h:144
VolumeHandle::childNumber
int childNumber() const
Definition
VolumeHandle.h:151
VolumeHandle::getPersistifiableState
QByteArray getPersistifiableState() const
Definition
VolumeHandle.cxx:539
VolumeHandle::child
VolumeHandle * child(int index) const
Definition
VolumeHandle.h:150
VolumeHandle::nChildren
unsigned nChildren() const
Definition
VolumeHandle.h:149
index
Definition
index.py:1
Generated on
for ATLAS Offline Software by
1.17.0