Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "TEveCaloData.h"
0002 
0003 #include "Fireworks/Core/interface/Context.h"
0004 #include "Fireworks/Core/interface/FWViewContext.h"
0005 #include "Fireworks/Core/interface/FWViewEnergyScale.h"
0006 #include "Fireworks/ParticleFlow/interface/FWLegoEvePFCandidate.h"
0007 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
0008 #include "Fireworks/Core/interface/fwLog.h"
0009 
0010 FWLegoEvePFCandidate::FWLegoEvePFCandidate(const reco::PFCandidate& iData,
0011                                            const FWViewContext* vc,
0012                                            const fireworks::Context& context)
0013     : m_energy(0.f), m_et(0.f) {
0014   m_et = iData.et();
0015   m_energy = iData.energy();
0016 
0017   float base = 0.001;  // flour offset 1%
0018 
0019   // first vertical  line , which is et/energy
0020   FWViewEnergyScale* caloScale = vc->getEnergyScale();
0021   float val = caloScale->getPlotEt() ? m_et : m_energy;
0022   AddLine(iData.eta(), iData.phi(), base, iData.eta(), iData.phi(), base + val * caloScale->getScaleFactorLego());
0023 
0024   AddMarker(0, 1.f);
0025   SetMarkerStyle(3);
0026   SetMarkerSize(0.01);
0027   SetDepthTest(false);
0028 
0029   // circle pt
0030   const unsigned int nLineSegments = 20;
0031   float circleScalingFactor = 50;
0032   const double jetRadius = iData.pt() / circleScalingFactor;
0033 
0034   for (unsigned int iphi = 0; iphi < nLineSegments; ++iphi) {
0035     AddLine(iData.eta() + jetRadius * cos(2 * M_PI / nLineSegments * iphi),
0036             iData.phi() + jetRadius * sin(2 * M_PI / nLineSegments * iphi),
0037             base,
0038             iData.eta() + jetRadius * cos(2 * M_PI / nLineSegments * (iphi + 1)),
0039             iData.phi() + jetRadius * sin(2 * M_PI / nLineSegments * (iphi + 1)),
0040             base);
0041   }
0042 }
0043 
0044 void FWLegoEvePFCandidate::updateScale(const FWViewContext* vc, const fireworks::Context& context) {
0045   FWViewEnergyScale* caloScale = vc->getEnergyScale();
0046   float val = caloScale->getPlotEt() ? m_et : m_energy;
0047 
0048   // printf("update scale %f \n", getScale(vc, context)); fflush(stdout);
0049   float scaleFac = caloScale->getScaleFactorLego();
0050   // resize first line
0051   TEveChunkManager::iterator li(GetLinePlex());
0052   li.next();
0053   TEveStraightLineSet::Line_t& l = *(TEveStraightLineSet::Line_t*)li();
0054   l.fV2[2] = l.fV1[2] + val * scaleFac;
0055 
0056   // move end point
0057   TEveChunkManager::iterator mi(GetMarkerPlex());
0058   mi.next();
0059   TEveStraightLineSet::Marker_t& m = *(TEveStraightLineSet::Marker_t*)mi();
0060   m.fV[2] = l.fV2[2];
0061 }