CMS 3D CMS Logo

FWCandidateLegoProxyBuilder.cc
Go to the documentation of this file.
1 #ifndef _FWCANDIDATELEGOPROXYBUILDER_H_
2 #define _FWCANDIDATELEGOPROXYBUILDER_H_
3 
4 // -*- C++ -*-
5 //
6 // Package: Candidates
7 // Class : FWCandidateLegoProxyBuilder
8 //
9 // Implementation:
10 // <Notes on implementation>
11 //
12 // Original Author: Simon Harris
13 // Created: 24/06/2011
14 //
15 
16 // User include files
21 
23 
24 //-----------------------------------------------------------------------------
25 // FWCandidateLegoProxyBuilder
26 //-----------------------------------------------------------------------------
28 {
29  public:
30  // ---------------- Constructor(s)/Destructor ----------------------
33 
34  // --------------------- Member Functions --------------------------
35  bool havePerViewProduct( FWViewType::EType ) const override { return true; }
36  void scaleProduct( TEveElementList*, FWViewType::EType, const FWViewContext* ) override;
37  void localModelChanges( const FWModelId&, TEveElement*, FWViewType::EType,
38  const FWViewContext* ) override;
39 
41 
42  private:
43  // ----------------------- Data Members ----------------------------
46 
47  // --------------------- Member Functions --------------------------
49  void build( const reco::Candidate&, unsigned int, TEveElement&, const FWViewContext* ) override;
50 };
51 #endif
52 //=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_
53 
54 
55 //______________________________________________________________________________
56 void
58  const FWViewContext *vc )
59 {
60  for( TEveElement::List_i i = parent->BeginChildren(); i != parent->EndChildren(); ++i )
61  {
62  if( (*i)->HasChildren() )
63  {
64  TEveElement *el = (*i)->FirstChild(); // There is only one child
65  FWLegoCandidate *candidate = dynamic_cast<FWLegoCandidate*> (el);
66  candidate->updateScale( vc, context() );
67  }
68  }
69 }
70 
71 //______________________________________________________________________________
72 void
75 {
76  // Line set marker is nto the same color as line, have to fix it here
77  if( (parent)->HasChildren() )
78  {
79  TEveElement *el = (parent)->FirstChild(); // There is only one child
80  FWLegoCandidate *candidate = dynamic_cast<FWLegoCandidate*> (el);
81  candidate->SetMarkerColor( item()->modelInfo( iId.index() ).displayProperties().color() );
82  candidate->ElementChanged();
83  }
84 }
85 
86 //______________________________________________________________________________
87 void
88 FWCandidateLegoProxyBuilder::build( const reco::Candidate &iData, unsigned int iIndex,
89  TEveElement &oItemHolder, const FWViewContext *vc )
90 {
91  FWLegoCandidate *candidate = new FWLegoCandidate( vc, context(), iData.energy(),
92  iData.et(), iData.pt(),
93  iData.eta(), iData.phi() );
94 
95  candidate->SetMarkerColor( item()->defaultDisplayProperties().color() );
96  context().voteMaxEtAndEnergy( iData.et(), iData.energy() );
97 
98  setupAddElement( candidate, &oItemHolder );
99 }
100 
101 //______________________________________________________________________________
type
Definition: HCALResponse.h:21
const fireworks::Context & context() const
#define REGISTER_PROXYBUILDER_METHODS()
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
void voteMaxEtAndEnergy(float Et, float energy) const
Definition: Context.cc:183
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
void scaleProduct(TEveElementList *, FWViewType::EType, const FWViewContext *) override
bool havePerViewProduct(FWViewType::EType) const override
const FWEventItem * item() const
virtual double et() const =0
transverse energy
virtual double energy() const =0
energy
int index() const
Definition: FWModelId.h:49
virtual double eta() const =0
momentum pseudorapidity
virtual double pt() const =0
transverse momentum
void updateScale(const FWViewContext *vc, const fireworks::Context &)
const FWCandidateLegoProxyBuilder & operator=(const FWCandidateLegoProxyBuilder &)=delete
void localModelChanges(const FWModelId &, TEveElement *, FWViewType::EType, const FWViewContext *) override
virtual double phi() const =0
momentum azimuthal angle