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