#include <VisReco/VisEcal/interface/VisEcalRecHitTwig.h>
Public Member Functions | |
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) |
VisEcalRecHitTwig (IgState *state, IgTwig *parent, const std::string &name="", const std::string &friendlyName="", const std::string &moduleLabel="", const std::string &instanceName="", const std::string &processName="", unsigned color=0xff009c00) | |
Private Attributes | |
VisCaloAnnotation | m_annotation |
VisBinningStrategy | m_binning |
VisEcalEnergyCut | m_cut |
VisCaloEnergyScale | m_escale |
const std::string | m_friendlyName |
const std::string | m_instanceName |
const std::string | m_moduleLabel |
std::string | m_name |
const std::string | m_processName |
std::vector< EcalRecHit > | m_recHits |
unsigned | m_rgba |
VisEcalRMax | m_rMax |
VisLegoScale | m_scale |
std::string | m_text |
Definition at line 25 of file VisEcalRecHitTwig.h.
VisEcalRecHitTwig::VisEcalRecHitTwig | ( | IgState * | state, | |
IgTwig * | parent, | |||
const std::string & | name = "" , |
|||
const std::string & | friendlyName = "" , |
|||
const std::string & | moduleLabel = "" , |
|||
const std::string & | instanceName = "" , |
|||
const std::string & | processName = "" , |
|||
unsigned | color = 0xff009c00 | |||
) |
Definition at line 68 of file VisEcalRecHitTwig.cc.
References createThisTwig(), edm::TypeID::friendlyClassName(), DBSPlugin::get(), and VisTwigFactroyService::registerTwig().
00075 : VisQueuedTwig (state, parent, name), 00076 m_name (name), 00077 m_friendlyName (friendlyName), 00078 m_moduleLabel (moduleLabel), 00079 m_instanceName (instanceName), 00080 m_processName (processName), 00081 m_binning (state, lat::CreateCallback (this, &VisEcalRecHitTwig::twigChanged)), 00082 m_scale (state, lat::CreateCallback (this, &VisEcalRecHitTwig::twigChanged)), 00083 m_cut (state, lat::CreateCallback (this, &VisEcalRecHitTwig::twigChanged)), 00084 m_escale (state, lat::CreateCallback (this, &VisEcalRecHitTwig::twigChanged)), 00085 m_annotation (state, lat::CreateCallback (this, &VisEcalRecHitTwig::twigChanged)), 00086 m_rMax (state, lat::CreateCallback (this, &VisEcalRecHitTwig::twigChanged)), 00087 m_text ("no info"), 00088 m_recHits (500), 00089 m_rgba (colour) 00090 { 00091 VisTwigFactroyService *tfService = VisTwigFactroyService::get (state); 00092 if (! tfService) 00093 { 00094 tfService = new VisTwigFactroyService (state); 00095 } 00096 edm::TypeID recHitCollID (typeid (EcalRecHitCollection)); 00097 tfService->registerTwig (recHitCollID.friendlyClassName (), &createThisTwig); 00098 }
void VisEcalRecHitTwig::onNewEvent | ( | const edm::Event & | event, | |
const edm::EventSetup & | eventSetup | |||
) | [virtual] |
Reimplemented from VisQueuedTwig.
Definition at line 105 of file VisEcalRecHitTwig.cc.
References cms::Exception::append(), arg, edm::SortedCollection< T, SORT >::begin(), c, e, edm::SortedCollection< T, SORT >::end(), exception, DBSPlugin::get(), i, edm::Event::id(), m_friendlyName, m_instanceName, m_moduleLabel, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_processName, m_recHits, m_text, IgSimpleTwig::name(), VisQueuedTwig::onBaseInvalidate(), VisQueuedTwig::onNewEvent(), edm::SortedCollection< T, SORT >::size(), and VisQueuedTwig::state().
00107 { 00108 // Get debugging dump. 00109 VisQueuedTwig::onNewEvent (event, eventSetup); 00110 00111 m_recHits.clear (); 00112 00113 m_text = (QString ("Run # %1, event # %2") 00114 .arg (event.id ().run ()) 00115 .arg (event.id ().event ()).latin1 ()); 00116 00117 std::vector<edm::Handle<EcalRecHitCollection> > rechits; 00118 try 00119 { 00120 QApplication::setOverrideCursor (Qt::waitCursor); 00121 if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (state ())) 00122 sbar->setMessage ("Retrieving an EcalRecHitCollection..."); 00123 00124 if ((! m_friendlyName.empty ()) || (! m_moduleLabel.empty ()) || (! m_instanceName.empty ()) || (! m_processName.empty ())) 00125 { 00126 VisEventSelector visSel (m_friendlyName, m_moduleLabel, m_instanceName, m_processName); 00127 event.getMany (visSel, rechits); 00128 } 00129 00130 if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (state ())) 00131 sbar->setMessage ("EcalRecHitCollection done."); 00132 QApplication::restoreOverrideCursor (); 00133 } 00134 catch (cms::Exception& e) 00135 { 00136 e.append (" from VisEcalRecHitTwig::onNewEvent "); 00137 e.append (this->name ()); 00138 00139 if (this->m_onCmsException) 00140 this->m_onCmsException (&e); 00141 } 00142 catch (lat::Error &e) 00143 { 00144 if (this->m_onError) 00145 this->m_onError (&e); 00146 } 00147 catch (std::exception &e) 00148 { 00149 if (this->m_onException) 00150 this->m_onException (&e); 00151 } 00152 catch (...) 00153 { 00154 if (this->m_onUnhandledException) 00155 this->m_onUnhandledException (); 00156 } 00157 00158 if (! rechits.empty ()) 00159 { 00160 for (std::vector<edm::Handle<EcalRecHitCollection> >::iterator i = rechits.begin (), iEnd = rechits.end (); i != iEnd; ++i) 00161 { 00162 const EcalRecHitCollection& c = *(*i); 00163 QString sizeStr = (QString ("%1").arg (c.size ())); 00164 QString nameStr = QString (this->name ()); 00165 int ib = nameStr.find ("["); 00166 int ie = nameStr.find ("]"); 00167 nameStr.replace (ib + 1, ie - 1, sizeStr); 00168 this->name (nameStr); 00169 for (std::vector<EcalRecHit>::const_iterator ci = c.begin (), ciEnd = c.end (); ci != ciEnd; ++ci) 00170 { 00171 m_recHits.push_back (*ci); 00172 } 00173 } 00174 } 00175 00176 VisQueuedTwig::onBaseInvalidate (); 00177 00178 if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (state ())) 00179 sbar->setMessage (QString (m_text)); 00180 }
Definition at line 101 of file VisEcalRecHitTwig.cc.
References IgRepSet::invalidate(), and IgTwig::SELF_MASK.
00102 { IgRepSet::invalidate (this, SELF_MASK); }
Reimplemented from VisQueuedTwig.
Definition at line 559 of file VisEcalRecHitTwig.cc.
References cms::Exception::append(), ASSERT, IgSoRectColHist::barrelMaxEta, IgSoRectColHist::beamPipeTheta, TestMuL1L2Filter_cff::cerr, Ig3DBaseRep::clear(), e, IgSoRectColHist::endcapMaxTheta, lat::endl(), IgSoRectColHist::energies, relval_parameters_module::energy, exception, IgSoRectColHist::faceColors, DBSPlugin::get(), VisEventSetupService::getBinNumber(), i, IgSoRectColHist::layer, IgSoRectColHist::logScale, m_binning, m_cut, m_escale, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_recHits, m_rMax, IgSoRectColHist::maxDist, Ig3DBaseRep::node(), IgSoRectColHist::numR, IgSoRectColHist::numZ, IgSoRectColHist::radiusR, IgSoRectColHist::radiusZ, IgSoRectColHist::scaleFactor, VisQueuedTwig::state(), VisQueuedTwig::update(), and VisActiveConfigurable< T >::value().
00560 { 00561 // Get debugging dump. 00562 VisQueuedTwig::update (rep); 00563 00564 IgQtLock (); 00565 00566 rep->clear (); 00567 00568 SoSeparator *sep = new SoSeparator; 00569 SoMaterial *mat = new SoMaterial; 00570 mat->ambientColor.setValue (1.0, 0.0, 153.0 / 255.0); 00571 mat->diffuseColor.setValue (1.0, 0.0, 153.0 / 255.0); 00572 mat->specularColor.setValue (1.0, 0.0, 153.0 / 255.0); 00573 mat->emissiveColor.setValue (1.0, 0.0, 153.0 / 255.0); 00574 sep->addChild (mat); 00575 00576 VisEventSetupService *esService = VisEventSetupService::get (state ()); 00577 ASSERT (esService); 00578 00579 unsigned binNumber = 0; 00580 const unsigned nBinsZ = 85*2; // bins along the Z axis (one side only, 85 = a quarter of bins in Z direction) 00581 const unsigned nBinsR = 39*2; 00582 const unsigned nbrOfBins = 2 * (nBinsZ + nBinsR); 00583 const float radiusR = 1.29f; 00584 const float radiusZ = 3.17f; 00585 const float barrelMaxEta = 1.479f; // max eta of ECAL Barrel 00586 const float beamPipeTheta = 5.7f * M_PI / 180.f; // opening angle of the beam gap 00587 const float endcapMaxTheta = 25.464f * M_PI / 180.f;// max theta of ECAL endcaps 00588 00589 std::vector<float> energies (nbrOfBins * 2); // times 2 for the other energy (which is not used) 00590 try 00591 { 00592 if (! m_recHits.empty ()) 00593 { 00594 for (std::vector<EcalRecHit>::const_iterator i = m_recHits.begin (), iEnd = m_recHits.end (); i != iEnd; ++i) 00595 { 00596 float energy = (*i).energy (); 00597 if (energy > m_cut.value ()) 00598 { 00599 binNumber = esService->getBinNumber ((*i).detid (), nBinsR, nBinsZ, radiusR, radiusZ, barrelMaxEta, beamPipeTheta, endcapMaxTheta); 00600 00601 if (binNumber < nbrOfBins) 00602 { 00603 if (m_binning.value () == "project") 00604 (energies[binNumber] > energy) ? energies[binNumber] : energies[binNumber] = energy; 00605 else 00606 energies[binNumber] += energy; 00607 } 00608 else 00609 { 00610 std::cerr << "Bin number (" << binNumber << ") exceeds the number of bins (" << nbrOfBins << ")"<< std::endl; 00611 } 00612 } 00613 } 00614 00615 if (*max_element (energies.begin (), energies.end ()) > 0.0) 00616 { 00617 IgSoRectColHist* hist = new IgSoRectColHist; 00618 hist->radiusR = radiusR; 00619 hist->radiusZ = radiusZ; 00620 if (m_rMax.value () > 0) hist->maxDist = m_rMax.value (); 00621 hist->numR = nBinsR; 00622 hist->numZ = nBinsZ; 00623 hist->energies.setValues (0, energies.size(), &energies [0]); 00624 hist->logScale = false; 00625 hist->layer = -6.0; 00626 hist->scaleFactor = m_escale.value (); 00627 hist->barrelMaxEta = barrelMaxEta; 00628 hist->beamPipeTheta = beamPipeTheta; 00629 hist->endcapMaxTheta = endcapMaxTheta; 00630 00631 std::vector<SbColor> colors (4); 00632 colors[0] = SbColor (1.0, 0.0, 153.0 / 255.0); // first energy's positive color 00633 colors[1] = SbColor (1.0, 1.0, 153.0 / 255.0); // first energy's negative color 00634 colors[2] = SbColor (51.0 / 255.0, 1.0, 102.0 / 255.0); // second energy's positive color (not used) 00635 colors[3] = SbColor (51.0 / 255.0, 0.0, 102.0 / 255.0); // second energy's negative color (not used) 00636 00637 hist->faceColors.setValues (0, colors.size (), &colors[0]); 00638 sep->addChild (hist); 00639 } 00640 } 00641 } 00642 catch (cms::Exception& e) 00643 { 00644 e.append (" from VisEcalRecHitTwig::update(IgRZRep*) "); 00645 e.append (this->name ()); 00646 00647 if (this->m_onCmsException) 00648 this->m_onCmsException (&e); 00649 } 00650 catch (lat::Error &e) 00651 { 00652 if (this->m_onError) 00653 this->m_onError (&e); 00654 } 00655 catch (std::exception &e) 00656 { 00657 if (this->m_onException) 00658 this->m_onException (&e); 00659 } 00660 catch (...) 00661 { 00662 if (this->m_onUnhandledException) 00663 this->m_onUnhandledException (); 00664 } 00665 rep->node ()->addChild (sep); 00666 }
Reimplemented from VisQueuedTwig.
Definition at line 424 of file VisEcalRecHitTwig.cc.
References cms::Exception::append(), ASSERT, Ig3DBaseRep::clear(), e, IgSoCircularHist::energies, relval_parameters_module::energy, exception, first, DBSPlugin::get(), VisEventSetupService::getCellPosition(), i, int, prof2calltree::last, IgSoCircularHist::layer, IgSoCircularHist::logScale, m_annotation, m_binning, m_cut, m_escale, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_recHits, m_rMax, IgSoCircularHist::maxRadius, IgSoCircularHist::minRadius, Ig3DBaseRep::node(), IgSoCircularHist::numberOfBins, PV3DBase< T, PVType, FrameType >::phi(), phi, radius(), IgSoCircularHist::scaleFactor, IgSoCircularHist::showAnnotations, VisQueuedTwig::state(), VisEcalSubdetector::subDetName(), VisQueuedTwig::update(), and VisActiveConfigurable< T >::value().
00425 { 00426 // Get debugging dump. 00427 VisQueuedTwig::update (rep); 00428 00429 IgQtLock (); 00430 00431 rep->clear (); 00432 00433 SoSeparator *sep = new SoSeparator; 00434 SoSeparator *posSep = new SoSeparator; 00435 SoSeparator *negSep = new SoSeparator; 00436 sep->addChild (posSep); 00437 sep->addChild (negSep); 00438 00439 SoMaterial *mat = new SoMaterial; 00440 mat->ambientColor.setValue (1.0, 0.0, 153.0 / 255.0); 00441 mat->diffuseColor.setValue (1.0, 0.0, 153.0 / 255.0); 00442 mat->specularColor.setValue (1.0, 0.0, 153.0 / 255.0); 00443 mat->emissiveColor.setValue (1.0, 0.0, 153.0 / 255.0); 00444 posSep->addChild (mat); 00445 00446 SoMaterial *negMat = new SoMaterial; 00447 negMat->ambientColor.setValue (51.0 / 255.0, 1.0, 102.0 / 255.0); 00448 negMat->diffuseColor.setValue (51.0 / 255.0, 1.0, 102.0 / 255.0); 00449 negMat->specularColor.setValue (51.0 / 255.0, 1.0, 102.0 / 255.0); 00450 negMat->emissiveColor.setValue (51.0 / 255.0, 1.0, 102.0 / 255.0); 00451 negSep->addChild (negMat); 00452 00453 int nbrOfBins = 360; 00454 int binNumber; 00455 00456 std::vector<float> bufferPositive (nbrOfBins); 00457 std::vector<float> bufferNegative (nbrOfBins); 00458 try 00459 { 00460 if (! m_recHits.empty ()) 00461 { 00462 VisEventSetupService *esService = VisEventSetupService::get (state ()); 00463 ASSERT (esService); 00464 00465 float radius = 1.29; 00466 00467 for (std::vector<EcalRecHit>::const_iterator i = m_recHits.begin (), iEnd = m_recHits.end (); i != iEnd; ++i) 00468 { 00469 float energy = (*i).energy (); 00470 if (energy > m_cut.value ()) 00471 { 00472 if (VisEcalSubdetector::subDetName ((EcalSubdetector)((*i).id ().subdetId ())) == "EcalBarrel") 00473 { 00474 const GlobalPoint& pos = esService->getCellPosition ((*i).detid ()); 00475 float phi = pos.phi (); 00476 00477 (phi < 0) ? phi = 2 * M_PI + phi : phi; 00478 00479 binNumber = (int) floor (phi / (2 * M_PI / nbrOfBins)); 00480 00481 if (binNumber >= 0 && binNumber < nbrOfBins) 00482 if (m_binning.value () == "project") 00483 { 00484 if ((energy > 0.0) && (energy > bufferPositive [binNumber])) 00485 bufferPositive [binNumber] = energy; 00486 else if ((energy < 0.0) && (energy < bufferNegative [binNumber])) 00487 bufferNegative [binNumber] = energy; 00488 } 00489 else 00490 (energy > 0.0) ? bufferPositive [binNumber] += energy : bufferNegative [binNumber] += energy; 00491 } 00492 } 00493 } 00494 00495 std::vector<float>::const_iterator first = bufferPositive.begin (); 00496 std::vector<float>::const_iterator last = bufferPositive.end (); 00497 00498 if (*max_element (first, last) > 0.0) 00499 { 00500 IgSoCircularHist *recHits = new IgSoCircularHist; 00501 recHits->minRadius = radius; 00502 recHits->maxRadius = m_rMax.value (); 00503 recHits->scaleFactor = m_escale.value (); 00504 recHits->numberOfBins = nbrOfBins; 00505 recHits->energies.setValues (0, nbrOfBins, &bufferPositive [0]); 00506 recHits->logScale = false; 00507 recHits->showAnnotations = m_annotation.value (); 00508 recHits->layer = 5.5; 00509 posSep->addChild (recHits); 00510 } 00511 00512 std::vector<float>::const_iterator nfirst = bufferNegative.begin (); 00513 std::vector<float>::const_iterator nlast = bufferNegative.end (); 00514 00515 if (fabs(*max_element (nfirst, nlast)) > 0.0) 00516 { 00517 IgSoCircularHist *negRecHits = new IgSoCircularHist; 00518 negRecHits->minRadius = radius; 00519 negRecHits->maxRadius = -1; 00520 negRecHits->scaleFactor = m_escale.value (); 00521 negRecHits->numberOfBins = nbrOfBins; 00522 negRecHits->energies.setValues (0, nbrOfBins, &bufferNegative [0]); 00523 negRecHits->logScale = false; 00524 negRecHits->showAnnotations = m_annotation.value (); 00525 negRecHits->layer = 5.0; 00526 00527 negSep->addChild (negRecHits); 00528 } 00529 } 00530 } 00531 catch (cms::Exception& e) 00532 { 00533 e.append (" from VisEcalRecHitTwig::update (IgRPhiRep*) "); 00534 e.append (this->name ()); 00535 00536 if (this->m_onCmsException) 00537 this->m_onCmsException (&e); 00538 } 00539 catch (lat::Error &e) 00540 { 00541 if (this->m_onError) 00542 this->m_onError (&e); 00543 } 00544 catch (std::exception &e) 00545 { 00546 if (this->m_onException) 00547 this->m_onException (&e); 00548 } 00549 catch (...) 00550 { 00551 if (this->m_onUnhandledException) 00552 this->m_onUnhandledException (); 00553 } 00554 00555 rep->node ()->addChild (sep); 00556 }
Reimplemented from VisQueuedTwig.
Definition at line 183 of file VisEcalRecHitTwig.cc.
References cms::Exception::append(), ASSERT, e, relval_parameters_module::energy, eta, PV3DBase< T, PVType, FrameType >::eta(), exception, DBSPlugin::get(), VisEventSetupService::getCellPosition(), i, m_cut, m_friendlyName, m_instanceName, m_moduleLabel, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_processName, m_recHits, m_text, IgSimpleTwig::name(), PV3DBase< T, PVType, FrameType >::phi(), phi, IgTextRep::setText(), VisQueuedTwig::state(), VisQueuedTwig::update(), and VisActiveConfigurable< T >::value().
00184 { 00185 // Get debugging dump. 00186 VisQueuedTwig::update (rep); 00187 00188 // Prepare property description. 00189 std::ostringstream text; 00190 text << this->name () << " from "; 00191 text << m_text << "<br>"; 00192 00193 if (m_friendlyName.empty () && m_moduleLabel.empty () && m_instanceName.empty () && m_processName.empty ()) 00194 { 00195 text << "Please, select the branches of this Twig for more information."; 00196 } 00197 else 00198 { 00199 text << "Displayed only above " << m_cut.value () << " GeV:<br>"; 00200 00201 text << "<table width='100%' border=1>" 00202 << "<TR align = center>" 00203 << "<TH>Number</TH>" 00204 << "<TH>Energy</TH>" 00205 << "<TH>Time</TH>" 00206 << "<TH>Eta</TH>" 00207 << "<TH>Phi</TH>" 00208 << "</TR>"; 00209 text << setiosflags (std::ios::showpoint | std::ios::fixed); 00210 text.setf (std::ios::right, std::ios::adjustfield); 00211 00212 int nDigis = 0; 00213 if (! m_recHits.empty ()) 00214 { 00215 VisEventSetupService *esService = VisEventSetupService::get (state ()); 00216 ASSERT (esService); 00217 00218 try 00219 { 00220 for (std::vector<EcalRecHit>::const_iterator i = m_recHits.begin (), iEnd = m_recHits.end (); i != iEnd; ++i) 00221 { 00222 float energy = (*i).energy (); 00223 if (energy > m_cut.value ()) 00224 { 00225 const GlobalPoint& pos = esService->getCellPosition ((*i).detid ()); 00226 float eta = pos.eta (); 00227 float phi = pos.phi (); 00228 00229 text << "<TR align = right>" 00230 << "<TD>" << std::setw (3) << nDigis++ << "</TD>" 00231 << "<TD>" << std::setw (5) << std::setprecision (3) << energy << "</TD>" 00232 << "<TD>" << std::setw (5) << std::setprecision (3) << (*i).time () << "</TD>" 00233 << "<TD>" << std::setw (5) << std::setprecision (3) << eta << "</TD>" 00234 << "<TD>" << std::setw (5) << std::setprecision (3) << phi << "</TD>" 00235 << "</TR>"; 00236 } 00237 } 00238 } 00239 catch (cms::Exception& e) 00240 { 00241 e.append (" from VisHBHERecHitTwig::update(IgTextRep*) "); 00242 e.append (this->name ()); 00243 00244 if (this->m_onCmsException) 00245 this->m_onCmsException (&e); 00246 } 00247 catch (lat::Error &e) 00248 { 00249 if (this->m_onError) 00250 this->m_onError (&e); 00251 } 00252 catch (std::exception &e) 00253 { 00254 if (this->m_onException) 00255 this->m_onException (&e); 00256 } 00257 catch (...) 00258 { 00259 if (this->m_onUnhandledException) 00260 this->m_onUnhandledException (); 00261 } 00262 } 00263 00264 text << "</table>"; 00265 } 00266 00267 // Send it over. 00268 IgQtLock (); 00269 rep->setText (text.str ()); 00270 }
Reimplemented from VisQueuedTwig.
Definition at line 355 of file VisEcalRecHitTwig.cc.
References cms::Exception::append(), ASSERT, Ig3DBaseRep::clear(), e, IgSoTower::emFraction, IgSoTower::energy, relval_parameters_module::energy, eta, PV3DBase< T, PVType, FrameType >::eta(), IgSoTower::etaWidth, exception, DBSPlugin::get(), VisEventSetupService::getCellPosition(), i, m_cut, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_recHits, m_scale, Ig3DBaseRep::node(), PV3DBase< T, PVType, FrameType >::phi(), phi, IgSoTower::phiWidth, IgSoTower::position, IgSoTower::scaleFactor, VisQueuedTwig::state(), VisQueuedTwig::update(), and VisActiveConfigurable< T >::value().
00356 { 00357 // Get debugging dump. 00358 VisQueuedTwig::update (rep); 00359 00360 IgQtLock (); 00361 00362 rep->clear (); 00363 00364 SoSeparator *sep = new SoSeparator; 00365 00366 try 00367 { 00368 if (! m_recHits.empty ()) 00369 { 00370 VisEventSetupService *esService = VisEventSetupService::get (state ()); 00371 ASSERT (esService); 00372 00373 for (std::vector<EcalRecHit>::const_iterator i = m_recHits.begin (), iEnd = m_recHits.end (); i != iEnd; ++i) 00374 { 00375 float energy = (*i).energy (); 00376 if (fabs (energy) > m_cut.value ()) 00377 { 00378 const GlobalPoint& pos = esService->getCellPosition ((*i).detid ()); 00379 00380 float eta = pos.eta (); 00381 float phi = pos.phi (); 00382 (phi < 0.0) ? phi = 2 * M_PI + phi : phi; // correction in absence of one convention 00383 00384 IgSoTower *tower = new IgSoTower; 00385 tower->position = SbVec2f (phi, eta); // eta, phi 00386 tower->scaleFactor = m_scale.value (); 00387 tower->etaWidth = 0.0174; 00388 tower->phiWidth = 0.0174; 00389 tower->energy = energy; 00390 tower->emFraction = 1; 00391 sep->addChild (tower); 00392 } 00393 } 00394 } 00395 } 00396 catch (cms::Exception& e) 00397 { 00398 e.append (" from VisEcalRecHitTwig::update(IgLegoRep *) "); 00399 e.append (this->name ()); 00400 00401 if (this->m_onCmsException) 00402 this->m_onCmsException (&e); 00403 } 00404 catch (lat::Error &e) 00405 { 00406 if (this->m_onError) 00407 this->m_onError (&e); 00408 } 00409 catch (std::exception &e) 00410 { 00411 if (this->m_onException) 00412 this->m_onException (&e); 00413 } 00414 catch (...) 00415 { 00416 if (this->m_onUnhandledException) 00417 this->m_onUnhandledException (); 00418 } 00419 00420 rep->node ()->addChild (sep); 00421 }
Reimplemented from VisQueuedTwig.
Definition at line 273 of file VisEcalRecHitTwig.cc.
References cms::Exception::append(), ASSERT, Ig3DBaseRep::clear(), e, relval_parameters_module::energy, exception, DBSPlugin::get(), VisEventSetupService::getCorners(), i, m_cut, m_escale, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_recHits, m_rgba, Ig3DBaseRep::node(), EZArrayFL< T >::size(), VisQueuedTwig::state(), IgSbColorMap::unpack(), VisQueuedTwig::update(), VisActiveConfigurable< T >::value(), x, y, and z.
00274 { 00275 // Get debugging dump. 00276 VisQueuedTwig::update (rep); 00277 00278 IgQtLock (); 00279 00280 rep->clear (); 00281 00282 SoSeparator *sep = new SoSeparator; 00283 00284 SoMaterial *mat = new SoMaterial; 00285 float rgbcomponents [4]; 00286 IgSbColorMap::unpack (m_rgba, rgbcomponents); 00287 mat->diffuseColor.setValue (SbColor (rgbcomponents)); 00288 sep->addChild (mat); 00289 00290 if (! m_recHits.empty ()) 00291 { 00292 VisEventSetupService *esService = VisEventSetupService::get (state ()); 00293 ASSERT (esService); 00294 00295 try 00296 { 00297 for (std::vector<EcalRecHit>::const_iterator i = m_recHits.begin (), iEnd = m_recHits.end (); i != iEnd; ++i) 00298 { 00299 float energy = (*i).energy (); 00300 if (energy > m_cut.value ()) 00301 { 00302 const CaloCellGeometry::CornersVec& corners = esService->getCorners ((*i).detid ()); 00303 ASSERT (corners.size () == 8); 00304 00305 IgSoCrystalHit *crystalHit = new IgSoCrystalHit; 00306 crystalHit->energy.setValue (energy); 00307 crystalHit->scale.setValue (m_escale.value ()); 00308 crystalHit->relativeWidth.setValue (1.0); 00309 crystalHit->drawCrystal.setValue (false); 00310 crystalHit->drawHit.setValue (true); 00311 00312 crystalHit->front1.setValue (corners [3].x () / 100.0, corners [3].y () / 100.0, corners [3].z () / 100.0); 00313 crystalHit->front2.setValue (corners [2].x () / 100.0, corners [2].y () / 100.0, corners [2].z () / 100.0); 00314 crystalHit->front3.setValue (corners [1].x () / 100.0, corners [1].y () / 100.0, corners [1].z () / 100.0); 00315 crystalHit->front4.setValue (corners [0].x () / 100.0, corners [0].y () / 100.0, corners [0].z () / 100.0); 00316 00317 crystalHit->back1.setValue (corners [7].x () / 100.0, corners [7].y () / 100.0, corners [7].z () / 100.0); 00318 crystalHit->back2.setValue (corners [6].x () / 100.0, corners [6].y () / 100.0, corners [6].z () / 100.0); 00319 crystalHit->back3.setValue (corners [5].x () / 100.0, corners [5].y () / 100.0, corners [5].z () / 100.0); 00320 crystalHit->back4.setValue (corners [4].x () / 100.0, corners [4].y () / 100.0, corners [4].z () / 100.0); 00321 00322 sep->addChild (crystalHit); 00323 } 00324 } 00325 } 00326 catch (cms::Exception& e) 00327 { 00328 e.append (" from VisEcalRecHitTwig::update(Ig3DRep*) "); 00329 e.append (this->name ()); 00330 00331 if (this->m_onCmsException) 00332 this->m_onCmsException (&e); 00333 } 00334 catch (lat::Error &e) 00335 { 00336 if (this->m_onError) 00337 this->m_onError (&e); 00338 } 00339 catch (std::exception &e) 00340 { 00341 if (this->m_onException) 00342 this->m_onException (&e); 00343 } 00344 catch (...) 00345 { 00346 if (this->m_onUnhandledException) 00347 this->m_onUnhandledException (); 00348 } 00349 } 00350 00351 rep->node ()->addChild (sep); 00352 }
VisEcalEnergyCut VisEcalRecHitTwig::m_cut [private] |
const std::string VisEcalRecHitTwig::m_friendlyName [private] |
const std::string VisEcalRecHitTwig::m_instanceName [private] |
const std::string VisEcalRecHitTwig::m_moduleLabel [private] |
std::string VisEcalRecHitTwig::m_name [private] |
const std::string VisEcalRecHitTwig::m_processName [private] |
std::vector<EcalRecHit> VisEcalRecHitTwig::m_recHits [private] |
unsigned VisEcalRecHitTwig::m_rgba [private] |
VisEcalRMax VisEcalRecHitTwig::m_rMax [private] |
VisLegoScale VisEcalRecHitTwig::m_scale [private] |
std::string VisEcalRecHitTwig::m_text [private] |