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
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();
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
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
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 );