CMS 3D CMS Logo

FWPFCandidatesLegoProxyBuilder.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: ParticleFlow
4 // Class : FWCandidatesLegoProxyBuilder
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Colin Bernet
10 // Created: Fri May 28 14:54:19 CEST 2010
11 // Edited: sharris, Wed 10 Feb 2011, 13:00
12 //
13 
14 // User include files
20 #include "Fireworks/ParticleFlow/interface/setTrackTypePF.h" // NB: This has to come after FWLegoCandidate include
21 
22 //-----------------------------------------------------------------------------
23 // FWCandidate3DProxyBuilder
24 //-----------------------------------------------------------------------------
25 
27 public:
30 
31  // --------------------- Member Functions --------------------------
32  bool havePerViewProduct(FWViewType::EType) const override { return true; }
33  void scaleProduct(TEveElementList* parent, FWViewType::EType, const FWViewContext* vc) override;
34  void localModelChanges(const FWModelId& iId,
35  TEveElement* iCompound,
36  FWViewType::EType viewType,
37  const FWViewContext* vc) override;
38 
40 
41  FWPFCandidatesLegoProxyBuilder(const FWPFCandidatesLegoProxyBuilder&) = delete; // stop default
42  const FWPFCandidatesLegoProxyBuilder& operator=(const FWPFCandidatesLegoProxyBuilder&) = delete; // stop default
43 
44 private:
45  // --------------------- Member Functions --------------------------
47  void build(const reco::PFCandidate&, unsigned int, TEveElement&, const FWViewContext*) override;
48 };
49 //=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_
50 
51 //
52 // constructors and destructor
53 //
54 //______________________________________________________________________________
57 
58 //
59 // member functions
60 //
61 //______________________________________________________________________________
63  unsigned int iIndex,
64  TEveElement& oItemHolder,
65  const FWViewContext* vc) {
66  FWLegoCandidate* candidate =
67  new FWLegoCandidate(vc, context(), iData.energy(), iData.et(), iData.pt(), iData.eta(), iData.phi());
68  candidate->SetMarkerColor(item()->defaultDisplayProperties().color());
69  fireworks::setTrackTypePF(iData, candidate);
70 
71  context().voteMaxEtAndEnergy(iData.et(), iData.et());
72 
73  setupAddElement(candidate, &oItemHolder);
74 }
75 
76 //______________________________________________________________________________
79  const FWViewContext* vc) {
80  for (TEveElement::List_i i = parent->BeginChildren(); i != parent->EndChildren(); ++i) {
81  if ((*i)->HasChildren()) {
82  TEveElement* el = (*i)->FirstChild(); // there is only one child added in this proxy builder
83  FWLegoCandidate* candidate = dynamic_cast<FWLegoCandidate*>(el);
84  candidate->updateScale(vc, context());
85  }
86  }
87 }
88 
89 //______________________________________________________________________________
91  TEveElement* parent,
92  FWViewType::EType viewType,
93  const FWViewContext* vc) {
94  // line set marker is not same color as line, have to fix it here
95  if ((parent)->HasChildren()) {
96  TEveElement* el = (parent)->FirstChild(); // we know there is only one child added in this proxy builder
97  FWLegoCandidate* candidate = dynamic_cast<FWLegoCandidate*>(el);
98  candidate->SetMarkerColor(item()->modelInfo(iId.index()).displayProperties().color());
99  candidate->ElementChanged();
100  }
101 }
102 
103 //______________________________________________________________________________
106  "PF Candidates",
#define REGISTER_PROXYBUILDER_METHODS()
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
double pt() const final
transverse momentum
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
static constexpr unsigned int kLegoPFECALBit
Definition: FWViewType.h:51
int index() const
Definition: FWModelId.h:41
const fireworks::Context & context() const
void scaleProduct(TEveElementList *parent, FWViewType::EType, const FWViewContext *vc) override
void voteMaxEtAndEnergy(float Et, float energy) const
Definition: Context.cc:169
void localModelChanges(const FWModelId &iId, TEveElement *iCompound, FWViewType::EType viewType, const FWViewContext *vc) override
void updateScale(const FWViewContext *vc, const fireworks::Context &)
static constexpr unsigned int kLegoBit
Definition: FWViewType.h:50
void setTrackTypePF(const reco::PFCandidate &pfCand, TAttLine *track)
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
double et() const final
transverse energy
bool havePerViewProduct(FWViewType::EType) const override
const FWPFCandidatesLegoProxyBuilder & operator=(const FWPFCandidatesLegoProxyBuilder &)=delete
double phi() const final
momentum azimuthal angle
const FWEventItem * item() const
double energy() const final
energy
double eta() const final
momentum pseudorapidity