CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  virtual bool havePerViewProduct(FWViewType::EType) const { return true; }
34  virtual void scaleProduct(TEveElementList* parent, FWViewType::EType, const FWViewContext* vc);
35  virtual void localModelChanges(const FWModelId& iId, TEveElement* iCompound,
36  FWViewType::EType viewType, const FWViewContext* vc);
37 
39 
40  private:
43 
44  // --------------------- Member Functions --------------------------
46  void build(const reco::PFCandidate&, unsigned int, TEveElement&, const FWViewContext*);
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
int i
Definition: DBlmapReader.cc:9
#define REGISTER_PROXYBUILDER_METHODS()
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
list parent
Definition: dbtoconf.py:74
virtual float pt() const
transverse momentum
virtual double et() const
transverse energy
virtual float phi() const
momentum azimuthal angle
virtual void localModelChanges(const FWModelId &iId, TEveElement *iCompound, FWViewType::EType viewType, const FWViewContext *vc)
void voteMaxEtAndEnergy(float Et, float energy) const
Definition: Context.cc:184
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
const FWEventItem * item() const
Color_t color() const
virtual double energy() const
energy
const FWPFCandidatesLegoProxyBuilder & operator=(const FWPFCandidatesLegoProxyBuilder &)
int index() const
Definition: FWModelId.h:49
virtual float eta() const
momentum pseudorapidity
virtual void scaleProduct(TEveElementList *parent, FWViewType::EType, const FWViewContext *vc)
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:38
virtual bool havePerViewProduct(FWViewType::EType) const
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:535