#include <VisReco/VisTracker/interface/VisTrackerPiDigiTwig.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) |
VisTrackerPiDigiTwig (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::vector< std::pair< DetId, PixelDigi > > | m_digis |
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 |
std::string | m_text |
Definition at line 26 of file VisTrackerPiDigiTwig.h.
VisTrackerPiDigiTwig::VisTrackerPiDigiTwig | ( | 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 VisTrackerPiDigiTwig.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 { 00075 VisTwigFactroyService *tfService = VisTwigFactroyService::get (state); 00076 if (! tfService) 00077 { 00078 tfService = new VisTwigFactroyService (state); 00079 } 00080 edm::TypeID piDigiCollID (typeid (edm::DetSetVector<PixelDigi>)); 00081 tfService->registerTwig (piDigiCollID.friendlyClassName (), &createThisTwig); 00082 }
void VisTrackerPiDigiTwig::onNewEvent | ( | const edm::Event & | event, | |
const edm::EventSetup & | eventSetup | |||
) | [virtual] |
Reimplemented from VisQueuedTwig.
Definition at line 85 of file VisTrackerPiDigiTwig.cc.
References cms::Exception::append(), arg, edm::DetSetVector< T >::begin(), c, GenMuonPlsPt100GeV_cfg::cout, edm::DetSet< T >::data, ds, e, edm::DetSetVector< T >::end(), lat::endl(), exception, edm::EventSetup::get(), i, edm::DetSet< T >::id, edm::Event::id(), IgRepSet::invalidate(), m_digis, m_friendlyName, m_instanceName, m_moduleLabel, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_pDD, m_processName, m_text, VisQueuedTwig::onNewEvent(), p, IgTwig::SELF_MASK, and edm::DetSetVector< T >::size().
00087 { 00088 // Get debugging dump. 00089 VisQueuedTwig::onNewEvent (event, eventSetup); 00090 00091 m_digis.clear (); 00092 00093 m_text = (QString ("Run # %1, event # %2") 00094 .arg (event.id ().run ()) 00095 .arg (event.id ().event ()).latin1 ()); 00096 00097 std::vector< edm::Handle<edm::DetSetVector<PixelDigi> > > p_digi_collections; 00098 try 00099 { 00100 if ((! m_friendlyName.empty ()) || (! m_moduleLabel.empty ()) || (! m_instanceName.empty ()) || (! m_processName.empty ())) 00101 { 00102 VisEventSelector visSel (m_friendlyName, m_moduleLabel, m_instanceName, m_processName); 00103 event.getMany (visSel, p_digi_collections); 00104 } 00105 else 00106 { 00107 event.getManyByType (p_digi_collections); 00108 } 00109 eventSetup.get<TrackerDigiGeometryRecord> ().get (m_pDD); 00110 } 00111 catch (cms::Exception& e) 00112 { 00113 e.append (" from VisTrackerPiDigiTwig: "); 00114 e.append (this->name ()); 00115 00116 if (this->m_onCmsException) 00117 this->m_onCmsException (&e); 00118 } 00119 catch (lat::Error &e) 00120 { 00121 if (this->m_onError) 00122 this->m_onError (&e); 00123 } 00124 catch (std::exception &e) 00125 { 00126 if (this->m_onException) 00127 this->m_onException (&e); 00128 } 00129 catch (...) 00130 { 00131 if (this->m_onUnhandledException) 00132 this->m_onUnhandledException (); 00133 } 00134 00135 if (! p_digi_collections.empty ()) 00136 { 00137 std::vector< edm::Handle<edm::DetSetVector<PixelDigi> > >::iterator i; 00138 for (i = p_digi_collections.begin (); i != p_digi_collections.end (); i++) 00139 { 00140 const edm::DetSetVector<PixelDigi> &c = *(*i); 00141 00142 edm::DetSetVector<PixelDigi>::const_iterator DSViter=c.begin(); 00143 std::cout << c.size() << std::endl; 00144 for (; DSViter!=c.end();DSViter++){ 00145 edm::DetSet<PixelDigi> ds = *DSViter; 00146 if (ds.data.size()) 00147 { 00148 const uint32_t& detID = ds.id; 00149 DetId detid(detID); 00150 edm::DetSet<PixelDigi>::const_iterator idigi=ds.data.begin(); 00151 for(;idigi!=ds.data.end();idigi++){ 00152 std::pair<DetId, PixelDigi> p; 00153 p.first = detid; 00154 p.second = (*idigi); 00155 m_digis.push_back (p); 00156 } // for digis 00157 }//if data.size 00158 }//for DSViter 00159 } 00160 } 00161 00162 IgRepSet::invalidate (this, SELF_MASK); 00163 }
Reimplemented from VisQueuedTwig.
Definition at line 456 of file VisTrackerPiDigiTwig.cc.
References cms::Exception::append(), Ig3DBaseRep::clear(), e, exception, PixelGeomDetUnit::geographicalId(), i, RectangularPixelTopology::localPosition(), m_digis, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_pDD, Ig3DBaseRep::node(), row, PixelGeomDetUnit::specificTopology(), funct::sqrt(), DetId::subdetId(), VisQueuedTwig::update(), PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), y, PV3DBase< T, PVType, FrameType >::z(), and z.
00457 { 00458 // Get debugging dump. 00459 VisQueuedTwig::update (rep); 00460 00461 IgQtLock (); 00462 rep->clear (); 00463 00464 if (! m_digis.empty () ) 00465 { 00466 SoSeparator *sep = new SoSeparator; 00467 SoMaterial *mat = new SoMaterial; 00468 mat->diffuseColor.setValue (0.3, 0.8, 0.0); 00469 sep->addChild (mat); 00470 00471 SoDrawStyle *drawStyle = new SoDrawStyle; 00472 drawStyle->pointSize = 3.0; 00473 sep->addChild (drawStyle); 00474 00475 try 00476 { 00477 SoVertexProperty *vertices = new SoVertexProperty; 00478 int nVrx = 0; 00479 00480 for (std::vector<std::pair<DetId,PixelDigi> >::const_iterator i = m_digis.begin (); i != m_digis.end (); ++i) 00481 { 00482 const DetId& id = (*i).first; 00483 const PixelGeomDetUnit* theDet = dynamic_cast<const PixelGeomDetUnit*>(m_pDD->idToDet (id)); 00484 // Draw only if in barrel. 00485 int subdet = theDet->geographicalId().subdetId(); 00486 if(subdet==1 || subdet == 3 || subdet == 5){ 00487 const RectangularPixelTopology *theTopol = dynamic_cast<const RectangularPixelTopology *>( &(theDet->specificTopology ())); 00488 int row = (*i).second.row(); 00489 int column =(*i).second.column(); 00490 GlobalPoint pos = (m_pDD->idToDet (id))->surface().toGlobal(theTopol->localPosition(MeasurementPoint(row,column))); 00491 float x = 0; 00492 float y = sqrt(pos.x ()*pos.x()+pos.y()*pos.y()) / 100.0; if(pos.y()< 0. )y = - y; 00493 float z = pos.z () / 100.0; // cm -> m 00494 00495 vertices->vertex.set1Value (nVrx++, SbVec3f (x, y, z)); 00496 } 00497 } 00498 vertices->vertex.setNum (nVrx); 00499 00500 SoPointSet *points = new SoPointSet; 00501 points->vertexProperty.setValue (vertices); 00502 points->numPoints.setValue (nVrx); 00503 sep->addChild (points); 00504 } 00505 catch (cms::Exception& e) 00506 { 00507 e.append (" from VisTrackerPiDigiTwig: "); 00508 e.append (this->name ()); 00509 00510 if (this->m_onCmsException) 00511 this->m_onCmsException (&e); 00512 } 00513 catch (lat::Error &e) 00514 { 00515 if (this->m_onError) 00516 this->m_onError (&e); 00517 } 00518 catch (std::exception &e) 00519 { 00520 if (this->m_onException) 00521 this->m_onException (&e); 00522 } 00523 catch (...) 00524 { 00525 if (this->m_onUnhandledException) 00526 this->m_onUnhandledException (); 00527 } 00528 00529 rep->node ()->addChild (sep); 00530 } 00531 }
Reimplemented from VisQueuedTwig.
Definition at line 382 of file VisTrackerPiDigiTwig.cc.
References cms::Exception::append(), Ig3DBaseRep::clear(), e, exception, i, RectangularPixelTopology::localPosition(), m_digis, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_pDD, Ig3DBaseRep::node(), row, PixelGeomDetUnit::specificTopology(), VisQueuedTwig::update(), PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), y, and z.
00383 { 00384 // Get debugging dump. 00385 VisQueuedTwig::update (rep); 00386 00387 IgQtLock (); 00388 rep->clear (); 00389 00390 if (! m_digis.empty ()) 00391 { 00392 SoSeparator *sep = new SoSeparator; 00393 00394 SoMaterial *mat = new SoMaterial; 00395 mat->diffuseColor.setValue (0.0, 1.0, 0.0); 00396 sep->addChild (mat); 00397 00398 SoDrawStyle *drawStyle = new SoDrawStyle; 00399 drawStyle->pointSize = 4.0; 00400 sep->addChild (drawStyle); 00401 00402 try 00403 { 00404 SoVertexProperty *vertices = new SoVertexProperty; 00405 int nVrtx = 0; 00406 for (std::vector<std::pair<DetId, PixelDigi> >::const_iterator 00407 i = m_digis.begin (); i != m_digis.end (); ++i) 00408 { 00409 const DetId& id = (*i).first; 00410 const PixelGeomDetUnit* theDet = dynamic_cast<const PixelGeomDetUnit*>(m_pDD->idToDet (id)); 00411 const RectangularPixelTopology *theTopol = dynamic_cast<const RectangularPixelTopology *>( &(theDet->specificTopology ())); 00412 int row = (*i).second.row(); 00413 int column =(*i).second.column(); 00414 GlobalPoint pos = (m_pDD->idToDet (id))->surface().toGlobal(theTopol->localPosition(MeasurementPoint(row,column))); 00415 float x = pos.x () / 100.0; // cm -> m 00416 float y = pos.y () / 100.0; // cm -> m 00417 float z = 10.0; // cm -> m 00418 vertices->vertex.set1Value (nVrtx++, SbVec3f (x, y, z)); 00419 } 00420 vertices->vertex.setNum (nVrtx); 00421 SoPointSet *points = new SoPointSet; 00422 points->vertexProperty.setValue (vertices); 00423 points->numPoints.setValue (nVrtx); 00424 00425 sep->addChild (points); 00426 } 00427 catch (cms::Exception& e) 00428 { 00429 e.append (" from VisTrackerPiDigiTwig: "); 00430 e.append (this->name ()); 00431 00432 if (this->m_onCmsException) 00433 this->m_onCmsException (&e); 00434 } 00435 catch (lat::Error &e) 00436 { 00437 if (this->m_onError) 00438 this->m_onError (&e); 00439 } 00440 catch (std::exception &e) 00441 { 00442 if (this->m_onException) 00443 this->m_onException (&e); 00444 } 00445 catch (...) 00446 { 00447 if (this->m_onUnhandledException) 00448 this->m_onUnhandledException (); 00449 } 00450 00451 rep->node ()->addChild (sep); 00452 } 00453 }
Reimplemented from VisQueuedTwig.
Definition at line 166 of file VisTrackerPiDigiTwig.cc.
References cms::Exception::append(), e, exception, i, edm::ESHandle< T >::isValid(), RectangularPixelTopology::localPosition(), m_digis, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_pDD, m_text, row, IgTextRep::setText(), PixelGeomDetUnit::specificTopology(), VisQueuedTwig::update(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
00167 { 00168 // Get debugging dump. 00169 VisQueuedTwig::update (rep); 00170 00171 // Prepare property description. 00172 std::ostringstream text; 00173 text << "Total " << m_digis.size () << " Pixel digis from"; 00174 if(m_digis.size() > 100){ 00175 text << " input file: printing only first 100 " << "<br>"; 00176 }else text << " input file: " << m_text << "<br>"; 00177 00178 text << "<table width='100%' border=1>" 00179 << "<TR align = center>" 00180 << "<TH>Number</TH>" 00181 << "<TH>GeomdetId</TH>" 00182 << "<TH>Position</TH>" 00183 << "<TH>Charge</TH>" 00184 << "<TH>Column</TH>" 00185 << "<TH>Row</TH>" 00186 << "</TR>"; 00187 text << setiosflags (std::ios::showpoint | std::ios::fixed); 00188 text.setf (std::ios::right, std::ios::adjustfield); 00189 00190 if ((! m_digis.empty ())&& m_pDD.isValid ()) 00191 { 00192 int nDigis = 0; 00193 try 00194 { 00195 for (std::vector<std::pair<DetId, PixelDigi> >::const_iterator i = m_digis.begin (); i != m_digis.end (); ++i) 00196 { 00197 const DetId& id = (*i).first; 00198 const PixelGeomDetUnit* theDet = dynamic_cast<const PixelGeomDetUnit*>(m_pDD->idToDet (id)); 00199 const RectangularPixelTopology *theTopol = dynamic_cast<const RectangularPixelTopology *>( &(theDet->specificTopology ())); 00200 00201 int row = (*i).second.row(); 00202 int column =(*i).second.column(); 00203 00204 GlobalPoint pos = (m_pDD->idToDet (id))->surface().toGlobal(theTopol->localPosition(MeasurementPoint(row,column))); 00205 00206 text << "<TR align = right>" 00207 << "<TD>" << std::setw (3) << nDigis++ << "</TD>" 00208 << "<TD>" << std::setw (11) << ((*i).first).rawId()<< "</TD>" 00209 << "<TD>" << pos.x () << ", " << pos.y () << ", " << pos.z () << "</TD>" 00210 << "<TD>" << std::setw (6) << std::setprecision (3) << (*i).second.adc () << "</TD>" 00211 << "<TD>" << std::setw (6) << std::setprecision (3) << (*i).second.column () << "</TD>" 00212 << "<TD>" << std::setw (6) << std::setprecision (3) << (*i).second.row () << "</TD></TR>"; 00213 if (nDigis>100) break; 00214 } 00215 } 00216 catch (cms::Exception& e) 00217 { 00218 e.append (" from VisTrackerPiDigiTwig: "); 00219 e.append (this->name ()); 00220 00221 if (this->m_onCmsException) 00222 this->m_onCmsException (&e); 00223 } 00224 catch (lat::Error &e) 00225 { 00226 if (this->m_onError) 00227 this->m_onError (&e); 00228 } 00229 catch (std::exception &e) 00230 { 00231 if (this->m_onException) 00232 this->m_onException (&e); 00233 } 00234 catch (...) 00235 { 00236 if (this->m_onUnhandledException) 00237 this->m_onUnhandledException (); 00238 } 00239 text << "</table><p>"; 00240 } 00241 // Send it over. 00242 IgQtLock (); 00243 rep->setText (text.str ()); 00244 }
Reimplemented from VisQueuedTwig.
Definition at line 321 of file VisTrackerPiDigiTwig.cc.
References cms::Exception::append(), Ig3DBaseRep::clear(), e, IgSoTower::energy, eta, PV3DBase< T, PVType, FrameType >::eta(), exception, i, RectangularPixelTopology::localPosition(), m_digis, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_pDD, Ig3DBaseRep::node(), PV3DBase< T, PVType, FrameType >::phi(), phi, IgSoTower::position, row, IgSoTower::scaleFactor, PixelGeomDetUnit::specificTopology(), and VisQueuedTwig::update().
00322 { 00323 // Get debugging dump. 00324 VisQueuedTwig::update (rep); 00325 00326 IgQtLock (); 00327 rep->clear (); 00328 00329 SoSeparator *sep = new SoSeparator; // global 00330 00331 try 00332 { 00333 for (std::vector<std::pair<DetId, PixelDigi> >::const_iterator i = m_digis.begin (); i != m_digis.end (); ++i) 00334 { 00335 const DetId& id = (*i).first; 00336 const PixelGeomDetUnit* theDet = dynamic_cast<const PixelGeomDetUnit*>(m_pDD->idToDet (id)); 00337 const RectangularPixelTopology *theTopol = dynamic_cast<const RectangularPixelTopology *>( &(theDet->specificTopology ())); 00338 int row = (*i).second.row(); 00339 int column =(*i).second.column(); 00340 GlobalPoint pos = (m_pDD->idToDet (id))->surface().toGlobal(theTopol->localPosition(MeasurementPoint(row,column))); 00341 double eta = pos.eta (); 00342 double phi = pos.phi (); 00343 if (phi < 0.0) phi = 2 * M_PI + phi; // correction in absence of one convention 00344 int adcCounts = (*i).second.adc (); 00345 00346 IgSoTower *tower = new IgSoTower; 00347 tower->position = SbVec2f (phi, eta); // eta, phi 00348 tower->scaleFactor = 20.0; 00349 tower->energy = adcCounts; 00350 sep->addChild (tower); 00351 } 00352 00353 } 00354 catch (cms::Exception& e) 00355 { 00356 e.append (" from VisTrackerPiDigiTwig: "); 00357 e.append (this->name ()); 00358 00359 if (this->m_onCmsException) 00360 this->m_onCmsException (&e); 00361 } 00362 catch (lat::Error &e) 00363 { 00364 if (this->m_onError) 00365 this->m_onError (&e); 00366 } 00367 catch (std::exception &e) 00368 { 00369 if (this->m_onException) 00370 this->m_onException (&e); 00371 } 00372 catch (...) 00373 { 00374 if (this->m_onUnhandledException) 00375 this->m_onUnhandledException (); 00376 } 00377 00378 rep->node ()->addChild (sep); 00379 }
Reimplemented from VisQueuedTwig.
Definition at line 247 of file VisTrackerPiDigiTwig.cc.
References cms::Exception::append(), Ig3DBaseRep::clear(), e, exception, i, RectangularPixelTopology::localPosition(), m_digis, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_pDD, Ig3DBaseRep::node(), row, PixelGeomDetUnit::specificTopology(), VisQueuedTwig::update(), PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), y, PV3DBase< T, PVType, FrameType >::z(), and z.
00248 { 00249 // Get debugging dump. 00250 VisQueuedTwig::update (rep); 00251 IgQtLock (); 00252 rep->clear (); 00253 00254 if (! m_digis.empty ()) 00255 { 00256 SoMaterial *mat = new SoMaterial; 00257 mat->diffuseColor.setValue (0.0, 1.0, 0.0);//green 00258 mat->emissiveColor.setValue(0.0, 1.0, 0.0); 00259 00260 SoDrawStyle *drawStyle = new SoDrawStyle; 00261 drawStyle->pointSize = 4.0; 00262 00263 SoSeparator *sep = new SoSeparator; // global 00264 sep->addChild (mat); 00265 sep->addChild (drawStyle); 00266 00267 try 00268 { 00269 SoVertexProperty *vertices = new SoVertexProperty; 00270 int nVrtx = 0; 00271 for (std::vector<std::pair<DetId, PixelDigi> >::const_iterator 00272 i = m_digis.begin (); i != m_digis.end (); ++i) 00273 { 00274 const DetId& id = (*i).first; 00275 const PixelGeomDetUnit* theDet = dynamic_cast<const PixelGeomDetUnit*>(m_pDD->idToDet (id)); 00276 const RectangularPixelTopology *theTopol = dynamic_cast<const RectangularPixelTopology *>( &(theDet->specificTopology ())); 00277 int row = (*i).second.row(); 00278 int column =(*i).second.column(); 00279 GlobalPoint pos = (m_pDD->idToDet (id))->surface().toGlobal(theTopol->localPosition(MeasurementPoint(row,column))); 00280 float x = pos.x () / 100.0; // cm -> m 00281 float y = pos.y () / 100.0; // cm -> m 00282 float z = pos.z () / 100.0; // cm -> m 00283 vertices->vertex.set1Value (nVrtx++, SbVec3f (x, y, z)); 00284 } 00285 00286 vertices->vertex.setNum (nVrtx); 00287 SoPointSet *points = new SoPointSet; 00288 points->vertexProperty.setValue (vertices); 00289 points->numPoints.setValue (nVrtx); 00290 00291 sep->addChild (points); 00292 } 00293 catch (cms::Exception& e) 00294 { 00295 e.append (" from VisTrackerPiDigiTwig: "); 00296 e.append (this->name ()); 00297 00298 if (this->m_onCmsException) 00299 this->m_onCmsException (&e); 00300 } 00301 catch (lat::Error &e) 00302 { 00303 if (this->m_onError) 00304 this->m_onError (&e); 00305 } 00306 catch (std::exception &e) 00307 { 00308 if (this->m_onException) 00309 this->m_onException (&e); 00310 } 00311 catch (...) 00312 { 00313 if (this->m_onUnhandledException) 00314 this->m_onUnhandledException (); 00315 } 00316 rep->node ()->addChild (sep); 00317 } 00318 }
std::vector<std::pair<DetId, PixelDigi> > VisTrackerPiDigiTwig::m_digis [private] |
const std::string VisTrackerPiDigiTwig::m_friendlyName [private] |
const std::string VisTrackerPiDigiTwig::m_instanceName [private] |
const std::string VisTrackerPiDigiTwig::m_moduleLabel [private] |
const std::string VisTrackerPiDigiTwig::m_processName [private] |
std::string VisTrackerPiDigiTwig::m_text [private] |