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 --------------------------
45  void build(const reco::PFCandidate&, unsigned int, TEveElement&, const FWViewContext*);
46 };
47 //=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_
48 
49 
50 //
51 // constructors and destructor
52 //
53 //______________________________________________________________________________
56 
57 //
58 // member functions
59 //
60 //______________________________________________________________________________
61 void
62 FWPFCandidatesLegoProxyBuilder::build(const reco::PFCandidate &iData, unsigned int iIndex, TEveElement &oItemHolder, const FWViewContext *vc)
63 {
64  FWLegoCandidate *candidate = new FWLegoCandidate( vc, context(), iData.energy(), iData.et(), iData.pt(),
65  iData.eta(), iData.phi() );
66  candidate->SetMarkerColor( item()->defaultDisplayProperties().color() );
67  fireworks::setTrackTypePF( iData, candidate );
68 
69  context().voteMaxEtAndEnergy( iData.et(), iData.et() );
70 
71  setupAddElement( candidate, &oItemHolder );
72 }
73 
74 //______________________________________________________________________________
75 void
77 {
78  for (TEveElement::List_i i = parent->BeginChildren(); i!= parent->EndChildren(); ++i)
79  {
80  if ((*i)->HasChildren())
81  {
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 //______________________________________________________________________________
90 void
92  FWViewType::EType viewType, const FWViewContext* vc)
93 {
94  // line set marker is not same color as line, have to fix it here
95  if ((parent)->HasChildren())
96  {
97  TEveElement* el = (parent)->FirstChild(); // we know there is only one child added in this proxy builder
98  FWLegoCandidate *candidate = dynamic_cast<FWLegoCandidate*> (el);
99  const FWDisplayProperties& dp = item()->modelInfo(iId.index()).displayProperties();
100  candidate->SetMarkerColor( dp.color());
101  candidate->ElementChanged();
102  }
103 }
104 
105 //______________________________________________________________________________
type
Definition: HCALResponse.h:22
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 double et() const
transverse energy
virtual void localModelChanges(const FWModelId &iId, TEveElement *iCompound, FWViewType::EType viewType, const FWViewContext *vc)
void voteMaxEtAndEnergy(float Et, float energy) const
Definition: Context.cc:185
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
virtual double eta() const
momentum pseudorapidity
const FWEventItem * item() const
Color_t color() const
virtual double energy() const
energy
const FWPFCandidatesLegoProxyBuilder & operator=(const FWPFCandidatesLegoProxyBuilder &)
int index() const
Definition: FWModelId.h:50
virtual void scaleProduct(TEveElementList *parent, FWViewType::EType, const FWViewContext *vc)
virtual double pt() const
transverse momentum
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:33
virtual bool havePerViewProduct(FWViewType::EType) const
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:535
virtual double phi() const
momentum azimuthal angle