Go to the documentation of this file.00001 #include "Fireworks/ParticleFlow/interface/FWPFLegoCandidate.h"
00002
00003 #include "Fireworks/Core/interface/Context.h"
00004 #include "Fireworks/Core/interface/FWViewContext.h"
00005 #include "Fireworks/Core/interface/FWViewEnergyScale.h"
00006
00007
00008 FWPFLegoCandidate::FWPFLegoCandidate( const FWViewContext *vc, const fireworks::Context &context, float energy, float et, float pt,
00009 float eta, float phi )
00010 : m_energy(energy), m_et(et), m_pt(pt), m_eta(eta), m_phi(phi)
00011 {
00012 float base = 0.001;
00013
00014
00015 FWViewEnergyScale *caloScale = vc->getEnergyScale();
00016 float val = caloScale->getPlotEt() ? m_et : m_energy;
00017
00018 AddLine( m_eta, m_phi, base,
00019 m_eta, m_phi, base + val * caloScale->getScaleFactorLego() );
00020
00021 AddMarker( 0, 1.f );
00022 SetMarkerStyle( 3 );
00023 SetMarkerSize( 0.01 );
00024 SetDepthTest( false );
00025
00026
00027 const unsigned int nLineSegments = 20;
00028 const double radius = log( 1 + m_pt ) / log(10) / 10.f;
00029
00030 const double twoPi = 2 * TMath::Pi();
00031
00032 for( unsigned int iPhi = 0; iPhi < nLineSegments; ++iPhi )
00033 {
00034 AddLine( m_eta + radius * cos( twoPi / nLineSegments * iPhi ),
00035 m_phi + radius * sin( twoPi / nLineSegments * iPhi ),
00036 base,
00037 m_eta + radius * cos( twoPi / nLineSegments * ( iPhi + 1 ) ),
00038 m_phi + radius * sin( twoPi / nLineSegments * ( iPhi + 1 ) ),
00039 base );
00040 }
00041 }
00042
00043
00044 void
00045 FWPFLegoCandidate::updateScale( const FWViewContext *vc, const fireworks::Context &context )
00046 {
00047 FWViewEnergyScale *caloScale = vc->getEnergyScale();
00048 float val = caloScale->getPlotEt() ? m_et : m_energy;
00049 float scaleFac = caloScale->getScaleFactorLego();
00050
00051
00052 TEveChunkManager::iterator li( GetLinePlex() );
00053 li.next();
00054 TEveStraightLineSet::Line_t &l = * ( TEveStraightLineSet::Line_t* ) li();
00055 l.fV2[2] = l.fV1[2] + val * scaleFac;
00056
00057
00058 TEveChunkManager::iterator mi( GetMarkerPlex() );
00059 mi.next();
00060 TEveStraightLineSet::Marker_t &m = * ( TEveStraightLineSet::Marker_t* ) mi();
00061 m.fV[2] = l.fV2[2];
00062 }