test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  virtual bool havePerViewProduct( FWViewType::EType ) const override { return true; }
36  virtual void scaleProduct( TEveElementList*, FWViewType::EType, const FWViewContext* ) override;
37  virtual 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  const FWDisplayProperties &dp = item()->modelInfo( iId.index() ).displayProperties();
82  candidate->SetMarkerColor( dp.color() );
83  candidate->ElementChanged();
84  }
85 }
86 
87 //______________________________________________________________________________
88 void
89 FWCandidateLegoProxyBuilder::build( const reco::Candidate &iData, unsigned int iIndex,
90  TEveElement &oItemHolder, const FWViewContext *vc )
91 {
92  FWLegoCandidate *candidate = new FWLegoCandidate( vc, context(), iData.energy(),
93  iData.et(), iData.pt(),
94  iData.eta(), iData.phi() );
95 
96  candidate->SetMarkerColor( item()->defaultDisplayProperties().color() );
97  context().voteMaxEtAndEnergy( iData.et(), iData.energy() );
98 
99  setupAddElement( candidate, &oItemHolder );
100 }
101 
102 //______________________________________________________________________________
type
Definition: HCALResponse.h:21
const fireworks::Context & context() const
int i
Definition: DBlmapReader.cc:9
virtual double energy() const =0
energy
#define REGISTER_PROXYBUILDER_METHODS()
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
virtual double et() const =0
transverse energy
virtual double pt() const =0
transverse momentum
void voteMaxEtAndEnergy(float Et, float energy) const
Definition: Context.cc:183
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
virtual void scaleProduct(TEveElementList *, FWViewType::EType, const FWViewContext *) override
const FWEventItem * item() const
Color_t color() const
int index() const
Definition: FWModelId.h:49
virtual bool havePerViewProduct(FWViewType::EType) const override
auto dp
Definition: deltaR.h:22
void updateScale(const FWViewContext *vc, const fireworks::Context &)
const FWCandidateLegoProxyBuilder & operator=(const FWCandidateLegoProxyBuilder &)
virtual void localModelChanges(const FWModelId &, TEveElement *, FWViewType::EType, const FWViewContext *) override
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:537
virtual double phi() const =0
momentum azimuthal angle
virtual double eta() const =0
momentum pseudorapidity