#include <Iguana/Inventor/interface/IgSoLegoPlot.h>
Definition at line 58 of file IgSoLegoPlot.h.
IgSoLegoPlot::IgSoLegoPlot | ( | void | ) |
Definition at line 29 of file IgSoLegoPlot.cc.
References displayNegTowers, divsEta, divsPhi, f, FALSE, heightScale, hlt_scaler_cfg::labels, maxEta, minEnergy, IgSoShapeKit::setUpConnections(), and TRUE.
00030 { 00031 SO_KIT_CONSTRUCTOR (IgSoLegoPlot); 00032 SO_KIT_ADD_FIELD (divsPhi, (1)); 00033 SO_KIT_ADD_FIELD (divsEta, (1)); 00034 SO_KIT_ADD_FIELD (heightScale, (1.0f)); 00035 SO_KIT_ADD_FIELD (maxEta, (4.5f)); 00036 SO_KIT_ADD_FIELD (minEnergy, (0.5f)); 00037 SO_KIT_ADD_FIELD (displayNegTowers, (FALSE)); 00038 00039 SO_KIT_ADD_CATALOG_ENTRY (phiLabels, SoSeparator, FALSE, separator,\x0, TRUE); 00040 SO_KIT_ADD_CATALOG_ENTRY (etaLabels, SoSeparator, FALSE, separator,\x0, TRUE); 00041 SO_KIT_ADD_CATALOG_ENTRY (grid, SoIndexedLineSet, FALSE, separator,\x0, TRUE); 00042 SO_KIT_ADD_CATALOG_ENTRY (font, SoFont, FALSE, separator,\x0, TRUE); 00043 SO_KIT_ADD_CATALOG_ENTRY (labels, SoSeparator, FALSE, separator,\x0, TRUE); 00044 SO_KIT_ADD_CATALOG_ENTRY (labelScale, SoSeparator, FALSE, labels,\x0, TRUE); 00045 SO_KIT_ADD_CATALOG_ENTRY (labelScaleFont, SoFont, FALSE, labelScale,\x0, TRUE); 00046 SO_KIT_ADD_CATALOG_ENTRY (labelScaleOffset, SoTranslation, FALSE, labelScale,\x0, TRUE); 00047 SO_KIT_ADD_CATALOG_ENTRY (labelScaleText, SoText2, FALSE, labelScale,\x0, TRUE); 00048 SO_KIT_ADD_CATALOG_ENTRY (labelX, SoSeparator, FALSE, labels,\x0, TRUE); 00049 SO_KIT_ADD_CATALOG_ENTRY (labelXOffset, SoTranslation, FALSE, labelX,\x0, TRUE); 00050 SO_KIT_ADD_CATALOG_ENTRY (labelXText, SoText2, FALSE, labelX,\x0, TRUE); 00051 SO_KIT_ADD_CATALOG_ENTRY (labelZ, SoSeparator, FALSE, labels,\x0, TRUE); 00052 SO_KIT_ADD_CATALOG_ENTRY (labelZOffset, SoTranslation, FALSE, labelZ,\x0, TRUE); 00053 SO_KIT_ADD_CATALOG_ENTRY (labelZText, SoText2, FALSE, labelZ,\x0, TRUE); 00054 SO_KIT_ADD_CATALOG_ENTRY (legos, SoSeparator, FALSE, separator,\x0, TRUE); 00055 SO_KIT_INIT_INSTANCE (); 00056 setUpConnections (true, true); 00057 }
Reimplemented from IgSoShapeKit.
Definition at line 26 of file IgSoLegoPlot.cc.
Referenced by initNodes(), and initShapes().
00027 { SO_KIT_INIT_CLASS (IgSoLegoPlot, IgSoShapeKit, "IgSoShapeKit"); }
Reimplemented from IgSoShapeKit.
Definition at line 60 of file IgSoLegoPlot.cc.
References funct::abs(), heightScale, int, maxEta, prof2calltree::ticks, x, and z.
00061 { 00062 static const float LABEL_OFFSET = 0.3F; 00063 00064 SoFont *font = new SoFont; 00065 SoSeparator *phiLabels = new SoSeparator; 00066 SoSeparator *etaLabels = new SoSeparator; 00067 SoIndexedLineSet *grid = new SoIndexedLineSet; 00068 SoFont *labelScaleFont = new SoFont; 00069 SoTranslation *labelScaleOffset = new SoTranslation; 00070 SoText2 *labelScaleText = new SoText2; 00071 SoTranslation *labelXOffset = new SoTranslation; 00072 SoText2 *labelXText = new SoText2; 00073 SoTranslation *labelZOffset = new SoTranslation; 00074 SoText2 *labelZText = new SoText2; 00075 SoVertexProperty *vtx = new SoVertexProperty; 00076 SoText2 *text; 00077 SoMFInt32 coords; 00078 00079 // set up co-ords for an overall outline plus a one unit vertical scale mark 00080 float x = float (2 * M_PI); 00081 float z = maxEta.getValue (); 00082 int vertex = 6; 00083 int coord = 0; 00084 00085 vtx->vertex.set1Value (0, SbVec3f (0, 0, -z)); 00086 vtx->vertex.set1Value (1, SbVec3f (0, 0, z)); 00087 vtx->vertex.set1Value (2, SbVec3f (x, 0, z)); 00088 vtx->vertex.set1Value (3, SbVec3f (x, 0, -z)); 00089 vtx->vertex.set1Value (4, SbVec3f (0, 0, -z)); 00090 vtx->vertex.set1Value (5, SbVec3f (0, 1, -z)); 00091 for (; coord < vertex; coord++) 00092 coords.set1Value (coord, coord); 00093 coords.set1Value (coord++, SO_END_LINE_INDEX); 00094 00095 // set up co-ords for grid lines at unit intervals in eta, pi/4 in phi 00096 // phi lines, exclude 0 and 2pi 00097 x = M_PI/4; 00098 z = maxEta.getValue (); 00099 00100 SoText2 *phiLabelText [8]; 00101 SoTranslation *phiStart = new SoTranslation; 00102 SoTranslation *phiTranslation = new SoTranslation; 00103 int ticks = 7; 00104 int tick; 00105 00106 phiStart->translation = SbVec3f (M_PI/4, 0, -z-2*LABEL_OFFSET); 00107 phiTranslation->translation = SbVec3f (M_PI/4, 0, 0); 00108 phiLabels->addChild (phiStart); 00109 00110 for (tick = 0; tick < ticks; tick++, x += M_PI/4) 00111 { 00112 vtx->vertex.set1Value (vertex, SbVec3f (x, 0, -z)); 00113 coords.set1Value (coord++, vertex++); 00114 vtx->vertex.set1Value (vertex, SbVec3f (x, 0, z)); 00115 coords.set1Value (coord++, vertex++); 00116 coords.set1Value (coord++, SO_END_LINE_INDEX); 00117 00118 text = phiLabelText [tick] = new SoText2; 00119 text->justification = SoText2::CENTER; 00120 phiLabels->addChild (text); 00121 phiLabels->addChild (phiTranslation); 00122 } 00123 00124 text = phiLabelText [tick] = new SoText2; 00125 text->justification = SoText2::CENTER; 00126 phiLabels->addChild (text); 00127 00128 phiLabelText [0]->string = "p/4"; 00129 phiLabelText [1]->string = "p/2"; 00130 phiLabelText [2]->string = "3p/4"; 00131 phiLabelText [3]->string = "p"; 00132 phiLabelText [4]->string = "5p/4"; 00133 phiLabelText [5]->string = "3p/2"; 00134 phiLabelText [6]->string = "7p/4"; 00135 phiLabelText [7]->string = "2p"; 00136 00137 // now eta 00138 x = 2*M_PI; 00139 z = ceil (-maxEta.getValue ()); 00140 if (z == -maxEta.getValue ()) 00141 z += 1; // remove those end regions 00142 00143 SoTranslation *etaStart = new SoTranslation; 00144 SoTranslation *etaTranslation = new SoTranslation; 00145 00146 etaStart->translation = SbVec3f (-2 * LABEL_OFFSET, 0, z); 00147 etaTranslation->translation = SbVec3f (0, 0, 1); 00148 etaLabels->addChild (etaStart); 00149 00150 ticks = int (2 * abs (int (z)) + 1); 00151 for (tick = 0; tick < ticks; tick++, z++) 00152 { 00153 vtx->vertex.set1Value (vertex, SbVec3f (0, 0, z)); 00154 coords.set1Value (coord++, vertex++); 00155 vtx->vertex.set1Value (vertex, SbVec3f (x, 0, z)); 00156 coords.set1Value (coord++, vertex++); 00157 coords.set1Value (coord++, SO_END_LINE_INDEX); 00158 00159 text = new SoText2; 00160 text->justification = SoText2::CENTER; 00161 char textLabel [10]; 00162 sprintf (textLabel, "%.0f", z); 00163 text->string = textLabel; 00164 etaLabels->addChild (text); 00165 etaLabels->addChild (etaTranslation); 00166 } 00167 00168 grid->vertexProperty = vtx; 00169 grid->coordIndex = coords; 00170 00171 // labels 00172 #if defined WIN32 00173 labelScaleFont->name = "Times New Roman;Regular"; 00174 #elif defined __APPLE__ 00175 labelScaleFont->name = "Times New Roman"; 00176 #else 00177 labelScaleFont->name = "Times-Roman"; 00178 #endif 00179 00180 // scale 00181 char scaleChars[12] = "1.0 GeV"; 00182 sprintf (scaleChars, "%.2G GeV", heightScale.getValue ()); 00183 labelScaleText->string = scaleChars; 00184 labelScaleOffset->translation 00185 = SbVec3f (-LABEL_OFFSET, 1, -maxEta.getValue()-LABEL_OFFSET); 00186 00187 // axis labels 00188 // font->size = 14.0; //in points-- CHANGE THE SIZE WITH EXTREME CARE 00189 font->name = "Symbol"; 00190 labelXOffset->translation = SbVec3f (M_PI, 0, -maxEta.getValue() - 8 * LABEL_OFFSET); 00191 labelXText->string = "f"; 00192 labelZOffset->translation = SbVec3f (-8 * LABEL_OFFSET, 0, 0); 00193 labelZText->string = "h"; 00194 00195 // set parts 00196 setPart ("phiLabels", phiLabels); 00197 setPart ("etaLabels", etaLabels); 00198 setPart ("grid", grid); 00199 setPart ("font", font); 00200 setPart ("labelScaleFont", labelScaleFont); 00201 setPart ("labelScaleOffset",labelScaleOffset); 00202 setPart ("labelScaleText", labelScaleText); 00203 setPart ("labelXOffset", labelXOffset); 00204 setPart ("labelXText", labelXText); 00205 setPart ("labelZOffset", labelZOffset); 00206 setPart ("labelZText", labelZText); 00207 }
void IgSoLegoPlot::setData | ( | const IgSbLegoHistogram & | histo | ) |
Load pre-binned data into the lego plot.
Definition at line 211 of file IgSoLegoPlot.cc.
References divsEta, divsPhi, heightScale, it, IgSbLegoBin::ix, IgSbLegoBin::iy, maxEta, and minEnergy.
00212 { 00213 if (hist.empty ()) 00214 { 00215 divsEta = divsPhi = 1; 00216 setPart ("legos", 0); 00217 return; 00218 } 00219 00220 // data is arranged cycles first in phi, then in eta; lowest to highest 00221 // em then hadronic 00222 SoMaterial *emMaterial = new SoMaterial; 00223 SoMaterial *hadMaterial = new SoMaterial; 00224 SoSeparator *legos = new SoSeparator; 00225 00226 emMaterial->emissiveColor.setValue (0.2F, 0.F, 0.F); 00227 emMaterial->diffuseColor.setValue (0.F, 1.F, 0.F); 00228 hadMaterial->emissiveColor.setValue (0.2F, 0.F, 0.F); 00229 hadMaterial->diffuseColor.setValue (0.F, 0.F, 1.F); 00230 00231 IgSbLegoBin largest = hist.rbegin ()->first; 00232 divsEta = largest.ix + 1; 00233 divsPhi = largest.iy + 1; 00234 00235 // x is phi; z is eta 00236 float phiSize = 2 * M_PI / divsPhi.getValue (); 00237 float etaSize = 2 * maxEta.getValue () / divsEta.getValue (); 00238 00239 for (IgSbLegoHistogram::const_iterator it = hist.begin (); it != hist.end (); it++) 00240 { 00241 float emE = it->second.emE; 00242 float E = it->second.E; 00243 if (emE > minEnergy.getValue () || E > minEnergy.getValue ()) 00244 { 00245 int iPhi = it->first.ix; 00246 int iEta = it->first.iy; 00247 float zEta = iEta * etaSize + etaSize / 2; 00248 float xPhi = iPhi * phiSize + phiSize / 2; 00249 00250 SoSeparator *sep = new SoSeparator; 00251 SoTranslation *trans = new SoTranslation; 00252 00253 trans->translation 00254 = SbVec3f (xPhi, emE / 2 / heightScale.getValue (), 00255 zEta - maxEta.getValue ()); 00256 sep->addChild (trans); 00257 00258 float firstOffset = 0; 00259 if (emE > minEnergy.getValue ()) 00260 { 00261 SoCube *cube = new SoCube; 00262 cube->width = phiSize; 00263 cube->depth = etaSize; 00264 cube->height = emE / heightScale.getValue (); 00265 sep->addChild (emMaterial); 00266 sep->addChild (cube); 00267 firstOffset = emE; 00268 } 00269 00270 if (E > minEnergy.getValue ()) 00271 { 00272 trans = new SoTranslation; 00273 trans->translation 00274 = SbVec3f (0.F, (firstOffset+E) / 2 / heightScale.getValue (), 0.F); 00275 sep->addChild (trans); 00276 00277 SoCube *cube = new SoCube; 00278 cube->width = phiSize; 00279 cube->depth = etaSize; 00280 cube->height = E / heightScale.getValue (); 00281 sep->addChild (hadMaterial); 00282 sep->addChild (cube); 00283 } 00284 00285 legos->addChild (sep); 00286 } 00287 } 00288 00289 setPart ("legos", legos); 00290 }
IgSoLegoPlot::SO_KIT_CATALOG_ENTRY_HEADER | ( | legos | ) | [private] |
IgSoLegoPlot::SO_KIT_CATALOG_ENTRY_HEADER | ( | labelZText | ) | [private] |
IgSoLegoPlot::SO_KIT_CATALOG_ENTRY_HEADER | ( | labelZOffset | ) | [private] |
IgSoLegoPlot::SO_KIT_CATALOG_ENTRY_HEADER | ( | labelZ | ) | [private] |
IgSoLegoPlot::SO_KIT_CATALOG_ENTRY_HEADER | ( | labelXText | ) | [private] |
IgSoLegoPlot::SO_KIT_CATALOG_ENTRY_HEADER | ( | labelXOffset | ) | [private] |
IgSoLegoPlot::SO_KIT_CATALOG_ENTRY_HEADER | ( | labelX | ) | [private] |
IgSoLegoPlot::SO_KIT_CATALOG_ENTRY_HEADER | ( | labelScaleText | ) | [private] |
IgSoLegoPlot::SO_KIT_CATALOG_ENTRY_HEADER | ( | labelScaleOffset | ) | [private] |
IgSoLegoPlot::SO_KIT_CATALOG_ENTRY_HEADER | ( | labelScaleFont | ) | [private] |
IgSoLegoPlot::SO_KIT_CATALOG_ENTRY_HEADER | ( | labelScale | ) | [private] |
IgSoLegoPlot::SO_KIT_CATALOG_ENTRY_HEADER | ( | labels | ) | [private] |
IgSoLegoPlot::SO_KIT_CATALOG_ENTRY_HEADER | ( | font | ) | [private] |
IgSoLegoPlot::SO_KIT_CATALOG_ENTRY_HEADER | ( | grid | ) | [private] |
IgSoLegoPlot::SO_KIT_CATALOG_ENTRY_HEADER | ( | etaLabels | ) | [private] |
IgSoLegoPlot::SO_KIT_CATALOG_ENTRY_HEADER | ( | phiLabels | ) | [private] |
IgSoLegoPlot::SO_KIT_HEADER | ( | IgSoLegoPlot | ) | [private] |
SoSFBool IgSoLegoPlot::displayNegTowers |
SoSFInt32 IgSoLegoPlot::divsEta |
SoSFInt32 IgSoLegoPlot::divsPhi |
SoSFFloat IgSoLegoPlot::heightScale |
Definition at line 84 of file IgSoLegoPlot.h.
Referenced by IgSoLegoPlot(), refresh(), and setData().
SoSFFloat IgSoLegoPlot::maxEta |
Definition at line 85 of file IgSoLegoPlot.h.
Referenced by IgSoLegoPlot(), refresh(), and setData().
SoSFFloat IgSoLegoPlot::minEnergy |