CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/Fireworks/ParticleFlow/src/FWLegoEvePFCandidate.cc

Go to the documentation of this file.
00001 #include "TEveCaloData.h"
00002 
00003 #include "Fireworks/Core/interface/Context.h"
00004 #include "Fireworks/Core/interface/FWViewContext.h"
00005 #include "Fireworks/Core/interface/FWViewEnergyScale.h"
00006 #include "Fireworks/ParticleFlow/interface/FWLegoEvePFCandidate.h"
00007 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
00008 #include "Fireworks/Core/interface/fwLog.h"
00009 
00010 
00011 FWLegoEvePFCandidate::FWLegoEvePFCandidate(const reco::PFCandidate& iData, const FWViewContext* vc,  const fireworks::Context& context):
00012    m_energy(0.f),
00013    m_et(0.f)
00014 {
00015    m_et =  iData.et();
00016    m_energy = iData.energy();
00017 
00018    float base = 0.001; // flour offset 1%
00019 
00020    // first vertical  line , which is et/energy
00021    FWViewEnergyScale* caloScale = vc->getEnergyScale();
00022    float val = caloScale->getPlotEt() ?  m_et : m_energy;
00023    AddLine(iData.eta(),iData.phi(), base, 
00024            iData.eta(),iData.phi(), base + val*caloScale->getScaleFactorLego());
00025 
00026 
00027    AddMarker(0, 1.f);
00028    SetMarkerStyle(3); 
00029    SetMarkerSize(0.01); 
00030    SetDepthTest(false);
00031 
00032    // circle pt
00033    const unsigned int nLineSegments = 20;
00034    float circleScalingFactor = 50;
00035    const double jetRadius = iData.pt()/circleScalingFactor;
00036   
00037    for ( unsigned int iphi = 0; iphi < nLineSegments; ++iphi ) {
00038       AddLine(iData.eta()+jetRadius*cos(2*M_PI/nLineSegments*iphi),
00039               iData.phi()+jetRadius*sin(2*M_PI/nLineSegments*iphi),
00040               base,
00041               iData.eta()+jetRadius*cos(2*M_PI/nLineSegments*(iphi+1)),
00042               iData.phi()+jetRadius*sin(2*M_PI/nLineSegments*(iphi+1)),
00043               base);
00044    }
00045 }
00046 
00047 void
00048 FWLegoEvePFCandidate::updateScale(const FWViewContext* vc, const fireworks::Context& context)
00049 {
00050    FWViewEnergyScale* caloScale = vc->getEnergyScale();
00051    float val = caloScale->getPlotEt() ?  m_et : m_energy;
00052 
00053    // printf("update scale %f \n", getScale(vc, context)); fflush(stdout);
00054    float scaleFac =  caloScale->getScaleFactorLego();
00055    // resize first line
00056    TEveChunkManager::iterator li(GetLinePlex());
00057    li.next();
00058    TEveStraightLineSet::Line_t& l = * (TEveStraightLineSet::Line_t*) li(); 
00059    l.fV2[2] = l.fV1[2] + val*scaleFac;
00060 
00061    // move end point
00062    TEveChunkManager::iterator mi(GetMarkerPlex());
00063    mi.next();
00064    TEveStraightLineSet::Marker_t& m = * (TEveStraightLineSet::Marker_t*) mi();
00065    m.fV[2] =  l.fV2[2];
00066 }
00067