CMS 3D CMS Logo

IgSoSiStrips.cc

Go to the documentation of this file.
00001 //<<<<<< INCLUDES                                                       >>>>>>
00002 
00003 #include "Iguana/Inventor/interface/IgSoSiStrips.h"
00004 #include <Inventor/nodes/SoSeparator.h>
00005 #include <Inventor/nodes/SoCube.h>
00006 #include <Inventor/nodes/SoTranslation.h>
00007 
00008 //<<<<<< PRIVATE DEFINES                                                >>>>>>
00009 //<<<<<< PRIVATE CONSTANTS                                              >>>>>>
00010 //<<<<<< PRIVATE TYPES                                                  >>>>>>
00011 //<<<<<< PRIVATE VARIABLE DEFINITIONS                                   >>>>>>
00012 //<<<<<< PUBLIC VARIABLE DEFINITIONS                                    >>>>>>
00013 //<<<<<< CLASS STRUCTURE INITIALIZATION                                 >>>>>>
00014 
00015 SO_KIT_SOURCE (IgSoSiStrips);
00016 
00017 //<<<<<< PRIVATE FUNCTION DEFINITIONS                                   >>>>>>
00018 //<<<<<< PUBLIC FUNCTION DEFINITIONS                                    >>>>>>
00019 //<<<<<< MEMBER FUNCTION DEFINITIONS                                    >>>>>>
00020 
00021 void
00022 IgSoSiStrips::initClass (void)
00023 { SO_KIT_INIT_CLASS (IgSoSiStrips, IgSoShapeKit, "IgSoShapeKit"); }
00024 
00025 IgSoSiStrips::IgSoSiStrips (void)
00026 {
00027     SO_KIT_CONSTRUCTOR (IgSoSiStrips);
00028     SO_KIT_ADD_FIELD (thickness, (0.03));
00029     SO_KIT_ADD_FIELD (width,     (1.28));
00030     SO_KIT_ADD_FIELD (length,    (8.0));
00031     SO_KIT_ADD_FIELD (pitch,     (0.005));
00032     SO_KIT_ADD_FIELD (offset,    (0.000));
00033     SO_KIT_ADD_FIELD (strip,     (0));
00034     SO_KIT_ADD_FIELD (adc,       (0));
00035     SO_KIT_ADD_FIELD (gain,      (0.001));
00036     SO_KIT_ADD_CATALOG_ENTRY (translation, SoTranslation, FALSE, separator,\x0, TRUE);
00037     SO_KIT_ADD_CATALOG_ENTRY (pulses, SoSeparator, FALSE, separator,\x0, TRUE);
00038     SO_KIT_INIT_INSTANCE ();
00039     setUpConnections (true, true);
00040 }
00041 
00042 void
00043 IgSoSiStrips::refresh ()
00044 {
00045     if (strip.getNum () != adc.getNum ()) 
00046     {
00047         setPart ("translation", NULL);
00048         setPart ("pulses", NULL);
00049 
00050         return;
00051     }
00052     
00053 
00054     SoTranslation       *translation = new SoTranslation;
00055     SoSeparator         *pulses = new SoSeparator;
00056 
00057     translation->translation = SbVec3f (0, -width.getValue ()/2 + offset.getValue (), 0);
00058 
00059     for (int i = 0; i < strip.getNum (); i++)
00060     {
00061         SoSeparator     *pulse = new SoSeparator;
00062         SoTranslation   *inc = new SoTranslation;
00063         SoCube          *hit = new SoCube;
00064 
00065         inc->translation = SbVec3f (0, pitch.getValue () * strip[i], 0);
00066         hit->width  = thickness.getValue () + adc[i] * gain.getValue ();
00067         hit->height = pitch.getValue ();
00068         hit->depth  = length.getValue () - pitch.getValue ();
00069 
00070         pulse->addChild (inc);
00071         pulse->addChild (hit);
00072         pulses->addChild (pulse);
00073     }
00074 
00075     setPart ("translation", translation);
00076     setPart ("pulses", pulses);
00077 }

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