#include <VisReco/VisMuonCSC/interface/VisCSCSegmentTwig.h>
Public Member Functions | |
virtual void | onNewEvent (const edm::Event &event, const edm::EventSetup &eventSetup) |
virtual void | update (IgRZRep *rep) |
Update object property description. | |
virtual void | update (IgRPhiRep *rep) |
Update object property description. | |
virtual void | update (IgTextRep *rep) |
Update object property description. | |
virtual void | update (IgLegoRep *rep) |
Update object property description. | |
virtual void | update (Ig3DRep *rep) |
Update object property description. | |
VisCSCSegmentTwig (IgState *state, IgTwig *parent, const std::string &name="", const std::string &friendlyName="", const std::string &moduleLabel="", const std::string &instanceName="", const std::string &processName="") | |
Private Attributes | |
std::set< CSCDetId > | m_dets |
bool | m_envelopeFlag |
const std::string | m_friendlyName |
const std::string | m_instanceName |
int | m_lineColor |
int | m_lineColorEnvelope |
float | m_lineThickness |
float | m_lineThicknessEnvelope |
const std::string | m_moduleLabel |
edm::ESHandle< CSCGeometry > | m_pDD |
const std::string | m_processName |
std::vector< CSCSegment > | m_segs |
std::string | m_text |
Definition at line 23 of file VisCSCSegmentTwig.h.
VisCSCSegmentTwig::VisCSCSegmentTwig | ( | IgState * | state, | |
IgTwig * | parent, | |||
const std::string & | name = "" , |
|||
const std::string & | friendlyName = "" , |
|||
const std::string & | moduleLabel = "" , |
|||
const std::string & | instanceName = "" , |
|||
const std::string & | processName = "" | |||
) |
Definition at line 62 of file VisCSCSegmentTwig.cc.
References createThisTwig(), edm::TypeID::friendlyClassName(), DBSPlugin::get(), and VisTwigFactroyService::registerTwig().
00068 : VisQueuedTwig (state, parent, name), 00069 m_text (name), 00070 m_friendlyName (friendlyName), 00071 m_moduleLabel (moduleLabel), 00072 m_instanceName (instanceName), 00073 m_processName (processName), 00074 m_lineThickness(0.F), 00075 m_lineThicknessEnvelope(2.0F), 00076 m_lineColor(0xFF000000), 00077 m_lineColorEnvelope(0xFF000000), 00078 m_envelopeFlag(true) 00079 { 00080 VisTwigFactroyService *tfService = VisTwigFactroyService::get (state); 00081 if (! tfService) 00082 { 00083 tfService = new VisTwigFactroyService (state); 00084 } 00085 edm::TypeID digiCollID (typeid (CSCSegmentCollection)); 00086 tfService->registerTwig (digiCollID.friendlyClassName (), &createThisTwig); 00087 }
void VisCSCSegmentTwig::onNewEvent | ( | const edm::Event & | event, | |
const edm::EventSetup & | eventSetup | |||
) | [virtual] |
Reimplemented from VisQueuedTwig.
Definition at line 90 of file VisCSCSegmentTwig.cc.
References arg, c, e, exception, edm::EventSetup::get(), i, edm::Event::id(), m_friendlyName, m_instanceName, m_moduleLabel, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_pDD, m_processName, m_segs, m_text, VisQueuedTwig::onBaseInvalidate(), and VisQueuedTwig::onNewEvent().
00092 { 00093 // Get debugging dump. 00094 VisQueuedTwig::onNewEvent (event, eventSetup); 00095 00096 m_segs.clear (); 00097 m_text = (QString ("Run # %1, event # %2") 00098 .arg (event.id ().run ()) 00099 .arg (event.id ().event ()).latin1 ()); 00100 00101 std::vector<edm::Handle<CSCSegmentCollection> > segCollections; 00102 00103 try 00104 { 00105 if ((! m_friendlyName.empty ()) || (! m_moduleLabel.empty ()) || (! m_instanceName.empty ()) || (! m_processName.empty ())) 00106 { 00107 VisEventSelector visSel (m_friendlyName, m_moduleLabel, m_instanceName, m_processName); 00108 event.getMany (visSel, segCollections); 00109 } 00110 else 00111 { 00112 event.getManyByType (segCollections); 00113 } 00114 00115 eventSetup.get<MuonGeometryRecord> ().get (m_pDD); 00116 } 00117 catch (cms::Exception& e) 00118 { 00119 if (this->m_onCmsException) 00120 this->m_onCmsException (&e); 00121 } 00122 catch (lat::Error &e) 00123 { 00124 if (this->m_onError) 00125 this->m_onError (&e); 00126 } 00127 catch (std::exception &e) 00128 { 00129 if (this->m_onException) 00130 this->m_onException (&e); 00131 } 00132 catch (...) 00133 { 00134 if (this->m_onUnhandledException) 00135 this->m_onUnhandledException (); 00136 } 00137 00138 if (! segCollections.empty ()) 00139 { 00140 std::vector<edm::Handle<CSCSegmentCollection> >::iterator i; 00141 std::vector<edm::Handle<CSCSegmentCollection> >::iterator iEnd; 00142 for (i = segCollections.begin (), iEnd = segCollections.end (); i != iEnd; ++i) 00143 { 00144 const CSCSegmentCollection& c = *(*i); 00145 00146 CSCSegmentCollection::const_iterator segIt; 00147 CSCSegmentCollection::const_iterator segItEnd; 00148 for (segIt = c.begin (), segItEnd = c.end (); segIt != segItEnd; ++segIt) 00149 { 00150 m_segs.push_back (*segIt); 00151 } 00152 } 00153 } 00154 00155 VisQueuedTwig::onBaseInvalidate (); 00156 }
Update object property description.
Reimplemented from VisQueuedTwig.
Definition at line 440 of file VisCSCSegmentTwig.cc.
References BoundSurface::bounds(), Ig3DBaseRep::clear(), dir, e, exception, g1, g2, edm::ESHandle< T >::isValid(), parsecf::pyparsing::line(), VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_pDD, m_segs, Ig3DBaseRep::node(), GeomDet::surface(), Bounds::thickness(), Surface::toGlobal(), VisQueuedTwig::update(), PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), y, PV3DBase< T, PVType, FrameType >::z(), and z.
00441 { 00442 // Get debugging dump. 00443 VisQueuedTwig::update (rep); 00444 00445 IgQtLock (); 00446 00447 SoSeparator *sep = new SoSeparator; 00448 SoMaterial *mat = new SoMaterial; 00449 mat->ambientColor.setValue (0.135, 0.2225, 0.1575); 00450 00451 mat->diffuseColor.setValue (1.00, 0.28, 0.49); //light red 00452 00453 mat->specularColor.setValue (0.316228, 0.316228, 0.316228); 00454 mat->emissiveColor.setValue(0.0, 0.0, 0.0); 00455 mat->shininess = 0.1; 00456 sep->addChild (mat); 00457 00458 SoDrawStyle *sty = new SoDrawStyle; 00459 sty->style = SoDrawStyle::LINES; 00460 sty->lineWidth.setValue (6.0); 00461 sep->addChild (sty); 00462 00463 if (! m_segs.empty () && m_pDD.isValid ()) 00464 { 00465 try 00466 { 00467 // 00468 // Muon Endcap Segment 00469 // 00470 00471 for (std::vector<CSCSegment>::const_iterator iseg = m_segs.begin (), isegEnd = m_segs.end (); iseg != isegEnd; ++iseg) 00472 { 00473 const GeomDet *det = m_pDD->idToDet ((*iseg).cscDetId ()); 00474 00475 // Local pos & dir 00476 LocalPoint pos = (*iseg).localPosition(); 00477 LocalVector dir = (*iseg).localDirection(); 00478 00479 // Chamber thickness (in z) 00480 float halfThickness = det->surface ().bounds ().thickness () / 2.; 00481 00482 SoVertexProperty *vtx = new SoVertexProperty; 00483 00484 SoLineSet *line = new SoLineSet; 00485 line->numVertices = 2; 00486 00487 float z1 = halfThickness; 00488 float x1 = pos.x() + dir.x()*z1/dir.z(); 00489 float y1 = pos.y() + dir.y()*z1/dir.z(); 00490 GlobalPoint g1 = det->surface().toGlobal( LocalPoint(x1,y1,z1) ); 00491 00492 float z2 = -halfThickness; 00493 float x2 = pos.x() + dir.x()*z2/dir.z(); 00494 float y2 = pos.y() + dir.y()*z2/dir.z(); 00495 GlobalPoint g2 = det->surface().toGlobal( LocalPoint(x2,y2,z2) ); 00496 00497 float x = g1.x () / 100.0; // cm -> m 00498 float y = g1.y () / 100.0; // cm -> m 00499 float z = g1.z () / 100.0; // cm -> m 00500 00501 vtx->vertex.set1Value(0,SbVec3f(x,y,z)); 00502 00503 x = g2.x () / 100.0; // cm -> m 00504 y = g2.y () / 100.0; // cm -> m 00505 z = g2.z () / 100.0; // cm -> m 00506 00507 vtx->vertex.set1Value(1,SbVec3f(x,y,z)); 00508 00509 line->vertexProperty = vtx; 00510 00511 sep->addChild (line); 00512 } 00513 } 00514 catch (cms::Exception& e) 00515 { 00516 if (this->m_onCmsException) 00517 this->m_onCmsException (&e); 00518 } 00519 catch (lat::Error &e) 00520 { 00521 if (this->m_onError) 00522 this->m_onError (&e); 00523 } 00524 catch (std::exception &e) 00525 { 00526 if (this->m_onException) 00527 this->m_onException (&e); 00528 } 00529 catch (...) 00530 { 00531 if (this->m_onUnhandledException) 00532 this->m_onUnhandledException (); 00533 } 00534 } 00535 00536 rep->clear (); 00537 rep->node ()->addChild (sep); 00538 }
Update object property description.
Reimplemented from VisQueuedTwig.
Definition at line 338 of file VisCSCSegmentTwig.cc.
References BoundSurface::bounds(), Ig3DBaseRep::clear(), dir, e, exception, g1, g2, edm::ESHandle< T >::isValid(), parsecf::pyparsing::line(), VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_pDD, m_segs, Ig3DBaseRep::node(), GeomDet::surface(), Bounds::thickness(), Surface::toGlobal(), VisQueuedTwig::update(), PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), y, PV3DBase< T, PVType, FrameType >::z(), and z.
00339 { 00340 // Get debugging dump. 00341 VisQueuedTwig::update (rep); 00342 00343 IgQtLock (); 00344 00345 SoSeparator *sep = new SoSeparator; 00346 SoMaterial *mat = new SoMaterial; 00347 mat->ambientColor.setValue (0.135, 0.2225, 0.1575); 00348 00349 mat->diffuseColor.setValue (1.00, 0.28, 0.49); // light red 00350 00351 mat->specularColor.setValue (0.316228, 0.316228, 0.316228); 00352 mat->emissiveColor.setValue(0.0, 0.0, 0.0); 00353 mat->shininess = 0.1; 00354 sep->addChild (mat); 00355 00356 SoDrawStyle *sty = new SoDrawStyle; 00357 sty->style = SoDrawStyle::LINES; 00358 sty->lineWidth.setValue (1.0); 00359 sep->addChild (sty); 00360 00361 if (! m_segs.empty () && m_pDD.isValid ()) 00362 { 00363 try 00364 { 00365 // 00366 // Muon Endcap Segment 00367 // 00368 00369 for (std::vector<CSCSegment>::const_iterator iseg = m_segs.begin (), isegEnd = m_segs.end (); iseg != isegEnd; ++iseg) 00370 { 00371 const GeomDet *det = m_pDD->idToDet ((*iseg).cscDetId ()); 00372 00373 // Local pos & dir 00374 LocalPoint pos = (*iseg).localPosition (); 00375 LocalVector dir = (*iseg).localDirection (); 00376 00377 // Chamber thickness (in z) 00378 float halfThickness = det->surface ().bounds ().thickness ()/2.; 00379 00380 SoVertexProperty *vtx = new SoVertexProperty; 00381 00382 SoLineSet *line = new SoLineSet; 00383 line->numVertices = 2; 00384 00385 float z1 = halfThickness; 00386 float x1 = pos.x() + dir.x()*z1/dir.z(); 00387 float y1 = pos.y() + dir.y()*z1/dir.z(); 00388 GlobalPoint g1 = det->surface().toGlobal( LocalPoint(x1,y1,z1) ); 00389 00390 float z2 = -halfThickness; 00391 float x2 = pos.x() + dir.x()*z2/dir.z(); 00392 float y2 = pos.y() + dir.y()*z2/dir.z(); 00393 GlobalPoint g2 = det->surface().toGlobal( LocalPoint(x2,y2,z2) ); 00394 00395 float x = g1.x () / 100.0; // cm -> m 00396 float y = g1.y () / 100.0; // cm -> m 00397 float z = g1.z () / 100.0; // cm -> m 00398 00399 vtx->vertex.set1Value(0,SbVec3f(x,y,z)); 00400 00401 x = g2.x () / 100.0; // cm -> m 00402 y = g2.y () / 100.0; // cm -> m 00403 z = g2.z () / 100.0; // cm -> m 00404 00405 vtx->vertex.set1Value(1,SbVec3f(x,y,z)); 00406 00407 line->vertexProperty = vtx; 00408 00409 sep->addChild (line); 00410 } 00411 } 00412 catch (cms::Exception& e) 00413 { 00414 if (this->m_onCmsException) 00415 this->m_onCmsException (&e); 00416 } 00417 catch (lat::Error &e) 00418 { 00419 if (this->m_onError) 00420 this->m_onError (&e); 00421 } 00422 catch (std::exception &e) 00423 { 00424 if (this->m_onException) 00425 this->m_onException (&e); 00426 } 00427 catch (...) 00428 { 00429 if (this->m_onUnhandledException) 00430 this->m_onUnhandledException (); 00431 } 00432 } 00433 00434 rep->clear (); 00435 rep->node ()->addChild (sep); 00436 }
Update object property description.
Reimplemented from VisQueuedTwig.
Definition at line 160 of file VisCSCSegmentTwig.cc.
References dir, e, exception, edm::ESHandle< T >::isValid(), VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_pDD, m_segs, PV3DBase< T, PVType, FrameType >::phi(), IgTextRep::setText(), GeomDet::surface(), Surface::toGlobal(), VisQueuedTwig::update(), and PV3DBase< T, PVType, FrameType >::z().
00161 { 00162 // Get debugging dump. 00163 VisQueuedTwig::update (rep); 00164 00165 // Prepare the property description. 00166 std::ostringstream text; 00167 text << "Muon Endcap: CSC Track Segments<br>"; 00168 00169 if (! m_segs.empty () && m_pDD.isValid ()) 00170 { 00171 try 00172 { 00173 text << "<table width='100%' border=1>" 00174 << "<TR align = center>" 00175 << "<TH>Number</TH>" 00176 << "<TH>dim</TH>" 00177 << "<TH>position</TH>" 00178 << "<TH>direction</TH>" 00179 << "<TH>z [cm]</TH>" 00180 << "<TH>phi [rad]</TH>" 00181 << "<TH>chi2 / hits</TH>" 00182 << "</TR>"; 00183 text << setiosflags (std::ios::showpoint | std::ios::fixed); 00184 text.setf (std::ios::right, std::ios::adjustfield); 00185 00186 int nSegments = 0; 00187 00188 for (std::vector<CSCSegment>::const_iterator iseg = m_segs.begin (), isegEnd = m_segs.end (); iseg != isegEnd; ++iseg) 00189 { 00190 const GeomDet *det = m_pDD->idToDet ((*iseg).cscDetId ()); 00191 00192 GlobalPoint pos = det->surface ().toGlobal ((*iseg).localPosition ()); 00193 GlobalVector dir = det->surface ().toGlobal ((*iseg).localDirection ()); 00194 00195 text << "<TR align = right>" 00196 << "<TD>" << std::setw (2) << ++nSegments << "</TD>" 00197 << "<TD>" << std::setw (1) << "(*iseg).dimension ()" << "</TD>" 00198 << "<TD>" << std::setw (6) << std::setprecision (2) << pos << "</TD>" 00199 << "<TD>" << std::setw (6) << std::setprecision (2) << dir << "</TD>" 00200 << "<TD>" << std::setw (5) << std::setprecision (1) << pos.z () << "</TD>" 00201 << "<TD>" << std::setw (6) << std::setprecision (3) << pos.phi () << "</TD>" 00202 << "<TD>" << std::setw (6) << std::setprecision (2) << (*iseg).chi2 () 00203 << " / " << (*iseg).nRecHits () << "</TD>" 00204 << "</TR>"; 00205 } 00206 text << "</table>"; 00207 } 00208 catch (cms::Exception& e) 00209 { 00210 if (this->m_onCmsException) 00211 this->m_onCmsException (&e); 00212 } 00213 catch (lat::Error &e) 00214 { 00215 if (this->m_onError) 00216 this->m_onError (&e); 00217 } 00218 catch (std::exception &e) 00219 { 00220 if (this->m_onException) 00221 this->m_onException (&e); 00222 } 00223 catch (...) 00224 { 00225 if (this->m_onUnhandledException) 00226 this->m_onUnhandledException (); 00227 } 00228 } 00229 00230 // Send it over. 00231 IgQtLock (); 00232 rep->setText (text.str ()); 00233 }
Update object property description.
Reimplemented from VisQueuedTwig.
Definition at line 333 of file VisCSCSegmentTwig.cc.
Update object property description.
Reimplemented from VisQueuedTwig.
Definition at line 237 of file VisCSCSegmentTwig.cc.
References BoundSurface::bounds(), Ig3DBaseRep::clear(), d, dir, e, exception, g1, g2, VisCSCChamberDrawer::getOutline(), edm::ESHandle< T >::isValid(), m_dets, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_pDD, m_segs, Ig3DBaseRep::node(), GeomDet::surface(), Bounds::thickness(), Surface::toGlobal(), VisQueuedTwig::update(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
00238 { 00239 // Get debugging dump. 00240 VisQueuedTwig::update (rep); 00241 00242 IgQtLock (); 00243 rep->clear (); 00244 m_dets.clear (); 00245 00246 SoSeparator *sep = new SoSeparator; 00247 00248 if (! m_segs.empty () && m_pDD.isValid ()) 00249 { 00250 VisCSCChamberDrawer d; 00251 00252 try 00253 { 00254 // 00255 // Muon Endcap Segment 00256 // 00257 int nVtx = 0; 00258 SoCoordinate3 *pts = new SoCoordinate3; 00259 00260 for (std::vector<CSCSegment>::const_iterator iseg = m_segs.begin (), isegEnd = m_segs.end (); iseg != isegEnd; ++iseg) 00261 { 00262 const CSCDetId& id = (*iseg).cscDetId(); 00263 const GeomDet *det = m_pDD->idToDet (id); 00264 00265 // This is a frame around the (active) layer 00266 if (m_dets.find(id) == m_dets.end() ) 00267 { 00268 m_dets.insert(id); 00269 // This is a frame around the (active) layer 00270 d.getOutline(sep, m_pDD, id); 00271 } 00272 00273 // Local pos & dir 00274 LocalPoint pos = (*iseg).localPosition(); 00275 LocalVector dir = (*iseg).localDirection(); 00276 00277 // Chamber thickness (in z) 00278 float halfThickness = det->surface ().bounds ().thickness () / 2.; 00279 00280 00281 float z1 = halfThickness; 00282 float x1 = pos.x() + dir.x()*z1/dir.z(); 00283 float y1 = pos.y() + dir.y()*z1/dir.z(); 00284 GlobalPoint g1 = det->surface().toGlobal( LocalPoint(x1,y1,z1) ); 00285 00286 float z2 = -halfThickness; 00287 float x2 = pos.x() + dir.x()*z2/dir.z(); 00288 float y2 = pos.y() + dir.y()*z2/dir.z(); 00289 GlobalPoint g2 = det->surface().toGlobal( LocalPoint(x2,y2,z2) ); 00290 00291 SbVec3f ptA( g1.x(), g1.y(), g1.z() ); 00292 ptA *= 0.01F; // cm -> m 00293 00294 00295 pts->point.set1Value ( nVtx++, ptA ); 00296 SbVec3f ptB( g2.x(), g2.y(), g2.z() ); 00297 ptB *= 0.01F; // cm->m 00298 00299 pts->point.set1Value ( nVtx++, ptB ); 00300 00301 } 00302 sep->addChild(pts); 00303 00304 } 00305 catch (cms::Exception& e) 00306 { 00307 if (this->m_onCmsException) 00308 this->m_onCmsException (&e); 00309 } 00310 catch (lat::Error &e) 00311 { 00312 if (this->m_onError) 00313 this->m_onError (&e); 00314 } 00315 catch (std::exception &e) 00316 { 00317 if (this->m_onException) 00318 this->m_onException (&e); 00319 } 00320 catch (...) 00321 { 00322 if (this->m_onUnhandledException) 00323 this->m_onUnhandledException (); 00324 } 00325 } 00326 00327 rep->clear (); 00328 rep->node ()->addChild (sep); 00329 }
std::set<CSCDetId> VisCSCSegmentTwig::m_dets [private] |
bool VisCSCSegmentTwig::m_envelopeFlag [private] |
Definition at line 57 of file VisCSCSegmentTwig.h.
const std::string VisCSCSegmentTwig::m_friendlyName [private] |
const std::string VisCSCSegmentTwig::m_instanceName [private] |
int VisCSCSegmentTwig::m_lineColor [private] |
Definition at line 55 of file VisCSCSegmentTwig.h.
int VisCSCSegmentTwig::m_lineColorEnvelope [private] |
Definition at line 56 of file VisCSCSegmentTwig.h.
float VisCSCSegmentTwig::m_lineThickness [private] |
Definition at line 53 of file VisCSCSegmentTwig.h.
float VisCSCSegmentTwig::m_lineThicknessEnvelope [private] |
Definition at line 54 of file VisCSCSegmentTwig.h.
const std::string VisCSCSegmentTwig::m_moduleLabel [private] |
edm::ESHandle<CSCGeometry> VisCSCSegmentTwig::m_pDD [private] |
const std::string VisCSCSegmentTwig::m_processName [private] |
std::vector<CSCSegment> VisCSCSegmentTwig::m_segs [private] |
std::string VisCSCSegmentTwig::m_text [private] |