#include <VisReco/VisMuonCSC/interface/VisCSCCLCTDigiTwig.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) |
VisCSCCLCTDigiTwig (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::set< CSCDetId > | m_dets |
std::vector< std::pair < CSCDetId, CSCCLCTDigi > > | m_digis |
const std::string | m_friendlyName |
const std::string | m_instanceName |
const std::string | m_moduleLabel |
edm::ESHandle< CSCGeometry > | m_pDD |
const std::string | m_processName |
std::string | m_text |
Definition at line 24 of file VisCSCCLCTDigiTwig.h.
VisCSCCLCTDigiTwig::VisCSCCLCTDigiTwig | ( | 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 70 of file VisCSCCLCTDigiTwig.cc.
References createThisTwig(), edm::TypeID::friendlyClassName(), DBSPlugin::get(), and VisTwigFactroyService::registerTwig().
00076 : VisQueuedTwig (state, parent, name), 00077 m_text (name), 00078 m_friendlyName (friendlyName), 00079 m_moduleLabel (moduleLabel), 00080 m_instanceName (instanceName), 00081 m_processName (processName) 00082 { 00083 VisTwigFactroyService *tfService = VisTwigFactroyService::get (state); 00084 if (! tfService) 00085 { 00086 tfService = new VisTwigFactroyService (state); 00087 } 00088 edm::TypeID caloJetsID (typeid (CSCCLCTDigiCollection)); 00089 tfService->registerTwig (caloJetsID.friendlyClassName (), &createThisTwig); 00090 }
void VisCSCCLCTDigiTwig::onNewEvent | ( | const edm::Event & | event, | |
const edm::EventSetup & | eventSetup | |||
) | [virtual] |
Reimplemented from VisQueuedTwig.
Definition at line 93 of file VisCSCCLCTDigiTwig.cc.
References arg, c, e, exception, edm::EventSetup::get(), i, edm::Event::id(), 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::onBaseInvalidate(), VisQueuedTwig::onNewEvent(), p, and range.
00095 { 00096 // Get debugging dump. 00097 VisQueuedTwig::onNewEvent (event, eventSetup); 00098 00099 m_digis.clear (); 00100 m_text = (QString ("Run # %1, event # %2") 00101 .arg (event.id ().run ()) 00102 .arg (event.id ().event ()).latin1 ()); 00103 00104 std::vector<edm::Handle<CSCCLCTDigiCollection> > digiCollections; 00105 00106 try 00107 { 00108 if ((! m_friendlyName.empty ()) || (! m_moduleLabel.empty ()) || (! m_instanceName.empty ()) || (! m_processName.empty ())) 00109 { 00110 VisEventSelector visSel (m_friendlyName, m_moduleLabel, m_instanceName, m_processName); 00111 event.getMany (visSel, digiCollections); 00112 } 00113 else 00114 { 00115 event.getManyByType (digiCollections); 00116 } 00117 00118 eventSetup.get<MuonGeometryRecord> ().get (m_pDD); 00119 } 00120 catch (cms::Exception& e) 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 00141 if (! digiCollections.empty ()) 00142 { 00143 std::vector<edm::Handle<CSCCLCTDigiCollection> >::iterator i; 00144 std::vector<edm::Handle<CSCCLCTDigiCollection> >::iterator iEnd; 00145 for (i = digiCollections.begin (), iEnd = digiCollections.end (); i != iEnd; ++i) 00146 { 00147 const CSCCLCTDigiCollection& c = *(*i); 00148 00149 // Loop over the DetUnits with digis 00150 CSCCLCTDigiCollection::DigiRangeIterator detUnitIt; 00151 CSCCLCTDigiCollection::DigiRangeIterator detUnitItEnd; 00152 for (detUnitIt = c.begin (), detUnitItEnd = c.end (); detUnitIt != detUnitItEnd; ++detUnitIt) 00153 { 00154 const CSCDetId &id = (*detUnitIt).first; 00155 const CSCCLCTDigiCollection::Range &range = (*detUnitIt).second; 00156 00157 // Loop over the digis of this DetUnit 00158 for (CSCCLCTDigiCollection::const_iterator digiIt = range.first; 00159 digiIt != range.second; 00160 ++digiIt) 00161 { 00162 std::pair< CSCDetId, CSCCLCTDigi > p; 00163 p.first = id; 00164 p.second = (*digiIt); 00165 00166 m_digis.push_back (p); 00167 } // for digis in layer 00168 } // for layers 00169 } 00170 } 00171 00172 VisQueuedTwig::onBaseInvalidate (); 00173 }
Reimplemented from VisQueuedTwig.
Definition at line 490 of file VisCSCCLCTDigiTwig.cc.
References Ig3DBaseRep::clear(), e, exception, i, m_digis, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_pDD, Ig3DBaseRep::node(), VisQueuedTwig::update(), PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), y, PV3DBase< T, PVType, FrameType >::z(), and z.
00491 { 00492 // Get debugging dump. 00493 VisQueuedTwig::update (rep); 00494 00495 IgQtLock (); 00496 rep->clear (); 00497 00498 if (! m_digis.empty ()) 00499 { 00500 SoSeparator *sep = new SoSeparator; 00501 SoMaterial *mat = new SoMaterial; 00502 mat->diffuseColor.setValue (0.3, 0.8, 0.0); 00503 sep->addChild (mat); 00504 00505 SoDrawStyle *drawStyle = new SoDrawStyle; 00506 drawStyle->pointSize = 3.0; 00507 sep->addChild (drawStyle); 00508 00509 try 00510 { 00511 SoVertexProperty *vertices = new SoVertexProperty; 00512 int nVrx = 0; 00513 00514 for (std::vector<std::pair<CSCDetId, CSCCLCTDigi> >::const_iterator i = m_digis.begin (), iEnd = m_digis.end (); i != iEnd; ++i) 00515 { 00516 Surface::GlobalPoint pos = (m_pDD->idToDet ((*i).first))->surface ().position (); 00517 // int strip = (*i).second.getCLCT (); 00518 // std::vector<int> adcCounts = (*i).second.getADCCounts (); 00519 00520 float x = pos.x () / 100.0; // cm -> m 00521 float y = pos.y () / 100.0; // cm -> m 00522 float z = pos.z () / 100.0; // cm -> m 00523 00524 vertices->vertex.set1Value (nVrx++, SbVec3f (x, y, z)); 00525 } 00526 vertices->vertex.setNum (m_digis.size ()); 00527 00528 SoPointSet *points = new SoPointSet; 00529 points->vertexProperty.setValue (vertices); 00530 points->numPoints.setValue (m_digis.size ()); 00531 sep->addChild (points); 00532 } 00533 catch (cms::Exception& e) 00534 { 00535 if (this->m_onCmsException) 00536 this->m_onCmsException (&e); 00537 } 00538 catch (lat::Error &e) 00539 { 00540 if (this->m_onError) 00541 this->m_onError (&e); 00542 } 00543 catch (std::exception &e) 00544 { 00545 if (this->m_onException) 00546 this->m_onException (&e); 00547 } 00548 catch (...) 00549 { 00550 if (this->m_onUnhandledException) 00551 this->m_onUnhandledException (); 00552 } 00553 00554 rep->node ()->addChild (sep); 00555 } 00556 }
Reimplemented from VisQueuedTwig.
Definition at line 441 of file VisCSCCLCTDigiTwig.cc.
References Ig3DBaseRep::clear(), e, exception, i, m_digis, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, Ig3DBaseRep::node(), and VisQueuedTwig::update().
00442 { 00443 // Get debugging dump. 00444 VisQueuedTwig::update (rep); 00445 00446 IgQtLock (); 00447 rep->clear (); 00448 00449 if (! m_digis.empty ()) 00450 { 00451 SoSeparator *sep = new SoSeparator; 00452 00453 SoMaterial *mat = new SoMaterial; 00454 mat->diffuseColor.setValue (0.3, 0.8, 0.0); 00455 sep->addChild (mat); 00456 00457 try 00458 { 00459 for (std::vector<std::pair<CSCDetId, CSCCLCTDigi> >::const_iterator i = m_digis.begin (), iEnd = m_digis.end (); i != iEnd; ++i) 00460 { 00461 // Surface::GlobalPoint pos = (m_pDD->idToDet ((*i).first))->surface ().position (); 00462 } 00463 } 00464 catch (cms::Exception& e) 00465 { 00466 if (this->m_onCmsException) 00467 this->m_onCmsException (&e); 00468 } 00469 catch (lat::Error &e) 00470 { 00471 if (this->m_onError) 00472 this->m_onError (&e); 00473 } 00474 catch (std::exception &e) 00475 { 00476 if (this->m_onException) 00477 this->m_onException (&e); 00478 } 00479 catch (...) 00480 { 00481 if (this->m_onUnhandledException) 00482 this->m_onUnhandledException (); 00483 } 00484 00485 rep->node ()->addChild (sep); 00486 } 00487 }
Reimplemented from VisQueuedTwig.
Definition at line 176 of file VisCSCCLCTDigiTwig.cc.
References GenMuonPlsPt100GeV_cfg::cout, e, lat::endl(), exception, i, edm::ESHandle< T >::isValid(), m_digis, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_pDD, m_text, IgTextRep::setText(), VisQueuedTwig::update(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
00177 { 00178 // Get debugging dump. 00179 VisQueuedTwig::update (rep); 00180 00181 // Prepare property description. 00182 std::ostringstream text; 00183 text << "Total " << m_digis.size () << " CSC CLCT digis: " << m_text << "<br>"; 00184 00185 text << "<table width='100%' border=1>" 00186 << "<TR align = center>" 00187 << "<TH>Number</TH>" 00188 << "<TH>Position</TH>" 00189 << "<TH>Validity</TH>" 00190 << "<TH>Quality</TH>" 00191 << "<TH>Pattern</TH>" 00192 << "<TH>Strip</TH>" 00193 << "<TH>Strip type</TH>" 00194 << "<TH>Key strip</TH>" 00195 << "<TH>Track number</TH>" 00196 << "<TH>CFEB</TH>" 00197 << "<TH>Bend</TH>" 00198 << "<TH>BX</TH>" 00199 << "</TR>"; 00200 text << setiosflags (std::ios::showpoint | std::ios::fixed); 00201 text.setf (std::ios::right, std::ios::adjustfield); 00202 00203 if ((! m_digis.empty ()) && m_pDD.isValid ()) 00204 { 00205 int nDigis = 0; 00206 try 00207 { 00208 for (std::vector<std::pair<CSCDetId, CSCCLCTDigi> >::const_iterator i = m_digis.begin (), iEnd = m_digis.end (); 00209 i != iEnd; ++i) 00210 { 00211 Surface::GlobalPoint pos = (m_pDD->idToDet ((*i).first))->surface ().position (); 00212 text << "<TR align = right>" 00213 << "<TD>" << std::setw (3) << ++nDigis << "</TD>" 00214 << "<TD>" << pos.x () << ", " << pos.y () << ", " << pos.z () << "</TD>" 00215 << "<TD>" << std::setw (6) << std::setprecision (3) << (*i).second.isValid () << "</TD>" 00216 << "<TD>" << std::setw (6) << std::setprecision (3) << (*i).second.getQuality () << "</TD>" 00217 << "<TD>" << std::setw (6) << std::setprecision (3) << (*i).second.getPattern () << "</TD>" 00218 << "<TD>" << std::setw (6) << std::setprecision (3) << (*i).second.getStrip () << "</TD>" 00219 << "<TD>" << std::setw (6) << std::setprecision (3) << (*i).second.getStripType () << "</TD>" 00220 << "<TD>" << std::setw (6) << std::setprecision (3) << (*i).second.getKeyStrip () << "</TD>" 00221 << "<TD>" << std::setw (6) << std::setprecision (3) << (*i).second.getTrknmb () << "</TD>" 00222 << "<TD>" << std::setw (6) << std::setprecision (3) << (*i).second.getBend () << "</TD>" 00223 << "<TD>" << std::setw (6) << std::setprecision (3) << (*i).second.getBX () << "</TD></TR>"; 00224 00225 std::cout << "CSCDetId " << (*i).first << std::endl; 00226 } 00227 } 00228 catch (cms::Exception& e) 00229 { 00230 if (this->m_onCmsException) 00231 this->m_onCmsException (&e); 00232 } 00233 catch (lat::Error &e) 00234 { 00235 if (this->m_onError) 00236 this->m_onError (&e); 00237 } 00238 catch (std::exception &e) 00239 { 00240 if (this->m_onException) 00241 this->m_onException (&e); 00242 } 00243 catch (...) 00244 { 00245 if (this->m_onUnhandledException) 00246 this->m_onUnhandledException (); 00247 } 00248 } 00249 text << "</table>"; 00250 00251 // Send it over. 00252 IgQtLock (); 00253 rep->setText (text.str ()); 00254 }
Reimplemented from VisQueuedTwig.
Definition at line 380 of file VisCSCCLCTDigiTwig.cc.
References Ig3DBaseRep::clear(), e, exception, i, m_digis, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_pDD, n, Ig3DBaseRep::node(), PV3DBase< T, PVType, FrameType >::phi(), phi, and VisQueuedTwig::update().
00381 { 00382 // Get debugging dump. 00383 VisQueuedTwig::update (rep); 00384 00385 IgQtLock (); 00386 rep->clear (); 00387 00388 SoSeparator *sep = new SoSeparator; 00389 SoSeparator *posSep = new SoSeparator; 00390 SoSeparator *negSep = new SoSeparator; 00391 00392 SoMaterial *mat = new SoMaterial; 00393 mat->diffuseColor.setValue (0.3, 0.8, 0.0); 00394 posSep->addChild (mat); 00395 00396 SoMaterial *negMat = new SoMaterial; 00397 negMat->diffuseColor.setValue (1.0, 0.0, 0.0); 00398 negSep->addChild (negMat); 00399 00400 sep->addChild (posSep); 00401 sep->addChild (negSep); 00402 00403 try 00404 { 00405 int n = 0; 00406 00407 for (std::vector<std::pair<CSCDetId, CSCCLCTDigi> >::const_iterator i = m_digis.begin (), iEnd = m_digis.end (); i != iEnd; ++i) 00408 { 00409 Surface::GlobalPoint pos = (m_pDD->idToDet ((*i).first))->surface ().position (); 00410 // double eta = pos.eta (); 00411 double phi = pos.phi (); 00412 if (phi < 0.0) phi = 2 * M_PI + phi; // correction in absence of one convention 00413 ++n; 00414 } 00415 } 00416 catch (cms::Exception& e) 00417 { 00418 if (this->m_onCmsException) 00419 this->m_onCmsException (&e); 00420 } 00421 catch (lat::Error &e) 00422 { 00423 if (this->m_onError) 00424 this->m_onError (&e); 00425 } 00426 catch (std::exception &e) 00427 { 00428 if (this->m_onException) 00429 this->m_onException (&e); 00430 } 00431 catch (...) 00432 { 00433 if (this->m_onUnhandledException) 00434 this->m_onUnhandledException (); 00435 } 00436 00437 rep->node ()->addChild (sep); 00438 }
Reimplemented from VisQueuedTwig.
Definition at line 257 of file VisCSCCLCTDigiTwig.cc.
References angle(), Ig3DBaseRep::clear(), d, e, exception, CSCLayer::geometry(), VisCSCChamberDrawer::getOutline(), i, edm::ESHandle< T >::isValid(), TrapezoidalPlaneBounds::length(), m_dets, m_digis, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_pDD, Ig3DBaseRep::node(), r, GeomDet::toGlobal(), VisQueuedTwig::update(), width, PV3DBase< T, PVType, FrameType >::x(), x, CSCLayerGeometry::xOfStrip(), PV3DBase< T, PVType, FrameType >::y(), y, PV3DBase< T, PVType, FrameType >::z(), and z.
00258 { 00259 // Get debugging dump. 00260 VisQueuedTwig::update (rep); 00261 00262 IgQtLock (); 00263 rep->clear (); 00264 m_dets.clear (); 00265 00266 if ((! m_digis.empty ()) && m_pDD.isValid ()) 00267 { 00268 VisCSCChamberDrawer d; 00269 const float width = 0.01; // strip visualization 00270 const float depth = 0.01; // strip visualization 00271 00272 SbColor grey35; 00273 float transparency = 0.0f; 00274 grey35.setPackedValue(static_cast<uint32_t>(0x00595959), transparency); 00275 SoMaterial *mat = new SoMaterial; 00276 mat->diffuseColor.setValue (grey35); // grey35 00277 mat->emissiveColor.setValue(grey35); 00278 00279 SoDrawStyle *drawStyle = new SoDrawStyle; 00280 drawStyle->pointSize = 5.0; // big point; useful for the centers of the layers 00281 00282 SoSeparator *sep = new SoSeparator; // global 00283 sep->addChild (mat); 00284 sep->addChild (drawStyle); 00285 00286 try 00287 { 00288 SoMaterial *matl = new SoMaterial; 00289 matl->diffuseColor.setValue (0.0, 1.0, 0.0); // green 00290 matl->emissiveColor.setValue(0.0, 1.0, 0.0); 00291 matl->shininess = 1.; 00292 00293 SoDrawStyle *drawStylel = new SoDrawStyle; 00294 drawStylel->pointSize = 1.; 00295 00296 SoSeparator *pulses = new SoSeparator; // strips 00297 pulses->addChild (matl); 00298 pulses->addChild (drawStylel); 00299 00300 SoVertexProperty *vertices = new SoVertexProperty; 00301 for (std::vector<std::pair<CSCDetId, CSCCLCTDigi> >::const_iterator 00302 i = m_digis.begin (), iEnd = m_digis.end (); i != iEnd; ++i) 00303 { 00304 const CSCDetId &id = (*i).first; 00305 const CSCLayer *layer = m_pDD->chamber (id)->layer (4); 00306 const CSCLayerGeometry *layerGeom = layer->geometry (); 00307 00308 if (m_dets.find(id) == m_dets.end() ) 00309 { 00310 m_dets.insert(id); 00311 // This is a frame around the (active) layer 00312 d.getOutline(sep, m_pDD, id); 00313 00314 } 00315 00316 int strip_id = ((*i).second).getKeyStrip () / 2; 00317 float xstrip = layerGeom->xOfStrip (strip_id); 00318 Surface::GlobalPoint pos = layer->toGlobal (LocalPoint (xstrip, 0.0, 1.0)); // small shift in z 00319 // for Vis. purposes 00320 float x = pos.x () / 100.0; // cm -> m 00321 float y = pos.y () / 100.0; // cm -> m 00322 float z = pos.z () / 100.0; // cm -> m 00323 00324 SoTranslation *inc = new SoTranslation; 00325 inc->translation = SbVec3f (x, y, z); 00326 00327 SbVec3f axis (0.0, 0.0, 1.0); 00328 float angle = -atan (x / y); 00329 SbRotation r (axis, angle); 00330 00331 SoTransform *xform = new SoTransform; 00332 xform->rotation = r; 00333 00334 SoCube *hit = new SoCube; 00335 hit->width = width; 00336 hit->height = layerGeom->length () / 100.0; 00337 hit->depth = depth; 00338 00339 SoSeparator *pulse = new SoSeparator; // strip 00340 pulse->addChild (inc); 00341 pulse->addChild (xform); 00342 pulse->addChild (hit); 00343 pulses->addChild (pulse); 00344 // Visualize strips with signal 00345 sep->addChild (pulses); // strips 00346 } 00347 00348 vertices->vertex.setNum (m_digis.size ()); 00349 SoPointSet *points = new SoPointSet; 00350 points->vertexProperty.setValue (vertices); 00351 points->numPoints.setValue (m_digis.size ()); 00352 // Visualize the center of the layer 00353 // sep->addChild (points); 00354 } 00355 catch (cms::Exception& e) 00356 { 00357 if (this->m_onCmsException) 00358 this->m_onCmsException (&e); 00359 } 00360 catch (lat::Error &e) 00361 { 00362 if (this->m_onError) 00363 this->m_onError (&e); 00364 } 00365 catch (std::exception &e) 00366 { 00367 if (this->m_onException) 00368 this->m_onException (&e); 00369 } 00370 catch (...) 00371 { 00372 if (this->m_onUnhandledException) 00373 this->m_onUnhandledException (); 00374 } 00375 rep->node ()->addChild (sep); 00376 } 00377 }
std::set<CSCDetId> VisCSCCLCTDigiTwig::m_dets [private] |
std::vector< std::pair<CSCDetId, CSCCLCTDigi> > VisCSCCLCTDigiTwig::m_digis [private] |
const std::string VisCSCCLCTDigiTwig::m_friendlyName [private] |
const std::string VisCSCCLCTDigiTwig::m_instanceName [private] |
const std::string VisCSCCLCTDigiTwig::m_moduleLabel [private] |
edm::ESHandle<CSCGeometry> VisCSCCLCTDigiTwig::m_pDD [private] |
const std::string VisCSCCLCTDigiTwig::m_processName [private] |
std::string VisCSCCLCTDigiTwig::m_text [private] |