CMS 3D CMS Logo

IgSoTower Class Reference

#include <Iguana/Inventor/interface/IgSoTower.h>

Inheritance diagram for IgSoTower:

IgSoShapeKit

List of all members.

Public Member Functions

 IgSoTower (void)

Static Public Member Functions

static void initClass (void)

Public Attributes

SoSFFloat emFraction
SoSFFloat energy
SoSFFloat etaWidth
SoSFFloat minimumEnergy
SoMFUInt32 orderedRGBA
SoSFFloat phiWidth
SoSFVec2f position
SoSFFloat scaleFactor

Protected Member Functions

virtual void refresh (void)

Private Member Functions

void cleanParts (void)
 SO_KIT_CATALOG_ENTRY_HEADER (faces)
 SO_KIT_CATALOG_ENTRY_HEADER (shapeHints)
 SO_KIT_HEADER (IgSoTower)


Detailed Description

Definition at line 18 of file IgSoTower.h.


Constructor & Destructor Documentation

IgSoTower::IgSoTower ( void   ) 

Definition at line 29 of file IgSoTower.cc.

References emFraction, energy, etaWidth, f, FALSE, minimumEnergy, orderedRGBA, phiWidth, position, scaleFactor, IgSoShapeKit::setUpConnections(), and TRUE.

00030 {
00031     SO_KIT_CONSTRUCTOR (IgSoTower);
00032 
00033     SO_KIT_ADD_FIELD (position,         (0.0f,0.0f));
00034     SO_KIT_ADD_FIELD (energy,           (0.0f));
00035     SO_KIT_ADD_FIELD (emFraction,       (0.0f));
00036     SO_KIT_ADD_FIELD (scaleFactor,      (1.0f));
00037     SO_KIT_ADD_FIELD (minimumEnergy,    (0.0f));
00038     SO_KIT_ADD_FIELD (etaWidth,         (0.087f));
00039     SO_KIT_ADD_FIELD (phiWidth,         (0.087f));
00040     SO_KIT_ADD_FIELD (orderedRGBA,      (0));
00041 
00042     orderedRGBA.set1Value (0, SbColor (0.622, 0.0, 0.622).getPackedValue ());
00043     orderedRGBA.set1Value (1, orderedRGBA [0]);
00044     orderedRGBA.set1Value (2, orderedRGBA [0]);
00045     orderedRGBA.set1Value (3, orderedRGBA [0]);
00046     orderedRGBA.set1Value (4, orderedRGBA [0]);
00047     orderedRGBA.set1Value (5, orderedRGBA [0]);
00048     orderedRGBA.set1Value (6, SbColor (0.0, 0.0, 1.0).getPackedValue ());
00049     orderedRGBA.set1Value (7, orderedRGBA [6]);
00050     orderedRGBA.set1Value (8, orderedRGBA [6]);
00051     orderedRGBA.set1Value (9, orderedRGBA [6]);
00052     orderedRGBA.set1Value (10, orderedRGBA [6]);
00053     orderedRGBA.set1Value (11, orderedRGBA [6]);
00054    
00055     SO_KIT_ADD_CATALOG_ENTRY (shapeHints, SoShapeHints, FALSE, separator,\x0, TRUE);
00056     SO_KIT_ADD_CATALOG_ENTRY (faces, SoIndexedFaceSet, FALSE, separator,\x0, TRUE);
00057     SO_KIT_INIT_INSTANCE ();
00058     setUpConnections (true, true);
00059 }


Member Function Documentation

void IgSoTower::cleanParts ( void   )  [private]

Definition at line 62 of file IgSoTower.cc.

References NULL.

Referenced by refresh().

00063 {
00064     setPart ("shapeHints", NULL);
00065     setPart ("faces", NULL);
00066 }

void IgSoTower::initClass ( void   )  [static]

Reimplemented from IgSoShapeKit.

Definition at line 26 of file IgSoTower.cc.

Referenced by initNodes(), and initShapes().

00027 { SO_KIT_INIT_CLASS (IgSoTower, IgSoShapeKit, "IgSoShapeKit"); }

void IgSoTower::refresh ( void   )  [protected, virtual]

Reimplemented from IgSoShapeKit.

Definition at line 69 of file IgSoTower.cc.

References cleanParts(), emFraction, energy, etaWidth, minimumEnergy, NULL, orderedRGBA, phiWidth, position, and scaleFactor.

00070 {
00071     if ((energy.getValue () == 0.0) || (fabs (energy.getValue ()) < fabs (minimumEnergy.getValue ())))
00072     {
00073         cleanParts ();
00074         return;
00075     }
00076 
00077     SoShapeHints *shapeHints = new SoShapeHints;
00078     SoIndexedFaceSet *faces = new SoIndexedFaceSet;
00079     SoVertexProperty *vtx = new SoVertexProperty;
00080  
00081     int faceIndices [] = 
00082         {0, 1, 5, 4, SO_END_FACE_INDEX,
00083          3, 7, 6, 2, SO_END_FACE_INDEX,
00084          1, 2, 6, 5, SO_END_FACE_INDEX,
00085          5, 6, 7, 4, SO_END_FACE_INDEX,
00086          4, 7, 3, 0, SO_END_FACE_INDEX,
00087          0, 3, 2, 1, SO_END_FACE_INDEX,
00088 
00089          8,  9, 13, 12, SO_END_FACE_INDEX,
00090         11, 15, 14, 10, SO_END_FACE_INDEX,
00091          9, 10, 14, 13, SO_END_FACE_INDEX,
00092         13, 14, 15, 12, SO_END_FACE_INDEX,
00093         12, 15, 11,  8, SO_END_FACE_INDEX,
00094          8, 11, 10,  9, SO_END_FACE_INDEX
00095         };
00096     
00097     float       cx, cz;
00098     float       dx = etaWidth.getValue () / 2.0F;
00099     float       dz = phiWidth.getValue () / 2.0F;
00100     float       cMax = energy.getValue () / scaleFactor.getValue ();
00101     float       cMin = cMax * emFraction.getValue ();
00102     bool        noEm;
00103     bool        noHm;
00104     bool        top = false;
00105     bool        bottom = false;
00106     
00107     (emFraction.getValue () == 0.0) ? noEm = true : noEm = false;
00108     (emFraction.getValue () == 1.0) ? noHm = true : noHm = false;
00109     
00110     position.getValue ().getValue (cx, cz);
00111 
00112     if (cMax < 0.0)
00113     {
00114         shapeHints->vertexOrdering = SoShapeHints::CLOCKWISE;
00115 
00116         orderedRGBA.set1Value (0, orderedRGBA [0] xor 0xffffff00);
00117         orderedRGBA.set1Value (1, orderedRGBA [0]);
00118         orderedRGBA.set1Value (2, orderedRGBA [0]);
00119         orderedRGBA.set1Value (3, orderedRGBA [0]);
00120         orderedRGBA.set1Value (4, orderedRGBA [0]);
00121         orderedRGBA.set1Value (5, orderedRGBA [0]);
00122         orderedRGBA.set1Value (6, orderedRGBA [6] xor 0xffffff00);
00123         orderedRGBA.set1Value (7, orderedRGBA [6]);
00124         orderedRGBA.set1Value (8, orderedRGBA [6]);
00125         orderedRGBA.set1Value (9, orderedRGBA [6]);
00126         orderedRGBA.set1Value (10, orderedRGBA [6]);
00127         orderedRGBA.set1Value (11, orderedRGBA [6]);
00128     }
00129     else
00130     {
00131         shapeHints->vertexOrdering = SoShapeHints::COUNTERCLOCKWISE;
00132     }
00133     
00134     shapeHints->shapeType = SoShapeHints::SOLID;
00135     shapeHints->faceType = SoShapeHints::CONVEX;
00136     
00137     int nverts = 16;
00138     std::vector<SbVec3f> vertexData (nverts);
00139 
00140     if (! noEm) 
00141     {           
00142         vertexData [0][0] = cx - dx;
00143         vertexData [0][1] = cMin;
00144         vertexData [0][2] = cz - dz;
00145     
00146         vertexData [1][0] = cx + dx;
00147         vertexData [1][1] = cMin;
00148         vertexData [1][2] = cz - dz;
00149 
00150         vertexData [2][0] = cx + dx;
00151         vertexData [2][1] = cMin;
00152         vertexData [2][2] = cz + dz;
00153     
00154         vertexData [3][0] = cx - dx;
00155         vertexData [3][1] = cMin;
00156         vertexData [3][2] = cz + dz;
00157 
00158         vertexData [4][0] = cx - dx;
00159         vertexData [4][1] = 0;
00160         vertexData [4][2] = cz - dz;
00161 
00162         vertexData [5][0] = cx + dx;
00163         vertexData [5][1] = 0;
00164         vertexData [5][2] = cz - dz;
00165 
00166         vertexData [6][0] = cx + dx;
00167         vertexData [6][1] = 0;
00168         vertexData [6][2] = cz + dz;
00169 
00170         vertexData [7][0] = cx - dx;
00171         vertexData [7][1] = 0;
00172         vertexData [7][2] = cz + dz;
00173   
00174         bottom = true;
00175     } 
00176     
00177     if (! noHm) 
00178     {
00179         vertexData [8][0] = cx - dx;
00180         vertexData [8][1] = cMax;
00181         vertexData [8][2] = cz - dz;
00182     
00183         vertexData [9][0] = cx + dx;
00184         vertexData [9][1] = cMax;
00185         vertexData [9][2] = cz - dz;
00186 
00187         vertexData [10][0] = cx + dx;
00188         vertexData [10][1] = cMax;
00189         vertexData [10][2] = cz + dz;
00190     
00191         vertexData [11][0] = cx - dx;
00192         vertexData [11][1] = cMax;
00193         vertexData [11][2] = cz + dz;
00194 
00195         vertexData [12][0] = cx - dx;
00196         vertexData [12][1] = cMin;
00197         vertexData [12][2] = cz - dz;
00198 
00199         vertexData [13][0] = cx + dx;
00200         vertexData [13][1] = cMin;
00201         vertexData [13][2] = cz - dz;
00202 
00203         vertexData [14][0] = cx + dx;
00204         vertexData [14][1] = cMin;
00205         vertexData [14][2] = cz + dz;
00206 
00207         vertexData [15][0] = cx - dx;
00208         vertexData [15][1] = cMin;
00209         vertexData [15][2] = cz + dz;
00210         
00211         top = true;
00212     }
00213     
00214     vtx->materialBinding = SoMaterialBinding::PER_FACE;
00215 
00216     if (top && bottom)
00217     {
00218         vtx->vertex.setValues (0, 16, &vertexData [0]);
00219         vtx->orderedRGBA = orderedRGBA;
00220 
00221         faces->vertexProperty = vtx;
00222         faces->coordIndex.setValues (0, sizeof (faceIndices) / sizeof (int), faceIndices);
00223         setPart ("shapeHints",  shapeHints);
00224         setPart ("faces",       faces);
00225     }
00226     else if (top && (! bottom))
00227     {
00228         orderedRGBA.set1Value (0, orderedRGBA [6]);
00229         orderedRGBA.set1Value (1, orderedRGBA [6]);
00230         orderedRGBA.set1Value (2, orderedRGBA [6]);
00231         orderedRGBA.set1Value (3, orderedRGBA [6]);
00232         orderedRGBA.set1Value (4, orderedRGBA [6]);
00233         orderedRGBA.set1Value (5, orderedRGBA [6]);
00234         vtx->orderedRGBA = orderedRGBA;
00235         
00236         vtx->vertex.setValues (0, 8, &vertexData [8]);
00237         faces->vertexProperty = vtx;
00238         faces->coordIndex.setValues (0, 6 * 5, faceIndices);
00239         setPart ("shapeHints",  shapeHints);
00240         setPart ("faces",       faces);
00241     }
00242     else if ((! top) && bottom)
00243     {
00244         orderedRGBA.set1Value (6, orderedRGBA [0]);
00245         orderedRGBA.set1Value (7, orderedRGBA [0]);
00246         orderedRGBA.set1Value (8, orderedRGBA [0]);
00247         orderedRGBA.set1Value (9, orderedRGBA [0]);
00248         orderedRGBA.set1Value (10, orderedRGBA [0]);
00249         orderedRGBA.set1Value (11, orderedRGBA [0]);
00250         vtx->orderedRGBA = orderedRGBA;
00251 
00252         vtx->vertex.setValues (0, 8, &vertexData [0]);
00253         faces->vertexProperty = vtx;
00254         faces->coordIndex.setValues (0, 6 * 5, faceIndices);
00255         setPart ("shapeHints",  shapeHints);
00256         setPart ("faces",       faces);
00257     }
00258     else 
00259     {
00260         vtx->orderedRGBA = orderedRGBA;
00261         faces->vertexProperty = vtx;
00262         shapeHints->ref(); shapeHints->unref();
00263         faces->ref(); faces->unref();
00264         setPart ("shapeHints",  NULL);
00265         setPart ("faces",       NULL);
00266     }
00267 }

IgSoTower::SO_KIT_CATALOG_ENTRY_HEADER ( faces   )  [private]

IgSoTower::SO_KIT_CATALOG_ENTRY_HEADER ( shapeHints   )  [private]

IgSoTower::SO_KIT_HEADER ( IgSoTower   )  [private]


Member Data Documentation

SoSFFloat IgSoTower::emFraction

Definition at line 30 of file IgSoTower.h.

Referenced by IgSoTower(), refresh(), selectTower(), VisHORecHitTwig::update(), VisPFRecHitTwig::update(), VisEcalRecHitTwig::update(), VisPFClusterTwig::update(), VisEcalUncalibratedRecHitTwig::update(), VisHBHERecHitTwig::update(), VisBasicClusterTwig::update(), VisCaloTowerTwig::update(), VisSuperClusterCollectionTwig::update(), VisBasicClusterCollectionTwig::update(), and VisSuperClusterTwig::update().

SoSFFloat IgSoTower::energy

Definition at line 29 of file IgSoTower.h.

Referenced by IgSoTower(), refresh(), selectTower(), VisHORecHitTwig::update(), VisEcalRecHitTwig::update(), VisCSCStripDigiTwig::update(), VisPFRecHitTwig::update(), VisPFClusterTwig::update(), VisTrackerClusterTwig::update(), VisTrackerPiRechitTwig::update(), VisEcalUncalibratedRecHitTwig::update(), VisPixelDigiTwig::update(), VisBasicClusterTwig::update(), VisHBHERecHitTwig::update(), VisHFRecHitTwig::update(), VisTrackerRechit2DTwig::update(), VisBasicClusterCollectionTwig::update(), VisSuperClusterCollectionTwig::update(), VisCaloTowerTwig::update(), VisTrackerPiDigiTwig::update(), VisTrackerRechit2DMatchedTwig::update(), VisTkSimTrackTwig::update(), VisSuperClusterTwig::update(), and VisTrackerDigiTwig::update().

SoSFFloat IgSoTower::etaWidth

Definition at line 33 of file IgSoTower.h.

Referenced by IgSoTower(), refresh(), VisEcalRecHitTwig::update(), VisPFRecHitTwig::update(), VisPFClusterTwig::update(), VisTrackerClusterTwig::update(), VisEcalUncalibratedRecHitTwig::update(), VisBasicClusterTwig::update(), VisTrackerRechit2DTwig::update(), VisBasicClusterCollectionTwig::update(), VisSuperClusterCollectionTwig::update(), VisCaloTowerTwig::update(), VisTrackerRechit2DMatchedTwig::update(), VisSuperClusterTwig::update(), and VisTrackerDigiTwig::update().

SoSFFloat IgSoTower::minimumEnergy

Definition at line 32 of file IgSoTower.h.

Referenced by IgSoTower(), and refresh().

SoMFUInt32 IgSoTower::orderedRGBA

Definition at line 35 of file IgSoTower.h.

Referenced by IgSoTower(), refresh(), VisTrackerClusterTwig::update(), VisTrackerRechit2DTwig::update(), VisTrackerRechit2DMatchedTwig::update(), and VisTrackerDigiTwig::update().

SoSFFloat IgSoTower::phiWidth

Definition at line 34 of file IgSoTower.h.

Referenced by IgSoTower(), refresh(), VisEcalRecHitTwig::update(), VisPFRecHitTwig::update(), VisPFClusterTwig::update(), VisTrackerClusterTwig::update(), VisEcalUncalibratedRecHitTwig::update(), VisBasicClusterTwig::update(), VisTrackerRechit2DTwig::update(), VisBasicClusterCollectionTwig::update(), VisSuperClusterCollectionTwig::update(), VisCaloTowerTwig::update(), VisTrackerRechit2DMatchedTwig::update(), VisSuperClusterTwig::update(), and VisTrackerDigiTwig::update().

SoSFVec2f IgSoTower::position

Definition at line 28 of file IgSoTower.h.

Referenced by IgSoTower(), refresh(), VisHORecHitTwig::update(), VisPFRecHitTwig::update(), VisCSCStripDigiTwig::update(), VisEcalRecHitTwig::update(), VisTrackerPiRechitTwig::update(), VisTrackerClusterTwig::update(), VisPFClusterTwig::update(), VisTrackerPiClusterTwig::update(), VisPixelDigiTwig::update(), VisEcalUncalibratedRecHitTwig::update(), VisHBHERecHitTwig::update(), VisBasicClusterTwig::update(), VisTrackerRechit2DTwig::update(), VisHFRecHitTwig::update(), VisTrackerPiDigiTwig::update(), VisCaloTowerTwig::update(), VisSuperClusterCollectionTwig::update(), VisBasicClusterCollectionTwig::update(), VisTrackerRechit2DMatchedTwig::update(), VisTkSimTrackTwig::update(), VisTrackerDigiTwig::update(), and VisSuperClusterTwig::update().

SoSFFloat IgSoTower::scaleFactor

Definition at line 31 of file IgSoTower.h.

Referenced by IgSoTower(), refresh(), VisHORecHitTwig::update(), VisPFRecHitTwig::update(), VisCSCStripDigiTwig::update(), VisEcalRecHitTwig::update(), VisTrackerPiRechitTwig::update(), VisTrackerClusterTwig::update(), VisPFClusterTwig::update(), VisTrackerPiClusterTwig::update(), VisPixelDigiTwig::update(), VisEcalUncalibratedRecHitTwig::update(), VisHBHERecHitTwig::update(), VisBasicClusterTwig::update(), VisTrackerRechit2DTwig::update(), VisHFRecHitTwig::update(), VisTrackerPiDigiTwig::update(), VisCaloTowerTwig::update(), VisSuperClusterCollectionTwig::update(), VisBasicClusterCollectionTwig::update(), VisTrackerRechit2DMatchedTwig::update(), VisTkSimTrackTwig::update(), VisTrackerDigiTwig::update(), and VisSuperClusterTwig::update().


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