CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWGenParticleLegoProxyBuilder.cc
Go to the documentation of this file.
1 #include "TEvePointSet.h"
2 
7 
10 
12 
13 public:
16 
17  virtual void setItem(const FWEventItem* iItem) override
18  {
20  if (iItem)
21  {
22  iItem->getConfig()->assertParam("MarkerStyle", 0l, -1l, 3l);
23  iItem->getConfig()->assertParam("MarkerSize",2., 0.1, 10.);
24  }
25  }
26 
27  // ---------- member functions ---------------------------
29 
30 private:
32 
34 
35  void build(const reco::GenParticle& iData, unsigned int iIndex,TEveElement& oItemHolder, const FWViewContext*) override;
36 };
37 
38 //______________________________________________________________________________
39 
40 
41 void
42 FWGenParticleLegoProxyBuilder::build(const reco::GenParticle& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext*)
43  {
44  long markerStyle = item()->getConfig()->value<long>("MarkerStyle");
45  double markerSize = item()->getConfig()->value<double>("MarkerSize");
46 
47 
48  // workaround around for TEvePointSet marker styles indices
49  if (markerStyle == 0 )
50  markerStyle = 3;
51  else if (markerStyle == 1)
52  markerStyle = 4;
53  else if (markerStyle == 2)
54  markerStyle = 8;
55  std::cerr << std::endl;
56 
57  // scale non-pixel size marker
58  if (markerStyle == 3 )
59  markerSize /= 20;
60 
61  TEvePointSet* ps = new TEvePointSet();
62  ps->SetMarkerStyle(markerStyle);
63  ps->SetMarkerSize(markerSize);
64  ps->SetNextPoint(iData.eta(), iData.phi(), 0.001);
65  setupAddElement( ps, &oItemHolder );
66 
67  }
68 
70 
FWProxyBuilderConfiguration * getConfig() const
Definition: FWEventItem.h:165
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
virtual void setItem(const FWEventItem *iItem) override
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
const FWGenParticleLegoProxyBuilder & operator=(const FWGenParticleLegoProxyBuilder &)
const FWEventItem * item() const
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
virtual void setItem(const FWEventItem *iItem)
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
FWGenericParameter< T > * assertParam(const std::string &name, T def)