![]() |
![]() |
#include <VisReco/VisTracker/interface/VisTrackerClusterTwig.h>
Public Member Functions | |
virtual void | onNewEvent (const edm::Event &event, const edm::EventSetup &eventSetup) |
virtual void | twigChanged (void) |
virtual void | update (IgRZRep *rep) |
virtual void | update (IgRPhiRep *rep) |
virtual void | update (IgTextRep *rep) |
virtual void | update (IgLegoRep *rep) |
virtual void | update (Ig3DRep *rep) |
VisTrackerClusterTwig (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 | |
VisSiStripClusterPointSize | m_clusterPointSize |
const std::string | m_friendlyName |
const std::string | m_instanceName |
const std::string | m_moduleLabel |
edm::ESHandle< TrackerGeometry > | m_pDD |
const std::string | m_processName |
VisLegoScale | m_scale |
VisSiStripClusterRep | m_siStripClusterRep |
std::string | m_text |
std::vector< std::pair< DetId, SiStripCluster > > | s_cluster |
Definition at line 26 of file VisTrackerClusterTwig.h.
VisTrackerClusterTwig::VisTrackerClusterTwig | ( | 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 73 of file VisTrackerClusterTwig.cc.
References createThisTwig(), edm::TypeID::friendlyClassName(), DBSPlugin::get(), and VisTwigFactroyService::registerTwig().
00079 : VisQueuedTwig (state, parent, name), 00080 m_text (name), 00081 m_friendlyName (friendlyName), 00082 m_moduleLabel (moduleLabel), 00083 m_instanceName (instanceName), 00084 m_processName (processName), 00085 m_clusterPointSize (state, lat::CreateCallback (this, &VisTrackerClusterTwig::twigChanged)), 00086 m_siStripClusterRep (state, lat::CreateCallback (this, &VisTrackerClusterTwig::twigChanged)), 00087 m_scale (state, lat::CreateCallback (this, &VisTrackerClusterTwig::twigChanged)) 00088 { 00089 VisTwigFactroyService *tfService = VisTwigFactroyService::get (state); 00090 if (! tfService) 00091 { 00092 tfService = new VisTwigFactroyService (state); 00093 } 00094 edm::TypeID clusterCollID (typeid (edmNew::DetSetVector<SiStripCluster>)); 00095 tfService->registerTwig (clusterCollID.friendlyClassName (), &createThisTwig); 00096 }
void VisTrackerClusterTwig::onNewEvent | ( | const edm::Event & | event, | |
const edm::EventSetup & | eventSetup | |||
) | [virtual] |
Reimplemented from VisQueuedTwig.
Definition at line 103 of file VisTrackerClusterTwig.cc.
References cms::Exception::append(), arg, edmNew::DetSetVector< T >::begin(), edm::Event::bunchCrossing(), c, ds, e, edmNew::DetSetVector< T >::end(), edm::EventID::event(), exception, edm::EventSetup::get(), i, edm::Event::id(), IgRepSet::invalidate(), LFfwvis, LOG, edm::Event::luminosityBlock(), m_friendlyName, m_instanceName, m_moduleLabel, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_pDD, m_processName, m_text, IgSimpleTwig::name(), VisQueuedTwig::onNewEvent(), edm::Event::orbitNumber(), p, edm::EventID::run(), s_cluster, IgTwig::SELF_MASK, edmNew::DetSetVector< T >::size(), IgTwig::STRUCTURE_MASK, and GsfMatrixTools::trace().
00105 { 00106 // Get debugging dump. 00107 VisQueuedTwig::onNewEvent (event, eventSetup); 00108 00109 s_cluster.clear (); 00110 00111 m_text = QString ("Run %1, Event %2, LS %3, Orbit %4, BX %5") 00112 .arg (event.id ().run ()) 00113 .arg (event.id ().event ()) 00114 .arg (event.luminosityBlock ()) 00115 .arg (event.orbitNumber ()) 00116 .arg (event.bunchCrossing ()) 00117 .latin1 (); 00118 00119 std::vector< edm::Handle<edmNew::DetSetVector<SiStripCluster> > > cluster_collections; 00120 try 00121 { 00122 if ((! m_friendlyName.empty ()) || (! m_moduleLabel.empty ()) || (! m_instanceName.empty ()) || (! m_processName.empty ())) 00123 { 00124 VisEventSelector visSel (m_friendlyName, m_moduleLabel, m_instanceName, m_processName); 00125 event.getMany (visSel, cluster_collections); 00126 } 00127 eventSetup.get<TrackerDigiGeometryRecord> ().get (m_pDD); 00128 } 00129 catch (lat::Error& e) 00130 { 00131 if (this->m_onError) 00132 this->m_onError (&e); 00133 } 00134 catch (cms::Exception& e) 00135 { 00136 e.append (" from VisTrackerClusterTwig: "); 00137 e.append (this->name ()); 00138 00139 if (this->m_onCmsException) 00140 this->m_onCmsException (&e); 00141 } 00142 catch (std::exception& e) 00143 { 00144 if (this->m_onException) 00145 this->m_onException (&e); 00146 } 00147 catch (...) 00148 { 00149 if (this->m_onUnhandledException) 00150 this->m_onUnhandledException (); 00151 } 00152 00153 if (! cluster_collections.empty ()) 00154 { 00155 std::vector< edm::Handle<edmNew::DetSetVector<SiStripCluster> > >::iterator i; 00156 std::vector< edm::Handle<edmNew::DetSetVector<SiStripCluster> > >::iterator iEnd; 00157 for (i = cluster_collections.begin (), iEnd = cluster_collections.end (); i != iEnd; ++i) 00158 { 00159 const edmNew::DetSetVector<SiStripCluster> &c = *(*i); 00160 QString sizeStr = (QString ("%1").arg (c.size ())); 00161 QString nameStr = QString (this->name ()); 00162 int ib = nameStr.find ("["); 00163 int ie = nameStr.find ("]"); 00164 nameStr.replace (ib + 1, ie - 1, sizeStr); 00165 00166 this->name (nameStr); 00167 00168 edmNew::DetSetVector<SiStripCluster>::const_iterator DSViter = c.begin (); 00169 edmNew::DetSetVector<SiStripCluster>::const_iterator DSViterEnd = c.end (); 00170 00171 LOG (2, trace, LFfwvis, "There are " << c.size () << "SiStrip culsters\n"); 00172 00173 for (; DSViter != DSViterEnd; ++DSViter) 00174 { 00175 edmNew::DetSet<SiStripCluster> ds = *DSViter; 00176 const uint32_t detID = DSViter->detId(); 00177 DetId detid (detID); 00178 edmNew::DetSet<SiStripCluster>::const_iterator icluster = DSViter->begin(); 00179 edmNew::DetSet<SiStripCluster>::const_iterator iclusterEnd = DSViter->end(); 00180 for (; icluster != iclusterEnd; ++icluster) 00181 { 00182 std::pair<DetId, SiStripCluster> p; 00183 p.first = detid; 00184 p.second = (*icluster); 00185 s_cluster.push_back (p); 00186 } 00187 } 00188 } 00189 } 00190 00191 IgRepSet::invalidate (this, IgTwig::SELF_MASK | IgTwig::STRUCTURE_MASK); 00192 }
Definition at line 99 of file VisTrackerClusterTwig.cc.
References IgRepSet::invalidate(), and IgTwig::SELF_MASK.
00100 { IgRepSet::invalidate (this, SELF_MASK); }
Reimplemented from VisQueuedTwig.
Definition at line 575 of file VisTrackerClusterTwig.cc.
References cms::Exception::append(), c, Ig3DBaseRep::clear(), e, exception, SiStripCluster::firstStrip(), i, edm::ESHandle< T >::isValid(), StripTopology::localPosition(), m_clusterPointSize, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_pDD, Ig3DBaseRep::node(), s_cluster, StripGeomDetUnit::specificTopology(), funct::sqrt(), IgSbColorMap::unpack(), VisQueuedTwig::update(), VisActiveConfigurable< T >::value(), PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), y, PV3DBase< T, PVType, FrameType >::z(), and z.
00576 { 00577 // Get debugging dump. 00578 VisQueuedTwig::update (rep); 00579 00580 IgQtLock (); 00581 rep->clear (); 00582 00583 if (! s_cluster.empty () && m_pDD.isValid ()) 00584 { 00585 SoSeparator *sep = new SoSeparator; 00586 SoSeparator *colorSep = new SoSeparator; 00587 sep->addChild (colorSep); 00588 00589 SoTranslation *trans = new SoTranslation; 00590 trans->translation = SbVec3f (-0.05, 0, 0); 00591 sep->addChild (trans); 00592 00593 SoSeparator *yellowSep = new SoSeparator; 00594 sep->addChild (yellowSep); 00595 00596 SoMaterial *mat = new SoMaterial; 00597 float rgbcomponents [4]; 00598 IgSbColorMap::unpack (0x6600FF00, rgbcomponents); // Electric indigo 00599 mat->diffuseColor.setValue (SbColor (rgbcomponents)); 00600 colorSep->addChild (mat); 00601 00602 SoDrawStyle *drawStyle = new SoDrawStyle; 00603 drawStyle->pointSize = m_clusterPointSize.value (); 00604 colorSep->addChild (drawStyle); 00605 00606 SoMaterial *yellowMat = new SoMaterial; 00607 IgSbColorMap::unpack (0xCCFF0000, rgbcomponents); // Electric lime 00608 yellowMat->diffuseColor.setValue (SbColor (rgbcomponents)); 00609 yellowSep->addChild (yellowMat); 00610 00611 SoDrawStyle *yellowDrawStyle = new SoDrawStyle; 00612 if (m_clusterPointSize.value () > 2) 00613 yellowDrawStyle->pointSize = m_clusterPointSize.value () - 2; 00614 yellowSep->addChild (yellowDrawStyle); 00615 00616 try 00617 { 00618 SoVertexProperty *vertices = new SoVertexProperty; 00619 int nVrx = 0; 00620 00621 for (std::vector<std::pair<DetId, SiStripCluster> >::const_iterator i = s_cluster.begin (), iEnd = s_cluster.end (); i != iEnd; ++i) 00622 { 00623 const DetId& id = (*i).first; 00624 00625 SiStripCluster c = (*i).second; 00626 short firststrip = c.firstStrip (); 00627 const StripGeomDetUnit* theStripDet = dynamic_cast<const StripGeomDetUnit*>( (m_pDD->idToDet (id))); 00628 const StripTopology* theStripTopol = dynamic_cast<const StripTopology *>( &(theStripDet->specificTopology ())); 00629 GlobalPoint pos = (m_pDD->idToDet (id))->surface ().toGlobal (theStripTopol->localPosition (firststrip)); 00630 float x = -3.1; 00631 float y = sqrt (pos.x () * pos.x () + pos.y () * pos.y ()) / 100.0; 00632 if (pos.y () < 0.0) y = - y; 00633 float z = pos.z () / 100.0; // cm -> m 00634 00635 vertices->vertex.set1Value (nVrx++, SbVec3f (x, y, z)); 00636 } 00637 00638 vertices->vertex.setNum (s_cluster.size()); 00639 00640 SoPointSet *points = new SoPointSet; 00641 points->vertexProperty.setValue (vertices); 00642 points->numPoints.setValue (s_cluster.size()); 00643 00644 colorSep->addChild (points); 00645 yellowSep->addChild (points); 00646 } 00647 catch (cms::Exception& e) 00648 { 00649 e.append (" from VisTrackerClusterTwig: "); 00650 e.append (this->name ()); 00651 00652 if (this->m_onCmsException) 00653 this->m_onCmsException (&e); 00654 } 00655 catch (lat::Error &e) 00656 { 00657 if (this->m_onError) 00658 this->m_onError (&e); 00659 } 00660 catch (std::exception &e) 00661 { 00662 if (this->m_onException) 00663 this->m_onException (&e); 00664 } 00665 catch (...) 00666 { 00667 if (this->m_onUnhandledException) 00668 this->m_onUnhandledException (); 00669 } 00670 00671 rep->node ()->addChild (sep); 00672 } 00673 }
Reimplemented from VisQueuedTwig.
Definition at line 469 of file VisTrackerClusterTwig.cc.
References cms::Exception::append(), c, Ig3DBaseRep::clear(), e, exception, SiStripCluster::firstStrip(), StripGeomDetUnit::geographicalId(), i, edm::ESHandle< T >::isValid(), StripTopology::localPosition(), m_clusterPointSize, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_pDD, Ig3DBaseRep::node(), s_cluster, StripGeomDetUnit::specificTopology(), DetId::subdetId(), IgSbColorMap::unpack(), VisQueuedTwig::update(), VisActiveConfigurable< T >::value(), PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), y, and z.
00470 { 00471 // Get debugging dump. 00472 VisQueuedTwig::update (rep); 00473 00474 IgQtLock (); 00475 rep->clear (); 00476 00477 if (! s_cluster.empty () && m_pDD.isValid ()) 00478 { 00479 SoSeparator *sep = new SoSeparator; 00480 SoSeparator *colorSep = new SoSeparator; 00481 sep->addChild (colorSep); 00482 00483 SoTranslation *trans = new SoTranslation; 00484 trans->translation = SbVec3f (0, 0, 0.05); 00485 sep->addChild (trans); 00486 00487 SoSeparator *yellowSep = new SoSeparator; 00488 sep->addChild (yellowSep); 00489 00490 SoMaterial *mat = new SoMaterial; 00491 float rgbcomponents [4]; 00492 IgSbColorMap::unpack (0x6600FF00, rgbcomponents); // Electric indigo 00493 mat->diffuseColor.setValue (SbColor (rgbcomponents)); 00494 colorSep->addChild (mat); 00495 00496 // Electric lime 00497 SoDrawStyle *drawStyle = new SoDrawStyle; 00498 drawStyle->pointSize = m_clusterPointSize.value (); 00499 colorSep->addChild (drawStyle); 00500 00501 SoMaterial *yellowMat = new SoMaterial; 00502 IgSbColorMap::unpack (0xCCFF0000, rgbcomponents); // Electric lime 00503 yellowMat->diffuseColor.setValue (SbColor (rgbcomponents)); 00504 yellowSep->addChild (yellowMat); 00505 00506 SoDrawStyle *yellowDrawStyle = new SoDrawStyle; 00507 if (m_clusterPointSize.value () > 2) 00508 yellowDrawStyle->pointSize = m_clusterPointSize.value () - 2; 00509 yellowSep->addChild (yellowDrawStyle); 00510 00511 try 00512 { 00513 SoVertexProperty *vertices = new SoVertexProperty; 00514 int nVrtx = 0; 00515 for (std::vector<std::pair<DetId, SiStripCluster> >::const_iterator 00516 i = s_cluster.begin (), iEnd = s_cluster.end (); i != iEnd; ++i) 00517 { 00518 const DetId& id = (*i).first; 00519 00520 SiStripCluster c = (*i).second; 00521 short firststrip = c.firstStrip (); 00522 const StripGeomDetUnit* theStripDet = dynamic_cast<const StripGeomDetUnit*>( (m_pDD->idToDet (id))); 00523 // Draw only if in barrel. 00524 int subdet = theStripDet->geographicalId().subdetId(); 00525 if (subdet == 1 || subdet == 3 || subdet == 5) 00526 { 00527 const StripTopology* theStripTopol = dynamic_cast<const StripTopology *>( &(theStripDet->specificTopology ())); 00528 GlobalPoint pos = (m_pDD->idToDet (id))->surface().toGlobal(theStripTopol->localPosition(firststrip)); 00529 00530 float x = pos.x () / 100.0; // cm -> m 00531 float y = pos.y () / 100.0; // cm -> m 00532 float z = 3.1; // Z layer 00533 00534 vertices->vertex.set1Value (nVrtx++, SbVec3f (x, y, z)); 00535 } 00536 } 00537 00538 vertices->vertex.setNum (nVrtx); 00539 SoPointSet *points = new SoPointSet; 00540 points->vertexProperty.setValue (vertices); 00541 points->numPoints.setValue (nVrtx); 00542 00543 colorSep->addChild (points); 00544 yellowSep->addChild (points); 00545 } 00546 catch (cms::Exception& e) 00547 { 00548 e.append (" from VisTrackerClusterTwig: "); 00549 e.append (this->name ()); 00550 00551 if (this->m_onCmsException) 00552 this->m_onCmsException (&e); 00553 } 00554 catch (lat::Error &e) 00555 { 00556 if (this->m_onError) 00557 this->m_onError (&e); 00558 } 00559 catch (std::exception &e) 00560 { 00561 if (this->m_onException) 00562 this->m_onException (&e); 00563 } 00564 catch (...) 00565 { 00566 if (this->m_onUnhandledException) 00567 this->m_onUnhandledException (); 00568 } 00569 00570 rep->node ()->addChild (sep); 00571 } 00572 }
Reimplemented from VisQueuedTwig.
Definition at line 195 of file VisTrackerClusterTwig.cc.
References cms::Exception::append(), c, e, exception, SiStripCluster::firstStrip(), i, edm::ESHandle< T >::isValid(), StripTopology::localPosition(), VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_pDD, m_text, s_cluster, IgTextRep::setText(), StripGeomDetUnit::specificTopology(), VisQueuedTwig::update(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
00196 { 00197 // Get debugging dump. 00198 VisQueuedTwig::update (rep); 00199 00200 // Prepare property description. 00201 std::ostringstream text; 00202 00203 text << m_text << "<br>"; 00204 00205 text << "Total " << s_cluster.size () << " Silicon Strip clusters from"; 00206 00207 if (s_cluster.size () > 100) 00208 { 00209 text << " input file: printing only first 100 " << "<br>"; 00210 } 00211 else 00212 text << " input file: " << m_text << "<br>"; 00213 00214 text << "<table width='100%' border=1>" 00215 << "<TR align = center>" 00216 << "<TH>Number</TH>" 00217 << "<TH>GeomdetId</TH>" 00218 << "<TH>Position</TH>" 00219 << "<TH>ClusterSize</TH>" 00220 << "<TH>Barycenter</TH>" 00221 << "</TR>"; 00222 00223 text << setiosflags (std::ios::showpoint | std::ios::fixed); 00224 text.setf (std::ios::right, std::ios::adjustfield); 00225 00226 if ((! s_cluster.empty ()) && m_pDD.isValid ()) 00227 { 00228 int nSClusters = 0; 00229 try 00230 { 00231 for (std::vector<std::pair<DetId, SiStripCluster> >::const_iterator i = s_cluster.begin (), iEnd = s_cluster.end (); i != iEnd; ++i) 00232 { 00233 const DetId& id = (*i).first; 00234 00235 SiStripCluster c = (*i).second; 00236 short firststrip = c.firstStrip (); 00237 const StripGeomDetUnit* theStripDet = dynamic_cast<const StripGeomDetUnit*>((m_pDD->idToDet (id))); 00238 const StripTopology* theStripTopol = dynamic_cast<const StripTopology *>( &(theStripDet->specificTopology ())); 00239 GlobalPoint pos = (m_pDD->idToDet (id))->surface ().toGlobal (theStripTopol->localPosition (firststrip)); 00240 00241 text << "<TR align = right>" 00242 << "<TD>" << std::setw (3) << nSClusters++ << "</TD>" 00243 << "<TD>" << std::setw (11) << ((*i).first).rawId()<< "</TD>" 00244 << "<TD>" << pos.x () << ", " << pos.y () << ", " << pos.z () << "</TD>" 00245 << "<TD>" << std::setw (6) << std::setprecision (3) << (*i).second.amplitudes().size() << "</TD>" 00246 << "<TD>" << std::setw (6) << std::setprecision (3) << (*i).second.barycenter() << "</TD>"; 00247 if (nSClusters>100) break; 00248 } 00249 } 00250 catch (cms::Exception& e) 00251 { 00252 e.append (" from VisTrackerClusterTwig: "); 00253 e.append (this->name ()); 00254 00255 if (this->m_onCmsException) 00256 this->m_onCmsException (&e); 00257 } 00258 catch (lat::Error &e) 00259 { 00260 if (this->m_onError) 00261 this->m_onError (&e); 00262 } 00263 catch (std::exception &e) 00264 { 00265 if (this->m_onException) 00266 this->m_onException (&e); 00267 } 00268 catch (...) 00269 { 00270 if (this->m_onUnhandledException) 00271 this->m_onUnhandledException (); 00272 } 00273 } 00274 00275 text << "</table>"; 00276 00277 // Send it over. 00278 IgQtLock (); 00279 rep->setText (text.str ()); 00280 }
Reimplemented from VisQueuedTwig.
Definition at line 394 of file VisTrackerClusterTwig.cc.
References cms::Exception::append(), c, Ig3DBaseRep::clear(), e, IgSoTower::energy, eta, PV3DBase< T, PVType, FrameType >::eta(), IgSoTower::etaWidth, exception, SiStripCluster::firstStrip(), i, edm::ESHandle< T >::isValid(), j, StripTopology::localPosition(), VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_pDD, m_scale, Ig3DBaseRep::node(), IgSoTower::orderedRGBA, PV3DBase< T, PVType, FrameType >::phi(), phi, IgSoTower::phiWidth, IgSoTower::position, s_cluster, IgSoTower::scaleFactor, StripGeomDetUnit::specificTopology(), VisQueuedTwig::update(), and VisActiveConfigurable< T >::value().
00395 { 00396 // Get debugging dump. 00397 VisQueuedTwig::update (rep); 00398 00399 IgQtLock (); 00400 rep->clear (); 00401 00402 SoSeparator *sep = new SoSeparator; // global 00403 00404 if (! s_cluster.empty () && m_pDD.isValid ()) 00405 { 00406 try 00407 { 00408 for (std::vector<std::pair<DetId, SiStripCluster> >::const_iterator i = s_cluster.begin (); i != s_cluster.end (); ++i) 00409 { 00410 const DetId& id = (*i).first; 00411 00412 SiStripCluster c = (*i).second; 00413 short firststrip = c.firstStrip(); 00414 const StripGeomDetUnit* theStripDet = dynamic_cast<const StripGeomDetUnit*>( (m_pDD->idToDet (id))); 00415 const StripTopology* theStripTopol = dynamic_cast<const StripTopology *>( &(theStripDet->specificTopology ())); 00416 GlobalPoint pos = (m_pDD->idToDet (id))->surface().toGlobal(theStripTopol->localPosition(firststrip)); 00417 00418 double eta = pos.eta (); 00419 double phi = pos.phi (); 00420 if (phi < 0.0) phi = 2 * M_PI + phi; // correction in absence of one convention 00421 00422 int clusterCharge = 0; 00423 int sas = (*i).second.amplitudes ().size (); 00424 00425 for (int j = 0; j < sas; j++) 00426 { 00427 clusterCharge += (*i).second.amplitudes ()[j]; 00428 } 00429 00430 IgSoTower *tower = new IgSoTower; 00431 tower->position = SbVec2f (phi, eta); // eta, phi 00432 tower->etaWidth = 0.02; 00433 tower->phiWidth = 0.02; 00434 tower->scaleFactor = m_scale.value (); 00435 tower->energy = clusterCharge * 250.0 * 3.61e-09; 00436 tower->orderedRGBA.set1Value (6, SbColor (0.4, 0.0, 1.0).getPackedValue ()); 00437 sep->addChild (tower); 00438 } 00439 } 00440 catch (cms::Exception& e) 00441 { 00442 e.append (" from VisTrackerClusterTwig: "); 00443 e.append (this->name ()); 00444 00445 if (this->m_onCmsException) 00446 this->m_onCmsException (&e); 00447 } 00448 catch (lat::Error &e) 00449 { 00450 if (this->m_onError) 00451 this->m_onError (&e); 00452 } 00453 catch (std::exception &e) 00454 { 00455 if (this->m_onException) 00456 this->m_onException (&e); 00457 } 00458 catch (...) 00459 { 00460 if (this->m_onUnhandledException) 00461 this->m_onUnhandledException (); 00462 } 00463 } 00464 00465 rep->node ()->addChild (sep); 00466 }
Reimplemented from VisQueuedTwig.
Definition at line 283 of file VisTrackerClusterTwig.cc.
References cms::Exception::append(), c, Ig3DBaseRep::clear(), e, exception, SiStripCluster::firstStrip(), i, edm::ESHandle< T >::isValid(), StripTopology::localPosition(), lp1, m_clusterPointSize, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_pDD, m_siStripClusterRep, n, Ig3DBaseRep::node(), s_cluster, StripGeomDetUnit::specificTopology(), IgSbColorMap::unpack(), VisQueuedTwig::update(), VisActiveConfigurable< T >::value(), PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), y, PV3DBase< T, PVType, FrameType >::z(), and z.
00284 { 00285 // Get debugging dump. 00286 VisQueuedTwig::update (rep); 00287 IgQtLock (); 00288 rep->clear (); 00289 00290 if (! s_cluster.empty () && m_pDD.isValid ()) 00291 { 00292 SoMaterial *mat = new SoMaterial; 00293 float rgbcomponents [4]; 00294 IgSbColorMap::unpack (0x6600FF00, rgbcomponents); // Electric indigo 00295 mat->diffuseColor.setValue (SbColor (rgbcomponents)); 00296 00297 SoDrawStyle *drawStyle = new SoDrawStyle; 00298 drawStyle->pointSize = m_clusterPointSize.value (); 00299 00300 SoSeparator *sep = new SoSeparator; // global 00301 sep->addChild (mat); 00302 sep->addChild (drawStyle); 00303 00304 try 00305 { 00306 SoVertexProperty *vertices = new SoVertexProperty; 00307 SoVertexProperty *vtx = new SoVertexProperty; 00308 SoIndexedLineSet *strips = new SoIndexedLineSet; 00309 int nVrtx = 0; 00310 int n = 0; 00311 int coord = 0; 00312 SoMFInt32 coords; 00313 00314 for (std::vector<std::pair<DetId, SiStripCluster> >::const_iterator 00315 i = s_cluster.begin (), iEnd = s_cluster.end (); i != iEnd; ++i) 00316 { 00317 const DetId& id = (*i).first; 00318 00319 SiStripCluster c = (*i).second; 00320 short firststrip = c.firstStrip (); 00321 const StripGeomDetUnit* theStripDet = dynamic_cast<const StripGeomDetUnit*>( (m_pDD->idToDet (id))); 00322 const StripTopology* theStripTopol = dynamic_cast<const StripTopology *>( &(theStripDet->specificTopology ())); 00323 GlobalPoint pos = (m_pDD->idToDet (id))->surface().toGlobal(theStripTopol->localPosition(firststrip)); 00324 if (m_siStripClusterRep.value () == "strip") 00325 { 00326 MeasurementPoint mp1((float)firststrip,(float)-0.5);LocalPoint lp1=theStripTopol->localPosition(mp1); 00327 MeasurementPoint mp2((float)firststrip,(float)+0.5);LocalPoint lp2=theStripTopol->localPosition(mp2); 00328 GlobalPoint pos1 = (m_pDD->idToDet (id))->surface().toGlobal(lp1); 00329 GlobalPoint pos2 = (m_pDD->idToDet (id))->surface().toGlobal(lp2); 00330 vtx->vertex.set1Value(n,SbVec3f(pos1.x()/100.0,pos1.y()/100.0,pos1.z()/100.0)); 00331 coords.set1Value (coord, n); 00332 coord++;n++; 00333 vtx->vertex.set1Value(n,SbVec3f(pos2.x()/100.0,pos2.y()/100.0,pos2.z()/100.0)); 00334 coords.set1Value (coord, n); 00335 coord++;n++; 00336 coords.set1Value (coord, SO_END_LINE_INDEX); 00337 coord++; 00338 } 00339 00340 //Surface::GlobalPoint pos = (m_pDD->idToDet (id))->surface ().position (); 00341 float x = pos.x () / 100.0; // cm -> m 00342 float y = pos.y () / 100.0; // cm -> m 00343 float z = pos.z () / 100.0; // cm -> m 00344 00345 vertices->vertex.set1Value (nVrtx++, SbVec3f (x, y, z)); 00346 } 00347 00348 vertices->vertex.setNum (nVrtx); 00349 SoMFInt32 markerIndex; 00350 markerIndex.setValue (SoMarkerSet::CIRCLE_FILLED_5_5); 00351 00352 SoMarkerSet *points = new SoMarkerSet; 00353 points->markerIndex = markerIndex; 00354 points->vertexProperty.setValue (vertices); 00355 points->numPoints.setValue (nVrtx); 00356 00357 sep->addChild (points); 00358 if (m_siStripClusterRep.value () == "strip") 00359 { 00360 strips->vertexProperty = vtx; 00361 strips->coordIndex = coords; 00362 sep->addChild (strips); 00363 } 00364 } 00365 catch (cms::Exception& e) 00366 { 00367 e.append (" from VisTrackerClusterTwig: "); 00368 e.append (this->name ()); 00369 00370 if (this->m_onCmsException) 00371 this->m_onCmsException (&e); 00372 } 00373 catch (lat::Error &e) 00374 { 00375 if (this->m_onError) 00376 this->m_onError (&e); 00377 } 00378 catch (std::exception &e) 00379 { 00380 if (this->m_onException) 00381 this->m_onException (&e); 00382 } 00383 catch (...) 00384 { 00385 if (this->m_onUnhandledException) 00386 this->m_onUnhandledException (); 00387 } 00388 00389 rep->node ()->addChild (sep); 00390 } 00391 }
const std::string VisTrackerClusterTwig::m_friendlyName [private] |
const std::string VisTrackerClusterTwig::m_instanceName [private] |
const std::string VisTrackerClusterTwig::m_moduleLabel [private] |
const std::string VisTrackerClusterTwig::m_processName [private] |
VisLegoScale VisTrackerClusterTwig::m_scale [private] |
std::string VisTrackerClusterTwig::m_text [private] |
std::vector<std::pair<DetId, SiStripCluster> > VisTrackerClusterTwig::s_cluster [private] |