CMS 3D CMS Logo

VisGenJetTwig Class Reference

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

Inheritance diagram for VisGenJetTwig:

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 scaleChanged (void)
virtual void update (IgRZRep *rep)
virtual void update (IgRPhiRep *rep)
virtual void update (IgLegoRep *rep)
 Update object.
virtual void update (Ig3DRep *rep)
 Update object.
virtual void update (IgTextRep *rep)
 VisGenJetTwig (IgState *state, IgTwig *parent, const std::string &name, const edm::Event &event, const edm::EventSetup &eventSetup, const reco::GenJet &jet)

Private Attributes

VisCaloAnnotation m_annotation
VisEnergyCut m_cut
VisCaloEnergyScale m_escale
const edm::Eventm_event
const edm::EventSetupm_eventSetup
const reco::GenJetm_jet
VisLegoScale m_scale


Detailed Description

Definition at line 25 of file VisGenJetTwig.h.


Constructor & Destructor Documentation

VisGenJetTwig::VisGenJetTwig ( IgState state,
IgTwig parent,
const std::string &  name,
const edm::Event event,
const edm::EventSetup eventSetup,
const reco::GenJet jet 
)

Definition at line 44 of file VisGenJetTwig.cc.

00049     : VisQueuedTwig (state, parent, name),
00050       m_event (event),
00051       m_eventSetup (eventSetup),
00052       m_jet (jet),
00053       m_scale (state, lat::CreateCallback (this, &VisGenJetTwig::scaleChanged)),
00054       m_cut (state, lat::CreateCallback (this, &VisGenJetTwig::scaleChanged)),
00055       m_escale (state, lat::CreateCallback (this, &VisGenJetTwig::scaleChanged)),
00056       m_annotation (state, lat::CreateCallback (this, &VisGenJetTwig::scaleChanged))
00057 {}


Member Function Documentation

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

Reimplemented from VisQueuedTwig.

Definition at line 64 of file VisGenJetTwig.cc.

References VisQueuedTwig::onNewEvent().

00066 {
00067     // Get debugging dump.
00068     VisQueuedTwig::onNewEvent (event, eventSetup);
00069 }

void VisGenJetTwig::scaleChanged ( void   )  [virtual]

Definition at line 60 of file VisGenJetTwig.cc.

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

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

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

Reimplemented from VisQueuedTwig.

Definition at line 322 of file VisGenJetTwig.cc.

00323 {}

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

Reimplemented from VisQueuedTwig.

Definition at line 318 of file VisGenJetTwig.cc.

00319 {}

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

Update object.

Reimplemented from VisQueuedTwig.

Definition at line 244 of file VisGenJetTwig.cc.

References Ig3DBaseRep::clear(), e, reco::Particle::et(), reco::Particle::eta(), exception, reco::btau::jetEta, reco::btau::jetPhi, label, m_cut, m_jet, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, m_scale, Ig3DBaseRep::node(), reco::Particle::phi(), IgSbColorMap::unpack(), VisQueuedTwig::update(), and VisActiveConfigurable< T >::value().

00245 {
00246     // Get debugging dump.
00247     VisQueuedTwig::update (rep);
00248     
00249     // Lock the Qt application.
00250     IgQtLock ();
00251     rep->clear ();
00252 
00253     SoSeparator *contents = new SoSeparator;
00254     
00255     SoSeparator *jetsSep = new SoSeparator;
00256     contents->addChild (jetsSep);
00257     
00258     SoSeparator *labelSep = new SoSeparator;
00259     contents->addChild (labelSep);
00260     
00261     try 
00262     {
00263         double jetEt = m_jet.et ();
00264         if (jetEt > m_cut.value ()) 
00265         {
00266             SoSeparator *sep = new SoSeparator;
00267             jetsSep->addChild (sep);
00268             SoMaterial *mat = new SoMaterial;
00269             float rgbcomponents [4];
00270             IgSbColorMap::unpack (0x66330000, rgbcomponents);
00271             mat->diffuseColor.setValue (rgbcomponents);
00272             sep->addChild (mat);
00273             
00274             double jetPhi = m_jet.phi();
00275             if (jetPhi < 0) jetPhi += 2 * M_PI;
00276             double jetEta = m_jet.eta ();
00277             
00278             QString label = QString ("Et = %1 GeV")
00279                             .arg (jetEt, 0, 'g', 2);
00280             SoSeparator *labelSep = new SoSeparator;
00281             SoText2  *jetLabel = new SoText2;
00282             jetLabel->string = label.latin1 ();
00283             SoTranslation *jetLabelTranslation = new SoTranslation;
00284             
00285             jetLabelTranslation->translation = SbVec3f (jetPhi, jetEt / m_scale.value () + 0.01, jetEta);
00286             
00287             labelSep->addChild (jetLabelTranslation);
00288             labelSep->addChild (jetLabel);
00289             sep->addChild (labelSep);
00290         }
00291     }
00292     
00293     catch (cms::Exception& e)
00294     {
00295         if (this->m_onCmsException)
00296             this->m_onCmsException (&e);
00297     }
00298     catch (lat::Error &e) 
00299     {
00300         if (this->m_onError)
00301             this->m_onError (&e);
00302     }
00303     catch (std::exception &e) 
00304     {
00305         if (this->m_onException)
00306             this->m_onException (&e);
00307     }
00308     catch (...) 
00309     {
00310         if (this->m_onUnhandledException)
00311             this->m_onUnhandledException ();
00312     }
00313 
00314     rep->node ()->addChild (contents);
00315 }

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

Update object.

Reimplemented from VisQueuedTwig.

Definition at line 152 of file VisGenJetTwig.cc.

References Ig3DBaseRep::clear(), funct::cos(), ct, e, IgSoJet::energy, reco::Particle::et(), reco::Particle::eta(), exception, funct::exp(), reco::btau::jetEta, reco::btau::jetPhi, label, m_cut, m_jet, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, Ig3DBaseRep::node(), reco::Particle::phi(), IgSoJet::phi, funct::sin(), st, IgSoJet::theta, IgSbColorMap::unpack(), VisQueuedTwig::update(), and VisActiveConfigurable< T >::value().

00153 {
00154     // Get debugging dump.
00155     VisQueuedTwig::update (rep);
00156     
00157     // Lock the Qt application.
00158     IgQtLock ();
00159     rep->clear ();
00160     
00161     SoSeparator *contents = new SoSeparator;
00162     
00163     SoSeparator *jetsSep = new SoSeparator;
00164     contents->addChild (jetsSep);
00165     
00166     SoSeparator *labelSep = new SoSeparator;
00167     contents->addChild (labelSep);
00168     
00169     try 
00170     {
00171         double jetEt = m_jet.et ();
00172         if (jetEt > m_cut.value ()) 
00173         {
00174             SoSeparator *sep = new SoSeparator;
00175             jetsSep->addChild (sep);
00176             SoMaterial *mat = new SoMaterial;
00177             float rgbcomponents [4];
00178             IgSbColorMap::unpack (0x66330000, rgbcomponents);
00179             mat->diffuseColor.setValue (rgbcomponents);
00180             sep->addChild (mat);
00181             
00182             double jetPhi = m_jet.phi();
00183             if (jetPhi < 0) jetPhi += 2 * M_PI;
00184             double jetEta = m_jet.eta();
00185             double jetTheta = 2.0 * atan (exp (-jetEta));
00186             
00187             QString label = QString ("Et = %1 GeV")
00188                             .arg (jetEt, 0, 'g', 2);
00189             SoSeparator *labelSep = new SoSeparator;
00190             SoText2  *jetLabel = new SoText2;
00191             jetLabel->string = label.latin1 ();
00192             SoTranslation *jetLabelTranslation = new SoTranslation;
00193             
00194             double ct = cos (jetTheta);
00195             double st = sin (jetTheta);
00196             double cp = cos (jetPhi);
00197             double sp = sin (jetPhi);
00198             
00199             float length1 = ct ? 4.0 / fabs (ct) : 4.0;
00200             float length2 = st ? 2.0 / fabs (st) : 2.0;
00201             float bodyHeight = length1 < length2 ? length1 : length2;
00202             float hatHeight = 2.0 * jetEt / 100.0;
00203             jetLabelTranslation->translation = SbVec3f ((bodyHeight + hatHeight) * st * cp,
00204                                                         (bodyHeight + hatHeight) * st * sp,
00205                                                         (bodyHeight + hatHeight) * ct);
00206             
00207             labelSep->addChild (jetLabelTranslation);
00208             labelSep->addChild (jetLabel);
00209             sep->addChild (labelSep);
00210             
00211             IgSoJet *recoJet = new IgSoJet;
00212             recoJet->theta.setValue (jetTheta);
00213             recoJet->phi.setValue (jetPhi);
00214             recoJet->energy.setValue (jetEt);
00215             sep->addChild (recoJet); 
00216         }
00217     }
00218     catch (cms::Exception& e)
00219     {
00220         if (this->m_onCmsException)
00221             this->m_onCmsException (&e);
00222     }
00223     catch (lat::Error &e) 
00224     {
00225         if (this->m_onError)
00226             this->m_onError (&e);
00227     }
00228     catch (std::exception &e) 
00229     {
00230         if (this->m_onException)
00231             this->m_onException (&e);
00232     }
00233     catch (...) 
00234     {
00235         if (this->m_onUnhandledException)
00236             this->m_onUnhandledException ();
00237     }
00238 
00239     rep->node ()->addChild (contents);
00240 }

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

Reimplemented from VisQueuedTwig.

Definition at line 72 of file VisGenJetTwig.cc.

References arg, reco::GenJet::auxiliaryEnergy(), e, reco::GenJet::emEnergy(), reco::Particle::et(), reco::Particle::eta(), exception, reco::GenJet::hadEnergy(), edm::Event::id(), reco::GenJet::invisibleEnergy(), m_cut, m_event, m_jet, VisQueuedTwig::m_onCmsException, VisQueuedTwig::m_onError, VisQueuedTwig::m_onException, VisQueuedTwig::m_onUnhandledException, reco::Particle::phi(), IgTextRep::setText(), VisQueuedTwig::update(), and VisActiveConfigurable< T >::value().

00073 {
00074     // Get debugging dump.
00075     VisQueuedTwig::update (rep);
00076 
00077     // Prepare property description.
00078     std::ostringstream  text;
00079 
00080     text << QString ("Run # %1, event # %2")
00081         .arg (m_event.id ().run ())
00082         .arg (m_event.id ().event ()).latin1 () << "<br>";
00083 
00084     text << "<table width='100%' border=1>"
00085          << "<TR align = center>"
00086          << "<TH>E<SUB>t (GeV)</TH>"
00087          << "<TH>E<SUB>em (GeV)</TH>"
00088          << "<TH>E<SUB>had</TH>"
00089          << "<TH>E<SUB>inv</TH>"
00090          << "<TH>E<SUB>aux</TH>"
00091          << "<TH>Eta</TH>"
00092          << "<TH>Phi</TH>"
00093          << "</TR>";
00094     text << setiosflags (std::ios::showpoint | std::ios::fixed);
00095     text.setf (std::ios::right, std::ios::adjustfield);
00096 
00097     try 
00098     {
00099         double jetEt = m_jet.et ();
00100         if (jetEt > m_cut.value ())
00101         {
00102             double eEm = m_jet.emEnergy ();
00103             double eHad = m_jet.hadEnergy ();
00104             double eInv = m_jet.invisibleEnergy ();
00105             double eAux = m_jet.auxiliaryEnergy ();
00106         
00107             text << "<TR align = right>"
00108                  << "<TD>" << std::setw (2) << std::setprecision (3) << jetEt << "</TD>"
00109                  << "<TD>" << std::setw (2) << std::setprecision (3) << eEm << "</TD>"
00110                  << "<TD>" << std::setw (6) << std::setprecision (3) << eHad << "</TD>"
00111                  << "<TD>" << std::setw (5) << std::setprecision (3) << eInv << "</TD>"
00112                  << "<TD>" << std::setw (5) << std::setprecision (3) << eAux << "</TD>"
00113                  << "<TD>" << std::setw (5) << std::setprecision (3) << m_jet.eta () << "</TD>"
00114                  << "<TD>" << std::setw (5) << std::setprecision (3) << m_jet.phi () << "</TD></TR>";
00115 
00116             text << "</table>";
00117         } 
00118         else 
00119         {
00120             text << "</table><br>The jet energy " << jetEt << "GeV is below an energy cut (" << m_cut.value () << "<br>";
00121         }
00122     }
00123     catch (cms::Exception& e)
00124     {
00125         if (this->m_onCmsException)
00126             this->m_onCmsException (&e);
00127     }
00128     catch (lat::Error &e) 
00129     {
00130         if (this->m_onError)
00131             this->m_onError (&e);
00132     }
00133     catch (std::exception &e) 
00134     {
00135         if (this->m_onException)
00136             this->m_onException (&e);
00137     }
00138     catch (...) 
00139     {
00140         if (this->m_onUnhandledException)
00141             this->m_onUnhandledException ();
00142     }
00143     
00144     // Send it over.
00145     IgQtLock ();
00146 
00147     rep->setText (text.str ());
00148 }


Member Data Documentation

VisCaloAnnotation VisGenJetTwig::m_annotation [private]

Definition at line 52 of file VisGenJetTwig.h.

VisEnergyCut VisGenJetTwig::m_cut [private]

Definition at line 50 of file VisGenJetTwig.h.

Referenced by update().

VisCaloEnergyScale VisGenJetTwig::m_escale [private]

Definition at line 51 of file VisGenJetTwig.h.

const edm::Event& VisGenJetTwig::m_event [private]

Definition at line 46 of file VisGenJetTwig.h.

Referenced by update().

const edm::EventSetup& VisGenJetTwig::m_eventSetup [private]

Definition at line 47 of file VisGenJetTwig.h.

const reco::GenJet& VisGenJetTwig::m_jet [private]

Definition at line 48 of file VisGenJetTwig.h.

Referenced by update().

VisLegoScale VisGenJetTwig::m_scale [private]

Definition at line 49 of file VisGenJetTwig.h.

Referenced by 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