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