CMS 3D CMS Logo

VisCaloTowerTwig Class Reference

#include <VisReco/VisRecoJets/interface/VisCaloTowerTwig.h>

Inheritance diagram for VisCaloTowerTwig:

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 (IgLegoRep *rep)
virtual void update (Ig3DRep *rep)
 Update object.
virtual void update (IgTextRep *rep)
 VisCaloTowerTwig (IgState *state, IgTwig *parent, const std::string &name="", const std::string &friendlyName="", const std::string &moduleLabel="", const std::string &instanceName="", const std::string &processName="")

Private Attributes

VisCaloAnnotation m_annotation
VisBinningStrategy m_binning
VisEnergyCut m_cut
VisCaloEnergyScale m_escale
const std::string m_friendlyName
const std::string m_instanceName
const std::string m_moduleLabel
VisPhiDelta m_phiDelta
VisPhiStart m_phiStart
const std::string m_processName
VisLegoScale m_scale
std::vector< CaloTowerm_seedTowers
std::string m_text


Detailed Description

Definition at line 26 of file VisCaloTowerTwig.h.


Constructor & Destructor Documentation

VisCaloTowerTwig::VisCaloTowerTwig ( IgState state,
IgTwig parent,
const std::string &  name = "",
const std::string &  friendlyName = "",
const std::string &  moduleLabel = "",
const std::string &  instanceName = "",
const std::string &  processName = "" 
)

Definition at line 81 of file VisCaloTowerTwig.cc.

References createThisTwig(), edm::TypeID::friendlyClassName(), DBSPlugin::get(), and VisTwigFactroyService::registerTwig().

00087     : VisQueuedTwig (state, parent, name),
00088       m_text (name),
00089       m_friendlyName (friendlyName),
00090       m_moduleLabel (moduleLabel),
00091       m_instanceName (instanceName),
00092       m_processName (processName),
00093       m_binning (state, lat::CreateCallback (this, &VisCaloTowerTwig::twigChanged)),
00094       m_annotation (state, lat::CreateCallback (this, &VisCaloTowerTwig::twigChanged)),
00095       m_scale (state, lat::CreateCallback (this, &VisCaloTowerTwig::twigChanged)),
00096       m_cut (state, lat::CreateCallback (this, &VisCaloTowerTwig::twigChanged)),
00097       m_escale (state, lat::CreateCallback (this, &VisCaloTowerTwig::twigChanged)),
00098       m_phiStart (state, lat::CreateCallback (this, &VisCaloTowerTwig::twigChanged)),
00099       m_phiDelta (state, lat::CreateCallback (this, &VisCaloTowerTwig::twigChanged))
00100 {
00101     VisTwigFactroyService *tfService = VisTwigFactroyService::get (state);
00102     if (! tfService)
00103     {
00104         tfService = new VisTwigFactroyService (state);
00105     }
00106     edm::TypeID caloTowersID (typeid (CaloTowerCollection));
00107     tfService->registerTwig (caloTowersID.friendlyClassName (), &createThisTwig);
00108 }


Member Function Documentation

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

Reimplemented from VisQueuedTwig.

Definition at line 115 of file VisCaloTowerTwig.cc.

References cms::Exception::append(), arg, edm::SortedCollection< T, SORT >::begin(), c, e, end, edm::SortedCollection< T, SORT >::end(), exception, i, edm::Event::id(), IgRepSet::invalidate(), j, m_friendlyName, m_instanceName, m_moduleLabel, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_processName, m_seedTowers, m_text, IgSimpleTwig::name(), VisQueuedTwig::onNewEvent(), IgTwig::SELF_MASK, edm::SortedCollection< T, SORT >::size(), and IgTwig::STRUCTURE_MASK.

00117 {
00118     // Get debugging dump.
00119     VisQueuedTwig::onNewEvent (event, eventSetup);
00120 
00121     m_text = QString ("Run # %1, event # %2")
00122              .arg (event.id ().run ())
00123              .arg (event.id ().event ()).latin1 ();
00124 
00125     std::vector<edm::Handle<CaloTowerCollection> > towers;
00126     try 
00127     {
00128         if ((! m_friendlyName.empty ()) || (! m_moduleLabel.empty ()) || (! m_instanceName.empty ()) || (! m_processName.empty ()))
00129         {
00130             VisEventSelector visSel (m_friendlyName, m_moduleLabel, m_instanceName, m_processName);
00131             event.getMany (visSel, towers);
00132         }
00133     }
00134     catch (cms::Exception& e)
00135     {
00136         e.append (" from VisCaloTowerTwig::onNewEvent ");
00137         e.append (this->name ());    
00138 
00139         if (this->m_onCmsException)
00140             this->m_onCmsException (&e);
00141     }
00142     catch (lat::Error &e) 
00143     {
00144         if (this->m_onError)
00145             this->m_onError (&e);
00146     }
00147     catch (std::exception &e) 
00148     {
00149         if (this->m_onException)
00150             this->m_onException (&e);
00151     }
00152     catch (...) 
00153     {
00154         if (this->m_onUnhandledException)
00155             this->m_onUnhandledException ();
00156     }
00157     
00158     m_seedTowers.clear ();
00159 
00160     if (! towers.empty ())
00161     {
00162         std::vector<edm::Handle<CaloTowerCollection> >::iterator i;
00163         for (i = towers.begin (); i != towers.end (); i++) 
00164         {
00165             const CaloTowerCollection& c = *(*i);
00166             QString sizeStr = (QString ("%1").arg (c.size ()));
00167             QString nameStr = QString (this->name ());
00168             int ib = nameStr.find ("[");
00169             int ie = nameStr.find ("]");
00170             nameStr.replace (ib + 1, ie - 1, sizeStr);
00171             
00172             this->name (nameStr);
00173             
00174             for (CaloTowerCollection::const_iterator j = c.begin (), end = c.end (); j != end; ++j) 
00175             {
00176                 m_seedTowers.push_back (*j);
00177             }
00178         }
00179     }
00180     
00181     IgRepSet::invalidate (this, IgTwig::SELF_MASK | IgTwig::STRUCTURE_MASK);
00182 }

void VisCaloTowerTwig::twigChanged ( void   )  [virtual]

Definition at line 111 of file VisCaloTowerTwig.cc.

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

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

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

Reimplemented from VisQueuedTwig.

Definition at line 515 of file VisCaloTowerTwig.cc.

References cms::Exception::append(), ASSERT, IgSoRectColHist::barrelMaxEta, IgSoRectColHist::beamPipeTheta, Ig3DBaseRep::clear(), e, em, end, IgSoRectColHist::energies, VisEventSetupService::etaToTheta(), exception, f, IgSoRectColHist::faceColors, DBSPlugin::get(), VisEventSetupService::getBinNumber(), it, IgSoRectColHist::layer, IgSoRectColHist::logScale, m_binning, m_cut, m_escale, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_seedTowers, Ig3DBaseRep::node(), IgSoRectColHist::numR, IgSoRectColHist::numZ, IgSoRectColHist::radiusR, IgSoRectColHist::radiusZ, IgSoRectColHist::scaleFactor, VisQueuedTwig::state(), VisQueuedTwig::update(), and VisActiveConfigurable< T >::value().

00516 {
00517     // Get debugging dump.
00518     VisQueuedTwig::update (rep);
00519         
00520     IgQtLock ();
00521     rep->clear ();
00522         
00523     SoSeparator *sep = new SoSeparator;    
00524     SoSeparator *hsep = new SoSeparator;    
00525     SoSeparator *emsep = new SoSeparator;    
00526     sep->addChild (hsep);
00527     sep->addChild (emsep);
00528 
00529     SoMaterial *hmat = new SoMaterial;
00530     hmat->ambientColor.setValue (SbColor (0.5,0.5,1.0));
00531     hmat->diffuseColor.setValue (SbColor (0.5,0.5,1.0));
00532     hmat->specularColor.setValue (SbColor (0.5,0.5,1.0));
00533     hmat->emissiveColor.setValue (SbColor (0.5,0.5,1.0));
00534     hsep->addChild (hmat);
00535 
00536     SoMaterial *mat = new SoMaterial;
00537     mat->ambientColor.setValue (SbColor (0.5,1.0,0.5));
00538     mat->diffuseColor.setValue (SbColor (0.5,1.0,0.5));
00539     mat->specularColor.setValue (SbColor (0.5,1.0,0.5));
00540     mat->emissiveColor.setValue (SbColor (0.5,1.0,0.5));
00541     emsep->addChild (mat);
00542 
00543     VisEventSetupService *esService = VisEventSetupService::get (state ());
00544     ASSERT (esService);
00545 
00546     unsigned binNumber = 0;
00547     const unsigned nBinsZ = 17*2;
00548     const unsigned nBinsR = 13*2;
00549     const unsigned nbrOfBins = 2 * (nBinsZ + nBinsR);
00550     const float radiusR = 1.86f;
00551     const float radiusZ = 3.78f;
00552     const float barrelMaxEta = 1.444f;            // max eta of HCAL Barrel
00553     const float beamPipeTheta = esService->etaToTheta (3.f);
00554     std::vector<float> energies (nbrOfBins * 2);  // times 2 for the other energy (which is not used)
00555     std::vector<float> emEnergies (nbrOfBins * 2);  // times 2 for the other energy (which is not used)
00556 
00557     try 
00558     {
00559         if (! m_seedTowers.empty ())
00560         {
00561             for (std::vector<CaloTower>::const_iterator it = m_seedTowers.begin (), end = m_seedTowers.end (); 
00562                  it != end; ++it)
00563             {
00564                 float et = (*it).et ();
00565                 if (et > m_cut.value ())
00566                 {
00567                     float em = (*it).emEt ();
00568                     binNumber = esService->getBinNumber ((*it).eta (), (*it).phi (), nBinsR, nBinsZ, radiusR, radiusZ, barrelMaxEta, beamPipeTheta);
00569 
00570                     if (binNumber < nbrOfBins)
00571                     {
00572                         if (m_binning.value () == "project")
00573                         {                           
00574                             (energies[binNumber] > et) ? energies[binNumber] : energies[binNumber] = et;
00575                             (emEnergies[binNumber]  > em) ? emEnergies[binNumber] : emEnergies[binNumber] = em;
00576                         }                       
00577                         else
00578                         {                           
00579                             energies[binNumber] += et;
00580                             emEnergies[binNumber] += em;                            
00581                         }                       
00582                     }
00583                 }
00584             }
00585             if (*max_element (energies.begin (), energies.end ()) > 0.0)
00586             {
00587                 IgSoRectColHist* hist = new IgSoRectColHist;
00588                 hist->radiusR = radiusR;
00589                 hist->radiusZ = radiusZ;
00590                 hist->numR = nBinsR;
00591                 hist->numZ = nBinsZ;
00592                 hist->energies.setValues (0, energies.size(), &energies [0]);
00593                 hist->logScale = false;
00594                 hist->layer = -4.0;
00595                 hist->scaleFactor = m_escale.value ();
00596                 hist->barrelMaxEta = barrelMaxEta;
00597                 hist->beamPipeTheta = beamPipeTheta;
00598 
00599                 std::vector<SbColor> colors (4);
00600                 colors[0] = SbColor (0.5,0.5,1.0); // first energy's positive color 
00601                 colors[1] = SbColor (0.5,0.5,1.0); // first energy's negative color
00602                 colors[2] = SbColor (0.5,0.5,1.0); // second energy's positive color (not used)
00603                 colors[3] = SbColor (0.5,0.5,1.0); // second energy's negative color (not used)
00604                                 
00605                 hist->faceColors.setValues (0, colors.size (), &colors[0]);
00606                 hsep->addChild (hist);
00607             }       
00608             if (*max_element (emEnergies.begin (), emEnergies.end ()) > 0.0)
00609             {
00610                 IgSoRectColHist* emhist = new IgSoRectColHist;
00611                 emhist->radiusR = radiusR;
00612                 emhist->radiusZ = radiusZ;
00613                 emhist->numR = nBinsR;
00614                 emhist->numZ = nBinsZ;
00615                 emhist->energies.setValues (0, emEnergies.size(), &emEnergies [0]);
00616                 emhist->logScale = false;
00617                 emhist->layer = -5.0;
00618                 emhist->scaleFactor = m_escale.value ();
00619                 emhist->barrelMaxEta = barrelMaxEta;
00620                 emhist->beamPipeTheta = beamPipeTheta;
00621 
00622                 std::vector<SbColor> colors (4);
00623                 colors[0] = SbColor (0.5,1.0,0.5); // first energy's positive color 
00624                 colors[1] = SbColor (0.5,1.0,0.5); // first energy's negative color
00625                 colors[2] = SbColor (0.5,1.0,0.5); // second energy's positive color (not used)
00626                 colors[3] = SbColor (0.5,1.0,0.5); // second energy's negative color (not used)
00627                                 
00628                 emhist->faceColors.setValues (0, colors.size (), &colors[0]);
00629                 emsep->addChild (emhist);
00630             }       
00631         }
00632     }
00633     catch (cms::Exception& e)
00634     {
00635         e.append (" from VisCaloTowerTwig::update(IgRZRep*) ");
00636         e.append (this->name ());    
00637 
00638         if (this->m_onCmsException)
00639             this->m_onCmsException (&e);
00640     }
00641     catch (lat::Error &e) 
00642     {
00643         if (this->m_onError)
00644             this->m_onError (&e);
00645     }
00646     catch (std::exception &e) 
00647     {
00648         if (this->m_onException)
00649             this->m_onException (&e);
00650     }
00651     catch (...) 
00652     {
00653         if (this->m_onUnhandledException)
00654             this->m_onUnhandledException ();
00655     }
00656     rep->node ()->addChild (sep);
00657 }

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

Reimplemented from VisQueuedTwig.

Definition at line 392 of file VisCaloTowerTwig.cc.

References cms::Exception::append(), Ig3DBaseRep::clear(), e, em, end, IgSoCircularHist::energies, eta, exception, f, it, 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_seedTowers, IgSoCircularHist::maxRadius, IgSoCircularHist::minRadius, Ig3DBaseRep::node(), IgSoCircularHist::numberOfBins, IgSoCircularHist::scaleFactor, IgSoCircularHist::showAnnotations, VisQueuedTwig::update(), and VisActiveConfigurable< T >::value().

00393 {
00394     // Get debugging dump.
00395     VisQueuedTwig::update (rep);
00396 
00397     IgQtLock ();
00398     rep->clear ();
00399     
00400     SoSeparator *sep = new SoSeparator;    
00401     SoSeparator *emSep = new SoSeparator;    
00402     SoSeparator *hadSep = new SoSeparator;
00403     sep->addChild (emSep);
00404     sep->addChild (hadSep);
00405     
00406     SoMaterial *mat = new SoMaterial;
00407     mat->ambientColor.setValue (0.5, 1.0, 0.5);
00408     mat->diffuseColor.setValue (0.5, 1.0, 0.5);
00409     mat->specularColor.setValue (0.5, 1.0, 0.5);
00410     mat->emissiveColor.setValue (0.5, 1.0, 0.5);
00411     emSep->addChild (mat);
00412     
00413     SoMaterial *hadMat = new SoMaterial;
00414     hadMat->ambientColor.setValue (0.5, 0.5, 1.0);
00415     hadMat->diffuseColor.setValue (0.5, 0.5, 1.0);
00416     hadMat->specularColor.setValue (0.5, 0.5, 1.0);
00417     hadMat->emissiveColor.setValue (0.5, 0.5, 1.0);
00418     hadSep->addChild (hadMat);
00419 
00420     int nbrOfBins = 72;
00421     int binNumber;
00422 
00423     std::vector<float> bufferEm (nbrOfBins);
00424     std::vector<float> bufferHad (nbrOfBins);
00425     try 
00426     {
00427         if (! m_seedTowers.empty ())
00428         {
00429             for (std::vector<CaloTower>::const_iterator it = m_seedTowers.begin (), end = m_seedTowers.end (); 
00430                  it != end; ++it)
00431             {
00432                 float et = (*it).et ();
00433                 if (et > m_cut.value ()) 
00434                 {
00435                     float eta = (*it).eta ();
00436                     float em = (*it).emEt ();
00437                     if (fabs (eta) < 1.444f)
00438                     {
00439                         int iphi = (*it).id ().iphi ();
00440                         binNumber = iphi - 1;
00441 
00442                         if (binNumber >= 0 && binNumber < 72)
00443                         {
00444                             if (m_binning.value () == "project")
00445                             {                           
00446                                 if (et > bufferHad [binNumber])
00447                                     bufferHad [binNumber] = et;
00448                                 if (em > bufferEm [binNumber])
00449                                     bufferEm [binNumber] = em;
00450                             }
00451                             else
00452                             {
00453                                 bufferHad [binNumber] += et;
00454                                 bufferEm [binNumber] += em;
00455                             }
00456                         }
00457                     }               
00458                 }               
00459             }
00460             if (*max_element (bufferHad.begin (), bufferHad.end ()) > 0.0)
00461             {
00462                 IgSoCircularHist *tower = new IgSoCircularHist;
00463                 tower->minRadius = 1.9;
00464                 tower->maxRadius = -1;
00465                 tower->scaleFactor = m_escale.value ();
00466                 tower->numberOfBins = nbrOfBins;
00467                 tower->energies.setValues (0, nbrOfBins, &bufferHad [0]);
00468                 tower->logScale = false;
00469                 tower->showAnnotations = m_annotation.value ();
00470                 tower->layer = 5.6;
00471                 hadSep->addChild (tower);
00472             }
00473             if (*max_element (bufferEm.begin (), bufferEm.end ()) > 0.0)
00474             {
00475                 IgSoCircularHist *emtower = new IgSoCircularHist;
00476                 emtower->minRadius = 1.9;
00477                 emtower->maxRadius = -1;
00478                 emtower->scaleFactor = m_escale.value ();
00479                 emtower->numberOfBins = nbrOfBins;
00480                 emtower->energies.setValues (0, nbrOfBins, &bufferEm [0]);
00481                 emtower->logScale = false;
00482                 emtower->showAnnotations = m_annotation.value ();
00483                 emtower->layer = 5.8;
00484                 emSep->addChild (emtower);
00485             }
00486         }
00487     }
00488     catch (cms::Exception& e)
00489     {
00490         e.append (" from VisCaloTowerTwig::update(IgRPhiRep*) ");
00491         e.append (this->name ());    
00492 
00493         if (this->m_onCmsException)
00494             this->m_onCmsException (&e);
00495     }
00496     catch (lat::Error &e) 
00497     {
00498         if (this->m_onError)
00499             this->m_onError (&e);
00500     }
00501     catch (std::exception &e) 
00502     {
00503         if (this->m_onException)
00504             this->m_onException (&e);
00505     }
00506     catch (...) 
00507     {
00508         if (this->m_onUnhandledException)
00509             this->m_onUnhandledException ();
00510     }
00511     rep->node ()->addChild (sep);
00512 }

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

Reimplemented from VisQueuedTwig.

Definition at line 254 of file VisCaloTowerTwig.cc.

References ASSERT, Ig3DBaseRep::clear(), IgSoTower::emFraction, end, IgSoTower::energy, eta, IgSoTower::etaWidth, DBSPlugin::get(), i, m_cut, m_scale, m_seedTowers, Ig3DBaseRep::node(), phi, VisEventSetupService::phi4eta(), IgSoTower::phiWidth, IgSoTower::position, IgSoTower::scaleFactor, selectTower(), VisQueuedTwig::state(), VisQueuedTwig::update(), and VisActiveConfigurable< T >::value().

00255 {
00256     // Get debugging dump.
00257     VisQueuedTwig::update (rep);
00258 
00259     IgQtLock ();
00260     rep->clear ();
00261     
00262     VisEventSetupService *esService = VisEventSetupService::get (state ());
00263     ASSERT (esService);
00264     
00265     SoSelection *towerSep = new SoSelection;
00266     towerSep->policy = SoSelection::SINGLE;
00267     towerSep->addSelectionCallback (selectTower, (void*) false);
00268     
00269     // Loop over all Seeds
00270     for (std::vector<CaloTower>::const_iterator i = m_seedTowers.begin (), end = m_seedTowers.end (); i != end; ++i)
00271     {
00272         float eta = (*i).eta ();
00273         float phi = (*i).phi ();
00274         if (phi < 0) phi += 2 * M_PI;
00275         float et = (*i).et ();
00276         
00277         if (et > m_cut.value ())
00278         {
00279             IgSoTower *tower = new IgSoTower;
00280             tower->position = SbVec2f (phi, eta); // eta, phi
00281             tower->scaleFactor = m_scale.value ();
00282             tower->energy = et;
00283             tower->emFraction = (*i).emEt () / et;
00284             
00285             if (fabs (eta) > 1.74)
00286             {
00287                 tower->etaWidth = 0.174f;
00288                 tower->phiWidth = esService->phi4eta (fabs (eta));
00289             }
00290             
00291             towerSep->addChild (tower);
00292         }
00293     }
00294     
00295     rep->node ()->addChild (towerSep);
00296 }

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

Update object.

Reimplemented from VisQueuedTwig.

Definition at line 300 of file VisCaloTowerTwig.cc.

References cms::Exception::append(), ASSERT, Ig3DBaseRep::clear(), IgSoCalHit::drawShape, e, IgSoCalHit::emFraction, VisEventSetupService::emptyCorners(), end, IgSoCalHit::energy, exception, DBSPlugin::get(), VisEventSetupService::getCorners(), i, it, m_cut, m_escale, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_seedTowers, Ig3DBaseRep::node(), DetId::null(), IgSoCalHit::orderedRGBA, VisEventSetupService::present(), IgSoCalHit::scaleFactor, EZArrayFL< T >::size(), size, VisQueuedTwig::state(), VisQueuedTwig::update(), VisActiveConfigurable< T >::value(), IgSoCalHit::vertices, x, y, and z.

00301 {
00302     // Get debugging dump.
00303     VisQueuedTwig::update (rep);
00304     
00305     // Lock the Qt application.
00306     IgQtLock ();
00307     rep->clear ();
00308 
00309     SoSeparator *sep = new SoSeparator;
00310     
00311     VisEventSetupService *esService = VisEventSetupService::get (state ());
00312     ASSERT (esService);
00313     
00314     try 
00315     {
00316         for (std::vector<CaloTower>::const_iterator it = m_seedTowers.begin (), end = m_seedTowers.end (); 
00317              it != end; ++it)
00318         {
00319             float et = (*it).et ();
00320             if (et > m_cut.value ()) 
00321             {
00322                 size_t size = (*it).constituentsSize ();
00323             
00324                 for (size_t i = 0; i <= size; ++i)
00325                 {
00326                     DetId det = (*it).constituent (i);
00327                     if (! det.null ())
00328                     {
00329                         if (esService->present (det))
00330                         {
00331                             if (! esService->emptyCorners (det))
00332                             {
00333                                 const CaloCellGeometry::CornersVec& corners = esService->getCorners (det);
00334                                 ASSERT (corners.size () == 8);
00335                                 std::vector<SbVec3f> pts(8);
00336 
00337                                 pts [0] = SbVec3f (corners [0].x () / 100.0, corners [0].y () / 100.0, corners [0].z () / 100.0);
00338                                 pts [1] = SbVec3f (corners [1].x () / 100.0, corners [1].y () / 100.0, corners [1].z () / 100.0);
00339                                 pts [2] = SbVec3f (corners [2].x () / 100.0, corners [2].y () / 100.0, corners [2].z () / 100.0);
00340                                 pts [3] = SbVec3f (corners [3].x () / 100.0, corners [3].y () / 100.0, corners [3].z () / 100.0);
00341                     
00342                                 pts [4] = SbVec3f (corners [4].x () / 100.0, corners [4].y () / 100.0, corners [4].z () / 100.0);
00343                                 pts [5] = SbVec3f (corners [5].x () / 100.0, corners [5].y () / 100.0, corners [5].z () / 100.0);
00344                                 pts [6] = SbVec3f (corners [6].x () / 100.0, corners [6].y () / 100.0, corners [6].z () / 100.0);
00345                                 pts [7] = SbVec3f (corners [7].x () / 100.0, corners [7].y () / 100.0, corners [7].z () / 100.0);
00346 
00347                                 IgSoCalHit *hit = new IgSoCalHit;
00348                                 hit->vertices.setValues (0, 8, &pts[0]);
00349                                 hit->energy.setValue (et);
00350                                 hit->drawShape = false;
00351                                 hit->scaleFactor = m_escale.value ();
00352                                 hit->emFraction = (*it).emEt () / et;
00353                                 hit->orderedRGBA.set1Value (0, SbColor (0.5,0.5,0.5).getPackedValue ());
00354                                 hit->orderedRGBA.set1Value (1, SbColor (0.5,1.0,0.5).getPackedValue ());
00355                                 hit->orderedRGBA.set1Value (2, SbColor (0.5,0.5,1.0).getPackedValue ());
00356                     
00357                                 sep->addChild (hit);
00358                             }
00359                         }
00360                     }               
00361                 }               
00362             }
00363         }
00364     }
00365     catch (cms::Exception& e)
00366     {
00367         e.append (" from VisCaloTowerTwig::update(Ig3DRep*) ");
00368         e.append (this->name ());    
00369 
00370         if (this->m_onCmsException)
00371             this->m_onCmsException (&e);
00372     }
00373     catch (lat::Error &e) 
00374     {
00375         if (this->m_onError)
00376             this->m_onError (&e);
00377     }
00378     catch (std::exception &e) 
00379     {
00380         if (this->m_onException)
00381             this->m_onException (&e);
00382     }
00383     catch (...) 
00384     {
00385         if (this->m_onUnhandledException)
00386             this->m_onUnhandledException ();
00387     }
00388     rep->node ()->addChild (sep);
00389 }

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

Reimplemented from VisQueuedTwig.

Definition at line 185 of file VisCaloTowerTwig.cc.

References eta, i, m_cut, m_friendlyName, m_instanceName, m_moduleLabel, m_processName, m_seedTowers, m_text, IgSimpleTwig::name(), phi, IgTextRep::setText(), VisQueuedTwig::update(), and VisActiveConfigurable< T >::value().

00186 {
00187     // Get debugging dump.
00188     VisQueuedTwig::update (rep);
00189 
00190     // Prepare property description.
00191     std::ostringstream  text;
00192     text << this->name () << " from ";
00193     text << m_text << "<br>";
00194     
00195     if (m_friendlyName.empty () && m_moduleLabel.empty () && m_instanceName.empty () && m_processName.empty ())
00196     {
00197         text << "Please, select the branches of this Twig for more information.";       
00198     }
00199     else
00200     {
00201         text << "Displayed only above  " << m_cut.value () << " GeV:<br>";
00202 
00203         text << "<table width='100%' border=1>"
00204              << "<TR align = center>"
00205              << "<TH>Number</TH>"
00206              << "<TH>E<SUB>T (GeV)</TH>"
00207              << "<TH>E<SUB>T em (GeV)</TH>"
00208              << "<TH>E<SUB>T had (GeV)</TH>"
00209              << "<TH>E<SUB>T outer (GeV)</TH>"
00210              << "<TH>E (GeV)</TH>"
00211              << "<TH>E<SUB>em (GeV)</TH>"
00212              << "<TH>E<SUB>had (GeV)</TH>"
00213              << "<TH>E<SUB>outer (GeV)</TH>"
00214              << "<TH>eta</TH>"
00215              << "<TH>phi [rad]</TH>"
00216              << "</TR>";
00217         text << setiosflags (std::ios::showpoint | std::ios::fixed);
00218         text.setf (std::ios::right, std::ios::adjustfield);
00219         
00220         int nTowers = 0;
00221         for (std::vector<CaloTower>::const_iterator i = m_seedTowers.begin (); i != m_seedTowers.end (); ++i) 
00222         {
00223             double eta = (*i).eta ();
00224             double phi = (*i).phi ();
00225             double et = (*i).et ();
00226 
00227             if (et > m_cut.value ()) 
00228             {   
00229                 text << "<TR align = right>"
00230                      << "<TD>" << std::setw (3) << nTowers++ << "</TD>"
00231                      << "<TD>" << std::setw (2) << std::setprecision (3) << et << "</TD>"
00232                      << "<TD>" << std::setw (2) << std::setprecision (3) << (*i).emEt () << "</TD>"
00233                      << "<TD>" << std::setw (2) << std::setprecision (3) << (*i).hadEt () << "</TD>"
00234                      << "<TD>" << std::setw (2) << std::setprecision (3) << (*i).outerEt () << "</TD>"
00235                      << "<TD>" << std::setw (2) << std::setprecision (3) << (*i).energy () << "</TD>"
00236                      << "<TD>" << std::setw (2) << std::setprecision (3) << (*i).emEnergy () << "</TD>"
00237                      << "<TD>" << std::setw (2) << std::setprecision (3) << (*i).hadEnergy () << "</TD>"
00238                      << "<TD>" << std::setw (2) << std::setprecision (3) << (*i).outerEnergy () << "</TD>"
00239                      << "<TD>" << std::setw (6) << std::setprecision (3) << eta << "</TD>"
00240                      << "<TD>" << std::setw (5) << std::setprecision (3) << phi << "</TD>"
00241                      << "</TR>";
00242             }
00243         }
00244     
00245         text << "</table><br>";
00246     }
00247 
00248     // Send it over.
00249     IgQtLock ();
00250     rep->setText (text.str ());
00251 }


Member Data Documentation

VisCaloAnnotation VisCaloTowerTwig::m_annotation [private]

Definition at line 58 of file VisCaloTowerTwig.h.

Referenced by update().

VisBinningStrategy VisCaloTowerTwig::m_binning [private]

Definition at line 57 of file VisCaloTowerTwig.h.

Referenced by update().

VisEnergyCut VisCaloTowerTwig::m_cut [private]

Definition at line 60 of file VisCaloTowerTwig.h.

Referenced by update().

VisCaloEnergyScale VisCaloTowerTwig::m_escale [private]

Definition at line 61 of file VisCaloTowerTwig.h.

Referenced by update().

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

Definition at line 52 of file VisCaloTowerTwig.h.

Referenced by onNewEvent(), and update().

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

Definition at line 54 of file VisCaloTowerTwig.h.

Referenced by onNewEvent(), and update().

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

Definition at line 53 of file VisCaloTowerTwig.h.

Referenced by onNewEvent(), and update().

VisPhiDelta VisCaloTowerTwig::m_phiDelta [private]

Definition at line 63 of file VisCaloTowerTwig.h.

VisPhiStart VisCaloTowerTwig::m_phiStart [private]

Definition at line 62 of file VisCaloTowerTwig.h.

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

Definition at line 55 of file VisCaloTowerTwig.h.

Referenced by onNewEvent(), and update().

VisLegoScale VisCaloTowerTwig::m_scale [private]

Definition at line 59 of file VisCaloTowerTwig.h.

Referenced by update().

std::vector<CaloTower> VisCaloTowerTwig::m_seedTowers [private]

Definition at line 56 of file VisCaloTowerTwig.h.

Referenced by onNewEvent(), and update().

std::string VisCaloTowerTwig::m_text [private]

Definition at line 51 of file VisCaloTowerTwig.h.

Referenced by onNewEvent(), and update().


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