CMS 3D CMS Logo

VisEcalUncalibratedRecHitTwig Class Reference

#include <VisReco/VisEcal/interface/VisEcalUncalibratedRecHitTwig.h>

Inheritance diagram for VisEcalUncalibratedRecHitTwig:

VisQueuedTwig IgSimpleTwig VisEventObserver IgCompoundTwig IgTwig IgRepresentable

List of all members.

Public Member Functions

void onNewEvent (const edm::Event &event, const edm::EventSetup &eventSetup)
virtual void twigChanged (void)
virtual void update (IgRZRep *rep)
virtual void update (IgRPhiRep *rep)
virtual void update (IgTextRep *rep)
virtual void update (IgLegoRep *rep)
virtual void update (Ig3DRep *rep)
 VisEcalUncalibratedRecHitTwig (IgState *state, IgTwig *parent, const std::string &name="", const std::string &friendlyName="", const std::string &moduleLabel="", const std::string &instanceName="", const std::string &processName="", unsigned color=0xff009c00)

Private Attributes

VisCaloAnnotation m_annotation
VisBinningStrategy m_binning
VisEcalEnergyCut m_cut
std::string m_detID
VisCaloEnergyScale m_escale
const std::string m_friendlyName
const std::string m_instanceName
const std::string m_moduleLabel
std::string m_name
const std::string m_processName
std::vector
< EcalUncalibratedRecHit
m_recHits
unsigned m_rgba
VisLegoScale m_scale
int m_subdetn
std::string m_text


Detailed Description

Definition at line 24 of file VisEcalUncalibratedRecHitTwig.h.


Constructor & Destructor Documentation

VisEcalUncalibratedRecHitTwig::VisEcalUncalibratedRecHitTwig ( 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 69 of file VisEcalUncalibratedRecHitTwig.cc.

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

00076     : VisQueuedTwig (state, parent, name),
00077       m_name (name),
00078       m_friendlyName (friendlyName),
00079       m_moduleLabel (moduleLabel),
00080       m_instanceName (instanceName),
00081       m_processName (processName),
00082       m_binning (state, lat::CreateCallback (this, &VisEcalUncalibratedRecHitTwig::twigChanged)),
00083       m_scale (state, lat::CreateCallback (this, &VisEcalUncalibratedRecHitTwig::twigChanged)),
00084       m_cut (state, lat::CreateCallback (this, &VisEcalUncalibratedRecHitTwig::twigChanged)),
00085       m_escale (state, lat::CreateCallback (this, &VisEcalUncalibratedRecHitTwig::twigChanged)),
00086       m_annotation (state, lat::CreateCallback (this, &VisEcalUncalibratedRecHitTwig::twigChanged)),
00087       m_text ("no info"),
00088       m_rgba (colour)
00089 {
00090     VisTwigFactroyService *tfService = VisTwigFactroyService::get (state);
00091     if (! tfService)
00092     {
00093         tfService = new VisTwigFactroyService (state);
00094     }
00095     edm::TypeID recHitCollID (typeid (EcalUncalibratedRecHitCollection));
00096     tfService->registerTwig (recHitCollID.friendlyClassName (), &createThisTwig);
00097 }


Member Function Documentation

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

Reimplemented from VisQueuedTwig.

Definition at line 104 of file VisEcalUncalibratedRecHitTwig.cc.

References cms::Exception::append(), arg, edm::SortedCollection< T, SORT >::begin(), c, e, edm::SortedCollection< T, SORT >::end(), exception, DBSPlugin::get(), i, edm::Event::id(), m_friendlyName, m_instanceName, m_moduleLabel, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_processName, m_recHits, m_text, IgSimpleTwig::name(), VisQueuedTwig::onBaseInvalidate(), VisQueuedTwig::onNewEvent(), edm::SortedCollection< T, SORT >::size(), and VisQueuedTwig::state().

00106 {
00107     // Get debugging dump.
00108     VisQueuedTwig::onNewEvent (event, eventSetup);
00109 
00110     m_recHits.clear ();
00111     
00112     m_text = (QString ("Run # %1, event # %2")
00113               .arg (event.id ().run ())
00114               .arg (event.id ().event ()).latin1 ());
00115 
00116     // Get uncalibrated ecal barrel rechits
00117     std::vector<edm::Handle<EcalUncalibratedRecHitCollection> > rechits;
00118     try
00119     {   
00120         QApplication::setOverrideCursor (Qt::waitCursor);
00121         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (state ()))
00122             sbar->setMessage ("Retrieving an EcalUncalibratedRecHitCollection...");
00123 
00124         if ((! m_friendlyName.empty ()) || (! m_moduleLabel.empty ()) || (! m_instanceName.empty ()) || (! m_processName.empty ()))
00125         {
00126             VisEventSelector visSel (m_friendlyName, m_moduleLabel, m_instanceName, m_processName);
00127             event.getMany (visSel, rechits);
00128         }
00129 
00130         if (IgQtAppStatusBarService *sbar = IgQtAppStatusBarService::get (state ()))
00131             sbar->setMessage ("EcalUncalibratedRecHitCollection done.");
00132         QApplication::restoreOverrideCursor ();
00133     }
00134     catch (cms::Exception& e)
00135     {
00136         e.append (" from VisEcalUncalibratedRecHitTwig::onNewEvent ");
00137         e.append (this->name ());    
00138 
00139         if (this->m_onCmsException)
00140             this->m_onCmsException (&e);
00141     }
00142     catch (lat::Error &e) 
00143     {
00144         if (this->m_onError)
00145             this->m_onError (&e);
00146     }
00147     catch (std::exception &e) 
00148     {
00149         if (this->m_onException)
00150             this->m_onException (&e);
00151     }
00152     catch (...) 
00153     {
00154         if (this->m_onUnhandledException)
00155             this->m_onUnhandledException ();
00156     }
00157     
00158     if (! rechits.empty ())
00159     {
00160         for (std::vector<edm::Handle<EcalUncalibratedRecHitCollection> >::iterator i = rechits.begin (), iEnd = rechits.end (); i != iEnd; ++i) 
00161         {
00162             const EcalUncalibratedRecHitCollection& c = *(*i);
00163             QString sizeStr = (QString ("%1").arg (c.size ()));
00164             QString nameStr = QString (this->name ());
00165             int ib = nameStr.find ("[");
00166             int ie = nameStr.find ("]");
00167             nameStr.replace (ib + 1, ie - 1, sizeStr);
00168             this->name (nameStr);
00169             for (std::vector<EcalUncalibratedRecHit>::const_iterator ci = c.begin (), ciEnd = c.end (); ci != ciEnd; ++ci)
00170             {
00171                 m_recHits.push_back (*ci); 
00172             }
00173         }
00174     }
00175         
00176     VisQueuedTwig::onBaseInvalidate ();
00177 }

void VisEcalUncalibratedRecHitTwig::twigChanged ( void   )  [virtual]

Definition at line 100 of file VisEcalUncalibratedRecHitTwig.cc.

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

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

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

Reimplemented from VisQueuedTwig.

Definition at line 571 of file VisEcalUncalibratedRecHitTwig.cc.

References cms::Exception::append(), ASSERT, IgSoRectColHist::barrelMaxEta, IgSoRectColHist::beamPipeTheta, TestMuL1L2Filter_cff::cerr, Ig3DBaseRep::clear(), e, IgSoRectColHist::endcapMaxTheta, lat::endl(), IgSoRectColHist::energies, relval_parameters_module::energy, exception, IgSoRectColHist::faceColors, DBSPlugin::get(), VisEventSetupService::getBinNumber(), i, IgSoRectColHist::layer, IgSoRectColHist::logScale, m_binning, m_cut, m_escale, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_recHits, Ig3DBaseRep::node(), IgSoRectColHist::numR, IgSoRectColHist::numZ, IgSoRectColHist::radiusR, IgSoRectColHist::radiusZ, IgSoRectColHist::scaleFactor, VisQueuedTwig::state(), VisQueuedTwig::update(), and VisActiveConfigurable< T >::value().

00572 {
00573     // Get debugging dump.
00574     VisQueuedTwig::update (rep);
00575         
00576     IgQtLock ();
00577         
00578     rep->clear ();
00579         
00580     SoSeparator *sep = new SoSeparator;    
00581     SoMaterial *mat = new SoMaterial;
00582     mat->ambientColor.setValue (1.0, 0.0, 153.0 / 255.0);
00583     mat->diffuseColor.setValue (1.0, 0.0, 153.0 / 255.0);
00584     mat->specularColor.setValue (1.0, 0.0, 153.0 / 255.0);
00585     mat->emissiveColor.setValue (1.0, 0.0, 153.0 / 255.0);
00586     sep->addChild (mat);    
00587 
00588     VisEventSetupService *esService = VisEventSetupService::get (state ());
00589     ASSERT (esService);
00590         
00591     unsigned binNumber = 0;
00592     const unsigned nBinsZ = 85*2;
00593     const unsigned nBinsR = 39*2;
00594     const unsigned nbrOfBins = 2 * (nBinsZ + nBinsR);
00595     const float radiusR = 1.29f;
00596     const float radiusZ = 3.17f;
00597     const float barrelMaxEta = 1.479f; // max eta of ECAL Barrel
00598     const float beamPipeTheta = 5.7f * M_PI / 180.f;
00599     const float endcapMaxTheta = 25.464f * M_PI / 180.f;
00600         
00601     std::vector<float> energies (nbrOfBins * 2); // times 2 for the other energy (which is not used)
00602     try 
00603     {
00604         if (! m_recHits.empty ()) 
00605         {
00606             for (std::vector<EcalUncalibratedRecHit>::const_iterator i = m_recHits.begin (), iEnd = m_recHits.end (); i != iEnd; ++i) 
00607             {
00608                 float amp = (*i).amplitude ();
00609                 float energy = amp * 12 / 1000; // Rough estimation: count around 12/13 MeV per ADC count
00610                 if (energy > m_cut.value ())
00611                 {
00612                     EcalUncalibratedRecHit hit = (*i);          
00613                     binNumber = esService->getBinNumber ((*i).id (), nBinsR, nBinsZ, radiusR, radiusZ, barrelMaxEta, beamPipeTheta, endcapMaxTheta);
00614 
00615                     if (binNumber < nbrOfBins)
00616                     {
00617                         if (m_binning.value () == "project")
00618                             (energies[binNumber] > energy) ? energies[binNumber] : energies[binNumber] = energy;
00619                         else
00620                             energies[binNumber] += energy;
00621                     }
00622                     else
00623                     {
00624                         std::cerr << "Bin number (" << binNumber << ") exceeds the number of bins (" <<  nbrOfBins << ")"<< std::endl;
00625                     }
00626                 }
00627             }
00628                         
00629             if (*max_element (energies.begin (), energies.end ()) > 0.0)
00630             {
00631                 IgSoRectColHist* hist = new IgSoRectColHist;
00632                 hist->radiusR = radiusR;
00633                 hist->radiusZ = radiusZ;
00634                 hist->numR = nBinsR;
00635                 hist->numZ = nBinsZ;
00636                 hist->energies.setValues (0, energies.size(), &energies [0]);
00637                 hist->logScale = false;
00638                 hist->layer = -5.0;
00639                 hist->scaleFactor = m_escale.value ();
00640                 hist->barrelMaxEta = barrelMaxEta;
00641                 hist->beamPipeTheta = beamPipeTheta;
00642                 hist->endcapMaxTheta = endcapMaxTheta;
00643                                 
00644                 std::vector<SbColor> colors (4);
00645                 colors[0] = SbColor (1.0, 0.0, 153.0 / 255.0);
00646                 colors[1] = SbColor (51.0 / 255.0, 1.0, 102.0 / 255.0);
00647                 colors[2] = SbColor (1.0, 1.0, 153.0 / 255.0);
00648                 colors[3] = SbColor (51.0 / 255.0, 0.0, 102.0 / 255.0);
00649                 
00650                 hist->faceColors.setValues (0, colors.size (), &colors[0]);
00651                 sep->addChild (hist);
00652             }
00653         }
00654     }
00655     catch (cms::Exception& e)
00656     {
00657         e.append (" from VisEcalUncalibratedRecHitTwig::update(IgRZRep*) ");
00658         e.append (this->name ());
00659 
00660         if (this->m_onCmsException)
00661             this->m_onCmsException (&e);
00662     }
00663     catch (lat::Error &e) 
00664     {
00665         if (this->m_onError)
00666             this->m_onError (&e);
00667     }
00668     catch (std::exception &e) 
00669     {
00670         if (this->m_onException)
00671             this->m_onException (&e);
00672     }
00673     catch (...) 
00674     {
00675         if (this->m_onUnhandledException)
00676             this->m_onUnhandledException ();
00677     }
00678         
00679     rep->node ()->addChild (sep);
00680 }

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

Reimplemented from VisQueuedTwig.

Definition at line 435 of file VisEcalUncalibratedRecHitTwig.cc.

References cms::Exception::append(), ASSERT, Ig3DBaseRep::clear(), e, IgSoCircularHist::energies, relval_parameters_module::energy, exception, first, DBSPlugin::get(), VisEventSetupService::getCellPosition(), i, int, prof2calltree::last, IgSoCircularHist::layer, IgSoCircularHist::logScale, m_annotation, m_binning, m_cut, m_escale, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_recHits, IgSoCircularHist::maxRadius, IgSoCircularHist::minRadius, Ig3DBaseRep::node(), IgSoCircularHist::numberOfBins, PV3DBase< T, PVType, FrameType >::phi(), phi, radius(), IgSoCircularHist::scaleFactor, IgSoCircularHist::showAnnotations, VisQueuedTwig::state(), VisEcalSubdetector::subDetName(), VisQueuedTwig::update(), and VisActiveConfigurable< T >::value().

00436 {
00437     // Get debugging dump.
00438     VisQueuedTwig::update (rep);
00439 
00440     IgQtLock ();
00441 
00442     rep->clear ();
00443     
00444     SoSeparator *sep = new SoSeparator;    
00445     SoSeparator *posSep = new SoSeparator;    
00446     SoSeparator *negSep = new SoSeparator;
00447     sep->addChild (posSep);
00448     sep->addChild (negSep);
00449     
00450     SoMaterial *mat = new SoMaterial;
00451     mat->ambientColor.setValue (1.0, 0.0, 153.0 / 255.0);
00452     mat->diffuseColor.setValue (1.0, 0.0, 153.0 / 255.0);
00453     mat->specularColor.setValue (1.0, 0.0, 153.0 / 255.0);
00454     mat->emissiveColor.setValue (1.0, 0.0, 153.0 / 255.0);
00455     posSep->addChild (mat);
00456     
00457     SoMaterial *negMat = new SoMaterial;
00458     negMat->ambientColor.setValue (51.0 / 255.0, 1.0, 102.0 / 255.0);
00459     negMat->diffuseColor.setValue (51.0 / 255.0, 1.0, 102.0 / 255.0);
00460     negMat->specularColor.setValue (51.0 / 255.0, 1.0, 102.0 / 255.0);
00461     negMat->emissiveColor.setValue (51.0 / 255.0, 1.0, 102.0 / 255.0);
00462     negSep->addChild (negMat);
00463 
00464     int nbrOfBins = 360;
00465     float radius = 1.29;
00466 
00467     int binNumber;
00468 
00469     std::vector<float> bufferPositive (nbrOfBins);
00470     std::vector<float> bufferNegative (nbrOfBins);
00471     try 
00472     {
00473         if (! m_recHits.empty ()) 
00474         {
00475             VisEventSetupService *esService = VisEventSetupService::get (state ());
00476             ASSERT (esService);
00477 
00478             for (std::vector<EcalUncalibratedRecHit>::const_iterator i = m_recHits.begin (), iEnd = m_recHits.end (); i != iEnd; ++i) 
00479             {
00480                 float amp = (*i).amplitude ();
00481                 float energy = amp * 12 / 1000; // Rough estimation
00482                 if (energy > m_cut.value ())
00483                 {
00484                     if (VisEcalSubdetector::subDetName ((EcalSubdetector)((*i).id ().subdetId ())) == "EcalBarrel")
00485                     {
00486                         const GlobalPoint& pos = esService->getCellPosition ((*i).id ());               
00487                         EcalUncalibratedRecHit hit = (*i);
00488                         float phi = pos.phi ();
00489                         
00490                         (phi < 0) ? phi = 2 * M_PI + phi : phi;
00491                     
00492                         binNumber = (int) floor (phi / (2 * M_PI / nbrOfBins));
00493 
00494                         if (binNumber >= 0 && binNumber < nbrOfBins) 
00495                             if (m_binning.value () == "project")
00496                             {                           
00497                                 if ((energy > 0.0) && (energy > bufferPositive [binNumber]))
00498                                     bufferPositive [binNumber] = energy;
00499                                 else if ((energy < 0.0) && (energy < bufferNegative [binNumber]))
00500                                     bufferNegative [binNumber] = energy;
00501                             }
00502                             else
00503                                 (energy >= 0.0) ? bufferPositive [binNumber] += energy : bufferNegative [binNumber] += energy;
00504                     }
00505                 }
00506             }
00507             
00508             std::vector<float> ::const_iterator first = bufferPositive.begin ();
00509             std::vector<float> ::const_iterator last = bufferPositive.end ();
00510             
00511             if (*max_element (first, last) > 0.0)
00512             {
00513                 IgSoCircularHist *recHits = new IgSoCircularHist;
00514                 recHits->minRadius = radius;
00515                 recHits->maxRadius = -1;
00516                 recHits->scaleFactor = m_escale.value ();
00517                 recHits->numberOfBins = nbrOfBins;
00518                 recHits->energies.setValues (0, nbrOfBins, &bufferPositive [0]);
00519                 recHits->logScale = false;
00520                 recHits->showAnnotations = m_annotation.value ();
00521                 recHits->layer = 5.5;
00522                 posSep->addChild (recHits);
00523             }
00524             
00525             std::vector<float> ::const_iterator nfirst = bufferNegative.begin ();
00526             std::vector<float> ::const_iterator nlast = bufferNegative.end ();
00527             
00528             if (fabs(*max_element (nfirst, nlast)) > 0.0)
00529             {
00530                 IgSoCircularHist *negRecHits = new IgSoCircularHist;
00531                 negRecHits->minRadius = radius;
00532                 negRecHits->maxRadius = -1;
00533                 negRecHits->scaleFactor = m_escale.value ();
00534                 negRecHits->numberOfBins = nbrOfBins;
00535                 negRecHits->energies.setValues (0, nbrOfBins, &bufferNegative [0]);
00536                 negRecHits->logScale = false;
00537                 negRecHits->showAnnotations = m_annotation.value ();
00538                 negRecHits->layer = 5.0;
00539                 negSep->addChild (negRecHits);
00540             }       
00541         }
00542     }
00543     catch (cms::Exception& e)
00544     {
00545         e.append (" from VisEcalUncalibratedRecHitTwig::update (IgRPhiRep*) ");
00546         e.append (this->name ());    
00547 
00548         if (this->m_onCmsException)
00549             this->m_onCmsException (&e);
00550     }
00551     catch (lat::Error &e) 
00552     {
00553         if (this->m_onError)
00554             this->m_onError (&e);
00555     }
00556     catch (std::exception &e) 
00557     {
00558         if (this->m_onException)
00559             this->m_onException (&e);
00560     }
00561     catch (...) 
00562     {
00563         if (this->m_onUnhandledException)
00564             this->m_onUnhandledException ();
00565     }
00566     
00567     rep->node ()->addChild (sep);
00568 }

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

Reimplemented from VisQueuedTwig.

Definition at line 180 of file VisEcalUncalibratedRecHitTwig.cc.

References cms::Exception::append(), ASSERT, EcalUncalibratedRecHit::chi2(), e, relval_parameters_module::energy, eta, PV3DBase< T, PVType, FrameType >::eta(), exception, DBSPlugin::get(), VisEventSetupService::getCellPosition(), i, EcalUncalibratedRecHit::jitter(), 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(), EcalUncalibratedRecHit::pedestal(), PV3DBase< T, PVType, FrameType >::phi(), phi, IgTextRep::setText(), VisQueuedTwig::state(), VisQueuedTwig::update(), and VisActiveConfigurable< T >::value().

00181 {
00182     // Get debugging dump.
00183     VisQueuedTwig::update (rep);
00184     
00185     // Prepare property description.
00186     std::ostringstream  text;
00187     text << this->name () << " from ";
00188     text << m_text << "<br>";
00189 
00190     if (m_friendlyName.empty () && m_moduleLabel.empty () && m_instanceName.empty () && m_processName.empty ())
00191     {
00192         text << "Please, select the branches of this Twig for more information.";       
00193     }
00194     else
00195     {
00196         text << "Displayed only above  " << m_cut.value () << " GeV:<br>";
00197     
00198         text << "<table width='100%' border=1>"
00199              << "<TR align = center>"
00200              << "<TH>Number</TH>"
00201              << "<TH>Eta</TH>"
00202              << "<TH>Phi</TH>"
00203              << "<TH>Amplitude</TH>"
00204              << "<TH>Pedestal</TH>"
00205              << "<TH>Jitter</TH>"
00206              << "<TH>Chi^2</TH>"
00207              << "</TR>";
00208         text << setiosflags (std::ios::showpoint | std::ios::fixed);
00209         text.setf (std::ios::right, std::ios::adjustfield);
00210     
00211         int nDigis = 0;
00212         if (! m_recHits.empty ()) 
00213         {
00214             VisEventSetupService *esService = VisEventSetupService::get (state ());
00215             ASSERT (esService);
00216 
00217             try 
00218             {
00219                 for (std::vector<EcalUncalibratedRecHit>::const_iterator i = m_recHits.begin (), iEnd = m_recHits.end (); i != iEnd; ++i) 
00220                 {
00221                     float amp = (*i).amplitude ();
00222                     float energy = amp * 12 / 1000; // Rough estimation
00223                     if (energy > m_cut.value ())
00224                     {
00225                         EcalUncalibratedRecHit hit = (*i);
00226                         const GlobalPoint& pos = esService->getCellPosition ((*i).id ());               
00227                         float eta = pos.eta ();
00228                         float phi = pos.phi ();
00229 
00230                         text << "<TR align = right>"
00231                              << "<TD>" << std::setw (3) << nDigis++ << "</TD>"
00232                              << "<TD>" << std::setw (5) << std::setprecision (3) << eta << "</TD>"
00233                              << "<TD>" << std::setw (5) << std::setprecision (3) << phi << "</TD>"
00234                              << "<TD>" << std::setw (5) << std::setprecision (3) << amp << "</TD>"
00235                              << "<TD>" << std::setw (5) << std::setprecision (3) << hit.pedestal () << "</TD>"
00236                              << "<TD>" << std::setw (5) << std::setprecision (3) << hit.jitter () << "</TD>"
00237                              << "<TD>" << std::setw (5) << std::setprecision (3) << hit.chi2 () << "</TD>"
00238                              << "</TR>";
00239                     }
00240                 }
00241             }
00242             catch (cms::Exception& e)
00243             {
00244                 e.append (" from VisEcalUncalibratedRecHitTwig::update(IgTextRep*) ");
00245                 e.append (this->name ());    
00246 
00247                 if (this->m_onCmsException)
00248                     this->m_onCmsException (&e);
00249             }
00250             catch (lat::Error &e) 
00251             {
00252                 if (this->m_onError)
00253                     this->m_onError (&e);
00254             }
00255             catch (std::exception &e) 
00256             {
00257                 if (this->m_onException)
00258                     this->m_onException (&e);
00259             }
00260             catch (...) 
00261             {
00262                 if (this->m_onUnhandledException)
00263                     this->m_onUnhandledException ();
00264             }
00265         }
00266     
00267         text << "</table>";
00268     }
00269     
00270     // Send it over.
00271     IgQtLock ();
00272     rep->setText (text.str ());
00273 }

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

Reimplemented from VisQueuedTwig.

Definition at line 365 of file VisEcalUncalibratedRecHitTwig.cc.

References cms::Exception::append(), ASSERT, Ig3DBaseRep::clear(), e, IgSoTower::emFraction, IgSoTower::energy, relval_parameters_module::energy, eta, PV3DBase< T, PVType, FrameType >::eta(), IgSoTower::etaWidth, exception, DBSPlugin::get(), VisEventSetupService::getCellPosition(), i, m_cut, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_recHits, m_scale, Ig3DBaseRep::node(), PV3DBase< T, PVType, FrameType >::phi(), phi, IgSoTower::phiWidth, IgSoTower::position, IgSoTower::scaleFactor, VisQueuedTwig::state(), VisQueuedTwig::update(), and VisActiveConfigurable< T >::value().

00366 {
00367     // Get debugging dump.
00368     VisQueuedTwig::update (rep);
00369 
00370     IgQtLock ();
00371 
00372     rep->clear ();
00373     
00374     SoSeparator *sep = new SoSeparator;    
00375 
00376     try 
00377     {
00378         if (! m_recHits.empty ()) 
00379         {
00380             VisEventSetupService *esService = VisEventSetupService::get (state ());
00381             ASSERT (esService);
00382 
00383             for (std::vector<EcalUncalibratedRecHit>::const_iterator i = m_recHits.begin (), iEnd = m_recHits.end (); i != iEnd; ++i) 
00384             {
00385                 float amp = (*i).amplitude ();
00386                 float energy = amp * 12 / 1000; // Rough estimation
00387                 if (fabs (energy) > m_cut.value ()) 
00388                 {
00389                     const GlobalPoint& pos = esService->getCellPosition ((*i).id ());           
00390                     EcalUncalibratedRecHit hit = (*i);
00391                     float eta = pos.eta ();
00392                     float phi = pos.phi ();
00393                     (phi < 0.0) ?  phi = 2 * M_PI + phi : phi; // correction in absence of one convention
00394 
00395                     IgSoTower *tower = new IgSoTower;
00396                     tower->position = SbVec2f (phi, eta); // eta, phi
00397                     tower->scaleFactor = m_scale.value ();
00398                     tower->etaWidth = 0.0174;
00399                     tower->phiWidth = 0.0174;
00400                     tower->energy = energy;
00401                     tower->emFraction = 1;
00402                     sep->addChild (tower);
00403                 }
00404             }
00405         } 
00406     }
00407     catch (cms::Exception& e)
00408     {
00409         e.append (" from VisEcalUncalibratedRecHitTwig::update(IgLegoRep *) ");
00410         e.append (this->name ());    
00411 
00412         if (this->m_onCmsException)
00413             this->m_onCmsException (&e);
00414     }
00415     catch (lat::Error &e) 
00416     {
00417         if (this->m_onError)
00418             this->m_onError (&e);
00419     }
00420     catch (std::exception &e) 
00421     {
00422         if (this->m_onException)
00423             this->m_onException (&e);
00424     }
00425     catch (...) 
00426     {
00427         if (this->m_onUnhandledException)
00428             this->m_onUnhandledException ();
00429     }
00430     
00431     rep->node ()->addChild (sep);
00432 }

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

Reimplemented from VisQueuedTwig.

Definition at line 276 of file VisEcalUncalibratedRecHitTwig.cc.

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

00277 {
00278     // Get debugging dump.
00279     VisQueuedTwig::update (rep);
00280     
00281     IgQtLock ();
00282 
00283     rep->clear ();
00284         
00285     if (! m_recHits.empty ())
00286     {
00287         VisEventSetupService *esService = VisEventSetupService::get (state ());
00288         ASSERT (esService);
00289 
00290         SoSeparator *sep = new SoSeparator;
00291     
00292         SoMaterial *mat = new SoMaterial;
00293         float rgbcomponents [4];
00294         IgSbColorMap::unpack (m_rgba, rgbcomponents);
00295         // mat->diffuseColor.setValue (SbColor (rgbcomponents));
00296         mat->diffuseColor.setValue (1.0, 0.0, 153.0 / 255.0);
00297         sep->addChild (mat);
00298 
00299         try
00300         {
00301             for (std::vector<EcalUncalibratedRecHit>::const_iterator i = m_recHits.begin (), iEnd = m_recHits.end (); i != iEnd; ++i) 
00302             {
00303                 float amp = (*i).amplitude ();
00304                 float energy = amp * 12 / 1000; // Rough estimation
00305                 if (energy > m_cut.value ()) 
00306                 {
00307                     EcalUncalibratedRecHit hit = (*i);
00308 
00309                     if (! hit.id ().null ()) 
00310                     {
00311                         const CaloCellGeometry::CornersVec& corners = esService->getCorners ((*i).id ());
00312                         ASSERT (corners.size () == 8);
00313                     
00314                         IgSoCrystalHit *crystalHit = new IgSoCrystalHit;
00315                         crystalHit->energy.setValue (energy);       
00316                         crystalHit->scale.setValue (m_escale.value ());
00317                         crystalHit->relativeWidth.setValue (1.0);
00318                         crystalHit->drawCrystal.setValue (false);
00319                         crystalHit->drawHit.setValue (true);
00320                     
00321                         crystalHit->front1.setValue (corners [3].x () / 100.0, corners [3].y () / 100.0, corners [3].z () / 100.0);
00322                         crystalHit->front2.setValue (corners [2].x () / 100.0, corners [2].y () / 100.0, corners [2].z () / 100.0);
00323                         crystalHit->front3.setValue (corners [1].x () / 100.0, corners [1].y () / 100.0, corners [1].z () / 100.0);
00324                         crystalHit->front4.setValue (corners [0].x () / 100.0, corners [0].y () / 100.0, corners [0].z () / 100.0);
00325                     
00326                         crystalHit->back1.setValue  (corners [7].x () / 100.0, corners [7].y () / 100.0, corners [7].z () / 100.0);
00327                         crystalHit->back2.setValue  (corners [6].x () / 100.0, corners [6].y () / 100.0, corners [6].z () / 100.0);
00328                         crystalHit->back3.setValue  (corners [5].x () / 100.0, corners [5].y () / 100.0, corners [5].z () / 100.0);
00329                         crystalHit->back4.setValue  (corners [4].x () / 100.0, corners [4].y () / 100.0, corners [4].z () / 100.0);
00330                     
00331                         sep->addChild (crystalHit);
00332                     }
00333                 }
00334             }
00335         }
00336         catch (cms::Exception& e)
00337         {
00338             e.append (" from VisEcalUncalibratedRecHitTwig::update(Ig3DRep*) ");
00339             e.append (this->name ());    
00340 
00341             if (this->m_onCmsException)
00342                 this->m_onCmsException (&e);
00343         }
00344         catch (lat::Error &e) 
00345         {
00346             if (this->m_onError)
00347                 this->m_onError (&e);
00348         }
00349         catch (std::exception &e) 
00350         {
00351             if (this->m_onException)
00352                 this->m_onException (&e);
00353         }
00354         catch (...) 
00355         {
00356             if (this->m_onUnhandledException)
00357                 this->m_onUnhandledException ();
00358         }
00359 
00360         rep->node ()->addChild (sep);
00361     }
00362 }


Member Data Documentation

VisCaloAnnotation VisEcalUncalibratedRecHitTwig::m_annotation [private]

Definition at line 58 of file VisEcalUncalibratedRecHitTwig.h.

Referenced by update().

VisBinningStrategy VisEcalUncalibratedRecHitTwig::m_binning [private]

Definition at line 54 of file VisEcalUncalibratedRecHitTwig.h.

Referenced by update().

VisEcalEnergyCut VisEcalUncalibratedRecHitTwig::m_cut [private]

Definition at line 56 of file VisEcalUncalibratedRecHitTwig.h.

Referenced by update().

std::string VisEcalUncalibratedRecHitTwig::m_detID [private]

Definition at line 61 of file VisEcalUncalibratedRecHitTwig.h.

VisCaloEnergyScale VisEcalUncalibratedRecHitTwig::m_escale [private]

Definition at line 57 of file VisEcalUncalibratedRecHitTwig.h.

Referenced by update().

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

Definition at line 50 of file VisEcalUncalibratedRecHitTwig.h.

Referenced by onNewEvent(), and update().

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

Definition at line 52 of file VisEcalUncalibratedRecHitTwig.h.

Referenced by onNewEvent(), and update().

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

Definition at line 51 of file VisEcalUncalibratedRecHitTwig.h.

Referenced by onNewEvent(), and update().

std::string VisEcalUncalibratedRecHitTwig::m_name [private]

Reimplemented from IgSimpleTwig.

Definition at line 49 of file VisEcalUncalibratedRecHitTwig.h.

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

Definition at line 53 of file VisEcalUncalibratedRecHitTwig.h.

Referenced by onNewEvent(), and update().

std::vector<EcalUncalibratedRecHit> VisEcalUncalibratedRecHitTwig::m_recHits [private]

Definition at line 60 of file VisEcalUncalibratedRecHitTwig.h.

Referenced by onNewEvent(), and update().

unsigned VisEcalUncalibratedRecHitTwig::m_rgba [private]

Definition at line 63 of file VisEcalUncalibratedRecHitTwig.h.

Referenced by update().

VisLegoScale VisEcalUncalibratedRecHitTwig::m_scale [private]

Definition at line 55 of file VisEcalUncalibratedRecHitTwig.h.

Referenced by update().

int VisEcalUncalibratedRecHitTwig::m_subdetn [private]

Definition at line 62 of file VisEcalUncalibratedRecHitTwig.h.

std::string VisEcalUncalibratedRecHitTwig::m_text [private]

Definition at line 59 of file VisEcalUncalibratedRecHitTwig.h.

Referenced by onNewEvent(), and update().


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