#include <VisReco/VisTracker/interface/VisTrackerPiRechitTwig.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) |
VisTrackerPiRechitTwig (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 |
edm::ESHandle< TrackerGeometry > | m_pDD |
const std::string | m_processName |
std::string | m_text |
std::vector< std::pair < std::pair< DetId, LocalPoint >, int > > | rtemp |
Definition at line 26 of file VisTrackerPiRechitTwig.h.
VisTrackerPiRechitTwig::VisTrackerPiRechitTwig | ( | 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 55 of file VisTrackerPiRechitTwig.cc.
References createThisTwig(), edm::TypeID::friendlyClassName(), DBSPlugin::get(), and VisTwigFactroyService::registerTwig().
00061 : VisQueuedTwig (state, parent, name), 00062 m_text (name), 00063 m_friendlyName (friendlyName), 00064 m_moduleLabel (moduleLabel), 00065 m_instanceName (instanceName), 00066 m_processName (processName) 00067 { 00068 VisTwigFactroyService *tfService = VisTwigFactroyService::get (state); 00069 if (! tfService) 00070 { 00071 tfService = new VisTwigFactroyService (state); 00072 } 00073 edm::TypeID pixelrechitCollID (typeid (SiPixelRecHitCollection)); 00074 tfService->registerTwig (pixelrechitCollID.friendlyClassName (), &createThisTwig); 00075 }
void VisTrackerPiRechitTwig::onNewEvent | ( | const edm::Event & | event, | |
const edm::EventSetup & | eventSetup | |||
) | [virtual] |
Reimplemented from VisQueuedTwig.
Definition at line 79 of file VisTrackerPiRechitTwig.cc.
References cms::Exception::append(), arg, c, e, exception, edm::EventSetup::get(), edm::RangeMap< ID, C, P >::get(), i, edm::Event::id(), edm::RangeMap< ID, C, P >::id_begin(), edm::RangeMap< ID, C, P >::id_end(), 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::onBaseInvalidate(), VisQueuedTwig::onNewEvent(), range, DetId::rawId(), and rtemp.
00081 { 00082 // Get debugging dump. 00083 VisQueuedTwig::onNewEvent (event, eventSetup); 00084 00085 rtemp.clear(); 00086 00087 m_text = (QString ("Run # %1, event # %2") 00088 .arg (event.id ().run ()) 00089 .arg (event.id ().event ()).latin1 ()); 00090 00091 std::vector< edm::Handle<SiPixelRecHitCollection> > pixelrechit_collections; 00092 try 00093 { 00094 if ((! m_friendlyName.empty ()) || (! m_moduleLabel.empty ()) || (! m_instanceName.empty ()) || (! m_processName.empty ())) 00095 { 00096 VisEventSelector visSel (m_friendlyName, m_moduleLabel, m_instanceName, m_processName); 00097 event.getMany (visSel, pixelrechit_collections); 00098 } 00099 else 00100 { 00101 event.getManyByType (pixelrechit_collections); 00102 } 00103 eventSetup.get<TrackerDigiGeometryRecord> ().get (m_pDD); 00104 } 00105 catch (cms::Exception& e) 00106 { 00107 e.append (" from VisTrackerPiRechitTwig: "); 00108 e.append (this->name ()); 00109 00110 if (this->m_onCmsException) 00111 this->m_onCmsException (&e); 00112 } 00113 catch (lat::Error &e) 00114 { 00115 if (this->m_onError) 00116 this->m_onError (&e); 00117 } 00118 catch (std::exception &e) 00119 { 00120 if (this->m_onException) 00121 this->m_onException (&e); 00122 } 00123 catch (...) 00124 { 00125 if (this->m_onUnhandledException) 00126 this->m_onUnhandledException (); 00127 } 00128 00129 if (! pixelrechit_collections.empty ()) 00130 { 00131 std::vector< edm::Handle<SiPixelRecHitCollection> >::iterator i; 00132 for (i = pixelrechit_collections.begin (); i != pixelrechit_collections.end (); i++) 00133 { 00134 const SiPixelRecHitCollection&c = *(*i); 00135 00136 SiPixelRecHitCollection::id_iterator detUnitIt; 00137 for (detUnitIt = c.id_begin(); detUnitIt != c.id_end(); ++detUnitIt) 00138 { 00139 SiPixelRecHitCollection::range range = c.get((*detUnitIt)); 00140 for (SiPixelRecHitCollection::const_iterator pixel_rechit = range.first; pixel_rechit!=range.second; ++pixel_rechit) 00141 { 00142 DetId detectorId = (*pixel_rechit).geographicalId(); 00143 unsigned int id = detectorId.rawId(); 00144 00145 DetId detIdObject(id); 00146 00147 LocalPoint position; 00148 if((*pixel_rechit).hasPositionAndError()) 00149 position=(*pixel_rechit).localPosition(); else break; 00150 00151 // const SiPixelCluster* Cluster=(*pixel_rechit).cluster().get(); 00152 00153 int clusterCharge = 0; 00154 /*int cas = Cluster->amplitudes().size(); 00155 for (int j=0; j<cas; j++) 00156 { 00157 clusterCharge +=Cluster->amplitudes()[j]; 00158 } 00159 */ 00160 00161 std::pair<std::pair<DetId, LocalPoint>, int> pxd; 00162 pxd.first.first = detIdObject; 00163 //pxd.second = position; 00164 pxd.first.second = position; 00165 pxd.second =clusterCharge; 00166 rtemp.push_back(pxd); 00167 } 00168 } 00169 } 00170 } 00171 VisQueuedTwig::onBaseInvalidate (); 00172 }
Reimplemented from VisQueuedTwig.
Definition at line 444 of file VisTrackerPiRechitTwig.cc.
References cms::Exception::append(), Ig3DBaseRep::clear(), e, exception, i, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_pDD, Ig3DBaseRep::node(), rtemp, funct::sqrt(), VisQueuedTwig::update(), PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), y, PV3DBase< T, PVType, FrameType >::z(), and z.
00445 { 00446 // Get debugging dump. 00447 VisQueuedTwig::update (rep); 00448 00449 IgQtLock (); 00450 rep->clear (); 00451 00452 if (! rtemp.empty ()) 00453 { 00454 SoSeparator *sep = new SoSeparator; 00455 SoMaterial *mat = new SoMaterial; 00456 mat->diffuseColor.setValue (1.0, 0.0, 0.0); 00457 sep->addChild (mat); 00458 00459 SoDrawStyle *drawStyle = new SoDrawStyle; 00460 drawStyle->pointSize = 3.0; 00461 sep->addChild (drawStyle); 00462 00463 try 00464 { 00465 SoVertexProperty *vertices = new SoVertexProperty; 00466 int nVrx = 0; 00467 00468 for (std::vector<std::pair<std::pair<DetId, LocalPoint>,int> >::const_iterator i = rtemp.begin (); i != rtemp.end (); ++i) 00469 { 00470 GlobalPoint pos = (m_pDD->idToDet ((*i).first.first))->surface().toGlobal((*i).first.second); 00471 float x = 0.0; 00472 float y = sqrt(pos.x ()*pos.x()+pos.y()*pos.y()) / 100.0; if(pos.y()< 0. )y = - y; 00473 float z = pos.z () / 100.0; // cm -> m 00474 00475 vertices->vertex.set1Value (nVrx++, SbVec3f (x, y, z)); 00476 } 00477 00478 vertices->vertex.setNum (rtemp.size()); 00479 00480 SoPointSet *points = new SoPointSet; 00481 points->vertexProperty.setValue (vertices); 00482 points->numPoints.setValue (rtemp.size()); 00483 sep->addChild (points); 00484 } 00485 catch (cms::Exception& e) 00486 { 00487 e.append (" from VisTrackerPiRechitTwig: "); 00488 e.append (this->name ()); 00489 00490 if (this->m_onCmsException) 00491 this->m_onCmsException (&e); 00492 } 00493 catch (lat::Error &e) 00494 { 00495 if (this->m_onError) 00496 this->m_onError (&e); 00497 } 00498 catch (std::exception &e) 00499 { 00500 if (this->m_onException) 00501 this->m_onException (&e); 00502 } 00503 catch (...) 00504 { 00505 if (this->m_onUnhandledException) 00506 this->m_onUnhandledException (); 00507 } 00508 rep->node ()->addChild (sep); 00509 } 00510 }
Reimplemented from VisQueuedTwig.
Definition at line 374 of file VisTrackerPiRechitTwig.cc.
References cms::Exception::append(), Ig3DBaseRep::clear(), e, exception, i, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_pDD, Ig3DBaseRep::node(), rtemp, VisQueuedTwig::update(), PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), y, PV3DBase< T, PVType, FrameType >::z(), and z.
00375 { 00376 // Get debugging dump. 00377 VisQueuedTwig::update (rep); 00378 00379 IgQtLock (); 00380 rep->clear (); 00381 00382 if (! rtemp.empty ()) 00383 { 00384 SoSeparator *sep = new SoSeparator; 00385 00386 SoMaterial *mat = new SoMaterial; 00387 mat->diffuseColor.setValue (1.0, 0.0, 0.0); 00388 sep->addChild (mat); 00389 00390 SoDrawStyle *drawStyle = new SoDrawStyle; 00391 drawStyle->pointSize = 4.0; 00392 sep->addChild (drawStyle); 00393 00394 try 00395 { 00396 SoVertexProperty *vertices = new SoVertexProperty; 00397 int nVrtx = 0; 00398 for (std::vector<std::pair<std::pair<DetId, LocalPoint>, int> >::const_iterator i = rtemp.begin (); i != rtemp.end (); ++i) 00399 { 00400 GlobalPoint pos = (m_pDD->idToDet ((*i).first.first))->surface().toGlobal((*i).first.second); 00401 float x = pos.x () / 100.0; // cm -> m 00402 float y = pos.y () / 100.0; // cm -> m 00403 float z = pos.z () / 100.0; // cm -> m 00404 00405 vertices->vertex.set1Value (nVrtx++, SbVec3f (x, y, z)); 00406 } 00407 00408 vertices->vertex.setNum (nVrtx); 00409 SoPointSet *points = new SoPointSet; 00410 points->vertexProperty.setValue (vertices); 00411 points->numPoints.setValue (nVrtx); 00412 00413 sep->addChild (points); 00414 } 00415 catch (cms::Exception& e) 00416 { 00417 e.append (" from VisTrackerPiRechitTwig: "); 00418 e.append (this->name ()); 00419 00420 if (this->m_onCmsException) 00421 this->m_onCmsException (&e); 00422 } 00423 catch (lat::Error &e) 00424 { 00425 if (this->m_onError) 00426 this->m_onError (&e); 00427 } 00428 catch (std::exception &e) 00429 { 00430 if (this->m_onException) 00431 this->m_onException (&e); 00432 } 00433 catch (...) 00434 { 00435 if (this->m_onUnhandledException) 00436 this->m_onUnhandledException (); 00437 } 00438 rep->node ()->addChild (sep); 00439 } 00440 }
Reimplemented from VisQueuedTwig.
Definition at line 175 of file VisTrackerPiRechitTwig.cc.
References cms::Exception::append(), e, exception, i, edm::ESHandle< T >::isValid(), VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_pDD, m_text, rtemp, IgTextRep::setText(), VisQueuedTwig::update(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
00176 { 00177 // Get debugging dump. 00178 VisQueuedTwig::update (rep); 00179 00180 // Prepare property description. 00181 std::ostringstream text; 00182 text << "Total " << rtemp.size () << " Silicon Pixel rechits from"; 00183 if(rtemp.size() > 100){ 00184 text << " input file: printing only first 100 " << "<br>"; 00185 }else text << " input file: " << m_text << "<br>"; 00186 00187 text << "<table width='100%' border=1>" 00188 << "<TR align = center>" 00189 << "<TH>Number</TH>" 00190 << "<TH>GeomdetId</TH>" 00191 << "<TH>Position</TH>" 00192 << "</TR>"; 00193 00194 text << setiosflags (std::ios::showpoint | std::ios::fixed); 00195 text.setf (std::ios::right, std::ios::adjustfield); 00196 00197 if ((! rtemp.empty ()) && m_pDD.isValid ()) 00198 { 00199 00200 int nRecHits = 0; 00201 try 00202 { 00203 for (std::vector<std::pair<std::pair<DetId, LocalPoint>, int> >::const_iterator i = rtemp.begin (); i != rtemp.end (); ++i) 00204 { 00205 GlobalPoint pos = (m_pDD->idToDet ((*i).first.first))->surface().toGlobal((*i).first.second); 00206 text << "<TR align = right>" 00207 << "<TD>" << std::setw (3) << nRecHits++ << "</TD>" 00208 << "<TD>" << std::setw (11) << ((*i).first.first).rawId()<< "</TD>" 00209 << "<TD>" << pos.x()/100 << ", " << pos.y()/100 << ", " << pos.z()/100 << "</TD>"; 00210 if (nRecHits>100) break; 00211 } 00212 } 00213 catch (cms::Exception& e) 00214 { 00215 e.append (" from VisTrackerPiRechitTwig: "); 00216 e.append (this->name ()); 00217 00218 if (this->m_onCmsException) 00219 this->m_onCmsException (&e); 00220 } 00221 catch (lat::Error &e) 00222 { 00223 if (this->m_onError) 00224 this->m_onError (&e); 00225 } 00226 catch (std::exception &e) 00227 { 00228 if (this->m_onException) 00229 this->m_onException (&e); 00230 } 00231 catch (...) 00232 { 00233 if (this->m_onUnhandledException) 00234 this->m_onUnhandledException (); 00235 } 00236 text << "</table>"; 00237 } 00238 00239 // Send it over. 00240 IgQtLock (); 00241 rep->setText (text.str ()); 00242 }
Reimplemented from VisQueuedTwig.
Definition at line 317 of file VisTrackerPiRechitTwig.cc.
References cms::Exception::append(), Ig3DBaseRep::clear(), e, IgSoTower::energy, eta, PV3DBase< T, PVType, FrameType >::eta(), exception, i, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_pDD, Ig3DBaseRep::node(), PV3DBase< T, PVType, FrameType >::phi(), phi, IgSoTower::position, rtemp, IgSoTower::scaleFactor, and VisQueuedTwig::update().
00318 { 00319 // Get debugging dump. 00320 VisQueuedTwig::update (rep); 00321 00322 IgQtLock (); 00323 rep->clear (); 00324 00325 SoSeparator *sep = new SoSeparator; // global 00326 00327 try 00328 { 00329 for (std::vector<std::pair<std::pair<DetId, LocalPoint>, int> >::const_iterator i = rtemp.begin (); i != rtemp.end (); ++i) 00330 { 00331 GlobalPoint pos = (m_pDD->idToDet ((*i).first.first))->surface().toGlobal((*i).first.second); 00332 00333 double eta = pos.eta (); 00334 double phi = pos.phi (); 00335 if (phi < 0.0) phi = 2 * M_PI + phi; // correction in absence of one convention 00336 00337 int recCharge =(*i).second; 00338 00339 IgSoTower *tower = new IgSoTower; 00340 tower->position = SbVec2f (phi, eta); // eta, phi 00341 tower->scaleFactor = 20.0; 00342 tower->energy = recCharge; 00343 sep->addChild (tower); 00344 } 00345 } 00346 catch (cms::Exception& e) 00347 { 00348 e.append (" from VisTrackerPiRechitTwig: "); 00349 e.append (this->name ()); 00350 00351 if (this->m_onCmsException) 00352 this->m_onCmsException (&e); 00353 } 00354 catch (lat::Error &e) 00355 { 00356 if (this->m_onError) 00357 this->m_onError (&e); 00358 } 00359 catch (std::exception &e) 00360 { 00361 if (this->m_onException) 00362 this->m_onException (&e); 00363 } 00364 catch (...) 00365 { 00366 if (this->m_onUnhandledException) 00367 this->m_onUnhandledException (); 00368 } 00369 rep->node ()->addChild (sep); 00370 }
Reimplemented from VisQueuedTwig.
Definition at line 246 of file VisTrackerPiRechitTwig.cc.
References cms::Exception::append(), Ig3DBaseRep::clear(), e, exception, i, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_pDD, Ig3DBaseRep::node(), rtemp, VisQueuedTwig::update(), PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), y, PV3DBase< T, PVType, FrameType >::z(), and z.
00247 { 00248 // Get debugging dump. 00249 VisQueuedTwig::update (rep); 00250 IgQtLock (); 00251 rep->clear (); 00252 00253 if (!rtemp.empty()) 00254 { 00255 SoMaterial *mat = new SoMaterial; 00256 mat->diffuseColor.setValue (1.0, 0.0, 0.0);//red 00257 mat->emissiveColor.setValue(1.0, 0.0, 0.0); 00258 00259 SoDrawStyle *drawStyle = new SoDrawStyle; 00260 drawStyle->pointSize = 4.0; 00261 00262 SoSeparator *sep = new SoSeparator; // global 00263 sep->addChild (mat); 00264 sep->addChild (drawStyle); 00265 00266 try 00267 { 00268 SoVertexProperty *vertices = new SoVertexProperty; 00269 int nVrtx = 0; 00270 00271 for (std::vector<std::pair<std::pair<DetId, LocalPoint>, int> >::const_iterator 00272 i = rtemp.begin (); i != rtemp.end (); ++i) 00273 { 00274 GlobalPoint pos = (m_pDD->idToDet ((*i).first.first))->surface().toGlobal((*i).first.second); 00275 float x = pos.x () / 100.0; // cm -> m 00276 float y = pos.y () / 100.0; // cm -> m 00277 float z = pos.z () / 100.0; // cm -> m 00278 00279 vertices->vertex.set1Value (nVrtx++, SbVec3f (x, y, z)); 00280 } 00281 00282 vertices->vertex.setNum (nVrtx); 00283 SoPointSet *points = new SoPointSet; 00284 points->vertexProperty.setValue (vertices); 00285 points->numPoints.setValue (nVrtx); 00286 00287 sep->addChild (points); 00288 } 00289 catch (cms::Exception& e) 00290 { 00291 e.append (" from VisTrackerPiRechitTwig: "); 00292 e.append (this->name ()); 00293 00294 if (this->m_onCmsException) 00295 this->m_onCmsException (&e); 00296 } 00297 catch (lat::Error &e) 00298 { 00299 if (this->m_onError) 00300 this->m_onError (&e); 00301 } 00302 catch (std::exception &e) 00303 { 00304 if (this->m_onException) 00305 this->m_onException (&e); 00306 } 00307 catch (...) 00308 { 00309 if (this->m_onUnhandledException) 00310 this->m_onUnhandledException (); 00311 } 00312 rep->node ()->addChild (sep); 00313 } 00314 }
const std::string VisTrackerPiRechitTwig::m_friendlyName [private] |
const std::string VisTrackerPiRechitTwig::m_instanceName [private] |
const std::string VisTrackerPiRechitTwig::m_moduleLabel [private] |
const std::string VisTrackerPiRechitTwig::m_processName [private] |
std::string VisTrackerPiRechitTwig::m_text [private] |
std::vector<std::pair<std::pair<DetId, LocalPoint>, int> > VisTrackerPiRechitTwig::rtemp [private] |