#include <VisReco/VisMuonCSC/interface/VisCSCChamberDrawer.h>
Public Member Functions | |
bool | getOutline (SoSeparator *sep, const edm::ESHandle< CSCGeometry > pGeom, const CSCDetId id) |
VisCSCChamberDrawer (void) | |
Private Attributes | |
bool | m_chamberFlag |
uint32_t | m_lineColor |
returns the outline of the chamber | |
float | m_lineThickness |
class VisCSCChamberDrawer
Definition at line 17 of file VisCSCChamberDrawer.h.
VisCSCChamberDrawer::VisCSCChamberDrawer | ( | void | ) |
Definition at line 18 of file VisCSCChamberDrawer.cc.
00018 : m_lineColor(0x59595900), m_lineThickness(2.0F), m_chamberFlag(true) 00019 { 00020 }
bool VisCSCChamberDrawer::getOutline | ( | SoSeparator * | sep, | |
const edm::ESHandle< CSCGeometry > | pGeom, | |||
const CSCDetId | id | |||
) |
Definition at line 22 of file VisCSCChamberDrawer.cc.
References CSCLayer::geometry(), i, edm::ESHandle< T >::isValid(), m_chamberFlag, m_lineColor, m_lineThickness, TrapezoidalPlaneBounds::parameters(), GeomDet::surface(), Surface::toGlobal(), x, y, and z.
Referenced by VisCSCStripDigiTwig::update(), VisCSCALCTDigiTwig::update(), VisCSCComparatorDigiTwig::update(), VisCSCCorrelatedLCTDigiTwig::update(), VisCSCSegmentTwig::update(), VisCSCCLCTDigiTwig::update(), and VisCSCWireDigiTwig::update().
00023 { 00024 if (!pGeom.isValid() || !m_chamberFlag) return false; 00025 00026 SbColor lineColor; 00027 float transparency = 0.0f; 00028 lineColor.setPackedValue(static_cast<uint32_t>(m_lineColor), transparency); 00029 SoMaterial *mat = new SoMaterial; 00030 mat->diffuseColor.setValue (lineColor); 00031 SoDrawStyle *drawStyle = new SoDrawStyle; 00032 if (m_lineThickness != 0.F) drawStyle->lineWidth = m_lineThickness; 00033 00034 00035 sep->addChild(mat); 00036 sep->addChild(drawStyle); 00037 00038 const CSCLayer *pLayer = pGeom->layer (id); 00039 if (!pLayer) 00040 { 00041 pLayer = pGeom->layer(4); // pick a default if not present 00042 //assert (pLayer); 00043 } 00044 const CSCLayerGeometry *layerGeom = pLayer->geometry (); 00045 // params: half bottom edge, half top edge, half thickness, half apothem 00046 const std::vector<float> trapezBounds = layerGeom->parameters (); 00047 const GeomDet *det = pGeom->idToDet(id); 00048 std::vector<Surface::GlobalPoint> crossPoint; 00049 // get vertices, converting from cm to meters 00050 crossPoint.push_back (det->surface ().toGlobal 00051 (LocalPoint (-trapezBounds [0], -trapezBounds [3], 0.0))); 00052 crossPoint.push_back (det->surface ().toGlobal 00053 (LocalPoint ( trapezBounds [0], -trapezBounds [3], 0.0))); 00054 crossPoint.push_back (det->surface ().toGlobal 00055 (LocalPoint ( trapezBounds [1], trapezBounds [3], 0.0))); 00056 crossPoint.push_back (det->surface ().toGlobal 00057 (LocalPoint (-trapezBounds [1], trapezBounds [3], 0.0))); 00058 crossPoint.push_back(crossPoint.front()); // close the loop 00059 std::vector<SbVec3f> pts(5); 00060 for (int i=0; i < 5; i++) 00061 { 00062 pts[i] = SbVec3f(crossPoint[i].x(), crossPoint[i].y(), crossPoint[i].z())*0.01F; 00063 } 00064 SoCoordinate3 *vert = new SoCoordinate3; 00065 vert->point.setValues(0, 5, &pts[0]); 00066 00067 sep->addChild(vert); 00068 SoLineSet *trapez = new SoLineSet; 00069 sep->addChild (trapez); 00070 00071 return true; 00072 }
bool VisCSCChamberDrawer::m_chamberFlag [private] |
uint32_t VisCSCChamberDrawer::m_lineColor [private] |
returns the outline of the chamber
Definition at line 24 of file VisCSCChamberDrawer.h.
Referenced by getOutline().
float VisCSCChamberDrawer::m_lineThickness [private] |