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