CMS 3D CMS Logo

VisG4VolumeTwig Class Reference

Twig representing a Geant4 detector volume. More...

#include <VisGeant4/VisG4Volumes/interface/VisG4VolumeTwig.h>

Inheritance diagram for VisG4VolumeTwig:

IgCompoundTwig IgTwig IgRepresentable

List of all members.

Public Member Functions

virtual void cascade (bool value)
virtual bool cascade (void) const
virtual bool expand (void)
virtual void logical (bool value)
virtual bool logical (void) const
virtual void name (const std::string &value)
virtual std::string name (void) const
VisG4Path path (unsigned index)
unsigned paths (void)
IgTwigphysicalChild (unsigned index)
unsigned physicalChildren (void)
VisG4VolumeTwigselect (const VisG4Path &path, bool autoexpand=false)
virtual void selfTraverse (bool value)
virtual bool selfTraverse (void) const
virtual void selfVisible (bool value)
virtual bool selfVisible (void) const
 VisG4VolumeTwig (IgTwig *parent, G4VPhysicalVolume *in, bool traverse=false, bool visible=false, bool open=false, bool logical=true)
G4VPhysicalVolume * volume (void) const

Static Public Attributes

static VisG4MaterialFilterm_materialFilter = 0
static VisG4Filterm_visualizationFilter = 0

Private Attributes

std::vector< VisG4Pathm_paths
G4VPhysicalVolume * m_volume

Static Private Attributes

static const unsigned int CASCADE = 8
static const unsigned int LOGICAL = 16
static const unsigned int TRAVERSE = 2
static const unsigned int VISIBLE = 4


Detailed Description

Twig representing a Geant4 detector volume.

Definition at line 24 of file VisG4VolumeTwig.h.


Constructor & Destructor Documentation

VisG4VolumeTwig::VisG4VolumeTwig ( IgTwig parent,
G4VPhysicalVolume *  in,
bool  traverse = false,
bool  visible = false,
bool  open = false,
bool  logical = true 
)

Definition at line 68 of file VisG4VolumeTwig.cc.

References VisG4MaterialFilter::appendFilter(), ASSERT, cascade(), logical(), m_materialFilter, m_volume, selfTraverse(), and selfVisible().

00074     : IgCompoundTwig (parent),
00075       m_volume (volume)
00076 {
00077     ASSERT (parent);
00078     ASSERT (m_volume);
00079     
00080     selfTraverse (traverse);
00081     selfVisible (visible);
00082     cascade (open);
00083     logical (logic);
00084     if (m_materialFilter == 0)
00085     {
00086         m_materialFilter = new VisG4MaterialCacheFilter (true);
00087         VisG4MaterialFilter *currentFilter = m_materialFilter;
00088 
00089         VisG4MaterialFilter *tmpFilter;
00090         
00091         if (! getenv ("DISABLE_LUT_FILTER"))
00092         {
00093             tmpFilter = new VisG4MaterialLUTFilter (true);         
00094             currentFilter->appendFilter (tmpFilter);
00095             currentFilter = tmpFilter;
00096         }
00097         
00098         if (getenv ("ENABLE_DENSITY_FILTER"))
00099         {
00100             tmpFilter = new VisG4MaterialDensityFilter (true);
00101             currentFilter->appendFilter (tmpFilter);
00102             currentFilter = tmpFilter;
00103         }
00104         
00105         if (getenv ("ENABLE_FALSE_COLOR_FILTER"))
00106         {
00107             tmpFilter = new VisG4MaterialFalseColorFilter (true);
00108             currentFilter->appendFilter (tmpFilter);
00109             currentFilter = tmpFilter;
00110         }
00111     } 
00112 }


Member Function Documentation

void VisG4VolumeTwig::cascade ( bool  value  )  [virtual]

Implements IgTwig.

Definition at line 194 of file VisG4VolumeTwig.cc.

References CASCADE, and IgCompoundTwig::flag().

00195 { flag (CASCADE, value); }

bool VisG4VolumeTwig::cascade ( void   )  const [virtual]

Implements IgTwig.

Definition at line 190 of file VisG4VolumeTwig.cc.

References CASCADE, and IgCompoundTwig::flag().

Referenced by VisG4VolumeTwig().

00191 { return flag (CASCADE); }

bool VisG4VolumeTwig::expand ( void   )  [virtual]

Reimplemented from IgCompoundTwig.

Definition at line 126 of file VisG4VolumeTwig.cc.

References VisG4Navigator::build(), IgCompoundTwig::expand(), and m_volume.

Referenced by VisG4TwigOps::doApplyFilter(), VisG4TwigOps::doShowCategory(), VisG4TwigOps::doShowMaterial(), and select().

00127 {
00128     if (IgCompoundTwig::expand ())
00129         return true;
00130 
00131     VisG4Navigator::build (1, m_volume, this);
00132     return false;
00133 }

void VisG4VolumeTwig::logical ( bool  value  )  [virtual]

Definition at line 203 of file VisG4VolumeTwig.cc.

References IgCompoundTwig::destroy(), IgCompoundTwig::EXPANDED, IgCompoundTwig::flag(), and LOGICAL.

00204 {
00205     if (flag (LOGICAL) != value)
00206     {
00207         // Flip representation
00208         destroy ();
00209         flag (LOGICAL, value);
00210         flag (EXPANDED, false);
00211     }
00212 }

bool VisG4VolumeTwig::logical ( void   )  const [virtual]

Definition at line 199 of file VisG4VolumeTwig.cc.

References IgCompoundTwig::flag(), and LOGICAL.

Referenced by VisG4TwigOps::actionLogical(), VisG4Navigator::build(), VisG4TwigOps::menuUpdate(), physicalChild(), physicalChildren(), and VisG4VolumeTwig().

00200 { return flag (LOGICAL); }

void VisG4VolumeTwig::name ( const std::string &  value  )  [virtual]

Implements IgTwig.

Definition at line 122 of file VisG4VolumeTwig.cc.

References ASSERT.

00123 { ASSERT (false); }

std::string VisG4VolumeTwig::name ( void   )  const [virtual]

Implements IgTwig.

Definition at line 118 of file VisG4VolumeTwig.cc.

References m_volume.

00119 { return m_volume->GetLogicalVolume ()->GetName (); }

VisG4Path VisG4VolumeTwig::path ( unsigned  index  ) 

Definition at line 285 of file VisG4VolumeTwig.cc.

References ASSERT, and m_paths.

Referenced by VisG4TwigOps::actionAppearance(), VisG4TwigOps::doApplyFilter(), and drawVolumeTwig().

00286 {
00287     ASSERT (m_paths.size () > index);
00288     return m_paths [index];
00289 }

unsigned VisG4VolumeTwig::paths ( void   ) 

Definition at line 233 of file VisG4VolumeTwig.cc.

References i, j, m_paths, m_volume, me, offset, p, IgTwig::parent(), prof2calltree::prefix, and width.

Referenced by VisG4TwigOps::actionAppearance(), VisG4TwigOps::doApplyFilter(), and drawVolumeTwig().

00234 {
00235     if (m_paths.empty ())
00236     {
00237         // We haven't yet computed the paths.  Do so now.
00238         if (VisG4VolumeTwig *p = dynamic_cast<VisG4VolumeTwig *> (parent ()))
00239         {
00240             // Parent is a volume twig.  Expand on paths assigned to it.
00241             G4VPhysicalVolume   *pvol = p->volume ();
00242             int                 nreps = 1;
00243 
00244             if (m_volume->IsReplicated ())
00245             {
00246                 EAxis    axis;
00247                 G4double width, offset;
00248                 G4bool   consuming;
00249                 m_volume->GetReplicationData (axis, nreps, width,
00250                                               offset, consuming);
00251             }
00252 
00253             if (p->logical ())
00254                 // Logical.  Push all subpaths with equal physical
00255                 // volume, using G4 daughter volume index (each
00256                 // replica).
00257                 for (unsigned i = 0; i < p->paths (); ++i)
00258                 {
00259                     VisG4Path           prefix = p->path (i);
00260                     G4LogicalVolume     *mother = pvol->GetLogicalVolume ();
00261                     G4LogicalVolume     *me = m_volume->GetLogicalVolume ();
00262 
00263                     for (int i = 0; i < mother->GetNoDaughters (); ++i)
00264                         if (mother->GetDaughter (i)->GetLogicalVolume () == me)
00265                             for (int j = 0; j < nreps; ++j)
00266                                 m_paths.push_back (VisG4Path (prefix, i, j));
00267                 }
00268 
00269             else
00270                 // Physical.  Push index of the G4 daughter volume
00271                 // (each replica).
00272                 for (unsigned i = 0, me = p->indexOf(this); i < p->paths();++i)
00273                     for (int j = 0; j < nreps; ++j)
00274                         m_paths.push_back (VisG4Path (p->path (i), me, j));
00275         }
00276         else
00277             m_paths.push_back (VisG4Path ());
00278     }
00279 
00280     // OK, now return the number of paths we have
00281     return m_paths.size ();
00282 }

IgTwig * VisG4VolumeTwig::physicalChild ( unsigned  index  ) 

Definition at line 227 of file VisG4VolumeTwig.cc.

References IgCompoundTwig::child(), VisG4Navigator::findLogical(), logical(), and m_volume.

00228 { return child (logical () ? VisG4Navigator::findLogical (m_volume, index)
00229                 : index); }

unsigned VisG4VolumeTwig::physicalChildren ( void   ) 

Definition at line 216 of file VisG4VolumeTwig.cc.

References IgCompoundTwig::children(), IgCompoundTwig::EXPANDED, IgCompoundTwig::flag(), logical(), and m_volume.

00217 {
00218     if (! logical ())
00219         return children ();
00220     else if (flag (EXPANDED))
00221         return m_volume->GetLogicalVolume ()->GetNoDaughters ();
00222     else
00223         return 0;
00224 }

VisG4VolumeTwig * VisG4VolumeTwig::select ( const VisG4Path path,
bool  autoexpand = false 
)

Definition at line 147 of file VisG4VolumeTwig.cc.

References ASSERT, c, IgCompoundTwig::child(), IgCompoundTwig::children(), VisG4Path::daughter(), VisG4Path::empty(), expand(), n, and VisG4Path::prefix().

00148 {
00149     if (path.empty ())
00150         return this;
00151 
00152     VisG4VolumeTwig *c = select (path.prefix (), autoexpand);
00153 
00154     if (! c->children () && autoexpand)
00155         c->expand ();
00156 
00157     unsigned n = path.daughter ();
00158     if (n < c->children ())
00159     {
00160         IgTwig          *sub = c->child (n);
00161         VisG4VolumeTwig *subvol = static_cast<VisG4VolumeTwig *> (sub);
00162         ASSERT (dynamic_cast<VisG4VolumeTwig *> (sub));
00163         return subvol;
00164     }
00165     else
00166         return 0;
00167 }

void VisG4VolumeTwig::selfTraverse ( bool  value  )  [virtual]

Implements IgTwig.

Definition at line 178 of file VisG4VolumeTwig.cc.

References IgCompoundTwig::flag(), and TRAVERSE.

00179 { flag (TRAVERSE, value); }

bool VisG4VolumeTwig::selfTraverse ( void   )  const [virtual]

Implements IgTwig.

Definition at line 174 of file VisG4VolumeTwig.cc.

References IgCompoundTwig::flag(), and TRAVERSE.

Referenced by VisG4TwigOps::actionApplyFilter(), VisG4TwigOps::actionShowCategory(), VisG4TwigOps::actionShowMaterial(), VisG4TwigOps::doApplyFilter(), VisG4TwigOps::doShowCategory(), VisG4TwigOps::doShowMaterial(), and VisG4VolumeTwig().

00175 { return flag (TRAVERSE); }

void VisG4VolumeTwig::selfVisible ( bool  value  )  [virtual]

Implements IgTwig.

Definition at line 186 of file VisG4VolumeTwig.cc.

References IgCompoundTwig::flag(), and VISIBLE.

00187 { flag (VISIBLE, value); }

bool VisG4VolumeTwig::selfVisible ( void   )  const [virtual]

Implements IgTwig.

Definition at line 182 of file VisG4VolumeTwig.cc.

References IgCompoundTwig::flag(), and VISIBLE.

Referenced by VisG4TwigOps::doApplyFilter(), VisG4TwigOps::doShowCategory(), VisG4TwigOps::doShowMaterial(), and VisG4VolumeTwig().

00183 { return flag (VISIBLE); }

G4VPhysicalVolume * VisG4VolumeTwig::volume ( void   )  const

Definition at line 170 of file VisG4VolumeTwig.cc.

References m_volume.

Referenced by VisG4TwigOps::actionAppearance(), VisG4TwigOps::actionColour(), VisG4TwigOps::actionGetMass(), VisG4TwigOps::actionTransparency(), VisG4TwigOps::doApplyFilter(), VisG4TwigOps::doGetMass(), VisG4TwigOps::doRender(), VisG4TwigOps::doShowCategory(), VisG4TwigOps::doShowMaterial(), drawVolumeTwig(), VisG4TwigOps::menuUpdate(), and MMM_DEFUN_FUNC().

00171 { return m_volume; }


Member Data Documentation

const unsigned int VisG4VolumeTwig::CASCADE = 8 [static, private]

Definition at line 70 of file VisG4VolumeTwig.h.

Referenced by cascade().

const unsigned int VisG4VolumeTwig::LOGICAL = 16 [static, private]

Definition at line 71 of file VisG4VolumeTwig.h.

Referenced by logical().

VisG4MaterialFilter * VisG4VolumeTwig::m_materialFilter = 0 [static]

Definition at line 65 of file VisG4VolumeTwig.h.

Referenced by VisG4VolumeTwig().

std::vector<VisG4Path> VisG4VolumeTwig::m_paths [private]

Definition at line 74 of file VisG4VolumeTwig.h.

Referenced by path(), and paths().

VisG4Filter * VisG4VolumeTwig::m_visualizationFilter = 0 [static]

Definition at line 66 of file VisG4VolumeTwig.h.

Referenced by VisG4TwigOps::actionApplyFilter(), and VisG4TwigOps::doApplyFilter().

G4VPhysicalVolume* VisG4VolumeTwig::m_volume [private]

Definition at line 73 of file VisG4VolumeTwig.h.

Referenced by expand(), name(), paths(), physicalChild(), physicalChildren(), VisG4VolumeTwig(), and volume().

const unsigned int VisG4VolumeTwig::TRAVERSE = 2 [static, private]

Definition at line 68 of file VisG4VolumeTwig.h.

Referenced by selfTraverse().

const unsigned int VisG4VolumeTwig::VISIBLE = 4 [static, private]

Definition at line 69 of file VisG4VolumeTwig.h.

Referenced by selfVisible().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:35:25 2009 for CMSSW by  doxygen 1.5.4