File indexing completed on 2024-04-06 12:11:50
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include "Fireworks/Core/interface/FWSimpleProxyBuilderTemplate.h"
0016 #include "Fireworks/Core/interface/Context.h"
0017 #include "Fireworks/Core/interface/FWEventItem.h"
0018 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
0019 #include "Fireworks/Candidates/interface/FWLegoCandidate.h"
0020 #include "Fireworks/ParticleFlow/interface/setTrackTypePF.h" // NB: This has to come after FWLegoCandidate include
0021
0022
0023
0024
0025
0026 class FWPFCandidatesLegoProxyBuilder : public FWSimpleProxyBuilderTemplate<reco::PFCandidate> {
0027 public:
0028 FWPFCandidatesLegoProxyBuilder();
0029 ~FWPFCandidatesLegoProxyBuilder() override;
0030
0031
0032 bool havePerViewProduct(FWViewType::EType) const override { return true; }
0033 void scaleProduct(TEveElementList* parent, FWViewType::EType, const FWViewContext* vc) override;
0034 void localModelChanges(const FWModelId& iId,
0035 TEveElement* iCompound,
0036 FWViewType::EType viewType,
0037 const FWViewContext* vc) override;
0038
0039 REGISTER_PROXYBUILDER_METHODS();
0040
0041 FWPFCandidatesLegoProxyBuilder(const FWPFCandidatesLegoProxyBuilder&) = delete;
0042 const FWPFCandidatesLegoProxyBuilder& operator=(const FWPFCandidatesLegoProxyBuilder&) = delete;
0043
0044 private:
0045
0046 using FWSimpleProxyBuilderTemplate<reco::PFCandidate>::build;
0047 void build(const reco::PFCandidate&, unsigned int, TEveElement&, const FWViewContext*) override;
0048 };
0049
0050
0051
0052
0053
0054
0055 FWPFCandidatesLegoProxyBuilder::FWPFCandidatesLegoProxyBuilder() {}
0056 FWPFCandidatesLegoProxyBuilder::~FWPFCandidatesLegoProxyBuilder() {}
0057
0058
0059
0060
0061
0062 void FWPFCandidatesLegoProxyBuilder::build(const reco::PFCandidate& iData,
0063 unsigned int iIndex,
0064 TEveElement& oItemHolder,
0065 const FWViewContext* vc) {
0066 FWLegoCandidate* candidate =
0067 new FWLegoCandidate(vc, context(), iData.energy(), iData.et(), iData.pt(), iData.eta(), iData.phi());
0068 candidate->SetMarkerColor(item()->defaultDisplayProperties().color());
0069 fireworks::setTrackTypePF(iData, candidate);
0070
0071 context().voteMaxEtAndEnergy(iData.et(), iData.et());
0072
0073 setupAddElement(candidate, &oItemHolder);
0074 }
0075
0076
0077 void FWPFCandidatesLegoProxyBuilder::scaleProduct(TEveElementList* parent,
0078 FWViewType::EType type,
0079 const FWViewContext* vc) {
0080 for (TEveElement::List_i i = parent->BeginChildren(); i != parent->EndChildren(); ++i) {
0081 if ((*i)->HasChildren()) {
0082 TEveElement* el = (*i)->FirstChild();
0083 FWLegoCandidate* candidate = dynamic_cast<FWLegoCandidate*>(el);
0084 candidate->updateScale(vc, context());
0085 }
0086 }
0087 }
0088
0089
0090 void FWPFCandidatesLegoProxyBuilder::localModelChanges(const FWModelId& iId,
0091 TEveElement* parent,
0092 FWViewType::EType viewType,
0093 const FWViewContext* vc) {
0094
0095 if ((parent)->HasChildren()) {
0096 TEveElement* el = (parent)->FirstChild();
0097 FWLegoCandidate* candidate = dynamic_cast<FWLegoCandidate*>(el);
0098 candidate->SetMarkerColor(item()->modelInfo(iId.index()).displayProperties().color());
0099 candidate->ElementChanged();
0100 }
0101 }
0102
0103
0104 REGISTER_FWPROXYBUILDER(FWPFCandidatesLegoProxyBuilder,
0105 reco::PFCandidate,
0106 "PF Candidates",
0107 FWViewType::kLegoPFECALBit | FWViewType::kLegoBit);