CMS 3D CMS Logo

VisSoG4Trajectories Class Reference

A specialised OpenInventor node that renders Geant4 trajectories directly from the current trajectory container. More...

#include <VisGeant4/VisG4Transients/interface/VisSoG4Trajectories.h>

List of all members.

Public Types

enum  Flush { NONE, STEP, TRAJECTORY, ALL }

Public Member Functions

void touch (void)
 VisSoG4Trajectories (void)

Static Public Member Functions

static void initClass (void)

Public Attributes

SoSFEnum flush
SoSFBool on

Protected Member Functions

virtual void computeBBox (SoAction *, SbBox3f &box, SbVec3f &center)
virtual void generatePrimitives (SoAction *action)
virtual void GLRender (SoGLRenderAction *renderAction)
virtual ~VisSoG4Trajectories (void)

Private Member Functions

 SO_NODE_HEADER (VisSoG4Trajectories)


Detailed Description

A specialised OpenInventor node that renders Geant4 trajectories directly from the current trajectory container.

A proof of concept implementation not suitable for long-term usage.

Definition at line 21 of file VisSoG4Trajectories.h.


Member Enumeration Documentation

enum VisSoG4Trajectories::Flush

Enumerator:
NONE 
STEP 
TRAJECTORY 
ALL 

Definition at line 25 of file VisSoG4Trajectories.h.

00026     {
00027         NONE,
00028         STEP,
00029         TRAJECTORY,
00030         ALL
00031     };


Constructor & Destructor Documentation

VisSoG4Trajectories::VisSoG4Trajectories ( void   ) 

Definition at line 51 of file VisSoG4Trajectories.cc.

References ALL, FALSE, flush, NONE, on, STEP, and TRAJECTORY.

00052 {
00053     SO_NODE_CONSTRUCTOR (VisSoG4Trajectories);
00054     SO_NODE_ADD_FIELD (on, (FALSE));
00055     SO_NODE_ADD_FIELD (flush, (NONE));
00056 
00057     SO_NODE_DEFINE_ENUM_VALUE (Flush, NONE);
00058     SO_NODE_DEFINE_ENUM_VALUE (Flush, STEP);
00059     SO_NODE_DEFINE_ENUM_VALUE (Flush, TRAJECTORY);
00060     SO_NODE_DEFINE_ENUM_VALUE (Flush, ALL);
00061 
00062     SO_NODE_SET_SF_ENUM_TYPE (flush,Flush);
00063 }

VisSoG4Trajectories::~VisSoG4Trajectories ( void   )  [protected, virtual]

Definition at line 65 of file VisSoG4Trajectories.cc.

00066 {}


Member Function Documentation

void VisSoG4Trajectories::computeBBox ( SoAction *  ,
SbBox3f &  box,
SbVec3f &  center 
) [protected, virtual]

Definition at line 69 of file VisSoG4Trajectories.cc.

References count, event(), i, m, and t.

00070 {
00071     if (G4RunManager *runManager = G4RunManager::GetRunManager ())
00072         if (const G4Event *event = runManager->GetCurrentEvent ())
00073             if (G4TrajectoryContainer *trajectories
00074                 = event->GetTrajectoryContainer ())
00075             {
00076                 for (int count = 0; count < trajectories->entries (); count++)
00077                 {
00078                     G4Trajectory *t = static_cast<G4Trajectory *>
00079                                       ((*trajectories) [count]);
00080                     for (int i = 0; i < t->GetPointEntries (); i++)
00081                     {
00082                         G4ThreeVector pos =
00083                             ((G4TrajectoryPoint *) t->GetPoint (i))
00084                             ->GetPosition ();
00085 
00086                         box.extendBy (SbVec3f (pos.x () / m,
00087                                                pos.y () / m,
00088                                                pos.z () / m));
00089                     }
00090                     center = box.getCenter ();
00091                 }
00092             }
00093 }

void VisSoG4Trajectories::generatePrimitives ( SoAction *  action  )  [protected, virtual]

Definition at line 172 of file VisSoG4Trajectories.cc.

References FALSE, and on.

00173 {
00174     if (on.getValue () == FALSE)
00175         return;
00176 
00177     // FIXME
00178 }

void VisSoG4Trajectories::GLRender ( SoGLRenderAction *  renderAction  )  [protected, virtual]

Definition at line 100 of file VisSoG4Trajectories.cc.

References ALL, count, DRAW_TRAJ_POINT, event(), FALSE, flush, i, on, reset(), state, STEP, t, and TRAJECTORY.

00101 {
00102     if (on.getValue () == FALSE || ! shouldGLRender (action))
00103         return;
00104 
00105     SoState *state = action->getState ();
00106     state->push ();
00107     SoLazyElement::setColorMaterial (state, true);
00108     SoGLLazyElement::sendNoMaterial (state);
00109 
00110     if (G4RunManager *runManager = G4RunManager::GetRunManager ())
00111         if (const G4Event *event = runManager->GetCurrentEvent ())
00112             if (G4TrajectoryContainer *trajectories
00113                 = event->GetTrajectoryContainer ())
00114             {
00115                 glDisable (GL_LIGHTING);
00116                 glColor3f (1,0,0);
00117 
00118                 Flush flushing = (Flush) flush.getValue();
00119 
00120                 for (int count = 0; count < trajectories->entries (); count++)
00121                 {
00122                     G4Trajectory *t = static_cast<G4Trajectory *>
00123                                       ((*trajectories) [count]);
00124 
00125                     if (t->GetPointEntries () == 1)
00126                     {
00127                         glBegin (GL_POINTS);
00128                         DRAW_TRAJ_POINT (t, 0);
00129                         glEnd ();
00130                         glFlush ();
00131                     }
00132                     else if (flushing == STEP)
00133                     {
00134                         for (int i = 0; i < t->GetPointEntries ()-1; i++)
00135                         {
00136                             glBegin (GL_LINES);
00137                             DRAW_TRAJ_POINT (t, i);
00138                             DRAW_TRAJ_POINT (t, i+1);
00139                             glEnd ();
00140                             glFlush ();
00141                         }
00142                     }
00143                     else
00144                     {
00145                         glBegin (GL_LINES);
00146                         for (int i = 0; i < t->GetPointEntries ()-1; i++)
00147                         {
00148                             DRAW_TRAJ_POINT (t, i);
00149                             DRAW_TRAJ_POINT (t, i+1);
00150                         }
00151                         glEnd ();
00152 
00153                         if (flushing == TRAJECTORY)
00154                             glFlush ();
00155                     }
00156 
00157                 }
00158 
00159                 if (flushing == ALL)
00160                     glFlush ();
00161 
00162                 glEnable (GL_LIGHTING);
00163             }
00164 
00165     ((SoGLLazyElement *) SoLazyElement::getInstance (state))
00166         ->reset (state, SoLazyElement::DIFFUSE_MASK
00167                  | SoLazyElement::LIGHT_MODEL_MASK);
00168     state->pop ();
00169 }

void VisSoG4Trajectories::initClass ( void   )  [static]

Definition at line 46 of file VisSoG4Trajectories.cc.

00047 {
00048     SO_NODE_INIT_CLASS (VisSoG4Trajectories, SoShape, "Shape");
00049 }

VisSoG4Trajectories::SO_NODE_HEADER ( VisSoG4Trajectories   )  [private]

void VisSoG4Trajectories::touch ( void   ) 

Definition at line 96 of file VisSoG4Trajectories.cc.

References on.

00097 { on.touch(); }


Member Data Documentation

SoSFEnum VisSoG4Trajectories::flush

Definition at line 34 of file VisSoG4Trajectories.h.

Referenced by GLRender(), MMM_DEFUN_FUNC(), and VisSoG4Trajectories().

SoSFBool VisSoG4Trajectories::on

Definition at line 33 of file VisSoG4Trajectories.h.

Referenced by generatePrimitives(), GLRender(), MMM_DEFUN_FUNC(), touch(), and VisSoG4Trajectories().


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