#include <VisReco/VisEcal/interface/VisBasicClusterCollectionTwig.h>
Public Member Functions | |
virtual 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 (IgLegoRep *rep) |
virtual void | update (Ig3DRep *rep) |
virtual void | update (IgTextRep *rep) |
VisBasicClusterCollectionTwig (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 |
std::vector< EcalRecHit > | m_clusterRecHits |
std::vector< reco::BasicCluster > | m_clusters |
VisEnergyCut | 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 |
unsigned | m_rgba |
VisLegoScale | m_scale |
std::string | m_text |
Definition at line 28 of file VisBasicClusterCollectionTwig.h.
VisBasicClusterCollectionTwig::VisBasicClusterCollectionTwig | ( | 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 71 of file VisBasicClusterCollectionTwig.cc.
References createThisTwig(), edm::TypeID::friendlyClassName(), DBSPlugin::get(), and VisTwigFactroyService::registerTwig().
00078 : VisQueuedTwig (state, parent, name), 00079 m_name (name), 00080 m_text (name), 00081 m_friendlyName (friendlyName), 00082 m_moduleLabel (moduleLabel), 00083 m_instanceName (instanceName), 00084 m_processName (processName), 00085 m_binning (state, lat::CreateCallback (this, &VisBasicClusterCollectionTwig::twigChanged)), 00086 m_scale (state, lat::CreateCallback (this, &VisBasicClusterCollectionTwig::twigChanged)), 00087 m_cut (state, lat::CreateCallback (this, &VisBasicClusterCollectionTwig::twigChanged)), 00088 m_escale (state, lat::CreateCallback (this, &VisBasicClusterCollectionTwig::twigChanged)), 00089 m_annotation (state, lat::CreateCallback (this, &VisBasicClusterCollectionTwig::twigChanged)), 00090 m_rgba (colour) 00091 { 00092 VisTwigFactroyService *tfService = VisTwigFactroyService::get (state); 00093 if (! tfService) 00094 { 00095 tfService = new VisTwigFactroyService (state); 00096 } 00097 edm::TypeID basicClusterID (typeid (reco::BasicClusterCollection)); 00098 tfService->registerTwig (basicClusterID.friendlyClassName (), &createThisTwig); 00099 }
void VisBasicClusterCollectionTwig::onNewEvent | ( | const edm::Event & | event, | |
const edm::EventSetup & | eventSetup | |||
) | [virtual] |
Reimplemented from VisQueuedTwig.
Definition at line 106 of file VisBasicClusterCollectionTwig.cc.
References cms::Exception::append(), arg, c, IgCompoundTwig::children(), IgCompoundTwig::destroy(), e, edm::SortedCollection< T, SORT >::end(), exception, edm::SortedCollection< T, SORT >::find(), DBSPlugin::get(), i, edm::Event::id(), IgRepSet::invalidate(), j, m_clusterRecHits, m_clusters, m_friendlyName, m_instanceName, m_moduleLabel, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_processName, m_text, IgSimpleTwig::name(), VisQueuedTwig::onNewEvent(), IgTwig::SELF_MASK, VisQueuedTwig::state(), and IgTwig::STRUCTURE_MASK.
00108 { 00109 // Get debugging dump. 00110 VisQueuedTwig::onNewEvent (event, eventSetup); 00111 00112 m_text = QString ("Run # %1, event # %2") 00113 .arg (event.id ().run ()) 00114 .arg (event.id ().event ()).latin1 (); 00115 00116 std::vector<edm::Handle<reco::BasicClusterCollection> > clusters; 00117 00118 try 00119 { 00120 QApplication::setOverrideCursor (Qt::waitCursor); 00121 if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (state ())) 00122 sbar->setMessage ("Retrieving a BasicClusterCollection..."); 00123 00124 if ((! m_friendlyName.empty ()) || (! m_moduleLabel.empty ()) || (! m_instanceName.empty ()) || (! m_processName.empty ())) 00125 { 00126 if (children ()) destroy (); 00127 00128 VisEventSelector visSel (m_friendlyName, m_moduleLabel, m_instanceName, m_processName); 00129 event.getMany (visSel, clusters); 00130 } 00131 00132 if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (state ())) 00133 sbar->setMessage ("BasicClusterCollection done."); 00134 QApplication::restoreOverrideCursor (); 00135 } 00136 catch (cms::Exception& e) 00137 { 00138 e.append (" from VisBasicClusterCollectionTwig::onNewEvent "); 00139 e.append (this->name ()); 00140 00141 if (this->m_onCmsException) 00142 this->m_onCmsException (&e); 00143 } 00144 catch (lat::Error &e) 00145 { 00146 if (this->m_onError) 00147 this->m_onError (&e); 00148 } 00149 catch (std::exception &e) 00150 { 00151 if (this->m_onException) 00152 this->m_onException (&e); 00153 } 00154 catch (...) 00155 { 00156 if (this->m_onUnhandledException) 00157 this->m_onUnhandledException (); 00158 } 00159 00160 std::vector< edm::Handle<EBRecHitCollection> > EBRecHits; 00161 std::vector< edm::Handle<EERecHitCollection> > EERecHits; 00162 00163 try 00164 { 00165 event.getManyByType (EBRecHits); 00166 event.getManyByType (EERecHits); 00167 } 00168 catch (cms::Exception& e) 00169 { 00170 e.append (" from VisBasicClusterCollectionTwig::onNewEvent "); 00171 e.append (this->name ()); 00172 00173 if (this->m_onCmsException) 00174 this->m_onCmsException (&e); 00175 } 00176 catch (lat::Error &e) 00177 { 00178 if (this->m_onError) 00179 this->m_onError (&e); 00180 } 00181 catch (std::exception &e) 00182 { 00183 if (this->m_onException) 00184 this->m_onException (&e); 00185 } 00186 catch (...) 00187 { 00188 if (this->m_onUnhandledException) 00189 this->m_onUnhandledException (); 00190 } 00191 m_clusters.clear (); 00192 00193 if (! clusters.empty ()) 00194 { 00195 std::vector<edm::Handle<reco::BasicClusterCollection> >::iterator i; 00196 std::vector<edm::Handle<reco::BasicClusterCollection> >::iterator iEnd; 00197 for (i = clusters.begin (), iEnd = clusters.end (); i != iEnd; ++i) 00198 { 00199 const reco::BasicClusterCollection& c = *(*i); 00200 QString sizeStr = (QString ("%1").arg (c.size ())); 00201 QString nameStr = QString (this->name ()); 00202 int ib = nameStr.find ("["); 00203 int ie = nameStr.find ("]"); 00204 nameStr.replace (ib + 1, ie - 1, sizeStr); 00205 this->name (nameStr); 00206 00207 for (reco::BasicClusterCollection::const_iterator j = c.begin (), jEnd = c.end (); j != jEnd; ++j) 00208 { 00209 m_clusters.push_back (*j); 00210 QString name = QString ("Basic Cluster Et = %1 GeV") 00211 .arg ((*j).energy (), 0, 'f', 2); 00212 00213 std::vector<DetId> clusterDetIds = (*j).getHitsByDetId (); 00214 std::vector<DetId>::iterator posCurrent; 00215 std::vector<DetId>::iterator posEnd; 00216 m_clusterRecHits.clear (); 00217 00218 for (posCurrent = clusterDetIds.begin (), posEnd = clusterDetIds.end (); posCurrent != posEnd; ++posCurrent) 00219 { 00220 int EcalNum = (*posCurrent).subdetId (); 00221 if (EcalNum == 1) 00222 { 00223 for (std::vector<edm::Handle<EBRecHitCollection> >::iterator ieb = EBRecHits.begin (), iebEnd = EBRecHits.end (); 00224 ieb != iebEnd; ++ieb) 00225 { 00226 const EBRecHitCollection& ceb = *(*ieb); 00227 EBDetId EcalID = (*posCurrent); 00228 EBRecHitCollection::const_iterator theRecHit = ceb.find (EcalID); 00229 if (theRecHit != ceb.end ()) 00230 { 00231 m_clusterRecHits.push_back (*theRecHit); 00232 } 00233 } 00234 } 00235 else if (EcalNum == 2) 00236 { 00237 for (std::vector<edm::Handle<EERecHitCollection> >::iterator iee = EERecHits.begin (), ieeEnd = EERecHits.end (); 00238 iee != ieeEnd; ++iee) 00239 { 00240 const EERecHitCollection& cee = *(*iee); 00241 EEDetId EcalID = (*posCurrent); 00242 EERecHitCollection::const_iterator theRecHit = cee.find (EcalID); 00243 if (theRecHit != cee.end ()) 00244 { 00245 m_clusterRecHits.push_back (*theRecHit); 00246 } 00247 } 00248 } 00249 } 00250 00251 new VisBasicClusterTwig (state (), this, name.latin1 (), m_clusterRecHits); 00252 } 00253 } 00254 } 00255 00256 IgRepSet::invalidate (this->parent (), IgTwig::SELF_MASK | IgTwig::STRUCTURE_MASK); 00257 00258 if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (state ())) 00259 sbar->setMessage (QString (m_text)); 00260 }
Definition at line 102 of file VisBasicClusterCollectionTwig.cc.
References IgRepSet::invalidate(), and IgTwig::SELF_MASK.
00103 { IgRepSet::invalidate (this, SELF_MASK); }
Reimplemented from VisQueuedTwig.
Definition at line 676 of file VisBasicClusterCollectionTwig.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_clusters, m_cut, m_escale, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, Ig3DBaseRep::node(), IgSoRectColHist::numR, IgSoRectColHist::numZ, IgSoRectColHist::radiusR, IgSoRectColHist::radiusZ, IgSoRectColHist::scaleFactor, VisQueuedTwig::state(), VisQueuedTwig::update(), and VisActiveConfigurable< T >::value().
00677 { 00678 // Get debugging dump. 00679 VisQueuedTwig::update (rep); 00680 00681 IgQtLock (); 00682 00683 rep->clear (); 00684 00685 SoSeparator *sep = new SoSeparator; 00686 SoMaterial *mat = new SoMaterial; 00687 mat->ambientColor.setValue (1.0, 0.0, 153.0 / 255.0); 00688 mat->diffuseColor.setValue (1.0, 0.0, 153.0 / 255.0); 00689 mat->specularColor.setValue (1.0, 0.0, 153.0 / 255.0); 00690 mat->emissiveColor.setValue (1.0, 0.0, 153.0 / 255.0); 00691 sep->addChild (mat); 00692 00693 VisEventSetupService *esService = VisEventSetupService::get (state ()); 00694 ASSERT (esService); 00695 00696 unsigned binNumber = 0; 00697 const unsigned nBinsZ = 85*2; // bins along the Z axis (one side only, 85 = a quarter of bins in Z direction) 00698 const unsigned nBinsR = 39*2; 00699 const unsigned nbrOfBins = 2 * (nBinsZ + nBinsR); 00700 const float radiusR = 1.29f; 00701 const float radiusZ = 3.17f; 00702 const float barrelMaxEta = 1.479f; // max eta of ECAL Barrel 00703 const float beamPipeTheta = 5.7f * M_PI / 180.f; // opening angle of the beam gap 00704 const float endcapMaxTheta = 25.464f * M_PI / 180.f;// max theta of ECAL endcaps 00705 00706 std::vector<float> energies (nbrOfBins * 2); // times 2 for the other energy (which is not used) 00707 try 00708 { 00709 if (! m_clusters.empty ()) 00710 { 00711 for (std::vector<reco::BasicCluster>::const_iterator i = m_clusters.begin (), iEnd = m_clusters.end (); i != iEnd; ++i) 00712 { 00713 float energy = (*i).energy (); 00714 if (energy > m_cut.value ()) 00715 { 00716 std::vector<DetId> clusterDetIds = (*i).getHitsByDetId (); 00717 std::vector<DetId>::iterator posCurrent; 00718 std::vector<DetId>::iterator posEnd; 00719 00720 for (posCurrent = clusterDetIds.begin (), posEnd = clusterDetIds.end (); posCurrent != posEnd; ++posCurrent) 00721 { 00722 binNumber = esService->getBinNumber (*posCurrent, nBinsR, nBinsZ, radiusR, radiusZ, barrelMaxEta, beamPipeTheta, endcapMaxTheta); 00723 00724 if ((binNumber >= 0) && (binNumber < nbrOfBins)) 00725 { 00726 if (m_binning.value () == "project") 00727 (energies[binNumber] > energy) ? energies[binNumber] : energies[binNumber] = energy; 00728 else 00729 energies[binNumber] += energy; 00730 } 00731 else 00732 { 00733 std::cerr << "Bin number (" << binNumber << ") exceeds the number of bins (" << nbrOfBins << ")"<< std::endl; 00734 } 00735 } 00736 } 00737 } 00738 00739 if (*max_element (energies.begin (), energies.end ()) > 0.0) 00740 { 00741 IgSoRectColHist* hist = new IgSoRectColHist; 00742 hist->radiusR = radiusR; 00743 hist->radiusZ = radiusZ; 00744 hist->numR = nBinsR; 00745 hist->numZ = nBinsZ; 00746 hist->energies.setValues (0, energies.size(), &energies [0]); 00747 hist->logScale = false; 00748 hist->layer = -5.0; 00749 hist->scaleFactor = m_escale.value (); 00750 hist->barrelMaxEta = barrelMaxEta; 00751 hist->beamPipeTheta = beamPipeTheta; 00752 hist->endcapMaxTheta = endcapMaxTheta; 00753 00754 std::vector<SbColor> colors (4); 00755 colors[0] = SbColor (1.0, 0.0, 153.0 / 255.0); // first energy's positive color 00756 colors[1] = SbColor (1.0, 1.0, 153.0 / 255.0); // first energy's negative color 00757 colors[2] = SbColor (51.0 / 255.0, 1.0, 102.0 / 255.0); // second energy's positive color (not used) 00758 colors[3] = SbColor (51.0 / 255.0, 0.0, 102.0 / 255.0); // second energy's negative color (not used) 00759 00760 hist->faceColors.setValues (0, colors.size (), &colors[0]); 00761 sep->addChild (hist); 00762 } 00763 } 00764 } 00765 catch (cms::Exception& e) 00766 { 00767 e.append (" from VisBasicClusterCollectionTwig::update(IgRZRep*) "); 00768 e.append (this->name ()); 00769 00770 if (this->m_onCmsException) 00771 this->m_onCmsException (&e); 00772 } 00773 catch (lat::Error &e) 00774 { 00775 if (this->m_onError) 00776 this->m_onError (&e); 00777 } 00778 catch (std::exception &e) 00779 { 00780 if (this->m_onException) 00781 this->m_onException (&e); 00782 } 00783 catch (...) 00784 { 00785 if (this->m_onUnhandledException) 00786 this->m_onUnhandledException (); 00787 } 00788 00789 rep->node ()->addChild (sep); 00790 }
Reimplemented from VisQueuedTwig.
Definition at line 538 of file VisBasicClusterCollectionTwig.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_clusters, m_cut, m_escale, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, IgSoCircularHist::maxRadius, IgSoCircularHist::minRadius, Ig3DBaseRep::node(), IgSoCircularHist::numberOfBins, PV3DBase< T, PVType, FrameType >::phi(), phi, radius(), IgSoCircularHist::scaleFactor, IgSoCircularHist::showAnnotations, VisQueuedTwig::state(), VisQueuedTwig::update(), and VisActiveConfigurable< T >::value().
00539 { 00540 // Get debugging dump. 00541 VisQueuedTwig::update (rep); 00542 00543 IgQtLock (); 00544 00545 rep->clear (); 00546 00547 SoSeparator *sep = new SoSeparator; 00548 SoSeparator *posSep = new SoSeparator; 00549 SoSeparator *negSep = new SoSeparator; 00550 sep->addChild (posSep); 00551 sep->addChild (negSep); 00552 00553 SoMaterial *mat = new SoMaterial; 00554 mat->ambientColor.setValue (1.0, 0.0, 153.0 / 255.0); 00555 mat->diffuseColor.setValue (1.0, 0.0, 153.0 / 255.0); 00556 mat->specularColor.setValue (1.0, 0.0, 153.0 / 255.0); 00557 mat->emissiveColor.setValue (1.0, 0.0, 153.0 / 255.0); 00558 posSep->addChild (mat); 00559 00560 SoMaterial *negMat = new SoMaterial; 00561 negMat->ambientColor.setValue (51.0 / 255.0, 1.0, 102.0 / 255.0); 00562 negMat->diffuseColor.setValue (51.0 / 255.0, 1.0, 102.0 / 255.0); 00563 negMat->specularColor.setValue (51.0 / 255.0, 1.0, 102.0 / 255.0); 00564 negMat->emissiveColor.setValue (51.0 / 255.0, 1.0, 102.0 / 255.0); 00565 negSep->addChild (negMat); 00566 00567 int nbrOfBins = 360; 00568 int binNumber; 00569 00570 std::vector<float> bufferPositive (nbrOfBins); 00571 std::vector<float> bufferNegative (nbrOfBins); 00572 try 00573 { 00574 if (! m_clusters.empty ()) 00575 { 00576 VisEventSetupService *esService = VisEventSetupService::get (state ()); 00577 ASSERT (esService); 00578 00579 float radius = 1.29; 00580 00581 for (std::vector<reco::BasicCluster>::const_iterator i = m_clusters.begin (), iEnd = m_clusters.end (); i != iEnd; ++i) 00582 { 00583 float energy = (*i).energy (); 00584 if (energy > m_cut.value ()) 00585 { 00586 std::vector<DetId> clusterDetIds = (*i).getHitsByDetId (); 00587 std::vector<DetId>::iterator posCurrent; 00588 std::vector<DetId>::iterator posEnd; 00589 00590 for (posCurrent = clusterDetIds.begin (), posEnd = clusterDetIds.end (); posCurrent != posEnd; ++posCurrent) 00591 { 00592 const GlobalPoint& pos = esService->getCellPosition (*posCurrent); 00593 float phi = pos.phi (); 00594 00595 (phi < 0) ? phi = 2 * M_PI + phi : phi; 00596 00597 binNumber = (int) floor (phi / (2 * M_PI / nbrOfBins)); 00598 if (binNumber >= 0 && binNumber < nbrOfBins) 00599 if (m_binning.value () == "project") 00600 { 00601 if ((energy > 0.0) && (energy > bufferPositive [binNumber])) 00602 bufferPositive [binNumber] = energy; 00603 else if ((energy < 0.0) && (energy < bufferNegative [binNumber])) 00604 bufferNegative [binNumber] = energy; 00605 } 00606 else 00607 (energy > 0.0) ? bufferPositive [binNumber] += energy : bufferNegative [binNumber] += energy; 00608 } 00609 } 00610 } 00611 00612 std::vector<float>::const_iterator first = bufferPositive.begin (); 00613 std::vector<float>::const_iterator last = bufferPositive.end (); 00614 00615 if (*max_element (first, last) > 0.0) 00616 { 00617 IgSoCircularHist *recHits = new IgSoCircularHist; 00618 recHits->minRadius = radius; 00619 recHits->maxRadius = -1; 00620 recHits->scaleFactor = m_escale.value (); 00621 recHits->numberOfBins = nbrOfBins; 00622 recHits->energies.setValues (0, nbrOfBins, &bufferPositive [0]); 00623 recHits->logScale = false; 00624 recHits->showAnnotations = m_annotation.value (); 00625 recHits->layer = 5.5; 00626 posSep->addChild (recHits); 00627 } 00628 00629 std::vector<float>::const_iterator nfirst = bufferNegative.begin (); 00630 std::vector<float>::const_iterator nlast = bufferNegative.end (); 00631 00632 if (fabs(*max_element (nfirst, nlast)) > 0.0) 00633 { 00634 IgSoCircularHist *negRecHits = new IgSoCircularHist; 00635 negRecHits->minRadius = radius; 00636 negRecHits->maxRadius = -1; 00637 negRecHits->scaleFactor = m_escale.value (); 00638 negRecHits->numberOfBins = nbrOfBins; 00639 negRecHits->energies.setValues (0, nbrOfBins, &bufferNegative [0]); 00640 negRecHits->logScale = false; 00641 negRecHits->showAnnotations = m_annotation.value (); 00642 negRecHits->layer = 5.0; 00643 00644 negSep->addChild (negRecHits); 00645 } 00646 } 00647 } 00648 catch (cms::Exception& e) 00649 { 00650 e.append (" from VisBasicClusterCollectionTwig::update (IgRPhiRep*) "); 00651 e.append (this->name ()); 00652 00653 if (this->m_onCmsException) 00654 this->m_onCmsException (&e); 00655 } 00656 catch (lat::Error &e) 00657 { 00658 if (this->m_onError) 00659 this->m_onError (&e); 00660 } 00661 catch (std::exception &e) 00662 { 00663 if (this->m_onException) 00664 this->m_onException (&e); 00665 } 00666 catch (...) 00667 { 00668 if (this->m_onUnhandledException) 00669 this->m_onUnhandledException (); 00670 } 00671 00672 rep->node ()->addChild (sep); 00673 }
Reimplemented from VisQueuedTwig.
Definition at line 462 of file VisBasicClusterCollectionTwig.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_clusters, m_cut, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_scale, Ig3DBaseRep::node(), PV3DBase< T, PVType, FrameType >::phi(), phi, IgSoTower::phiWidth, IgSoTower::position, IgSoTower::scaleFactor, VisQueuedTwig::state(), VisQueuedTwig::update(), and VisActiveConfigurable< T >::value().
00463 { 00464 // Get debugging dump. 00465 VisQueuedTwig::update (rep); 00466 00467 IgQtLock (); 00468 00469 rep->clear (); 00470 00471 SoSeparator *sep = new SoSeparator; 00472 00473 try 00474 { 00475 if (! m_clusters.empty ()) 00476 { 00477 VisEventSetupService *esService = VisEventSetupService::get (state ()); 00478 ASSERT (esService); 00479 00480 for (std::vector<reco::BasicCluster>::const_iterator i = m_clusters.begin (), iEnd = m_clusters.end (); i != iEnd; ++i) 00481 { 00482 float energy = (*i).energy (); 00483 if (fabs (energy) > m_cut.value ()) 00484 { 00485 std::vector<DetId> clusterDetIds = (*i).getHitsByDetId (); 00486 std::vector<DetId>::iterator posCurrent; 00487 std::vector<DetId>::iterator posEnd; 00488 00489 for (posCurrent = clusterDetIds.begin (), posEnd = clusterDetIds.end (); posCurrent != posEnd; ++posCurrent) 00490 { 00491 const GlobalPoint& pos = esService->getCellPosition (*posCurrent); 00492 00493 float eta = pos.eta (); 00494 float phi = pos.phi (); 00495 (phi < 0.0) ? phi = 2 * M_PI + phi : phi; // correction in absence of one convention 00496 00497 IgSoTower *tower = new IgSoTower; 00498 tower->position = SbVec2f (phi, eta); // eta, phi 00499 tower->scaleFactor = m_scale.value (); 00500 tower->etaWidth = 0.0174; 00501 tower->phiWidth = 0.0174; 00502 tower->energy = energy; 00503 tower->emFraction = 1; 00504 sep->addChild (tower); 00505 } 00506 } 00507 } 00508 } 00509 } 00510 catch (cms::Exception& e) 00511 { 00512 e.append (" from VisBasicClusterCollectionTwig::update(IgLegoRep *) "); 00513 e.append (this->name ()); 00514 00515 if (this->m_onCmsException) 00516 this->m_onCmsException (&e); 00517 } 00518 catch (lat::Error &e) 00519 { 00520 if (this->m_onError) 00521 this->m_onError (&e); 00522 } 00523 catch (std::exception &e) 00524 { 00525 if (this->m_onException) 00526 this->m_onException (&e); 00527 } 00528 catch (...) 00529 { 00530 if (this->m_onUnhandledException) 00531 this->m_onUnhandledException (); 00532 } 00533 00534 rep->node ()->addChild (sep); 00535 }
Reimplemented from VisQueuedTwig.
Definition at line 354 of file VisBasicClusterCollectionTwig.cc.
References cms::Exception::append(), ASSERT, Ig3DBaseRep::clear(), e, Ig3DBaseModel::encode(), relval_parameters_module::energy, exception, DBSPlugin::get(), VisEventSetupService::getCorners(), i, m_clusters, m_cut, m_escale, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, Ig3DBaseRep::node(), EZArrayFL< T >::size(), VisQueuedTwig::state(), IgSbColorMap::unpack(), VisQueuedTwig::update(), VisActiveConfigurable< T >::value(), x, y, and z.
00355 { 00356 // Get debugging dump. 00357 VisQueuedTwig::update (rep); 00358 00359 IgQtLock (); 00360 00361 rep->clear (); 00362 00363 SoSeparator *clusterSep = new SoSeparator; 00364 00365 SoMaterial *clusterMaterial = new SoMaterial; 00366 clusterMaterial->ambientColor.setValue (0.000, 0.000, 0.000); 00367 clusterMaterial->diffuseColor.setValue (1.000, 0.000, 0.000); 00368 clusterMaterial->emissiveColor.setValue (1.000, 0.000, 0.000); 00369 clusterMaterial->specularColor.setValue (0.000, 0.000, 0.000); 00370 clusterMaterial->shininess = 0.0; 00371 clusterMaterial->transparency = 0.0; 00372 clusterSep->addChild (clusterMaterial); 00373 00374 if (! m_clusters.empty ()) 00375 { 00376 try 00377 { 00378 unsigned colour [10] = { 0xff000000, 0xffff0000, 0x00ff0000, // red yellow green 00379 0xff00ff00, 0x00ffff00, 0xd0dfff00, // magenta cyan 00380 0xff000fff, 0x00ffff00, 0xe00fff00, 00381 0xff00ee00}; 00382 int mi = 0; 00383 00384 for (std::vector<reco::BasicCluster>::const_iterator i = m_clusters.begin (), iEnd = m_clusters.end (); i != iEnd; ++i) 00385 { 00386 float energy = (*i).energy (); 00387 if (energy > m_cut.value ()) 00388 { 00389 std::vector<DetId> clusterDetIds = (*i).getHitsByDetId (); 00390 std::vector<DetId>::iterator posCurrent; 00391 std::vector<DetId>::iterator posEnd; 00392 00393 SoSeparator *baseSep = new SoSeparator; 00394 clusterSep->addChild (baseSep); 00395 SoMaterial *baseMat = new SoMaterial; 00396 baseMat->setName (Ig3DBaseModel::encode ("Cluster color")); 00397 float rgbcomponents [4]; 00398 IgSbColorMap::unpack (colour [mi++], rgbcomponents); 00399 baseMat->diffuseColor.setValue (rgbcomponents); 00400 baseSep->addChild (baseMat); 00401 00402 VisEventSetupService *esService = VisEventSetupService::get (state ()); 00403 ASSERT (esService); 00404 00405 for (posCurrent = clusterDetIds.begin (), posEnd = clusterDetIds.end (); posCurrent != posEnd; ++posCurrent) 00406 { 00407 float cEnergy = 0; 00408 const CaloCellGeometry::CornersVec& corners = esService->getCorners (*posCurrent); 00409 ASSERT (corners.size () == 8); 00410 00411 IgSoCrystalHit *crystalHit = new IgSoCrystalHit; 00412 crystalHit->energy.setValue (cEnergy); 00413 crystalHit->scale.setValue (m_escale.value ()); 00414 crystalHit->relativeWidth.setValue (1.0); 00415 crystalHit->drawCrystal.setValue (true); 00416 crystalHit->drawHit.setValue (true); 00417 00418 crystalHit->front1.setValue (corners [3].x () / 100.0, corners [3].y () / 100.0, corners [3].z () / 100.0); 00419 crystalHit->front2.setValue (corners [2].x () / 100.0, corners [2].y () / 100.0, corners [2].z () / 100.0); 00420 crystalHit->front3.setValue (corners [1].x () / 100.0, corners [1].y () / 100.0, corners [1].z () / 100.0); 00421 crystalHit->front4.setValue (corners [0].x () / 100.0, corners [0].y () / 100.0, corners [0].z () / 100.0); 00422 00423 crystalHit->back1.setValue (corners [7].x () / 100.0, corners [7].y () / 100.0, corners [7].z () / 100.0); 00424 crystalHit->back2.setValue (corners [6].x () / 100.0, corners [6].y () / 100.0, corners [6].z () / 100.0); 00425 crystalHit->back3.setValue (corners [5].x () / 100.0, corners [5].y () / 100.0, corners [5].z () / 100.0); 00426 crystalHit->back4.setValue (corners [4].x () / 100.0, corners [4].y () / 100.0, corners [4].z () / 100.0); 00427 00428 baseSep->addChild (crystalHit); 00429 } 00430 } 00431 } 00432 } 00433 catch (cms::Exception& e) 00434 { 00435 e.append (" from VisBasicClusterCollectionTwig::update(Ig3DRep*) "); 00436 e.append (this->name ()); 00437 00438 if (this->m_onCmsException) 00439 this->m_onCmsException (&e); 00440 } 00441 catch (lat::Error &e) 00442 { 00443 if (this->m_onError) 00444 this->m_onError (&e); 00445 } 00446 catch (std::exception &e) 00447 { 00448 if (this->m_onException) 00449 this->m_onException (&e); 00450 } 00451 catch (...) 00452 { 00453 if (this->m_onUnhandledException) 00454 this->m_onUnhandledException (); 00455 } 00456 } 00457 00458 rep->node ()->addChild (clusterSep); 00459 }
Reimplemented from VisQueuedTwig.
Definition at line 263 of file VisBasicClusterCollectionTwig.cc.
References cms::Exception::append(), e, relval_parameters_module::energy, exception, i, m_clusters, m_cut, m_friendlyName, m_instanceName, m_moduleLabel, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_processName, m_text, n, IgSimpleTwig::name(), IgTextRep::setText(), VisQueuedTwig::update(), and VisActiveConfigurable< T >::value().
00264 { 00265 // Get debugging dump. 00266 VisQueuedTwig::update (rep); 00267 00268 // Prepare property description. 00269 std::ostringstream text; 00270 text << this->name () << " from "; 00271 text << m_text << "<br>"; 00272 00273 if (m_friendlyName.empty () && m_moduleLabel.empty () && m_instanceName.empty () && m_processName.empty ()) 00274 { 00275 text << "Please, select the branches of this Twig for more information."; 00276 } 00277 else 00278 { 00279 text << "Displayed only above " << m_cut.value () << " GeV:<br>"; 00280 00281 text << "<table width='100%' border=1>" 00282 << "<TR align = center>" 00283 << "<TH>Number</TH>" 00284 << "<TH>Energy</TH>" 00285 << "<TH>Position (x, y, z)</TH>" 00286 << "<TH>Algorithm</TH>" 00287 << "<TH>Chi-squared</TH>" 00288 << "<TH>Eta</TH>" 00289 << "<TH>Phi</TH>" 00290 << "</TR>"; 00291 text << setiosflags (std::ios::showpoint | std::ios::fixed); 00292 text.setf (std::ios::right, std::ios::adjustfield); 00293 00294 int n = 0; 00295 if (! m_clusters.empty ()) 00296 { 00297 try 00298 { 00299 for (std::vector<reco::BasicCluster>::const_iterator i = m_clusters.begin (), iEnd = m_clusters.end (); i != iEnd; ++i) 00300 { 00301 float energy = (*i).energy (); 00302 if (energy > m_cut.value ()) 00303 { 00304 text << "<TR align = right>" 00305 << "<TD>" << std::setw (3) << n++ << "</TD>" 00306 << "<TD>" << std::setw (5) << std::setprecision (3) << energy << "</TD>" 00307 << "<TD>" << std::setw (5) << std::setprecision (3) << (*i).x () << ", " << (*i).y () << ", " << (*i).z () << "</TD>"; 00308 00309 ((*i).algo () == 0) ? 00310 (text << "<TD>" << std::setw (5) << std::setprecision (3) << "island" << "</TD>") : 00311 (text << "<TD>" << std::setw (5) << std::setprecision (3) << "hybrid" << "</TD>"); 00312 00313 text << "<TD>" << std::setw (5) << std::setprecision (3) << (*i).chi2 () << "</TD>" 00314 << "<TD>" << std::setw (5) << std::setprecision (3) << (*i).eta () << "</TD>" 00315 << "<TD>" << std::setw (5) << std::setprecision (3) << (*i).phi ()<< "</TD>" 00316 << "</TR>"; 00317 } 00318 } 00319 } 00320 catch (cms::Exception& e) 00321 { 00322 e.append (" from VisBasicClusterCollectionTwig::update(IgTextRep*) "); 00323 e.append (this->name ()); 00324 00325 if (this->m_onCmsException) 00326 this->m_onCmsException (&e); 00327 } 00328 catch (lat::Error &e) 00329 { 00330 if (this->m_onError) 00331 this->m_onError (&e); 00332 } 00333 catch (std::exception &e) 00334 { 00335 if (this->m_onException) 00336 this->m_onException (&e); 00337 } 00338 catch (...) 00339 { 00340 if (this->m_onUnhandledException) 00341 this->m_onUnhandledException (); 00342 } 00343 } 00344 00345 text << "</table>"; 00346 } 00347 00348 // Send it over. 00349 IgQtLock (); 00350 rep->setText (text.str ()); 00351 }
std::vector<EcalRecHit> VisBasicClusterCollectionTwig::m_clusterRecHits [private] |
std::vector<reco::BasicCluster> VisBasicClusterCollectionTwig::m_clusters [private] |
Definition at line 62 of file VisBasicClusterCollectionTwig.h.
Referenced by onNewEvent(), and update().
const std::string VisBasicClusterCollectionTwig::m_friendlyName [private] |
Definition at line 53 of file VisBasicClusterCollectionTwig.h.
Referenced by onNewEvent(), and update().
const std::string VisBasicClusterCollectionTwig::m_instanceName [private] |
Definition at line 55 of file VisBasicClusterCollectionTwig.h.
Referenced by onNewEvent(), and update().
const std::string VisBasicClusterCollectionTwig::m_moduleLabel [private] |
Definition at line 54 of file VisBasicClusterCollectionTwig.h.
Referenced by onNewEvent(), and update().
std::string VisBasicClusterCollectionTwig::m_name [private] |
const std::string VisBasicClusterCollectionTwig::m_processName [private] |
Definition at line 56 of file VisBasicClusterCollectionTwig.h.
Referenced by onNewEvent(), and update().
unsigned VisBasicClusterCollectionTwig::m_rgba [private] |
Definition at line 64 of file VisBasicClusterCollectionTwig.h.
std::string VisBasicClusterCollectionTwig::m_text [private] |
Definition at line 52 of file VisBasicClusterCollectionTwig.h.
Referenced by onNewEvent(), and update().