Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:11:29

0001 #include "Fireworks/Candidates/interface/FWLegoCandidate.h"
0002 
0003 #include "Fireworks/Core/interface/Context.h"
0004 #include "Fireworks/Core/interface/FWViewContext.h"
0005 #include "Fireworks/Core/interface/FWViewEnergyScale.h"
0006 
0007 //______________________________________________________________________________
0008 FWLegoCandidate::FWLegoCandidate(
0009     const FWViewContext *vc, const fireworks::Context &context, float energy, float et, float pt, float eta, float phi)
0010     : m_energy(energy), m_et(et), m_pt(pt), m_eta(eta), m_phi(phi) {
0011   float base = 0.001;  // Floor offset 1%
0012 
0013   // First vertical line
0014   FWViewEnergyScale *caloScale = vc->getEnergyScale();
0015   float val = caloScale->getPlotEt() ? m_pt : m_energy;  // Use pt instead of et
0016 
0017   AddLine(m_eta, m_phi, base, m_eta, m_phi, base + val * caloScale->getScaleFactorLego());
0018 
0019   AddMarker(0, 1.f);
0020   SetMarkerStyle(3);
0021   SetMarkerSize(0.01);
0022   SetDepthTest(false);
0023 
0024   // Circle pt
0025   const unsigned int nLineSegments = 20;
0026   const double radius = log(1 + m_pt) / log(10) / 30.f;
0027   //const double radius = m_pt / 100.f;
0028   const double twoPi = 2 * TMath::Pi();
0029 
0030   for (unsigned int iPhi = 0; iPhi < nLineSegments; ++iPhi) {
0031     AddLine(m_eta + radius * cos(twoPi / nLineSegments * iPhi),
0032             m_phi + radius * sin(twoPi / nLineSegments * iPhi),
0033             base,
0034             m_eta + radius * cos(twoPi / nLineSegments * (iPhi + 1)),
0035             m_phi + radius * sin(twoPi / nLineSegments * (iPhi + 1)),
0036             base);
0037   }
0038 }
0039 
0040 //______________________________________________________________________________
0041 void FWLegoCandidate::updateScale(const FWViewContext *vc, const fireworks::Context &context) {
0042   FWViewEnergyScale *caloScale = vc->getEnergyScale();
0043   float val = caloScale->getPlotEt() ? m_pt : m_energy;  // Use pt instead of et
0044   float scaleFac = caloScale->getScaleFactorLego();
0045 
0046   // Resize first line
0047   TEveChunkManager::iterator li(GetLinePlex());
0048   li.next();
0049   TEveStraightLineSet::Line_t &l = *(TEveStraightLineSet::Line_t *)li();
0050   l.fV2[2] = l.fV1[2] + val * scaleFac;
0051 
0052   // Move end point (marker)
0053   TEveChunkManager::iterator mi(GetMarkerPlex());
0054   mi.next();
0055   TEveStraightLineSet::Marker_t &m = *(TEveStraightLineSet::Marker_t *)mi();
0056   m.fV[2] = l.fV2[2];  // Set to new top of line
0057 }