CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/Fireworks/ParticleFlow/plugins/FWPFClusterLegoProxyBuilder.cc

Go to the documentation of this file.
00001 #include "FWPFClusterLegoProxyBuilder.h"
00002 
00003 //______________________________________________________________________________
00004 void
00005 FWPFClusterLegoProxyBuilder::localModelChanges( const FWModelId &iId, TEveElement *parent, FWViewType::EType viewType, const FWViewContext *vc )
00006 {
00007     // Line set marker is not the same colour as line, fixed here
00008     if( ( parent )->HasChildren() )
00009     {
00010         for( TEveElement::List_i j = parent->BeginChildren(); j != parent->EndChildren(); j++ )
00011         {
00012             FWPFLegoCandidate *cluster = dynamic_cast<FWPFLegoCandidate*>( *j );
00013             const FWDisplayProperties &dp = FWProxyBuilderBase::item()->modelInfo( iId.index() ).displayProperties();
00014             cluster->SetMarkerColor( dp.color() );
00015             cluster->ElementChanged();
00016         }
00017     }
00018 }
00019 
00020 //______________________________________________________________________________
00021 void
00022 FWPFClusterLegoProxyBuilder::scaleProduct( TEveElementList* parent, FWViewType::EType type, const FWViewContext* vc )
00023 {
00024    for (TEveElement::List_i i = parent->BeginChildren(); i!= parent->EndChildren(); ++i)
00025    {
00026       if ((*i)->HasChildren())
00027       {
00028          TEveElement* el = (*i)->FirstChild();  // there is only one child added in this proxy builder
00029          FWPFLegoCandidate *cluster = dynamic_cast<FWPFLegoCandidate*>( el );
00030          cluster->updateScale(vc, context());
00031       }
00032    }
00033 }
00034 
00035 //______________________________________________________________________________
00036 void
00037 FWPFClusterLegoProxyBuilder::sharedBuild( const reco::PFCluster &iData, TEveElement &oItemHolder, const FWViewContext *vc )
00038 {
00039    TEveVector centre = TEveVector( iData.x(), iData.y(), iData.z() );
00040    float energy = iData.energy();
00041    float et = FWPFMaths::calculateEt( centre, energy );
00042    float pt = et;
00043    float eta = iData.eta();
00044    float phi = iData.phi();
00045 
00046    context().voteMaxEtAndEnergy( et, energy );
00047 
00048    FWPFLegoCandidate *cluster = new FWPFLegoCandidate( vc, FWProxyBuilderBase::context(), energy, et, pt, eta, phi );
00049    cluster->SetMarkerColor( FWProxyBuilderBase::item()->defaultDisplayProperties().color() );
00050    setupAddElement( cluster, &oItemHolder );
00051 }
00052 
00053 //______________________________ECAL____________________________________________
00054 void
00055 FWPFEcalClusterLegoProxyBuilder::build( const reco::PFCluster &iData, unsigned int iIndex, TEveElement &oItemHolder, const FWViewContext *vc )
00056 {
00057    PFLayer::Layer layer = iData.layer();
00058    if( layer < 0 )
00059       sharedBuild( iData, oItemHolder, vc ); 
00060 }
00061 
00062 //______________________________HCAL____________________________________________
00063 void
00064 FWPFHcalClusterLegoProxyBuilder::build( const reco::PFCluster &iData, unsigned int iIndex, TEveElement &oItemHolder, const FWViewContext *vc )
00065 {
00066    PFLayer::Layer layer = iData.layer();
00067    if( layer > 0 )
00068       sharedBuild( iData, oItemHolder, vc );
00069 }
00070 
00071 //______________________________________________________________________________
00072 REGISTER_FWPROXYBUILDER( FWPFEcalClusterLegoProxyBuilder, reco::PFCluster, "PF Cluster", FWViewType::kLegoPFECALBit );
00073 REGISTER_FWPROXYBUILDER( FWPFHcalClusterLegoProxyBuilder, reco::PFCluster, "PF Cluster", FWViewType::kLegoBit );