Go to the documentation of this file.00001 #ifndef _FWCANDIDATELEGOPROXYBUILDER_H_
00002 #define _FWCANDIDATELEGOPROXYBUILDER_H_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "Fireworks/Core/interface/FWSimpleProxyBuilderTemplate.h"
00018 #include "Fireworks/Core/interface/Context.h"
00019 #include "Fireworks/Core/interface/FWEventItem.h"
00020 #include "DataFormats/Candidate/interface/Candidate.h"
00021
00022 #include "Fireworks/Candidates/interface/FWLegoCandidate.h"
00023
00024
00025
00026
00027 class FWCandidateLegoProxyBuilder : public FWSimpleProxyBuilderTemplate<reco::Candidate>
00028 {
00029 public:
00030
00031 FWCandidateLegoProxyBuilder(){}
00032 virtual ~FWCandidateLegoProxyBuilder(){}
00033
00034
00035 virtual bool havePerViewProduct( FWViewType::EType ) const { return true; }
00036 virtual void scaleProduct( TEveElementList*, FWViewType::EType, const FWViewContext* );
00037 virtual void localModelChanges( const FWModelId&, TEveElement*, FWViewType::EType,
00038 const FWViewContext* );
00039
00040 REGISTER_PROXYBUILDER_METHODS();
00041
00042 private:
00043
00044 FWCandidateLegoProxyBuilder( const FWCandidateLegoProxyBuilder& );
00045 const FWCandidateLegoProxyBuilder& operator=( const FWCandidateLegoProxyBuilder& );
00046
00047
00048 void build( const reco::Candidate&, unsigned int, TEveElement&, const FWViewContext* );
00049 };
00050 #endif
00051
00052
00053
00054
00055 void
00056 FWCandidateLegoProxyBuilder::scaleProduct( TEveElementList *parent, FWViewType::EType type,
00057 const FWViewContext *vc )
00058 {
00059 for( TEveElement::List_i i = parent->BeginChildren(); i != parent->EndChildren(); ++i )
00060 {
00061 if( (*i)->HasChildren() )
00062 {
00063 TEveElement *el = (*i)->FirstChild();
00064 FWLegoCandidate *candidate = dynamic_cast<FWLegoCandidate*> (el);
00065 candidate->updateScale( vc, context() );
00066 }
00067 }
00068 }
00069
00070
00071 void
00072 FWCandidateLegoProxyBuilder::localModelChanges( const FWModelId &iId, TEveElement *parent,
00073 FWViewType::EType type, const FWViewContext *vc )
00074 {
00075
00076 if( (parent)->HasChildren() )
00077 {
00078 TEveElement *el = (parent)->FirstChild();
00079 FWLegoCandidate *candidate = dynamic_cast<FWLegoCandidate*> (el);
00080 const FWDisplayProperties &dp = item()->modelInfo( iId.index() ).displayProperties();
00081 candidate->SetMarkerColor( dp.color() );
00082 candidate->ElementChanged();
00083 }
00084 }
00085
00086
00087 void
00088 FWCandidateLegoProxyBuilder::build( const reco::Candidate &iData, unsigned int iIndex,
00089 TEveElement &oItemHolder, const FWViewContext *vc )
00090 {
00091 FWLegoCandidate *candidate = new FWLegoCandidate( vc, context(), iData.energy(),
00092 iData.et(), iData.pt(),
00093 iData.eta(), iData.phi() );
00094
00095 candidate->SetMarkerColor( item()->defaultDisplayProperties().color() );
00096 context().voteMaxEtAndEnergy( iData.et(), iData.energy() );
00097
00098 setupAddElement( candidate, &oItemHolder );
00099 }
00100
00101
00102 REGISTER_FWPROXYBUILDER( FWCandidateLegoProxyBuilder, reco::Candidate, "Candidates",
00103 FWViewType::kLegoBit | FWViewType::kLegoPFECALBit );