#include <VisReco/VisMuonDT/interface/VisDT2DSegmentTwig.h>
Public Member Functions | |
virtual void | onNewEvent (const edm::Event &event, const edm::EventSetup &eventSetup) |
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) |
VisDT2DSegmentTwig (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 Member Functions | |
void | addMaterial (SoSeparator *sep) |
Define material. | |
Private Attributes | |
const std::string | m_friendlyName |
const std::string | m_instanceName |
const std::string | m_moduleLabel |
edm::ESHandle< DTGeometry > | m_pDD |
const std::string | m_processName |
std::vector< DTSLRecSegment2D > | m_recseg |
std::string | m_text |
Definition at line 26 of file VisDT2DSegmentTwig.h.
VisDT2DSegmentTwig::VisDT2DSegmentTwig | ( | 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 80 of file VisDT2DSegmentTwig.cc.
References createThisTwig(), edm::TypeID::friendlyClassName(), DBSPlugin::get(), and VisTwigFactroyService::registerTwig().
00086 : VisQueuedTwig (state, parent, name), 00087 m_text ("no info"), 00088 m_friendlyName (friendlyName), 00089 m_moduleLabel (moduleLabel), 00090 m_instanceName (instanceName), 00091 m_processName (processName) 00092 { 00093 VisTwigFactroyService *tfService = VisTwigFactroyService::get (state); 00094 if (! tfService) 00095 { 00096 tfService = new VisTwigFactroyService (state); 00097 } 00098 edm::TypeID dt2DSegID (typeid (DTRecSegment2DCollection)); 00099 tfService->registerTwig (dt2DSegID.friendlyClassName (), &createThisTwig); 00100 }
void VisDT2DSegmentTwig::addMaterial | ( | SoSeparator * | sep | ) | [private] |
Define material.
Definition at line 557 of file VisDT2DSegmentTwig.cc.
Referenced by update().
00558 { 00559 SoMaterial *segment = new SoMaterial; // green 00560 segment->diffuseColor.setValue (0., 1., 0.); 00561 00562 sep->addChild (segment); 00563 }
void VisDT2DSegmentTwig::onNewEvent | ( | const edm::Event & | event, | |
const edm::EventSetup & | eventSetup | |||
) | [virtual] |
Reimplemented from VisQueuedTwig.
Definition at line 103 of file VisDT2DSegmentTwig.cc.
References arg, c, e, edm::EventID::event(), 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_recseg, m_text, VisQueuedTwig::onBaseInvalidate(), VisQueuedTwig::onNewEvent(), and edm::EventID::run().
00105 { 00106 // Get debugging dump. 00107 VisQueuedTwig::onNewEvent (event, eventSetup); 00108 00109 m_recseg.clear (); 00110 m_text = (QString ("Run # %1, event # %2") 00111 .arg (event.id ().run ()) 00112 .arg (event.id ().event ()).latin1 ()); 00113 00114 // Get the rec segments collection from the event 00115 std::vector<edm::Handle<DTRecSegment2DCollection> > recsegCollections; 00116 00117 try 00118 { 00119 if ((! m_friendlyName.empty ()) || (! m_moduleLabel.empty ()) || (! m_instanceName.empty ()) || (! m_processName.empty ())) 00120 { 00121 VisEventSelector visSel (m_friendlyName, m_moduleLabel, m_instanceName, m_processName); 00122 event.getMany (visSel, recsegCollections); 00123 } 00124 else 00125 { 00126 event.getManyByType (recsegCollections); 00127 } 00128 // event.getByLabel("recseg2dbuilder", recsegCollection); 00129 } 00130 catch (cms::Exception& e) 00131 { 00132 if (this->m_onCmsException) 00133 this->m_onCmsException (&e); 00134 } 00135 catch (lat::Error &e) 00136 { 00137 if (this->m_onError) 00138 this->m_onError (&e); 00139 } 00140 catch (std::exception &e) 00141 { 00142 if (this->m_onException) 00143 this->m_onException (&e); 00144 } 00145 catch (...) 00146 { 00147 if (this->m_onUnhandledException) 00148 this->m_onUnhandledException (); 00149 } 00150 00151 try 00152 { 00153 eventSetup.get<MuonGeometryRecord> ().get (m_pDD); 00154 } 00155 catch (cms::Exception& e) 00156 { 00157 if (this->m_onCmsException) 00158 this->m_onCmsException (&e); 00159 } 00160 catch (lat::Error &e) 00161 { 00162 if (this->m_onError) 00163 this->m_onError (&e); 00164 } 00165 catch (std::exception &e) 00166 { 00167 if (this->m_onException) 00168 this->m_onException (&e); 00169 } 00170 catch (...) 00171 { 00172 if (this->m_onUnhandledException) 00173 this->m_onUnhandledException (); 00174 } 00175 00176 if (! recsegCollections.empty ()) 00177 { 00178 std::vector<Handle<DTRecSegment2DCollection> >::iterator i; 00179 std::vector<Handle<DTRecSegment2DCollection> >::iterator iEnd; 00180 for (i = recsegCollections.begin (), iEnd = recsegCollections.end (); i != iEnd; ++i) 00181 { 00182 const DTRecSegment2DCollection& c = *(*i); 00183 for (DTRecSegment2DCollection::const_iterator rsi = c.begin (), rsiEnd = c.end (); 00184 rsi != rsiEnd; ++rsi) 00185 { 00186 m_recseg.push_back (*rsi); 00187 } 00188 } 00189 } 00190 00191 VisQueuedTwig::onBaseInvalidate (); 00192 }
Reimplemented from VisQueuedTwig.
Definition at line 485 of file VisDT2DSegmentTwig.cc.
References addMaterial(), Ig3DBaseRep::clear(), funct::cos(), e, exception, i, edm::ESHandle< T >::isValid(), parsecf::pyparsing::line(), VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_pDD, m_recseg, PV3DBase< T, PVType, FrameType >::mag(), Ig3DBaseRep::node(), PV3DBase< T, PVType, FrameType >::theta(), VisQueuedTwig::update(), PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), y, PV3DBase< T, PVType, FrameType >::z(), and z.
00486 { 00487 // Get debugging dump. 00488 VisQueuedTwig::update (rep); 00489 IgQtLock (); 00490 rep->clear (); 00491 00492 if ((! m_recseg.empty ()) && m_pDD.isValid ()) 00493 { 00494 SoSeparator *sep = new SoSeparator; 00495 addMaterial (sep); 00496 try 00497 { 00498 for (std::vector< DTSLRecSegment2D >::const_iterator i = m_recseg.begin (), iEnd = m_recseg.end (); i != iEnd; ++i) 00499 { 00500 float halfHeight = 1.3 * 2.0; // cm 00501 LocalVector locDir = (*i).localDirection (); 00502 LocalPoint locPos = (*i).localPosition (); 00503 00504 DTSuperLayerId slId ((*i).geographicalId ().rawId ()); 00505 const DTSuperLayer *slayer = m_pDD->superLayer (slId); 00506 00507 SoVertexProperty *vtx = new SoVertexProperty; 00508 00509 SoLineSet *line = new SoLineSet; 00510 line->numVertices = 2; 00511 00512 GlobalPoint posInner = slayer->toGlobal (locPos + locDir / locDir.mag () * halfHeight / cos (locDir.theta ())); 00513 float x = posInner.x () / 100.0; // cm -> m 00514 float y = posInner.y () / 100.0; // cm -> m 00515 float z = posInner.z () / 100.0; // cm -> m 00516 00517 vtx->vertex.set1Value (0, SbVec3f (x, y, z)); 00518 00519 GlobalPoint posOuter = slayer->toGlobal (locPos + locDir / (-locDir.mag ()) * halfHeight / cos (locDir.theta ())); 00520 x = posOuter.x () / 100.0; // cm -> m 00521 y = posOuter.y () / 100.0; // cm -> m 00522 z = posOuter.z () / 100.0; // cm -> m 00523 00524 vtx->vertex.set1Value (1, SbVec3f (x, y, z)); 00525 00526 line->vertexProperty = vtx; 00527 00528 sep->addChild (line); 00529 } 00530 } 00531 catch (cms::Exception& e) 00532 { 00533 if (this->m_onCmsException) 00534 this->m_onCmsException (&e); 00535 } 00536 catch (lat::Error &e) 00537 { 00538 if (this->m_onError) 00539 this->m_onError (&e); 00540 } 00541 catch (std::exception &e) 00542 { 00543 if (this->m_onException) 00544 this->m_onException (&e); 00545 } 00546 catch (...) 00547 { 00548 if (this->m_onUnhandledException) 00549 this->m_onUnhandledException (); 00550 } 00551 rep->node ()->addChild (sep); 00552 } 00553 }
Reimplemented from VisQueuedTwig.
Definition at line 376 of file VisDT2DSegmentTwig.cc.
References addMaterial(), Ig3DBaseRep::clear(), funct::cos(), e, exception, i, edm::ESHandle< T >::isValid(), parsecf::pyparsing::line(), VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_pDD, m_recseg, PV3DBase< T, PVType, FrameType >::mag(), Ig3DBaseRep::node(), python::EventAnalyzer_cfg::pset, PV3DBase< T, PVType, FrameType >::theta(), GeomDet::toGlobal(), VisQueuedTwig::update(), PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), y, PV3DBase< T, PVType, FrameType >::z(), and z.
00377 { 00378 // Get debugging dump. 00379 VisQueuedTwig::update (rep); 00380 00381 IgQtLock (); 00382 rep->clear (); 00383 00384 if ((! m_recseg.empty ()) && m_pDD.isValid ()) 00385 { 00386 SoSeparator *sep = new SoSeparator; 00387 addMaterial (sep); 00388 00389 try 00390 { 00391 for (std::vector< DTSLRecSegment2D >::const_iterator i = m_recseg.begin (), iEnd = m_recseg.end (); i != iEnd; ++i) 00392 { 00393 float halfHeight = 1.3 * 2.0; //cm 00394 LocalVector locDir = (*i).localDirection (); 00395 LocalPoint locPos = (*i).localPosition (); 00396 00397 DTSuperLayerId slId ((*i).geographicalId ().rawId ()); 00398 const DTSuperLayer* slayer = m_pDD->superLayer (slId); 00399 00400 SoVertexProperty *vtx = new SoVertexProperty; 00401 00402 SoLineSet *line = new SoLineSet; 00403 line->numVertices = 2; 00404 00405 GlobalPoint posInner = slayer->toGlobal (locPos + locDir / locDir.mag () * halfHeight / cos (locDir.theta ())); 00406 float x = posInner.x () / 100.0; // cm -> m 00407 float y = posInner.y () / 100.0; // cm -> m 00408 float z = posInner.z () / 100.0; // cm -> m 00409 00410 vtx->vertex.set1Value (0, SbVec3f (x, y, z)); 00411 00412 GlobalPoint posOuter = slayer->toGlobal (locPos + locDir / (-locDir.mag ()) * halfHeight / cos (locDir.theta ())); 00413 x = posOuter.x () / 100.0; // cm -> m 00414 y = posOuter.y () / 100.0; // cm -> m 00415 z = posOuter.z () / 100.0; // cm -> m 00416 00417 vtx->vertex.set1Value (1, SbVec3f (x, y, z)); 00418 00419 line->vertexProperty = vtx; 00420 00421 sep->addChild (line); 00422 00423 SoDrawStyle *drawStyle = new SoDrawStyle; 00424 drawStyle->pointSize.setValue (2.0); 00425 sep->addChild(drawStyle); 00426 00427 SoVertexProperty *pti = new SoVertexProperty; 00428 pti->materialBinding = SoVertexProperty::OVERALL; 00429 pti->orderedRGBA = 0x9900cc00; // yellow; 00430 00431 std::vector<DTRecHit1D> segRecHit = (*i).specificRecHits (); 00432 00433 int npti = 0; 00434 00435 for (std::vector< DTRecHit1D >::const_iterator rechit = segRecHit.begin (), rechitEnd = segRecHit.end (); 00436 rechit != rechitEnd; ++rechit) 00437 { 00438 DTWireId wireId = rechit->wireId (); 00439 const DTLayer* layer = m_pDD->layer (wireId); 00440 00441 LocalPoint LocalPos = rechit->localPosition (); 00442 GlobalPoint GlobalPos = layer->toGlobal (LocalPos); 00443 00444 pti->vertex.set1Value (npti, SbVec3f (GlobalPos.x () / 100.0, 00445 GlobalPos.y () / 100.0, 00446 GlobalPos.z () / 100.0)); //cm->m 00447 ++npti; 00448 } 00449 00450 if (npti > 0) 00451 { 00452 pti->vertex.setNum (npti); 00453 SoPointSet *pset = new SoPointSet; 00454 pset->vertexProperty = pti; 00455 sep->addChild (pset); 00456 } 00457 } 00458 } 00459 catch (cms::Exception& e) 00460 { 00461 if (this->m_onCmsException) 00462 this->m_onCmsException (&e); 00463 } 00464 catch (lat::Error &e) 00465 { 00466 if (this->m_onError) 00467 this->m_onError (&e); 00468 } 00469 catch (std::exception &e) 00470 { 00471 if (this->m_onException) 00472 this->m_onException (&e); 00473 } 00474 catch (...) 00475 { 00476 if (this->m_onUnhandledException) 00477 this->m_onUnhandledException (); 00478 } 00479 rep->node ()->addChild (sep); 00480 } 00481 }
Reimplemented from VisQueuedTwig.
Definition at line 195 of file VisDT2DSegmentTwig.cc.
References e, exception, i, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_pDD, m_recseg, PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), phi, IgTextRep::setText(), GeomDet::toGlobal(), and VisQueuedTwig::update().
00196 { 00197 // Get debugging dump. 00198 VisQueuedTwig::update (rep); 00199 00200 // Prepare property description. 00201 std::ostringstream text; 00202 00203 text << "<b>Muon Barrel: DT Track 2D Segments</b><br>"; 00204 00205 text << "<table width='100%' border=1>" 00206 << "<TR align = center>" 00207 << "<TH>Number</TH>" 00208 << "<TH>nHits</TH>" 00209 << "<TH>Wheel</TH>" 00210 << "<TH>Station</TH>" 00211 << "<TH>Sector</TH>" 00212 << "<TH>SL</TH>" 00213 << "<TH>position</TH>" 00214 << "<TH>direction</TH>" 00215 << "<TH>r [cm]</TH>" 00216 << "<TH>phi [rad]</TH>" 00217 << "<TH>chi2 / hits</TH>" 00218 << "</TR>"; 00219 text << setiosflags (ios::showpoint | ios::fixed); 00220 text.setf (ios::right, ios::adjustfield); 00221 00222 try 00223 { 00224 int nSegments = 0; 00225 for (std::vector< DTSLRecSegment2D >::const_iterator i = m_recseg.begin (), iEnd = m_recseg.end (); i != iEnd; ++i) 00226 { 00227 //int dimRs = (*i).dimension (); 00228 int nHits = (*i).recHits().size(); 00229 DTSuperLayerId slId ((*i).geographicalId ().rawId ()); 00230 int slayerIdRs = slId.superLayer (); 00231 const DTSuperLayer* slayer = m_pDD->superLayer (slId); 00232 00233 LocalVector locDir = (*i).localDirection (); 00234 LocalPoint locPos = (*i).localPosition (); 00235 00236 GlobalVector gloDir = slayer->toGlobal (locDir); 00237 GlobalPoint gloPos = slayer->toGlobal (locPos); 00238 00239 float phi = gloPos.phi (); 00240 phi = (phi < 0) ? 2 * M_PI + phi : phi; 00241 00242 double chi2 = (*i).chi2 (); 00243 int dof = (*i).degreesOfFreedom (); 00244 00245 int sectorIdRs = (*i).chamberId ().sector (); 00246 int stationIdRs = (*i).chamberId().station (); 00247 int wheelIdRs = (*i).chamberId ().wheel (); 00248 00249 text << "<TR align = right>" 00250 << "<TD>" << setw (2) << nSegments++ << "</TD>" 00251 << "<TD>" << setw (1) << nHits << "</TD>" 00252 << "<TD>" << wheelIdRs << "</TD>" 00253 << "<TD>" << stationIdRs << "</TD>" 00254 << "<TD>" << sectorIdRs << "</TD>" 00255 << "<TD>" << slayerIdRs << "</TD>" 00256 << "<TD>" << setw (6) << setprecision (2) << gloPos << "</TD>" 00257 << "<TD>" << setw (6) << setprecision (2) << gloDir << "</TD>" 00258 << "<TD>" << setw (5) << setprecision (1) << gloPos.perp () << "</TD>" 00259 << "<TD>" << setw (6) << setprecision (3) << phi << "</TD>" 00260 << "<TD>" << setw (6) << setprecision (2) << chi2 / dof << "</TD>" 00261 << "</TR>"; 00262 } 00263 } 00264 catch (cms::Exception& e) 00265 { 00266 if (this->m_onCmsException) 00267 this->m_onCmsException (&e); 00268 } 00269 catch (lat::Error &e) 00270 { 00271 if (this->m_onError) 00272 this->m_onError (&e); 00273 } 00274 catch (std::exception &e) 00275 { 00276 if (this->m_onException) 00277 this->m_onException (&e); 00278 } 00279 catch (...) 00280 { 00281 if (this->m_onUnhandledException) 00282 this->m_onUnhandledException (); 00283 } 00284 00285 text << "</table>"; 00286 00287 IgQtLock (); 00288 rep->setText (text.str ()); 00289 }
Reimplemented from VisQueuedTwig.
Definition at line 364 of file VisDT2DSegmentTwig.cc.
References Ig3DBaseRep::clear(), and VisQueuedTwig::update().
00365 { 00366 // Get debugging dump. 00367 VisQueuedTwig::update (rep); 00368 00369 IgQtLock (); 00370 rep->clear (); 00371 00372 //........ still missing 00373 }
Reimplemented from VisQueuedTwig.
Definition at line 292 of file VisDT2DSegmentTwig.cc.
References addMaterial(), Ig3DBaseRep::clear(), funct::cos(), e, exception, i, edm::ESHandle< T >::isValid(), parsecf::pyparsing::line(), VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_pDD, m_recseg, PV3DBase< T, PVType, FrameType >::mag(), Ig3DBaseRep::node(), PV3DBase< T, PVType, FrameType >::theta(), VisQueuedTwig::update(), PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), y, PV3DBase< T, PVType, FrameType >::z(), and z.
00293 { 00294 // Get debugging dump. 00295 VisQueuedTwig::update (rep); 00296 00297 IgQtLock (); 00298 rep->clear (); 00299 00300 if ((! m_recseg.empty ()) && m_pDD.isValid ()) 00301 { 00302 SoSeparator *sep = new SoSeparator; 00303 addMaterial (sep); 00304 try 00305 { 00306 for (std::vector< DTSLRecSegment2D >::const_iterator i = m_recseg.begin (), iEnd = m_recseg.end (); i != iEnd; ++i) 00307 { 00308 float halfHeight = 1.3 * 2.0; //cm 00309 LocalVector locDir = (*i).localDirection (); 00310 LocalPoint locPos = (*i).localPosition (); 00311 00312 DTSuperLayerId slId ((*i).geographicalId ().rawId ()); 00313 const DTSuperLayer *slayer = m_pDD->superLayer (slId); 00314 00315 SoVertexProperty *vtx = new SoVertexProperty; 00316 00317 SoLineSet *line = new SoLineSet; 00318 line->numVertices = 2; 00319 00320 GlobalPoint posInner = slayer->toGlobal (locPos + locDir / locDir.mag () * halfHeight / cos (locDir.theta ())); 00321 float x = posInner.x () / 100.0; // cm -> m 00322 float y = posInner.y () / 100.0; // cm -> m 00323 float z = posInner.z () / 100.0; // cm -> m 00324 00325 vtx->vertex.set1Value (0, SbVec3f (x, y, z)); 00326 00327 GlobalPoint posOuter = slayer->toGlobal (locPos + locDir / (-locDir.mag ()) * halfHeight / cos (locDir.theta ())); 00328 x = posOuter.x () / 100.0; // cm -> m 00329 y = posOuter.y () / 100.0; // cm -> m 00330 z = posOuter.z () / 100.0; // cm -> m 00331 00332 vtx->vertex.set1Value (1, SbVec3f (x, y, z)); 00333 00334 line->vertexProperty = vtx; 00335 00336 sep->addChild (line); 00337 } 00338 } 00339 catch (cms::Exception& e) 00340 { 00341 if (this->m_onCmsException) 00342 this->m_onCmsException (&e); 00343 } 00344 catch (lat::Error &e) 00345 { 00346 if (this->m_onError) 00347 this->m_onError (&e); 00348 } 00349 catch (std::exception &e) 00350 { 00351 if (this->m_onException) 00352 this->m_onException (&e); 00353 } 00354 catch (...) 00355 { 00356 if (this->m_onUnhandledException) 00357 this->m_onUnhandledException (); 00358 } 00359 rep->node ()->addChild (sep); 00360 } 00361 }
const std::string VisDT2DSegmentTwig::m_friendlyName [private] |
const std::string VisDT2DSegmentTwig::m_instanceName [private] |
const std::string VisDT2DSegmentTwig::m_moduleLabel [private] |
edm::ESHandle<DTGeometry> VisDT2DSegmentTwig::m_pDD [private] |
const std::string VisDT2DSegmentTwig::m_processName [private] |
std::vector< DTSLRecSegment2D > VisDT2DSegmentTwig::m_recseg [private] |
std::string VisDT2DSegmentTwig::m_text [private] |