Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TGeoAtt.cxx
Go to the documentation of this file.
1 // @(#)root/geom:$Id$
2 // Author: Andrei Gheata 01/11/01
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 /** \class TGeoAtt
13 \ingroup Geometry_classes
14 
15 Visualization and tracking attributes for volumes and nodes.
16 
17 The TGeoAtt class is an utility for volume/node visibility and tracking
18 activity. By default the attributes are set to visible/active
19 */
20 
21 #include "TGeoAtt.h"
22 
23 #include "TGeoManager.h"
24 #include "Rtypes.h"
25 
26 ClassImp(TGeoAtt);
27 
28 ////////////////////////////////////////////////////////////////////////////////
29 /// Default constructor
30 
31 TGeoAtt::TGeoAtt()
32 {
33  fGeoAtt = 0;
34  if (!gGeoManager) return;
35  SetActivity(kTRUE);
36  SetActiveDaughters(kTRUE);
37  SetVisibility(kTRUE);
38  SetVisDaughters(kTRUE);
39  SetVisStreamed(kFALSE);
40  SetVisTouched(kFALSE);
41  SetVisLeaves();
42 }
43 ////////////////////////////////////////////////////////////////////////////////
44 /// Constructor
45 
46 TGeoAtt::TGeoAtt(Option_t * /*vis_opt*/, Option_t * /*activity_opt*/, Option_t * /*optimization_opt*/)
47 {
48  fGeoAtt = 0;
49  SetActivity(kTRUE);
50  SetActiveDaughters(kTRUE);
51  SetVisibility(kTRUE);
52  SetVisDaughters(kTRUE);
53  SetVisStreamed(kFALSE);
54  SetVisTouched(kFALSE);
55  SetVisLeaves();
56 }
57 ////////////////////////////////////////////////////////////////////////////////
58 /// Destructor
59 
60 TGeoAtt::~TGeoAtt()
61 {
62 }
63 
64 ////////////////////////////////////////////////////////////////////////////////
65 /// Set branch type visibility.
66 
67 void TGeoAtt::SetVisBranch()
68 {
69  SetAttBit(kVisBranch, kTRUE);
70  SetAttBit(kVisContainers, kFALSE);
71  SetAttBit(kVisOnly, kFALSE);
72 }
73 
74 ////////////////////////////////////////////////////////////////////////////////
75 /// Set branch type visibility.
76 
77 void TGeoAtt::SetVisContainers(Bool_t flag)
78 {
79  SetVisLeaves(!flag);
80 }
81 
82 ////////////////////////////////////////////////////////////////////////////////
83 /// Set branch type visibility.
84 
85 void TGeoAtt::SetVisLeaves(Bool_t flag)
86 {
87  SetAttBit(kVisBranch, kFALSE);
88  SetAttBit(kVisContainers, !flag);
89  SetAttBit(kVisOnly, kFALSE);
90 }
91 
92 ////////////////////////////////////////////////////////////////////////////////
93 /// Set branch type visibility.
94 
95 void TGeoAtt::SetVisOnly(Bool_t flag)
96 {
97  SetAttBit(kVisBranch, kFALSE);
98  SetAttBit(kVisContainers, kFALSE);
99  SetAttBit(kVisOnly, flag);
100 }
101 
102 ////////////////////////////////////////////////////////////////////////////////
103 /// Set visibility for this object
104 
105 void TGeoAtt::SetVisibility(Bool_t vis)
106 {
107  if (vis) SetAttBit(kVisThis);
108  else ResetAttBit(kVisThis);
109  if (gGeoManager && gGeoManager->IsClosed()) SetVisTouched(kTRUE);
110 }
111 ////////////////////////////////////////////////////////////////////////////////
112 /// Set visibility for the daughters.
113 
114 void TGeoAtt::SetVisDaughters(Bool_t vis)
115 {
116  if (vis) SetAttBit(kVisDaughters);
117  else ResetAttBit(kVisDaughters);
118  if (gGeoManager && gGeoManager->IsClosed()) SetVisTouched(kTRUE);
119 }
120 ////////////////////////////////////////////////////////////////////////////////
121 /// Mark attributes as "streamed to file".
122 
123 void TGeoAtt::SetVisStreamed(Bool_t vis)
124 {
125  if (vis) SetAttBit(kVisStreamed);
126  else ResetAttBit(kVisStreamed);
127 }
128 ////////////////////////////////////////////////////////////////////////////////
129 /// Mark visualization attributes as "modified".
130 
131 void TGeoAtt::SetVisTouched(Bool_t vis)
132 {
133  if (vis) SetAttBit(kVisTouched);
134  else ResetAttBit(kVisTouched);
135 }
136 ////////////////////////////////////////////////////////////////////////////////
137 /// Set optimization flags.
138 
139 void TGeoAtt::SetOptimization(Option_t * /*option*/)
140 {
141 }
142