![]() |
![]() |
#include <VisReco/VisTracker/interface/VisTrajectorySeedTwig.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) |
VisTrajectorySeedTwig (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 |
std::vector< std::vector < SbVec3f > > | m_hitPoints |
const std::string | m_instanceName |
edm::ESHandle< MagneticField > | m_mgField |
const std::string | m_moduleLabel |
const std::string | m_processName |
std::vector< SbVec3f > | m_seedDirections |
std::vector< SbVec3f > | m_seedPositions |
VisTrajectorySeedScale | m_seedRescaleFactor |
std::string | m_text |
edm::ESHandle < GlobalTrackingGeometry > | m_trackerGeometry |
Definition at line 26 of file VisTrajectorySeedTwig.h.
VisTrajectorySeedTwig::VisTrajectorySeedTwig | ( | 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 VisTrajectorySeedTwig.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 m_seedRescaleFactor (state, lat::CreateCallback (this, &VisTrajectorySeedTwig::twigChanged)) 00093 { 00094 VisTwigFactroyService *tfService = VisTwigFactroyService::get (state); 00095 if (! tfService) 00096 { 00097 tfService = new VisTwigFactroyService (state); 00098 } 00099 edm::TypeID seedID (typeid (TrajectorySeedCollection)); 00100 tfService->registerTwig (seedID.friendlyClassName (), &createThisTwig); 00101 }
void VisTrajectorySeedTwig::onNewEvent | ( | const edm::Event & | event, | |
const edm::EventSetup & | eventSetup | |||
) | [virtual] |
Reimplemented from VisQueuedTwig.
Definition at line 108 of file VisTrajectorySeedTwig.cc.
References cms::Exception::append(), arg, ASSERT, edm::Event::bunchCrossing(), c, PTrajectoryStateOnDet::detId(), e, end, exception, edm::EventSetup::get(), DBSPlugin::get(), TrajectoryStateOnSurface::globalDirection(), VisEventSetupService::globalPosition(), TrajectoryStateOnSurface::globalPosition(), i, edm::Event::id(), VisEventSetupService::idToDet(), TrajectoryStateOnSurface::isValid(), edm::ESHandle< T >::isValid(), it, LFfwvis, LOG, edm::Event::luminosityBlock(), m_friendlyName, m_hitPoints, m_instanceName, m_mgField, m_moduleLabel, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_processName, m_seedDirections, m_seedPositions, m_text, m_trackerGeometry, IgSimpleTwig::name(), VisQueuedTwig::onBaseInvalidate(), VisQueuedTwig::onNewEvent(), edm::Event::orbitNumber(), VisQueuedTwig::state(), tc, GsfMatrixTools::trace(), TrajectoryStateTransform::transientState(), PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), y, PV3DBase< T, PVType, FrameType >::z(), and z.
00110 { 00111 // Get debugging dump. 00112 VisQueuedTwig::onNewEvent (event, eventSetup); 00113 00114 m_hitPoints.clear (); 00115 m_seedPositions.clear (); 00116 m_seedDirections.clear (); 00117 00118 m_text = (QString ("Run %1, Event %2, LS %3, Orbit %4, BX %5") 00119 .arg (event.id ().run ()) 00120 .arg (event.id ().event ()) 00121 .arg (event.luminosityBlock ()) 00122 .arg (event.orbitNumber ()) 00123 .arg (event.bunchCrossing ()) 00124 .latin1 ()); 00125 00126 std::vector<edm::Handle<TrajectorySeedCollection> > seedCollections; 00127 00128 try 00129 { 00130 if ((! m_friendlyName.empty ()) || (! m_moduleLabel.empty ()) || (! m_instanceName.empty ()) || (! m_processName.empty ())) 00131 { 00132 VisEventSelector visSel (m_friendlyName, m_moduleLabel, m_instanceName, m_processName); 00133 event.getMany (visSel, seedCollections); 00134 } 00135 } 00136 catch (cms::Exception& e) 00137 { 00138 e.append (" from VisTrajectorySeedTwig: "); 00139 e.append (this->name ()); 00140 00141 if (this->m_onCmsException) 00142 this->m_onCmsException (&e); 00143 } 00144 catch (lat::Error &e) 00145 { 00146 if (this->m_onError) 00147 this->m_onError (&e); 00148 } 00149 catch (std::exception &e) 00150 { 00151 if (this->m_onException) 00152 this->m_onException (&e); 00153 } 00154 catch (...) 00155 { 00156 if (this->m_onUnhandledException) 00157 this->m_onUnhandledException (); 00158 } 00159 00160 try 00161 { 00162 eventSetup.get<GlobalTrackingGeometryRecord> ().get (m_trackerGeometry); 00163 } 00164 catch (cms::Exception& e) 00165 { 00166 e.append (" from VisTrajectorySeedTwig: "); 00167 e.append (this->name ()); 00168 00169 if (this->m_onCmsException) 00170 this->m_onCmsException (&e); 00171 } 00172 catch (lat::Error &e) 00173 { 00174 if (this->m_onError) 00175 this->m_onError (&e); 00176 } 00177 catch (std::exception &e) 00178 { 00179 if (this->m_onException) 00180 this->m_onException (&e); 00181 } 00182 catch (...) 00183 { 00184 if (this->m_onUnhandledException) 00185 this->m_onUnhandledException (); 00186 } 00187 00188 00189 try 00190 { 00191 eventSetup.get<IdealMagneticFieldRecord> ().get (m_mgField); 00192 } 00193 catch (cms::Exception& e) 00194 { 00195 e.append (" from VisTrajectorySeedTwig: "); 00196 e.append (this->name ()); 00197 00198 if (this->m_onCmsException) 00199 this->m_onCmsException (&e); 00200 } 00201 catch (lat::Error &e) 00202 { 00203 if (this->m_onError) 00204 this->m_onError (&e); 00205 } 00206 catch (std::exception &e) 00207 { 00208 if (this->m_onException) 00209 this->m_onException (&e); 00210 } 00211 catch (...) 00212 { 00213 if (this->m_onUnhandledException) 00214 this->m_onUnhandledException (); 00215 } 00216 00217 if (! seedCollections.empty ()) 00218 { 00219 VisEventSetupService *esService = VisEventSetupService::get (state ()); 00220 ASSERT (esService); 00221 00222 if (m_trackerGeometry.isValid ()) 00223 { 00224 if (m_mgField.isValid ()) 00225 { 00226 LOG (2, trace, LFfwvis, "OK: seedCollections is not empty and GlobalTrackingGeometry is valid===>>>\n"); 00227 00228 std::vector<edm::Handle<TrajectorySeedCollection> >::iterator i; 00229 std::vector<edm::Handle<TrajectorySeedCollection> >::iterator end; 00230 00231 LOG (2, trace, LFfwvis, "There are " << seedCollections.size () << " seed collections.\n"); 00232 00233 int tc = 1; 00234 for (i = seedCollections.begin (), end = seedCollections.end (); i != end; ++i) 00235 { 00236 try 00237 { 00238 const TrajectorySeedCollection c = *(*i).product (); 00239 QString sizeStr = (QString ("%1").arg (c.size ())); 00240 QString nameStr = QString (this->name ()); 00241 int ib = nameStr.find ("["); 00242 int ie = nameStr.find ("]"); 00243 nameStr.replace (ib + 1, ie - 1, sizeStr); 00244 this->name (nameStr); 00245 00246 LOG (2, trace, LFfwvis, ": seed collection has " << c.size () << " seeds\n"); 00247 00248 for (TrajectorySeedCollection::const_iterator seed = c.begin (), seedEnd = c.end (); seed != seedEnd; ++seed) 00249 { 00250 LOG (2, trace, LFfwvis, "\nSeed with rechitsize = " << (*seed).nHits () << "\n"); 00251 std::vector<SbVec3f> mySeed; 00252 00253 int nRecHit = 1; 00254 for (edm::OwnVector<TrackingRecHit>::const_iterator it = seed->recHits ().first, itEnd = seed->recHits ().second; it != itEnd; ++it) 00255 { 00256 if ((*it).isValid () && !(*it).geographicalId ().null ()) 00257 { 00258 GlobalPoint gp = esService->globalPosition (&(*it)); 00259 float x = gp.x (); 00260 float y = gp.y (); 00261 float z = gp.z (); 00262 00263 LOG (2, trace, LFfwvis, "#" << nRecHit++ << ": " << "(" << x << ", " << y << ", " << z << ")" 00264 << " on module =" << (it)->geographicalId ().rawId () << "\n"); 00265 mySeed.push_back (SbVec3f (x, y, z)); 00266 } 00267 } 00268 m_hitPoints.push_back (mySeed); 00269 00270 LOG (2, trace, LFfwvis, "\nConvert TrajectoryState \n"); 00271 00272 TrajectoryStateTransform tsTransform; 00273 00274 PTrajectoryStateOnDet pTSOD = seed->startingState (); 00275 DetId seedDetId (pTSOD.detId ()); 00276 00277 const GeomDet* gdet = esService->idToDet (seedDetId); 00278 00279 TrajectoryStateOnSurface tsos = tsTransform.transientState (pTSOD, &(gdet->surface ()), 00280 &*m_mgField); 00281 00282 if (tsos.isValid ()) 00283 { 00284 float x = tsos.globalPosition ().x () / 100.0; 00285 float y = tsos.globalPosition ().y () / 100.0; 00286 float z = tsos.globalPosition ().z () / 100.0; 00287 00288 float dirx = tsos.globalDirection ().x () / 100.0; 00289 float diry = tsos.globalDirection ().y () / 100.0; 00290 float dirz = tsos.globalDirection ().z () / 100.0; 00291 00292 LOG (2, trace, LFfwvis, "seed"<< "Pos: (" << x << ", " << y << ", " << z 00293 << "),\n Dir: (" << dirx << ", " << diry << ", " << dirz << ") "); 00294 00295 m_seedPositions.push_back (SbVec3f (x, y, z)); 00296 m_seedDirections.push_back (SbVec3f (dirx, diry, dirz)); 00297 } 00298 } 00299 } 00300 catch (cms::Exception& e) 00301 { 00302 e.append (" from VisTrajectorySeedTwig: "); 00303 e.append (this->name ()); 00304 00305 if (this->m_onCmsException) 00306 this->m_onCmsException (&e); 00307 } 00308 catch (lat::Error &e) 00309 { 00310 if (this->m_onError) 00311 this->m_onError (&e); 00312 } 00313 catch (std::exception &e) 00314 { 00315 if (this->m_onException) 00316 this->m_onException (&e); 00317 } 00318 catch (...) 00319 { 00320 if (this->m_onUnhandledException) 00321 this->m_onUnhandledException (); 00322 } 00323 } 00324 } 00325 } 00326 } 00327 00328 VisQueuedTwig::onBaseInvalidate (); 00329 00330 if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (state ())) 00331 sbar->setMessage (QString (m_text)); 00332 }
Definition at line 104 of file VisTrajectorySeedTwig.cc.
References IgRepSet::invalidate(), and IgTwig::SELF_MASK.
00105 { IgRepSet::invalidate (this, SELF_MASK); }
Reimplemented from VisQueuedTwig.
Definition at line 487 of file VisTrajectorySeedTwig.cc.
References Ig3DBaseRep::clear(), i, m_seedDirections, m_seedPositions, m_seedRescaleFactor, Ig3DBaseRep::node(), funct::sqrt(), IgSoArrow::tail, IgSoArrow::tip, VisQueuedTwig::update(), and VisActiveConfigurable< T >::value().
00488 { 00489 // Get debugging dump. 00490 VisQueuedTwig::update (rep); 00491 00492 IgQtLock (); 00493 rep->clear (); 00494 00495 if (! m_seedPositions.empty ()) 00496 { 00497 SoSeparator *sep = new SoSeparator; 00498 00499 SoMaterial *recomat = new SoMaterial; 00500 recomat->diffuseColor.setValue (0.6, 1.0, 0.0); 00501 sep->addChild (recomat); 00502 00503 std::vector<SbVec3f>::const_iterator idir = m_seedDirections.begin (); 00504 00505 for (std::vector<SbVec3f>::const_iterator i = m_seedPositions.begin (); i != m_seedPositions.end (); ++i) 00506 { 00507 IgSoArrow* seedArrow = new IgSoArrow; 00508 float iyy = sqrt ((*i)[0]*(*i)[0] + (*i)[1]*(*i)[1]); 00509 if ((*i)[1] < 0) iyy = -iyy; 00510 00511 SbVec3f rzpos(0, iyy, (*i)[2]); 00512 00513 seedArrow->tail.setValue (rzpos); 00514 00515 float x1 ((*i)[0] + m_seedRescaleFactor.value () *(*idir)[0] ); 00516 float y1 ((*i)[1] + m_seedRescaleFactor.value () *(*idir)[1] ); 00517 float z1 ((*i)[2] + m_seedRescaleFactor.value () *(*idir)[2] ); 00518 00519 float irr = sqrt (x1*x1 + y1*y1); 00520 if (y1 < 0) irr = -irr; 00521 SbVec3f tipPos (SbVec3f (0, irr, z1)); 00522 seedArrow->tip.setValue (tipPos); 00523 sep->addChild (seedArrow); 00524 idir++; 00525 } 00526 rep->node ()->addChild (sep); 00527 } 00528 }
Reimplemented from VisQueuedTwig.
Definition at line 450 of file VisTrajectorySeedTwig.cc.
References Ig3DBaseRep::clear(), i, m_seedDirections, m_seedPositions, m_seedRescaleFactor, Ig3DBaseRep::node(), IgSoArrow::tail, IgSoArrow::tip, VisQueuedTwig::update(), and VisActiveConfigurable< T >::value().
00451 { 00452 // Get debugging dump. 00453 VisQueuedTwig::update (rep); 00454 00455 IgQtLock (); 00456 rep->clear (); 00457 00458 if (! m_seedPositions.empty ()) 00459 { 00460 SoSeparator *sep = new SoSeparator; 00461 00462 SoMaterial *recomat = new SoMaterial; 00463 recomat->diffuseColor.setValue (0.6, 1.0, 0.0); 00464 sep->addChild (recomat); 00465 00466 std::vector<SbVec3f>::const_iterator idir = m_seedDirections.begin (); 00467 00468 for (std::vector<SbVec3f>::const_iterator i = m_seedPositions.begin (); i != m_seedPositions.end (); ++i) 00469 { 00470 IgSoArrow* seedArrow = new IgSoArrow; 00471 seedArrow->tail.setValue (*i); 00472 00473 float x1 ((*i)[0] + m_seedRescaleFactor.value () *(*idir)[0]); 00474 float y1 ((*i)[1] + m_seedRescaleFactor.value () *(*idir)[1]); 00475 float z1 ((*i)[2] + m_seedRescaleFactor.value () *(*idir)[2]); 00476 00477 SbVec3f tipPos (SbVec3f (x1, y1, z1)); 00478 seedArrow->tip.setValue (tipPos); 00479 sep->addChild (seedArrow); 00480 idir++; 00481 } 00482 rep->node ()->addChild (sep); 00483 } 00484 }
Reimplemented from VisQueuedTwig.
Definition at line 335 of file VisTrajectorySeedTwig.cc.
References cms::Exception::append(), begin, e, exception, m_hitPoints, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_seedDirections, m_seedPositions, IgTextRep::setText(), funct::sqrt(), VisQueuedTwig::update(), x, y, and z.
00336 { 00337 // Get debugging dump. 00338 VisQueuedTwig::update (rep); 00339 00340 // Prepare the property description. 00341 std::ostringstream text; 00342 00343 text << setiosflags (std::ios::showpoint | std::ios::fixed); 00344 text.setf (std::ios::right, std::ios::adjustfield); 00345 00346 text << "Trajectory Seed = "; 00347 00348 try 00349 { 00350 unsigned int seed_size = m_seedPositions.size (); 00351 text << std::setw (3) << seed_size; 00352 00353 for (unsigned int nt = 0; nt < seed_size; ++nt) 00354 { 00355 double seed_pt = sqrt (m_seedDirections [nt][0] * m_seedDirections [nt][0] + m_seedDirections [nt][1] * m_seedDirections [nt][1]); 00356 00357 std::ostringstream out_pt; 00358 out_pt << seed_pt; 00359 text << "<table width='100%' border=1>" 00360 << "<TR align = center>" 00361 << "<TD COLSPAN =4>Seed number = " << nt 00362 << " track pt = " << out_pt.str () 00363 << "</TD></TR><TR align = center>" 00364 << "<TH>NumberRecHit</TH>" 00365 << "<TH>GlobalPos</TH>" 00366 << "</TR>"; 00367 00368 int n_rechit = 0; 00369 if (nt < m_hitPoints.size ()) //FIXME 00370 for (std::vector<SbVec3f>::const_iterator ir = m_hitPoints[nt].begin (); ir != m_hitPoints[nt].end (); ++ir) 00371 { 00372 SbVec3f xyzPoint = (*ir); 00373 float x = xyzPoint [0]; 00374 float y = xyzPoint [1]; 00375 float z = xyzPoint [2]; 00376 00377 text << "<TR align = right>" 00378 << "<TD>" << std::setw (3) << n_rechit++<< "</TD>" 00379 << "<TD>" << std::setw (6) << std::setprecision (3) << x << "," << y << "," << z << "</TD></TR>"; 00380 } 00381 text << "</table>"; 00382 } 00383 } 00384 catch (cms::Exception& e) 00385 { 00386 e.append (" from VisTrajectorySeedTwig: "); 00387 e.append (this->name ()); 00388 00389 if (this->m_onCmsException) 00390 this->m_onCmsException (&e); 00391 } 00392 catch (lat::Error &e) 00393 { 00394 if (this->m_onError) 00395 this->m_onError (&e); 00396 } 00397 catch (std::exception &e) 00398 { 00399 if (this->m_onException) 00400 this->m_onException (&e); 00401 } 00402 catch (...) 00403 { 00404 if (this->m_onUnhandledException) 00405 this->m_onUnhandledException (); 00406 } 00407 00408 IgQtLock (); 00409 rep->setText (text.str ()); 00410 }
Reimplemented from VisQueuedTwig.
Definition at line 531 of file VisTrajectorySeedTwig.cc.
References Ig3DBaseRep::clear(), and VisQueuedTwig::update().
00532 { 00533 00534 // Get debugging dump. 00535 VisQueuedTwig::update (rep); 00536 00537 IgQtLock (); 00538 rep->clear (); 00539 00540 //........ still missing 00541 }
Reimplemented from VisQueuedTwig.
Definition at line 413 of file VisTrajectorySeedTwig.cc.
References Ig3DBaseRep::clear(), i, m_seedDirections, m_seedPositions, m_seedRescaleFactor, Ig3DBaseRep::node(), IgSoArrow::tail, IgSoArrow::tip, VisQueuedTwig::update(), and VisActiveConfigurable< T >::value().
00414 { 00415 // Get debugging dump. 00416 VisQueuedTwig::update (rep); 00417 00418 IgQtLock (); 00419 rep->clear (); 00420 00421 if (! m_seedPositions.empty ()) 00422 { 00423 SoSeparator *sep = new SoSeparator; 00424 00425 SoMaterial *recomat = new SoMaterial; 00426 recomat->diffuseColor.setValue (0.6, 1.0, 0.0); 00427 sep->addChild (recomat); 00428 00429 std::vector<SbVec3f>::const_iterator idir = m_seedDirections.begin (); 00430 00431 for (std::vector<SbVec3f>::const_iterator i = m_seedPositions.begin (); i != m_seedPositions.end (); ++i) 00432 { 00433 IgSoArrow* seedArrow = new IgSoArrow; 00434 seedArrow->tail.setValue (*i); 00435 00436 float x1 ((*i)[0] + m_seedRescaleFactor.value () *(*idir)[0]); 00437 float y1 ((*i)[1] + m_seedRescaleFactor.value () *(*idir)[1]); 00438 float z1 ((*i)[2] + m_seedRescaleFactor.value () *(*idir)[2]); 00439 00440 SbVec3f tipPos( SbVec3f(x1, y1, z1) ); 00441 seedArrow->tip.setValue (tipPos); 00442 sep->addChild (seedArrow); 00443 idir++; 00444 } 00445 rep->node ()->addChild (sep); 00446 } 00447 }
const std::string VisTrajectorySeedTwig::m_friendlyName [private] |
std::vector<std::vector<SbVec3f> > VisTrajectorySeedTwig::m_hitPoints [private] |
const std::string VisTrajectorySeedTwig::m_instanceName [private] |
const std::string VisTrajectorySeedTwig::m_moduleLabel [private] |
const std::string VisTrajectorySeedTwig::m_processName [private] |
std::vector<SbVec3f> VisTrajectorySeedTwig::m_seedDirections [private] |
std::vector<SbVec3f> VisTrajectorySeedTwig::m_seedPositions [private] |
std::string VisTrajectorySeedTwig::m_text [private] |