CMS 3D CMS Logo

IgSoSphereHit.cc

Go to the documentation of this file.
00001 //<<<<<< INCLUDES                                                       >>>>>>
00002 
00003 #include "Iguana/Inventor/interface/IgSoSphereHit.h"
00004 #include <Inventor/nodes/SoSphere.h>
00005 #include <Inventor/nodes/SoTransform.h>
00006 
00007 //<<<<<< PRIVATE DEFINES                                                >>>>>>
00008 //<<<<<< PRIVATE CONSTANTS                                              >>>>>>
00009 //<<<<<< PRIVATE TYPES                                                  >>>>>>
00010 //<<<<<< PRIVATE VARIABLE DEFINITIONS                                   >>>>>>
00011 //<<<<<< PUBLIC VARIABLE DEFINITIONS                                    >>>>>>
00012 //<<<<<< CLASS STRUCTURE INITIALIZATION                                 >>>>>>
00013 
00014 SO_KIT_SOURCE (IgSoSphereHit);
00015 
00016 //<<<<<< PRIVATE FUNCTION DEFINITIONS                                   >>>>>>
00017 //<<<<<< PUBLIC FUNCTION DEFINITIONS                                    >>>>>>
00018 //<<<<<< MEMBER FUNCTION DEFINITIONS                                    >>>>>>
00019 
00020 void
00021 IgSoSphereHit::initClass (void)
00022 { SO_KIT_INIT_CLASS (IgSoSphereHit, IgSoShapeKit, "IgSoShapeKit"); }
00023 
00024 IgSoSphereHit::IgSoSphereHit (void)
00025 {
00026     SO_KIT_CONSTRUCTOR (IgSoSphereHit);
00027     SO_KIT_ADD_FIELD (scale,  (1.0));
00028     SO_KIT_ADD_FIELD (energy, (1.0));
00029     SO_KIT_ADD_FIELD (centre, (0.0, 0.0, 0.0));
00030     SO_KIT_ADD_CATALOG_ENTRY (transform, SoTransform, FALSE, separator,\x0, TRUE);
00031     SO_KIT_ADD_CATALOG_ENTRY (sphere, SoSphere, FALSE, separator,\x0, TRUE);
00032     SO_KIT_INIT_INSTANCE ();
00033     setUpConnections (true, true);
00034 }
00035 
00036 void
00037 IgSoSphereHit::refresh (void)
00038 {
00039     if (energy.getValue () < 0)
00040     {   
00041         setPart ("transform", NULL);
00042         setPart ("sphere", NULL);
00043         return;
00044     }
00045     
00046 
00047     SoTransform *transform = new SoTransform;
00048     SoSphere    *sphere = new SoSphere;
00049 
00050     // 2D projected area scales with energy, centred at the requested position
00051     sphere->radius = sqrt (energy.getValue ()) * scale.getValue ();
00052     transform->translation = centre;
00053 
00054     setPart ("transform", transform);
00055     setPart ("sphere", sphere);
00056 }

Generated on Tue Jun 9 17:38:47 2009 for CMSSW by  doxygen 1.5.4