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
QString
getNameTag
()
const
;
48
QString
getDisplayName
()
const
;
49
int
copyNumber
()
const
;
//Returns -1 if doesnt have a valid copy number (because volume is not replicated), -2 in case of error.
50
quint32
hashID
()
const
;
//For vp1 persistification
51
52
GeoPVConstLink
geoPVConstLink
()
const
;
53
const
GeoMaterial *
geoMaterial
()
const
;
54
std::string
getNameStdString
()
const
;
55
56
bool
hasName
(
const
std::string&)
const
;
57
58
const
SbMatrix&
getGlobalTransformToVolume
()
const
;
//Transform from world to this volume.
59
SbMatrix
getLocalTransformToVolume
()
const
;
//Transform from mother (=world for treetops) to this volume.
60
61
bool
isPositiveZ
()
const
;
//Uses getGlobalTransformToVolume to figure out whether Z of the transformation.
62
64
// Navigation: //
66
typedef
std::vector<VolumeHandle *>
VolumeHandleList
;
67
typedef
VolumeHandleList::iterator
VolumeHandleListItr
;
68
typedef
VolumeHandleList::const_iterator
VolumeHandleListConstItr
;
69
70
inline
VolumeHandle
*
parent
();
//returns 0 if toplevel.
71
inline
VolumeHandle
*
topLevelParent
();
//goes up through parents and returns the toplevel one (returns itself if toplevel).
72
inline
VolumeHandleListItr
childrenBegin
();
//Dont use if not childrenAreInitialised().
73
inline
VolumeHandleListItr
childrenEnd
();
//Dont use if not childrenAreInitialised()
74
inline
VolumeHandle
*
child
(
int
index
)
const
;
//Will crash if out of range!
75
inline
int
childNumber
()
const
;
76
77
// void zoomToVolume(SoCamera*, SoSeparator * root);
78
// void ensureVisibleInTreeWidget();
79
80
inline
VP1GeoFlags::VOLSTATE
state
()
const
;
81
// Selection filters disable ether propagation to preserve explicit child states.
82
void
setState
(
const
VP1GeoFlags::VOLSTATE
&
state
,
bool
autoExpandEther =
true
);
83
void
reset
();
//Set state of volume and all daughters to contracted
84
bool
isAttached
()
const
;
85
void
contractDaughtersRecursively
();
86
87
bool
isEther
()
const
;
88
void
expandMothersRecursivelyToNonEther
();
//expands the tree down to volumes that are either not ether or without children
89
90
bool
isInitialisedAndHasNonStandardShape
()
const
;
//True if the 3D shape of this volume can not be represented by standard VRML nodes.
91
92
SoSeparator *
nodeSoSeparator
()
const
;
//Returns pointer to 3D representation of volume (null if not built yet).
93
void
ensureBuildNodeSep
();
94
95
//Convenience:
96
// void zap();
97
// void ensureVisible();
98
// void expandAllChildren(unsigned limit = 50);
99
100
// void ensureVisibleInTreeWidget();
101
// double mass() const;
102
// int copyNumber() const;
103
// ...
104
// Get SoNodes, pvconstlink, ...
105
106
void
updateLabels
();
107
108
QByteArray
getPersistifiableState
()
const
;
109
void
applyPersistifiableState
(QByteArray);
110
111
// Which subsystem I'm in?
112
VP1GeoFlags::SubSystemFlag
subsystem
()
const
;
113
114
// For labels
115
virtual
QString
getDescriptiveName
()
const
;
116
virtual
QString
muonChamberT0
(
unsigned
int
=0)
const
;
117
118
public
:
119
class
Imp
;
//For once this is declared public. This is to avoid
120
//problems with datastream operators.
121
private
:
122
123
// Illegal to copy/assign a VolumeHandle:
124
VolumeHandle
(
const
VolumeHandle
& );
125
VolumeHandle
&
operator=
(
const
VolumeHandle
& );
126
127
Imp
*
m_d
;
128
129
//Here for inline methods:
130
const
int
m_childNumber
;
//0 if the first child of parent, 1 if the second, etc.
131
const
unsigned
m_nchildren
;
//cached for efficiency.
132
MuonChamberState
m_muonChamberState
;
133
134
VolumeHandle
*
m_parent
;
135
VolumeHandleList
m_children
;
136
VP1GeoFlags::VOLSTATE
m_state
;
137
//Some of these could be moved to private implementation with some care:
138
bool
haveParentsNotExpanded
()
const
;
139
void
attachAllContractedChildren
();
//also checks children of expanded children (recursively).
140
void
detachAllContractedChildren
();
//also checks children of expanded children (recursively).
141
};
142
144
// INLINES //
146
147
inline
VolumeHandle
*
VolumeHandle::parent
() {
return
m_parent
; }
148
inline
VolumeHandle
*
VolumeHandle::topLevelParent
() {
return
m_parent
?
m_parent
->topLevelParent() :
this
; }
149
inline
bool
VolumeHandle::childrenAreInitialised
()
const
{
return
m_children
.size()==
m_nchildren
; }
150
inline
VolumeHandle::VolumeHandleListItr
VolumeHandle::childrenBegin
() {
return
m_children
.begin(); }
151
inline
VolumeHandle::VolumeHandleListItr
VolumeHandle::childrenEnd
() {
return
m_children
.end(); }
152
inline
unsigned
VolumeHandle::nChildren
()
const
{
return
m_nchildren
; }
153
inline
VolumeHandle
*
VolumeHandle::child
(
int
index
)
const
{
return
m_children
.at(
index
); }
154
inline
int
VolumeHandle::childNumber
()
const
{
return
m_childNumber
; }
155
inline
VP1GeoFlags::VOLSTATE
VolumeHandle::state
()
const
{
return
m_state
; }
156
inline
bool
VolumeHandle::isInMuonChamber
()
const
{
return
m_muonChamberState
!=
NONMUONCHAMBER
; }
157
inline
bool
VolumeHandle::isMuonChamber
()
const
{
return
m_muonChamberState
==
MUONCHAMBER
||
m_muonChamberState
==
MUONCHAMBER_DIRTY
; }
158
inline
VolumeHandle::MuonChamberState
VolumeHandle::muonChamberState
()
const
{
return
m_muonChamberState
; }
159
inline
void
VolumeHandle::setMuonChamberDirty
(
bool
b) {
if
(
isMuonChamber
())
m_muonChamberState
= b?
MUONCHAMBER_DIRTY
:
MUONCHAMBER
; }
160
inline
bool
VolumeHandle::muonChamberDirty
()
const
{
return
m_muonChamberState
==
MUONCHAMBER_DIRTY
; }
161
inline
void
VolumeHandle::reset
() {
162
setState
(
VP1GeoFlags::CONTRACTED
);
163
contractDaughtersRecursively
();
164
}
165
inline
QString
VolumeHandle::getDescriptiveName
()
const
{
166
QString name =
getName
();
167
name.remove(
"_Station"
);
168
return
name;
169
}
170
171
inline
QString
VolumeHandle::muonChamberT0
(
unsigned
int
)
const
{
172
return
QString();
173
}
174
175
176
#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:27
VolumeHandle::Imp
Definition
VolumeHandle.cxx:47
VolumeHandle
Definition
VolumeHandle.h:21
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:96
VolumeHandle::isMuonChamber
bool isMuonChamber() const
Definition
VolumeHandle.h:157
VolumeHandle::childrenAreInitialised
bool childrenAreInitialised() const
Definition
VolumeHandle.h:149
VolumeHandle::~VolumeHandle
virtual ~VolumeHandle()
Definition
VolumeHandle.cxx:112
VolumeHandle::VolumeHandleListConstItr
VolumeHandleList::const_iterator VolumeHandleListConstItr
Definition
VolumeHandle.h:68
VolumeHandle::isPositiveZ
bool isPositiveZ() const
Definition
VolumeHandle.cxx:757
VolumeHandle::getGlobalTransformToVolume
const SbMatrix & getGlobalTransformToVolume() const
Definition
VolumeHandle.cxx:572
VolumeHandle::getNameStdString
std::string getNameStdString() const
Definition
VolumeHandle.cxx:175
VolumeHandle::attachAllContractedChildren
void attachAllContractedChildren()
Definition
VolumeHandle.cxx:505
VolumeHandle::state
VP1GeoFlags::VOLSTATE state() const
Definition
VolumeHandle.h:155
VolumeHandle::reset
void reset()
Definition
VolumeHandle.h:161
VolumeHandle::getDisplayName
QString getDisplayName() const
Definition
VolumeHandle.cxx:214
VolumeHandle::geoMaterial
const GeoMaterial * geoMaterial() const
Definition
VolumeHandle.cxx:590
VolumeHandle::operator=
VolumeHandle & operator=(const VolumeHandle &)
VolumeHandle::initialiseChildren
void initialiseChildren()
Definition
VolumeHandle.cxx:135
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:278
VolumeHandle::childrenBegin
VolumeHandleListItr childrenBegin()
Definition
VolumeHandle.h:150
VolumeHandle::m_muonChamberState
MuonChamberState m_muonChamberState
Definition
VolumeHandle.h:132
VolumeHandle::applyPersistifiableState
void applyPersistifiableState(QByteArray)
Definition
VolumeHandle.cxx:650
VolumeHandle::getLocalTransformToVolume
SbMatrix getLocalTransformToVolume() const
Definition
VolumeHandle.cxx:577
VolumeHandle::material
SoMaterial * material()
Definition
VolumeHandle.cxx:227
VolumeHandle::muonChamberT0
virtual QString muonChamberT0(unsigned int=0) const
Definition
VolumeHandle.h:171
VolumeHandle::childrenEnd
VolumeHandleListItr childrenEnd()
Definition
VolumeHandle.h:151
VolumeHandle::topLevelParent
VolumeHandle * topLevelParent()
Definition
VolumeHandle.h:148
VolumeHandle::isEther
bool isEther() const
Definition
VolumeHandle.cxx:595
VolumeHandle::VolumeHandle
VolumeHandle(const VolumeHandle &)
VolumeHandle::contractDaughtersRecursively
void contractDaughtersRecursively()
Definition
VolumeHandle.cxx:486
VolumeHandle::m_state
VP1GeoFlags::VOLSTATE m_state
Definition
VolumeHandle.h:136
VolumeHandle::isAttached
bool isAttached() const
Definition
VolumeHandle.cxx:584
VolumeHandle::nodeSoSeparator
SoSeparator * nodeSoSeparator() const
Definition
VolumeHandle.cxx:272
VolumeHandle::VolumeHandleList
std::vector< VolumeHandle * > VolumeHandleList
Definition
VolumeHandle.h:66
VolumeHandle::muonChamberDirty
bool muonChamberDirty() const
Definition
VolumeHandle.h:160
VolumeHandle::geoPVConstLink
GeoPVConstLink geoPVConstLink() const
Definition
VolumeHandle.cxx:163
VolumeHandle::m_d
Imp * m_d
Definition
VolumeHandle.h:127
VolumeHandle::haveParentsNotExpanded
bool haveParentsNotExpanded() const
Definition
VolumeHandle.cxx:499
VolumeHandle::isInitialisedAndHasNonStandardShape
bool isInitialisedAndHasNonStandardShape() const
Definition
VolumeHandle.cxx:750
VolumeHandle::copyNumber
int copyNumber() const
Definition
VolumeHandle.cxx:538
VolumeHandle::detachAllContractedChildren
void detachAllContractedChildren()
Definition
VolumeHandle.cxx:522
VolumeHandle::isInMuonChamber
bool isInMuonChamber() const
Definition
VolumeHandle.h:156
VolumeHandle::muonChamberState
MuonChamberState muonChamberState() const
Definition
VolumeHandle.h:158
VolumeHandle::m_parent
VolumeHandle * m_parent
Definition
VolumeHandle.h:134
VolumeHandle::setMuonChamberDirty
void setMuonChamberDirty(bool)
Definition
VolumeHandle.h:159
VolumeHandle::getDescriptiveName
virtual QString getDescriptiveName() const
Definition
VolumeHandle.h:165
VolumeHandle::m_children
VolumeHandleList m_children
Definition
VolumeHandle.h:135
VolumeHandle::expandMothersRecursivelyToNonEther
void expandMothersRecursivelyToNonEther()
Definition
VolumeHandle.cxx:612
VolumeHandle::updateLabels
void updateLabels()
Definition
VolumeHandle.cxx:766
VolumeHandle::setState
void setState(const VP1GeoFlags::VOLSTATE &state, bool autoExpandEther=true)
Definition
VolumeHandle.cxx:391
VolumeHandle::VolumeHandleListItr
VolumeHandleList::iterator VolumeHandleListItr
Definition
VolumeHandle.h:67
VolumeHandle::m_nchildren
const unsigned m_nchildren
Definition
VolumeHandle.h:131
VolumeHandle::m_childNumber
const int m_childNumber
Definition
VolumeHandle.h:130
VolumeHandle::subsystem
VP1GeoFlags::SubSystemFlag subsystem() const
Definition
VolumeHandle.cxx:679
VolumeHandle::hashID
quint32 hashID() const
Definition
VolumeHandle.cxx:565
VolumeHandle::parent
VolumeHandle * parent()
Definition
VolumeHandle.h:147
VolumeHandle::childNumber
int childNumber() const
Definition
VolumeHandle.h:154
VolumeHandle::getNameTag
QString getNameTag() const
Definition
VolumeHandle.cxx:188
VolumeHandle::getPersistifiableState
QByteArray getPersistifiableState() const
Definition
VolumeHandle.cxx:633
VolumeHandle::child
VolumeHandle * child(int index) const
Definition
VolumeHandle.h:153
VolumeHandle::nChildren
unsigned nChildren() const
Definition
VolumeHandle.h:152
index
Definition
index.py:1
Generated on
for ATLAS Offline Software by
1.17.0