#include <VisReco/VisTracker/interface/VisTrackingRecHitTwig.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) |
VisTrackingRecHitTwig (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 | |
const std::string | m_friendlyName |
const std::string | m_instanceName |
const std::string | m_moduleLabel |
const std::string | m_processName |
std::vector< SbVec3f > | m_recHits |
std::string | m_text |
edm::ESHandle < GlobalTrackingGeometry > | m_trackingGeometry |
Definition at line 21 of file VisTrackingRecHitTwig.h.
VisTrackingRecHitTwig::VisTrackingRecHitTwig | ( | 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 65 of file VisTrackingRecHitTwig.cc.
References createThisTwig(), edm::TypeID::friendlyClassName(), DBSPlugin::get(), and VisTwigFactroyService::registerTwig().
00071 : VisQueuedTwig (state, parent, name), 00072 m_text (name), 00073 m_friendlyName (friendlyName), 00074 m_moduleLabel (moduleLabel), 00075 m_instanceName (instanceName), 00076 m_processName (processName) 00077 { 00078 VisTwigFactroyService *tfService = VisTwigFactroyService::get (state); 00079 if (! tfService) 00080 { 00081 tfService = new VisTwigFactroyService (state); 00082 } 00083 edm::TypeID collectionID (typeid (TrackingRecHitCollection)); 00084 tfService->registerTwig (collectionID.friendlyClassName (), &createThisTwig); 00085 }
void VisTrackingRecHitTwig::onNewEvent | ( | const edm::Event & | event, | |
const edm::EventSetup & | eventSetup | |||
) | [virtual] |
Reimplemented from VisQueuedTwig.
Definition at line 92 of file VisTrackingRecHitTwig.cc.
References cms::Exception::append(), arg, edm::OwnVector< T, P >::begin(), c, e, end, edm::OwnVector< T, P >::end(), exception, edm::EventSetup::get(), i, edm::Event::id(), edm::ESHandle< T >::isValid(), VisTrackerRechit2DTwig::localPosition(), m_friendlyName, m_instanceName, m_moduleLabel, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_processName, m_recHits, m_text, m_trackingGeometry, IgSimpleTwig::name(), VisQueuedTwig::onBaseInvalidate(), VisQueuedTwig::onNewEvent(), edm::ESHandle< T >::product(), edm::OwnVector< T, P >::size(), x, y, and z.
00094 { 00095 // Get debugging dump. 00096 VisQueuedTwig::onNewEvent (event, eventSetup); 00097 00098 m_text = QString ("Run # %1, event # %2") 00099 .arg (event.id ().run ()) 00100 .arg (event.id ().event ()).latin1 (); 00101 m_recHits.clear (); 00102 00103 std::vector<edm::Handle<TrackingRecHitCollection> > collections; 00104 00105 try 00106 { 00107 if ((! m_friendlyName.empty ()) || (! m_moduleLabel.empty ()) || (! m_instanceName.empty ()) || (! m_processName.empty ())) 00108 { 00109 VisEventSelector visSel (m_friendlyName, m_moduleLabel, m_instanceName, m_processName); 00110 event.getMany (visSel, collections); 00111 } 00112 // else 00113 // { 00114 // event.getManyByType (collections); 00115 // } 00116 } 00117 catch (cms::Exception& e) 00118 { 00119 e.append (" from VisTrackingRecHitTwig: "); 00120 e.append (this->name ()); 00121 00122 if (this->m_onCmsException) 00123 this->m_onCmsException (&e); 00124 } 00125 catch (lat::Error &e) 00126 { 00127 if (this->m_onError) 00128 this->m_onError (&e); 00129 } 00130 catch (std::exception &e) 00131 { 00132 if (this->m_onException) 00133 this->m_onException (&e); 00134 } 00135 catch (...) 00136 { 00137 if (this->m_onUnhandledException) 00138 this->m_onUnhandledException (); 00139 } 00140 if (! m_trackingGeometry.isValid ()) 00141 { 00142 try 00143 { 00144 eventSetup.get<GlobalTrackingGeometryRecord> ().get (m_trackingGeometry); 00145 } 00146 catch (cms::Exception& e) 00147 { 00148 e.append (" from VisTrackingRecHitTwig: "); 00149 e.append (this->name ()); 00150 00151 if (this->m_onCmsException) 00152 this->m_onCmsException (&e); 00153 } 00154 catch (lat::Error &e) 00155 { 00156 if (this->m_onError) 00157 this->m_onError (&e); 00158 } 00159 catch (std::exception &e) 00160 { 00161 if (this->m_onException) 00162 this->m_onException (&e); 00163 } 00164 catch (...) 00165 { 00166 if (this->m_onUnhandledException) 00167 this->m_onUnhandledException (); 00168 } 00169 } 00170 00171 if (! collections.empty ()) 00172 { 00173 std::vector<edm::Handle<TrackingRecHitCollection> >::const_iterator i (collections.begin ()), end (collections.end ()); 00174 for (; i != end; ++i) 00175 { 00176 try 00177 { 00178 const TrackingRecHitCollection c = *(*i).product (); 00179 QString sizeStr = (QString ("%1").arg (c.size ())); 00180 QString nameStr = QString (this->name ()); 00181 int ib = nameStr.find ("["); 00182 int ie = nameStr.find ("]"); 00183 nameStr.replace (ib + 1, ie - 1, sizeStr); 00184 this->name (nameStr); 00185 00186 if (m_trackingGeometry.isValid ()) 00187 { 00188 for (TrackingRecHitCollection::const_iterator hit = c.begin (), hitEnd = c.end (); 00189 hit != hitEnd; ++hit) 00190 { 00191 if ((*hit).isValid () && !(*hit).geographicalId ().null ()) 00192 { 00193 LocalPoint point = VisTrackerRechit2DTwig::localPosition(&(*hit), m_trackingGeometry.product()); 00194 float x = m_trackingGeometry->idToDet ((*hit).geographicalId ())->surface ().toGlobal ( point).x () / 100.0; 00195 float y = m_trackingGeometry->idToDet ((*hit).geographicalId ())->surface ().toGlobal ( point).y () / 100.0; 00196 float z = m_trackingGeometry->idToDet ((*hit).geographicalId ())->surface ().toGlobal ( point).z () / 100.0; 00197 00198 m_recHits.push_back (SbVec3f (x, y, z)); 00199 } 00200 } 00201 } 00202 } 00203 catch (cms::Exception& e) 00204 { 00205 e.append (" from VisTrackingRecHitTwig: "); 00206 e.append (this->name ()); 00207 00208 if (this->m_onCmsException) 00209 this->m_onCmsException (&e); 00210 } 00211 catch (lat::Error &e) 00212 { 00213 if (this->m_onError) 00214 this->m_onError (&e); 00215 } 00216 catch (std::exception &e) 00217 { 00218 if (this->m_onException) 00219 this->m_onException (&e); 00220 } 00221 catch (...) 00222 { 00223 if (this->m_onUnhandledException) 00224 this->m_onUnhandledException (); 00225 } 00226 } 00227 } 00228 00229 VisQueuedTwig::onBaseInvalidate (); 00230 }
Definition at line 88 of file VisTrackingRecHitTwig.cc.
References IgRepSet::invalidate(), and IgTwig::SELF_MASK.
00089 { IgRepSet::invalidate (this, SELF_MASK); }
Reimplemented from VisQueuedTwig.
Definition at line 366 of file VisTrackingRecHitTwig.cc.
References Ig3DBaseRep::clear(), m_recHits, Ig3DBaseRep::node(), funct::sqrt(), IgSbColorMap::unpack(), VisQueuedTwig::update(), x, y, and z.
00367 { 00368 // Get debugging dump. 00369 VisQueuedTwig::update (rep); 00370 00371 IgQtLock (); 00372 rep->clear (); 00373 if (! m_recHits.empty ()) 00374 { 00375 SoSeparator *sep = new SoSeparator; 00376 00377 SoMaterial *mat = new SoMaterial; 00378 float rgbcomponents [4]; 00379 IgSbColorMap::unpack (0xee2c2c, rgbcomponents); 00380 mat->diffuseColor.setValue (SbColor (rgbcomponents)); 00381 sep->addChild (mat); 00382 00383 //set line width 00384 SoDrawStyle *drawStyle = new SoDrawStyle; 00385 drawStyle->pointSize = 8.0; 00386 sep->addChild (drawStyle); 00387 00388 SoVertexProperty *vertices = new SoVertexProperty; 00389 int nVrtx = 0; 00390 00391 for (std::vector<SbVec3f>::const_iterator hit = m_recHits.begin (), hitEnd = m_recHits.end (); 00392 hit != hitEnd; ++hit) 00393 { 00394 float x; 00395 float y; 00396 float z; 00397 (*hit).getValue (x, y, z); 00398 (y < 0.) ? y = - sqrt (x * x + y * y) : y = sqrt (x * x + y * y); 00399 00400 vertices->vertex.set1Value (nVrtx++, SbVec3f (0.0, y, z)); 00401 } 00402 00403 vertices->vertex.setNum (nVrtx); 00404 SoPointSet *points = new SoPointSet; 00405 points->vertexProperty.setValue (vertices); 00406 points->numPoints.setValue (nVrtx); 00407 00408 sep->addChild (points); 00409 00410 rep->node ()->addChild (sep); 00411 } 00412 }
Reimplemented from VisQueuedTwig.
Definition at line 325 of file VisTrackingRecHitTwig.cc.
References Ig3DBaseRep::clear(), m_recHits, Ig3DBaseRep::node(), IgSbColorMap::unpack(), and VisQueuedTwig::update().
00326 { 00327 // Get debugging dump. 00328 VisQueuedTwig::update (rep); 00329 00330 IgQtLock (); 00331 rep->clear (); 00332 00333 if (! m_recHits.empty ()) 00334 { 00335 SoSeparator *sep = new SoSeparator; 00336 00337 SoMaterial *mat = new SoMaterial; 00338 float rgbcomponents [4]; 00339 IgSbColorMap::unpack (0xee2c2c, rgbcomponents); 00340 mat->diffuseColor.setValue (SbColor (rgbcomponents)); 00341 sep->addChild (mat); 00342 00343 //set line width 00344 SoDrawStyle *drawStyle = new SoDrawStyle; 00345 drawStyle->pointSize = 8.0; 00346 sep->addChild (drawStyle); 00347 00348 SoVertexProperty *vertices = new SoVertexProperty; 00349 int nVrtx = 0; 00350 00351 for (std::vector<SbVec3f>::const_iterator hit = m_recHits.begin (), hitEnd = m_recHits.end (); hit != hitEnd; ++hit) 00352 vertices->vertex.set1Value (nVrtx++, (*hit)); 00353 00354 vertices->vertex.setNum (nVrtx); 00355 SoPointSet *points = new SoPointSet; 00356 points->vertexProperty.setValue (vertices); 00357 points->numPoints.setValue (nVrtx); 00358 00359 sep->addChild (points); 00360 00361 rep->node ()->addChild (sep); 00362 } 00363 }
Reimplemented from VisQueuedTwig.
Definition at line 233 of file VisTrackingRecHitTwig.cc.
References it, m_recHits, m_text, n, IgTextRep::setText(), VisQueuedTwig::update(), x, y, and z.
00234 { 00235 // Get debugging dump. 00236 VisQueuedTwig::update (rep); 00237 00238 // Prepare property description. 00239 std::ostringstream text; 00240 00241 text << m_text << "<br>"; 00242 00243 text << "<table width='100%' border=1>" 00244 << "<TR align = center>" 00245 << "<TH>Number</TH>" 00246 << "<TH>x, y, z</TH>" 00247 << "</TR>"; 00248 text << setiosflags (std::ios::showpoint | std::ios::fixed); 00249 text.setf (std::ios::right, std::ios::adjustfield); 00250 00251 int n = 1; 00252 00253 for (std::vector<SbVec3f>::const_iterator it = m_recHits.begin (), itEnd = m_recHits.end (); it != itEnd; ++it) 00254 { 00255 SbVec3f xyzPoint = (*it); 00256 float x = xyzPoint [0]; 00257 float y = xyzPoint [1]; 00258 float z = xyzPoint [2]; 00259 text << "<TR align = right>" 00260 << "<TD>" << std::setw (3) << n++ << "</TD>" 00261 << "<TD>" << std::setw (2) << std::setprecision (3) << x << "," << y << "," << z << "</TD>" 00262 << "</TR>"; 00263 } 00264 00265 text << "</table>"; 00266 00267 // Send it over. 00268 IgQtLock (); 00269 00270 rep->setText (text.str ()); 00271 }
Reimplemented from VisQueuedTwig.
Definition at line 315 of file VisTrackingRecHitTwig.cc.
References Ig3DBaseRep::clear(), and VisQueuedTwig::update().
00316 { 00317 // Get debugging dump. 00318 VisQueuedTwig::update (rep); 00319 00320 IgQtLock (); 00321 rep->clear (); 00322 }
Reimplemented from VisQueuedTwig.
Definition at line 274 of file VisTrackingRecHitTwig.cc.
References Ig3DBaseRep::clear(), m_recHits, Ig3DBaseRep::node(), IgSbColorMap::unpack(), and VisQueuedTwig::update().
00275 { 00276 // Get debugging dump. 00277 VisQueuedTwig::update (rep); 00278 00279 IgQtLock (); 00280 rep->clear (); 00281 00282 if (! m_recHits.empty ()) 00283 { 00284 SoSeparator *sep = new SoSeparator; 00285 00286 SoMaterial *mat = new SoMaterial; 00287 float rgbcomponents [4]; 00288 IgSbColorMap::unpack (0xee2c2c, rgbcomponents); 00289 mat->diffuseColor.setValue (SbColor (rgbcomponents)); 00290 sep->addChild (mat); 00291 00292 //set line width 00293 SoDrawStyle *drawStyle = new SoDrawStyle; 00294 drawStyle->pointSize = 8.0; 00295 sep->addChild (drawStyle); 00296 00297 SoVertexProperty *vertices = new SoVertexProperty; 00298 int nVrtx = 0; 00299 00300 for (std::vector<SbVec3f>::const_iterator hit = m_recHits.begin (), hitEnd = m_recHits.end (); hit != hitEnd; ++hit) 00301 vertices->vertex.set1Value (nVrtx++, (*hit)); 00302 00303 vertices->vertex.setNum (nVrtx); 00304 SoPointSet *points = new SoPointSet; 00305 points->vertexProperty.setValue (vertices); 00306 points->numPoints.setValue (nVrtx); 00307 00308 sep->addChild (points); 00309 00310 rep->node ()->addChild (sep); 00311 } 00312 }
const std::string VisTrackingRecHitTwig::m_friendlyName [private] |
const std::string VisTrackingRecHitTwig::m_instanceName [private] |
const std::string VisTrackingRecHitTwig::m_moduleLabel [private] |
const std::string VisTrackingRecHitTwig::m_processName [private] |
std::vector<SbVec3f> VisTrackingRecHitTwig::m_recHits [private] |
std::string VisTrackingRecHitTwig::m_text [private] |