CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/Fireworks/ParticleFlow/plugins/FWPFClusterRPZProxyBuilder.cc

Go to the documentation of this file.
00001 #include "FWPFClusterRPZProxyBuilder.h"
00002 
00003 //______________________________________________________________________________
00004 FWPFClusterRPZProxyBuilder::FWPFClusterRPZProxyBuilder()
00005 {
00006    m_clusterUtils = new FWPFClusterRPZUtils();
00007 }
00008 
00009 //______________________________________________________________________________
00010 FWPFClusterRPZProxyBuilder::~FWPFClusterRPZProxyBuilder()
00011 {
00012    delete m_clusterUtils;
00013 }
00014 
00015 //______________________________________________________________________________
00016 void
00017 FWPFClusterRPZProxyBuilder::scaleProduct( TEveElementList *parent, FWViewType::EType viewType, const FWViewContext *vc )
00018 {
00019    typedef std::vector<ScalableLines> Lines_t;
00020    FWViewEnergyScale *caloScale = vc->getEnergyScale();
00021 
00022    for( Lines_t::iterator i = m_clusters.begin(); i != m_clusters.end(); ++i )
00023    {
00024       if( vc == (*i).m_vc )
00025       {
00026          float value = caloScale->getPlotEt() ? (*i).m_et : (*i).m_energy;
00027          (*i).m_ls->SetScale( caloScale->getScaleFactor3D() * value );
00028          TEveProjected *proj = *(*i).m_ls->BeginProjecteds();
00029          proj->UpdateProjection();
00030       }
00031    }
00032 }
00033 
00034 //______________________________________________________________________________
00035 void
00036 FWPFClusterRPZProxyBuilder::sharedBuild( const reco::PFCluster &iData, unsigned int iIndex, 
00037                                          TEveElement &oItemHolder, const FWViewContext *vc, float r )
00038 {
00039    /* Handles RhoPhi view */
00040    TEveScalableStraightLineSet *ls;
00041    TEveVector centre = TEveVector( iData.x(), iData.y(), iData.z() );
00042    const FWDisplayProperties &dp = item()->defaultDisplayProperties();
00043    float energy, et;
00044    
00045    energy = iData.energy();
00046    et = FWPFMaths::calculateEt( centre, energy );
00047    context().voteMaxEtAndEnergy( et, energy );
00048 
00049    ls = m_clusterUtils->buildRhoPhiClusterLineSet( iData, vc, energy, et, r );
00050    ls->SetLineColor( dp.color() );
00051    m_clusters.push_back( ScalableLines( ls, et, energy, vc ) );
00052    setupAddElement( ls, &oItemHolder );
00053 }
00054 
00055 //______________________________________________________________________________
00056 void
00057 FWPFClusterRPZProxyBuilder::build( const reco::PFCluster &iData, unsigned int iIndex, 
00058                                                 TEveElement &oItemHolder, const FWViewContext *vc )
00059 {
00060    /* Handles RhoZ view */
00061    float energy, et;
00062    float ecalR = context().caloR1();
00063    float ecalZ = context().caloZ1();
00064    const FWDisplayProperties &dp = item()->defaultDisplayProperties();
00065    TEveScalableStraightLineSet *ls;
00066    TEveVector centre = TEveVector( iData.x(), iData.y(), iData.z() );
00067 
00068    energy = iData.energy();
00069    et = FWPFMaths::calculateEt( centre, energy );
00070    context().voteMaxEtAndEnergy( et, energy );
00071 
00072    ls = m_clusterUtils->buildRhoZClusterLineSet( iData, vc, context().caloTransAngle(), energy, et, ecalR, ecalZ );
00073    ls->SetLineColor( dp.color() );
00074 
00075    m_clusters.push_back( ScalableLines( ls, et, energy, vc ) );
00076    setupAddElement( ls, &oItemHolder ); 
00077 }
00078 
00079 //______________________________________________________________________________
00080 void
00081 FWPFEcalClusterRPZProxyBuilder::build( const reco::PFCluster &iData, unsigned int iIndex, TEveElement &oItemHolder, const FWViewContext *vc )
00082 {
00083    PFLayer::Layer layer = iData.layer();
00084    const FWEventItem::ModelInfo &info = item()->modelInfo( iIndex );
00085    if( info.displayProperties().isVisible() )
00086    {
00087       if( layer < 0 )
00088          sharedBuild( iData, iIndex, oItemHolder, vc, FWPFGeom::caloR1() );
00089       else
00090          sharedBuild( iData, iIndex, oItemHolder, vc, FWPFGeom::caloR2() );
00091    }
00092 }
00093 
00094 //______________________________________________________________________________
00095 void
00096 FWPFHcalClusterRPZProxyBuilder::build( const reco::PFCluster &iData, unsigned int iIndex, TEveElement &oItemHolder, const FWViewContext *vc )
00097 {
00098    const FWEventItem::ModelInfo &info = item()->modelInfo( iIndex );
00099    if( info.displayProperties().isVisible() )
00100       sharedBuild( iData, iIndex, oItemHolder, vc, FWPFGeom::caloR1() );
00101 }
00102 
00103 //______________________________________________________________________________
00104 REGISTER_FWPROXYBUILDER( FWPFClusterRPZProxyBuilder, reco::PFCluster, "PF Cluster", FWViewType::kRhoZBit );
00105 REGISTER_FWPROXYBUILDER( FWPFEcalClusterRPZProxyBuilder, reco::PFCluster, "PF Cluster", FWViewType::kRhoPhiPFBit );
00106 REGISTER_FWPROXYBUILDER( FWPFHcalClusterRPZProxyBuilder, reco::PFCluster, "PF Cluster", FWViewType::kRhoPhiBit );