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 {
28  public:
31 
32  // --------------------- Member Functions --------------------------
33  bool havePerViewProduct(FWViewType::EType) const override { return true; }
34  void scaleProduct(TEveElementList* parent, FWViewType::EType, const FWViewContext* vc) override;
35  void localModelChanges(const FWModelId& iId, TEveElement* iCompound,
36  FWViewType::EType viewType, const FWViewContext* vc) override;
37 
39 
40  private:
41  FWPFCandidatesLegoProxyBuilder(const FWPFCandidatesLegoProxyBuilder&) = delete; // stop default
42  const FWPFCandidatesLegoProxyBuilder& operator=(const FWPFCandidatesLegoProxyBuilder&) = delete; // stop default
43 
44  // --------------------- Member Functions --------------------------
46  void build(const reco::PFCandidate&, unsigned int, TEveElement&, const FWViewContext*) override;
47 };
48 //=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_
49 
50 
51 //
52 // constructors and destructor
53 //
54 //______________________________________________________________________________
57 
58 //
59 // member functions
60 //
61 //______________________________________________________________________________
62 void
63 FWPFCandidatesLegoProxyBuilder::build(const reco::PFCandidate &iData, unsigned int iIndex, TEveElement &oItemHolder, const FWViewContext *vc)
64 {
65  FWLegoCandidate *candidate = new FWLegoCandidate( vc, context(), iData.energy(), iData.et(), iData.pt(),
66  iData.eta(), iData.phi() );
67  candidate->SetMarkerColor( item()->defaultDisplayProperties().color() );
68  fireworks::setTrackTypePF( iData, candidate );
69 
70  context().voteMaxEtAndEnergy( iData.et(), iData.et() );
71 
72  setupAddElement( candidate, &oItemHolder );
73 }
74 
75 //______________________________________________________________________________
76 void
78 {
79  for (TEveElement::List_i i = parent->BeginChildren(); i!= parent->EndChildren(); ++i)
80  {
81  if ((*i)->HasChildren())
82  {
83  TEveElement* el = (*i)->FirstChild(); // there is only one child added in this proxy builder
84  FWLegoCandidate *candidate = dynamic_cast<FWLegoCandidate*> (el);
85  candidate->updateScale(vc, context());
86  }
87  }
88 }
89 
90 //______________________________________________________________________________
91 void
93  FWViewType::EType viewType, const FWViewContext* vc)
94 {
95  // line set marker is not same color as line, have to fix it here
96  if ((parent)->HasChildren())
97  {
98  TEveElement* el = (parent)->FirstChild(); // we know there is only one child added in this proxy builder
99  FWLegoCandidate *candidate = dynamic_cast<FWLegoCandidate*> (el);
100  const FWDisplayProperties& dp = item()->modelInfo(iId.index()).displayProperties();
101  candidate->SetMarkerColor( dp.color());
102  candidate->ElementChanged();
103  }
104 }
105 
106 //______________________________________________________________________________
type
Definition: HCALResponse.h:21
const fireworks::Context & context() const
#define REGISTER_PROXYBUILDER_METHODS()
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
double eta() const final
momentum pseudorapidity
bool havePerViewProduct(FWViewType::EType) const override
void voteMaxEtAndEnergy(float Et, float energy) const
Definition: Context.cc:183
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
double pt() const final
transverse momentum
const FWEventItem * item() const
Color_t color() const
void scaleProduct(TEveElementList *parent, FWViewType::EType, const FWViewContext *vc) override
int index() const
Definition: FWModelId.h:49
double et() const final
transverse energy
double energy() const final
energy
void localModelChanges(const FWModelId &iId, TEveElement *iCompound, FWViewType::EType viewType, const FWViewContext *vc) override
auto dp
Definition: deltaR.h:22
void updateScale(const FWViewContext *vc, const fireworks::Context &)
void setTrackTypePF(const reco::PFCandidate &pfCand, TAttLine *track)
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:39
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:537
const FWPFCandidatesLegoProxyBuilder & operator=(const FWPFCandidatesLegoProxyBuilder &)=delete
double phi() const final
momentum azimuthal angle