CMS 3D CMS Logo

VisHBHERecHitTwig Class Reference

#include <VisReco/VisHcal/interface/VisHBHERecHitTwig.h>

Inheritance diagram for VisHBHERecHitTwig:

VisQueuedTwig IgSimpleTwig VisEventObserver IgCompoundTwig IgTwig IgRepresentable

List of all members.

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 (IgTextRep *rep)
virtual void update (IgLegoRep *rep)
virtual void update (Ig3DRep *rep)
 VisHBHERecHitTwig (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=0x0066ff00)
 ~VisHBHERecHitTwig (void)

Private Member Functions

SoMaterial * energyColor (const float energy)
void generateColors (void)

Private Attributes

VisCaloAnnotation m_annotation
VisBinningStrategy m_binning
VisHcalColorCode m_colorCode
std::vector< SoMaterial * > m_colors
 color-energy map
VisEnergyCut m_cut
VisCaloEnergyScale m_escale
const std::string m_friendlyName
const std::string m_instanceName
float m_maxEnergy
const std::string m_moduleLabel
std::string m_name
int m_ncolors
 number of colors for colormap
VisPhiDelta m_phiDelta
VisPhiStart m_phiStart
const std::string m_processName
std::vector< HBHERecHitm_recHits
unsigned m_rgba
VisHcalRMax m_rMax
VisLegoScale m_scale
VisHcalShowHit m_showHit
VisHcalShowTower m_showTower
std::string m_text


Detailed Description

Definition at line 31 of file VisHBHERecHitTwig.h.


Constructor & Destructor Documentation

VisHBHERecHitTwig::VisHBHERecHitTwig ( 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 = 0x0066ff00 
)

Definition at line 68 of file VisHBHERecHitTwig.cc.

References createThisTwig(), edm::TypeID::friendlyClassName(), generateColors(), 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, &VisHBHERecHitTwig::twigChanged)),
00082       m_annotation (state, lat::CreateCallback (this, &VisHBHERecHitTwig::twigChanged)),
00083       m_escale (state, lat::CreateCallback (this, &VisHBHERecHitTwig::twigChanged)),
00084       m_cut (state, lat::CreateCallback (this, &VisHBHERecHitTwig::twigChanged)),
00085       m_scale (state, lat::CreateCallback (this, &VisHBHERecHitTwig::twigChanged)),
00086       m_phiStart (state, lat::CreateCallback (this, &VisHBHERecHitTwig::twigChanged)),
00087       m_phiDelta (state, lat::CreateCallback (this, &VisHBHERecHitTwig::twigChanged)),
00088       m_rMax (state, lat::CreateCallback (this, &VisHBHERecHitTwig::twigChanged)),
00089       m_colorCode (state, lat::CreateCallback (this, &VisHBHERecHitTwig::twigChanged)),
00090       m_showHit (state, lat::CreateCallback (this, &VisHBHERecHitTwig::twigChanged)),
00091       m_showTower (state, lat::CreateCallback (this, &VisHBHERecHitTwig::twigChanged)),
00092       m_text ("no info"),
00093       m_recHits (2350),
00094       m_rgba (colour),
00095       m_ncolors (10)
00096 {
00097     VisTwigFactroyService *tfService = VisTwigFactroyService::get (state);
00098     if (! tfService)
00099     {
00100         tfService = new VisTwigFactroyService (state);
00101     }
00102     edm::TypeID recHitCollID (typeid (HBHERecHitCollection));
00103     tfService->registerTwig (recHitCollID.friendlyClassName (), &createThisTwig);
00104     generateColors ();
00105 }

VisHBHERecHitTwig::~VisHBHERecHitTwig ( void   ) 

Definition at line 107 of file VisHBHERecHitTwig.cc.

References it, and m_colors.

00108 {
00109     if (! m_colors.empty ())
00110     {
00111         for (std::vector<SoMaterial *>::iterator it = m_colors.begin (); it != m_colors.end (); ++it)
00112         {
00113             (*it)->unref (); //let OIV collect these
00114         }
00115         m_colors.resize (0);
00116     }
00117 }


Member Function Documentation

SoMaterial * VisHBHERecHitTwig::energyColor ( const float  energy  )  [private]

Definition at line 692 of file VisHBHERecHitTwig.cc.

References m_colors, m_cut, m_maxEnergy, m_ncolors, min, and VisActiveConfigurable< T >::value().

Referenced by update().

00693 {
00694     // determine color (energy)
00695     int color_ndx = static_cast<int>((energy - m_cut.value ()) * m_ncolors / (m_maxEnergy - m_cut.value ()));
00696     color_ndx = std::min (color_ndx, m_ncolors - 1);
00697     return m_colors [color_ndx];
00698 }

void VisHBHERecHitTwig::generateColors ( void   )  [private]

Definition at line 701 of file VisHBHERecHitTwig.cc.

References i, it, m_colors, m_ncolors, and value.

Referenced by VisHBHERecHitTwig().

00702 {
00703     float hue = 0.66667F; // reverse load to get low to high: hue 0 -> red, 2/3->blue
00704     float saturation= 1.0F; 
00705     float value = 1.0F;
00706     SbColor hsvColor;
00707     float delta_hue = hue / m_ncolors;
00708     if (m_colors.empty ())
00709     {
00710         m_colors.reserve (m_ncolors);
00711         for (int i = 0; i < m_ncolors; i++, hue -= delta_hue)
00712         {
00713             hsvColor.setHSVValue (hue, saturation, value);
00714             SoMaterial *material = new SoMaterial;
00715             material->diffuseColor.setValue (hsvColor);
00716             m_colors.push_back (material);
00717             material->ref (); // make sure OIV doesn't garbage collect 
00718         }
00719     }
00720     else
00721     {
00722         for (std::vector<SoMaterial *>::iterator it = m_colors.begin (); it != m_colors.end (); it++, hue -= delta_hue)
00723         {
00724             hsvColor.setHSVValue (hue, saturation, value);
00725             (*it)->diffuseColor.setValue (hsvColor);
00726         }
00727     }
00728 }

void VisHBHERecHitTwig::onNewEvent ( const edm::Event event,
const edm::EventSetup eventSetup 
) [virtual]

Reimplemented from VisQueuedTwig.

Definition at line 124 of file VisHBHERecHitTwig.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_maxEnergy, 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().

00126 {
00127     // Get debugging dump.
00128     VisQueuedTwig::onNewEvent (event, eventSetup);
00129 
00130     m_recHits.clear ();
00131     
00132     m_text = (QString ("Run # %1, event # %2")
00133               .arg (event.id ().run ())
00134               .arg (event.id ().event ()).latin1 ());
00135     
00136     std::vector<edm::Handle<HBHERecHitCollection> > barrelRecHits;
00137     try
00138     {
00139         QApplication::setOverrideCursor (Qt::waitCursor);
00140             
00141         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (state ()))
00142             sbar->setMessage ("Retrieving an HBHERecHitCollection...");
00143 
00144         if ((! m_friendlyName.empty ()) || (! m_moduleLabel.empty ()) || (! m_instanceName.empty ()) || (! m_processName.empty ()))
00145         {
00146             VisEventSelector visSel (m_friendlyName, m_moduleLabel, m_instanceName, m_processName);
00147             event.getMany (visSel, barrelRecHits);
00148         }
00149 
00150         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (state ()))
00151             sbar->setMessage ("HBHERecHitCollection done.");    
00152  
00153         QApplication::restoreOverrideCursor ();
00154     }
00155     catch (cms::Exception& e)
00156     {
00157         e.append (" from VisHBHERecHitTwig::onNewEvent ");
00158         e.append (this->name ());    
00159 
00160         if (this->m_onCmsException)
00161             this->m_onCmsException (&e);
00162     }
00163     catch (lat::Error &e) 
00164     {
00165         if (this->m_onError)
00166             this->m_onError (&e);
00167     }
00168     catch (std::exception &e) 
00169     {
00170         if (this->m_onException)
00171             this->m_onException (&e);
00172     }
00173     catch (...) 
00174     {
00175         if (this->m_onUnhandledException)
00176             this->m_onUnhandledException ();
00177     }
00178     if (! barrelRecHits.empty ())
00179     {
00180         m_maxEnergy = 0;
00181         for (std::vector<edm::Handle<HBHERecHitCollection> >::iterator i = barrelRecHits.begin (), iEnd = barrelRecHits.end (); i != iEnd; ++i) 
00182         {
00183             const HBHERecHitCollection& c = *(*i);
00184             QString sizeStr = (QString ("%1").arg (c.size ()));
00185             QString nameStr = QString (this->name ());
00186             int ib = nameStr.find ("[");
00187             int ie = nameStr.find ("]");
00188             nameStr.replace (ib + 1, ie - 1, sizeStr);
00189             this->name (nameStr);
00190             for (std::vector<HBHERecHit>::const_iterator ibarrel = c.begin (), ibarrelEnd = c.end (); 
00191                  ibarrel != ibarrelEnd; ++ibarrel)
00192             {
00193                 m_recHits.push_back (*ibarrel);
00194                 m_maxEnergy < (*ibarrel).energy () ? m_maxEnergy = (*ibarrel).energy () : m_maxEnergy;
00195             }
00196         }
00197     }
00198 
00199     VisQueuedTwig::onBaseInvalidate ();
00200 
00201     if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (state ()))
00202         sbar->setMessage (QString (m_text));
00203 }

void VisHBHERecHitTwig::twigChanged ( void   )  [virtual]

Definition at line 120 of file VisHBHERecHitTwig.cc.

References IgRepSet::invalidate(), and IgTwig::SELF_MASK.

00121 { IgRepSet::invalidate (this, SELF_MASK); }

void VisHBHERecHitTwig::update ( IgRZRep rep  )  [virtual]

Reimplemented from VisQueuedTwig.

Definition at line 570 of file VisHBHERecHitTwig.cc.

References cms::Exception::append(), ASSERT, IgSoRectColHist::barrelMaxEta, IgSoRectColHist::beamPipeTheta, TestMuL1L2Filter_cff::cerr, Ig3DBaseRep::clear(), e, lat::endl(), IgSoRectColHist::energies, relval_parameters_module::energy, VisEventSetupService::etaToTheta(), exception, f, 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_rgba, m_rMax, IgSoRectColHist::maxDist, Ig3DBaseRep::node(), IgSoRectColHist::numR, IgSoRectColHist::numZ, IgSoRectColHist::radiusR, IgSoRectColHist::radiusZ, IgSoRectColHist::scaleFactor, VisQueuedTwig::state(), IgSbColorMap::unpack(), VisQueuedTwig::update(), and VisActiveConfigurable< T >::value().

00571 {
00572     // Get debugging dump.
00573     VisQueuedTwig::update (rep);
00574         
00575     IgQtLock ();
00576     rep->clear ();
00577         
00578     SoSeparator *sep = new SoSeparator;    
00579 
00580     SoMaterial *mat = new SoMaterial;
00581     float rgbcomponents [4];
00582     IgSbColorMap::unpack (m_rgba, rgbcomponents);
00583     mat->ambientColor.setValue (SbColor (rgbcomponents));
00584     mat->diffuseColor.setValue (SbColor (rgbcomponents));
00585     mat->specularColor.setValue (SbColor (rgbcomponents));
00586     mat->emissiveColor.setValue (SbColor (rgbcomponents));
00587     sep->addChild (mat);
00588 
00589     VisEventSetupService *esService = VisEventSetupService::get (state ());
00590     ASSERT (esService);
00591 
00592     unsigned binNumber = 0;
00593     const unsigned nBinsZ = 17*2;
00594     const unsigned nBinsR = 13*2;
00595     const unsigned nbrOfBins = 2 * (nBinsZ + nBinsR);
00596     const float radiusR = 1.86f;
00597     const float radiusZ = 3.78f;
00598     const float barrelMaxEta = 1.444f;            // max eta of HCAL Barrel
00599     const float beamPipeTheta = esService->etaToTheta (3.f);
00600     std::vector<float> energies (nbrOfBins * 2);  // times 2 for the other energy (which is not used)
00601 
00602     try 
00603     {
00604         if (! m_recHits.empty ())
00605         {
00606             for (std::vector<HBHERecHit>::const_iterator i = m_recHits.begin (), iEnd = m_recHits.end (); i != iEnd; ++i) 
00607             {
00608                 float energy = (*i).energy ();
00609                 if (energy > m_cut.value ())
00610                 {
00611                     binNumber = esService->getBinNumber ((*i).detid (), nBinsR, nBinsZ, radiusR, radiusZ, barrelMaxEta, beamPipeTheta);
00612 
00613                     if (binNumber < nbrOfBins)
00614                     {
00615                         if (m_binning.value () == "project")
00616                             (energies[binNumber] > energy) ? energies[binNumber] : energies[binNumber] = energy;
00617                         else
00618                             energies[binNumber] += energy;
00619                     }
00620                     else
00621                     {
00622                         std::cerr << "Bin number (" << binNumber << ") exceeds the number of bins (" <<  nbrOfBins << ")"<< std::endl;
00623                     }
00624                 }
00625             }
00626                         
00627             if (*max_element (energies.begin (), energies.end ()) > 0.0)
00628             {
00629                 SoMaterial *mat = new SoMaterial;
00630                 mat->ambientColor.setValue (0.0, 0.4, 1.0);
00631                 mat->diffuseColor.setValue (0.0, 0.4, 1.0);
00632                 mat->specularColor.setValue (0.0, 0.4, 1.0);
00633                 mat->emissiveColor.setValue (0.0, 0.4, 1.0);
00634 
00635                 SoDrawStyle *drawStyle = new SoDrawStyle;
00636                 drawStyle->lineWidth.setValue (2.0);
00637 
00638                 IgSoRectColHist* hist = new IgSoRectColHist;
00639                 hist->radiusR = radiusR;
00640                 hist->radiusZ = radiusZ;
00641                 if (m_rMax.value () > 0) hist->maxDist = m_rMax.value ();               
00642                 hist->numR = nBinsR;
00643                 hist->numZ = nBinsZ;
00644                 hist->energies.setValues (0, energies.size(), &energies [0]);
00645                 hist->logScale = false;
00646                 hist->layer = -5.0;
00647                 hist->scaleFactor = m_escale.value ();
00648                 hist->barrelMaxEta = barrelMaxEta;
00649                 hist->beamPipeTheta = beamPipeTheta;
00650                                 
00651                 std::vector<SbColor> colors (4);
00652                 colors[0] = SbColor (0.0, 0.3, 1.0); // first energy's positive color 
00653                 colors[1] = SbColor (1.0, 0.0, 1.0); // first energy's negative color
00654                 colors[2] = SbColor (1.0, 0.4, 0.0); // second energy's positive color (not used)
00655                 colors[3] = SbColor (1.0, 1.0, 0.0); // second energy's negative color (not used)
00656                                 
00657                 hist->faceColors.setValues (0, colors.size (), &colors[0]);
00658                 sep->addChild (mat);
00659                 sep->addChild (drawStyle);
00660                 sep->addChild (hist);
00661             }
00662         }
00663     }
00664     catch (cms::Exception& e)
00665     {
00666         e.append (" from VisHBHERecHitTwig::update(IgRZRep*) ");
00667         e.append (this->name ());    
00668 
00669         if (this->m_onCmsException)
00670             this->m_onCmsException (&e);
00671     }
00672     catch (lat::Error &e) 
00673     {
00674         if (this->m_onError)
00675             this->m_onError (&e);
00676     }
00677     catch (std::exception &e) 
00678     {
00679         if (this->m_onException)
00680             this->m_onException (&e);
00681     }
00682     catch (...) 
00683     {
00684         if (this->m_onUnhandledException)
00685             this->m_onUnhandledException ();
00686     }
00687     
00688     rep->node ()->addChild (sep);
00689 }

void VisHBHERecHitTwig::update ( IgRPhiRep rep  )  [virtual]

Reimplemented from VisQueuedTwig.

Definition at line 449 of file VisHBHERecHitTwig.cc.

References cms::Exception::append(), Ig3DBaseRep::clear(), e, IgSoCircularHist::energies, relval_parameters_module::energy, exception, i, 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, IgSoCircularHist::scaleFactor, IgSoCircularHist::showAnnotations, VisHcalSubdetector::subDetName(), VisQueuedTwig::update(), and VisActiveConfigurable< T >::value().

00450 {
00451     // Get debugging dump.
00452     VisQueuedTwig::update (rep);
00453 
00454     IgQtLock ();
00455     rep->clear ();
00456     
00457     SoSeparator *sep = new SoSeparator;    
00458     SoSeparator *posSep = new SoSeparator;    
00459     SoSeparator *negSep = new SoSeparator;
00460     sep->addChild (posSep);
00461     sep->addChild (negSep);
00462     
00463     SoMaterial *mat = new SoMaterial;
00464     mat->ambientColor.setValue (0.0, 0.4, 1.0);
00465     mat->diffuseColor.setValue (0.0, 0.4, 1.0);
00466     mat->specularColor.setValue (0.0, 0.4, 1.0);
00467     mat->emissiveColor.setValue (0.0, 0.4, 1.0);
00468     posSep->addChild (mat);
00469     
00470     SoMaterial *negMat = new SoMaterial;
00471     negMat->ambientColor.setValue (1.0, 0.0, 0.0);
00472     negMat->diffuseColor.setValue (1.0, 0.0, 0.0);
00473     negMat->specularColor.setValue (1.0, 0.0, 0.0);
00474     negMat->emissiveColor.setValue (1.0, 0.0, 0.0);
00475     negSep->addChild (negMat);
00476 
00477     int nbrOfBins = 72;
00478     int binNumber;
00479 
00480     std::vector<float> bufferPositive (nbrOfBins);
00481     std::vector<float> bufferNegative (nbrOfBins);
00482     try 
00483     {
00484         if (! m_recHits.empty ())
00485         {
00486             for (std::vector<HBHERecHit>::const_iterator i = m_recHits.begin (), iEnd = m_recHits.end (); i != iEnd; ++i) 
00487             {
00488                 float energy = (*i).energy ();
00489                 if (energy > m_cut.value ())
00490                 {
00491                     if (VisHcalSubdetector::subDetName ((*i).id ().subdet ()) == "HcalBarrel")
00492                     {
00493                         int iphi = (*i).id ().iphi ();
00494                         binNumber = iphi - 1;
00495 
00496                         if (binNumber >= 0 && binNumber < 72) 
00497                             if (m_binning.value () == "project")
00498                             {                           
00499                                 if ((energy > 0.0) && (energy > bufferPositive [binNumber]))
00500                                     bufferPositive [binNumber] = energy;
00501                                 else if ((energy < 0.0) && (energy < bufferNegative [binNumber]))
00502                                     bufferNegative [binNumber] = energy;
00503                             }
00504                             else
00505                                 (energy > 0.0) ?  bufferPositive [binNumber] += energy : bufferNegative [binNumber] += energy;
00506                     }
00507                 }
00508             }
00509 
00510             if (*max_element (bufferPositive.begin (), bufferPositive.end ()) > 0.0)
00511             {
00512                 IgSoCircularHist *recHits = new IgSoCircularHist;
00513                 recHits->minRadius = 1.9;
00514                 recHits->maxRadius = m_rMax.value ();
00515                 recHits->scaleFactor = m_escale.value ();
00516                 recHits->numberOfBins = nbrOfBins;
00517                 recHits->energies.setValues (0, nbrOfBins, &bufferPositive [0]);
00518                 recHits->logScale = false;
00519                 recHits->showAnnotations = m_annotation.value ();
00520                 recHits->layer = 5.5;
00521                 posSep->addChild (recHits);
00522             }
00523             
00524             std::vector<float>::const_iterator nfirst = bufferNegative.begin ();
00525             std::vector<float>::const_iterator nlast = bufferNegative.end ();
00526 
00527             if (fabs(*max_element (nfirst, nlast)) > 0.0)
00528             {
00529                 IgSoCircularHist *negRecHits = new IgSoCircularHist;
00530                 negRecHits->minRadius = 1.9;
00531                 negRecHits->maxRadius = -1;
00532                 negRecHits->scaleFactor = m_escale.value ();
00533                 negRecHits->numberOfBins = nbrOfBins;
00534                 negRecHits->energies.setValues (0, nbrOfBins, &bufferNegative [0]);
00535                 negRecHits->logScale = false;
00536                 negRecHits->showAnnotations = m_annotation.value ();
00537                 negRecHits->layer = 5.0;
00538                 negSep->addChild (negRecHits);
00539             }       
00540         }
00541     }
00542     catch (cms::Exception& e)
00543     {
00544         e.append (" from VisHBHERecHitTwig::update (IgRPhiRep*) ");
00545         e.append (this->name ());    
00546 
00547         if (this->m_onCmsException)
00548             this->m_onCmsException (&e);
00549     }
00550     catch (lat::Error &e) 
00551     {
00552         if (this->m_onError)
00553             this->m_onError (&e);
00554     }
00555     catch (std::exception &e) 
00556     {
00557         if (this->m_onException)
00558             this->m_onException (&e);
00559     }
00560     catch (...) 
00561     {
00562         if (this->m_onUnhandledException)
00563             this->m_onUnhandledException ();
00564     }
00565     
00566     rep->node ()->addChild (sep);
00567 }

void VisHBHERecHitTwig::update ( IgTextRep rep  )  [virtual]

Reimplemented from VisQueuedTwig.

Definition at line 206 of file VisHBHERecHitTwig.cc.

References cms::Exception::append(), e, relval_parameters_module::energy, exception, 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(), IgTextRep::setText(), VisHcalSubdetector::subDetName(), VisQueuedTwig::update(), and VisActiveConfigurable< T >::value().

00207 {
00208     // Get debugging dump.
00209     VisQueuedTwig::update (rep);
00210 
00211     // Prepare property description.
00212     std::ostringstream  text;
00213     text << this->name () << " from ";
00214     text << m_text << "<br>";
00215     
00216     if (m_friendlyName.empty () && m_moduleLabel.empty () && m_instanceName.empty () && m_processName.empty ())
00217     {
00218         text << "Please, select the branches of this Twig for more information.";       
00219     }
00220     else
00221     {
00222         text << "Displayed only above  " << m_cut.value () << " GeV:<br>";
00223 
00224         text << "<table width='100%' border=1>"
00225              << "<TR align = center>"
00226              << "<TH>Number</TH>"
00227              << "<TH>Energy</TH>"
00228              << "<TH>Time</TH>"
00229              << "<TH>Subdetector</TH>"
00230              << "<TH>ietaAbs</TH>"
00231              << "<TH>ieta</TH>"
00232              << "<TH>iphi [rad]</TH>"
00233              << "<TH>Depth</TH>"
00234              << "</TR>";
00235         text << setiosflags (std::ios::showpoint | std::ios::fixed);
00236         text.setf (std::ios::right, std::ios::adjustfield);
00237     
00238         int nDigis = 0;
00239         try 
00240         {
00241             for (std::vector<HBHERecHit>::const_iterator i = m_recHits.begin (), iEnd = m_recHits.end (); i != iEnd; ++i) 
00242             {
00243                 float energy = (*i).energy ();
00244                 if (energy > m_cut.value ())
00245                 {
00246                     text << "<TR align = right>"
00247                          << "<TD>" << std::setw (3) << nDigis++ << "</TD>"
00248                          << "<TD>" << std::setw (5) << std::setprecision (3) << energy << "</TD>"
00249                          << "<TD>" << std::setw (5) << std::setprecision (3) << (*i).time () << "</TD>"
00250                          << "<TD>" << std::setw (2) << VisHcalSubdetector::subDetName ((*i).id ().subdet ()) << "</TD>"
00251                          << "<TD>" << std::setw (5) << std::setprecision (3) << (*i).id ().ietaAbs () << "</TD>"
00252                          << "<TD>" << std::setw (6) << std::setprecision (3) << (*i).id ().ieta () << "</TD>"
00253                          << "<TD>" << std::setw (5) << std::setprecision (3) << (*i).id ().iphi () << "</TD>"
00254                          << "<TD>" << std::setw (5) << std::setprecision (3) << (*i).id ().depth() << "</TD>"
00255                          << "</TR>";
00256                 }           
00257             }
00258         }
00259         catch (cms::Exception& e)
00260         {
00261             e.append (" from VisHBHERecHitTwig::update(IgTextRep*) ");
00262             e.append (this->name ());    
00263 
00264             if (this->m_onCmsException)
00265                 this->m_onCmsException (&e);
00266         }
00267         catch (lat::Error &e) 
00268         {
00269             if (this->m_onError)
00270                 this->m_onError (&e);
00271         }
00272         catch (std::exception &e) 
00273         {
00274             if (this->m_onException)
00275                 this->m_onException (&e);
00276         }
00277         catch (...) 
00278         {
00279             if (this->m_onUnhandledException)
00280                 this->m_onUnhandledException ();
00281         }
00282         text << "</table>";
00283     }
00284     
00285     // Send it over.
00286     IgQtLock ();
00287     rep->setText (text.str ());
00288 }

void VisHBHERecHitTwig::update ( IgLegoRep rep  )  [virtual]

Reimplemented from VisQueuedTwig.

Definition at line 386 of file VisHBHERecHitTwig.cc.

References cms::Exception::append(), Ig3DBaseRep::clear(), e, IgSoTower::emFraction, IgSoTower::energy, eta, exception, i, m_cut, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_recHits, m_scale, Ig3DBaseRep::node(), phi, IgSoTower::position, IgSoTower::scaleFactor, VisQueuedTwig::update(), and VisActiveConfigurable< T >::value().

00387 {
00388     // Get debugging dump.
00389     VisQueuedTwig::update (rep);
00390 
00391     IgQtLock ();
00392     rep->clear ();
00393     
00394     SoSeparator *sep = new SoSeparator;    
00395 
00396     try 
00397     {
00398         if (! m_recHits.empty ())
00399         {
00400             for (std::vector<HBHERecHit>::const_iterator i = m_recHits.begin (), iEnd = m_recHits.end (); i != iEnd; ++i) 
00401             {
00402                 float et = (*i).energy ();
00403                 if (fabs (et) > m_cut.value ()) 
00404                 {
00405                     int iphi = (*i).id ().iphi ();
00406                     int ieta = (*i).id ().ieta ();
00407                     
00408                     float phi = (iphi - 1) * 0.087 + 0.087 / 2.0;
00409                     float eta = ieta * 0.087 + 0.087 / 2.0;
00410             
00411                     IgSoTower *tower = new IgSoTower;
00412                     tower->position = SbVec2f (phi, eta); // eta, phi
00413                     tower->scaleFactor = m_scale.value ();
00414                     tower->energy = et;
00415                     tower->emFraction = 0.0; // EM/Total 0%
00416                     sep->addChild (tower);
00417                 }
00418             }
00419         }
00420     }
00421     catch (cms::Exception& e)
00422     {
00423         e.append (" from VisHBHERecHitTwig::update(IgLegoRep *) ");
00424         e.append (this->name ());    
00425 
00426         if (this->m_onCmsException)
00427             this->m_onCmsException (&e);
00428     }
00429     catch (lat::Error &e) 
00430     {
00431         if (this->m_onError)
00432             this->m_onError (&e);
00433     }
00434     catch (std::exception &e) 
00435     {
00436         if (this->m_onException)
00437             this->m_onException (&e);
00438     }
00439     catch (...) 
00440     {
00441         if (this->m_onUnhandledException)
00442             this->m_onUnhandledException ();
00443     }
00444     
00445     rep->node ()->addChild (sep);
00446 }

void VisHBHERecHitTwig::update ( Ig3DRep rep  )  [virtual]

Reimplemented from VisQueuedTwig.

Definition at line 291 of file VisHBHERecHitTwig.cc.

References cms::Exception::append(), ASSERT, Ig3DBaseRep::clear(), e, relval_parameters_module::energy, energyColor(), exception, DBSPlugin::get(), VisEventSetupService::getCorners(), i, m_colorCode, m_cut, m_escale, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_recHits, m_rgba, m_showHit, m_showTower, Ig3DBaseRep::node(), EZArrayFL< T >::size(), VisQueuedTwig::state(), IgSbColorMap::unpack(), VisQueuedTwig::update(), VisActiveConfigurable< T >::value(), x, y, and z.

00292 {
00293     // Get debugging dump.
00294     VisQueuedTwig::update (rep);
00295 
00296     IgQtLock ();
00297     rep->clear ();
00298 
00299     SoSeparator *sep = new SoSeparator;
00300 
00301     if (m_colorCode.value () == "mono")
00302     {
00303         SoMaterial *mat = new SoMaterial;
00304         float rgbcomponents [4];
00305         IgSbColorMap::unpack (m_rgba, rgbcomponents);
00306         mat->diffuseColor.setValue (SbColor (rgbcomponents));
00307         sep->addChild (mat);
00308     }
00309     
00310     if (! m_recHits.empty ())
00311     {
00312         VisEventSetupService *esService = VisEventSetupService::get (state ());
00313         ASSERT (esService);
00314 
00315         try 
00316         {
00317             for (std::vector<HBHERecHit>::const_iterator i = m_recHits.begin (), iEnd = m_recHits.end (); i != iEnd; ++i) 
00318             {
00319                 float energy = (*i).energy ();
00320                 if (energy > m_cut.value ()) 
00321                 {
00322                     const CaloCellGeometry::CornersVec& corners = esService->getCorners ((*i).detid ());
00323                     ASSERT (corners.size () == 8);
00324                 
00325                     IgSoCrystalHit *crystalHit = new IgSoCrystalHit;
00326                     crystalHit->energy.setValue (energy);
00327                     
00328                     crystalHit->scale.setValue (m_escale.value ());
00329                     crystalHit->relativeWidth.setValue (0.9);
00330                     crystalHit->drawCrystal.setValue (m_showTower.value ());
00331                     crystalHit->drawHit.setValue (m_showHit.value ());
00332 
00333                     crystalHit->front1.setValue (corners [0].x () / 100.0, corners [0].y () / 100.0, corners [0].z () / 100.0);
00334                     crystalHit->front2.setValue (corners [1].x () / 100.0, corners [1].y () / 100.0, corners [1].z () / 100.0);
00335                     crystalHit->front3.setValue (corners [2].x () / 100.0, corners [2].y () / 100.0, corners [2].z () / 100.0);
00336                     crystalHit->front4.setValue (corners [3].x () / 100.0, corners [3].y () / 100.0, corners [3].z () / 100.0);
00337                     
00338                     crystalHit->back1.setValue  (corners [4].x () / 100.0, corners [4].y () / 100.0, corners [4].z () / 100.0);
00339                     crystalHit->back2.setValue  (corners [5].x () / 100.0, corners [5].y () / 100.0, corners [5].z () / 100.0);
00340                     crystalHit->back3.setValue  (corners [6].x () / 100.0, corners [6].y () / 100.0, corners [6].z () / 100.0);
00341                     crystalHit->back4.setValue  (corners [7].x () / 100.0, corners [7].y () / 100.0, corners [7].z () / 100.0);
00342                     
00343                     if (m_colorCode.value () == "mono")
00344                     {
00345                         sep->addChild (crystalHit);
00346                     }
00347                     else
00348                     {
00349                         SoSeparator *tsep = new SoSeparator; // isolate each hit
00350                         tsep->addChild (energyColor (energy));
00351                         tsep->addChild (crystalHit);
00352                         sep->addChild (tsep);                   
00353                     }               
00354                 }
00355             }
00356         }
00357         catch (cms::Exception& e)
00358         {
00359             e.append (" from VisHBHERecHitTwig::update(Ig3DRep*) ");
00360             e.append (this->name ());    
00361 
00362             if (this->m_onCmsException)
00363                 this->m_onCmsException (&e);
00364         }
00365         catch (lat::Error &e) 
00366         {
00367             if (this->m_onError)
00368                 this->m_onError (&e);
00369         }
00370         catch (std::exception &e) 
00371         {
00372             if (this->m_onException)
00373                 this->m_onException (&e);
00374         }
00375         catch (...) 
00376         {
00377             if (this->m_onUnhandledException)
00378                 this->m_onUnhandledException ();
00379         }
00380     }
00381     
00382     rep->node ()->addChild (sep);
00383 }


Member Data Documentation

VisCaloAnnotation VisHBHERecHitTwig::m_annotation [private]

Definition at line 66 of file VisHBHERecHitTwig.h.

Referenced by update().

VisBinningStrategy VisHBHERecHitTwig::m_binning [private]

Definition at line 65 of file VisHBHERecHitTwig.h.

Referenced by update().

VisHcalColorCode VisHBHERecHitTwig::m_colorCode [private]

Definition at line 73 of file VisHBHERecHitTwig.h.

Referenced by update().

std::vector<SoMaterial *> VisHBHERecHitTwig::m_colors [private]

color-energy map

Definition at line 79 of file VisHBHERecHitTwig.h.

Referenced by energyColor(), generateColors(), and ~VisHBHERecHitTwig().

VisEnergyCut VisHBHERecHitTwig::m_cut [private]

Definition at line 68 of file VisHBHERecHitTwig.h.

Referenced by energyColor(), and update().

VisCaloEnergyScale VisHBHERecHitTwig::m_escale [private]

Definition at line 67 of file VisHBHERecHitTwig.h.

Referenced by update().

const std::string VisHBHERecHitTwig::m_friendlyName [private]

Definition at line 61 of file VisHBHERecHitTwig.h.

Referenced by onNewEvent(), and update().

const std::string VisHBHERecHitTwig::m_instanceName [private]

Definition at line 63 of file VisHBHERecHitTwig.h.

Referenced by onNewEvent(), and update().

float VisHBHERecHitTwig::m_maxEnergy [private]

Definition at line 81 of file VisHBHERecHitTwig.h.

Referenced by energyColor(), and onNewEvent().

const std::string VisHBHERecHitTwig::m_moduleLabel [private]

Definition at line 62 of file VisHBHERecHitTwig.h.

Referenced by onNewEvent(), and update().

std::string VisHBHERecHitTwig::m_name [private]

Reimplemented from IgSimpleTwig.

Definition at line 60 of file VisHBHERecHitTwig.h.

int VisHBHERecHitTwig::m_ncolors [private]

number of colors for colormap

Definition at line 80 of file VisHBHERecHitTwig.h.

Referenced by energyColor(), and generateColors().

VisPhiDelta VisHBHERecHitTwig::m_phiDelta [private]

Definition at line 71 of file VisHBHERecHitTwig.h.

VisPhiStart VisHBHERecHitTwig::m_phiStart [private]

Definition at line 70 of file VisHBHERecHitTwig.h.

const std::string VisHBHERecHitTwig::m_processName [private]

Definition at line 64 of file VisHBHERecHitTwig.h.

Referenced by onNewEvent(), and update().

std::vector<HBHERecHit> VisHBHERecHitTwig::m_recHits [private]

Definition at line 77 of file VisHBHERecHitTwig.h.

Referenced by onNewEvent(), and update().

unsigned VisHBHERecHitTwig::m_rgba [private]

Definition at line 78 of file VisHBHERecHitTwig.h.

Referenced by update().

VisHcalRMax VisHBHERecHitTwig::m_rMax [private]

Definition at line 72 of file VisHBHERecHitTwig.h.

Referenced by update().

VisLegoScale VisHBHERecHitTwig::m_scale [private]

Definition at line 69 of file VisHBHERecHitTwig.h.

Referenced by update().

VisHcalShowHit VisHBHERecHitTwig::m_showHit [private]

Definition at line 74 of file VisHBHERecHitTwig.h.

Referenced by update().

VisHcalShowTower VisHBHERecHitTwig::m_showTower [private]

Definition at line 75 of file VisHBHERecHitTwig.h.

Referenced by update().

std::string VisHBHERecHitTwig::m_text [private]

Definition at line 76 of file VisHBHERecHitTwig.h.

Referenced by onNewEvent(), and update().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:35:26 2009 for CMSSW by  doxygen 1.5.4