CMS 3D CMS Logo

FWGenParticleLegoProxyBuilder.cc
Go to the documentation of this file.
1 #include "TEvePointSet.h"
2 
7 
10 
12 
13 public:
16 
17  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:
31  FWGenParticleLegoProxyBuilder(const FWGenParticleLegoProxyBuilder&) = delete; // stop default
32 
33  const FWGenParticleLegoProxyBuilder& operator=(const FWGenParticleLegoProxyBuilder&) = delete; // stop default
34 
36  void build(const reco::GenParticle& iData, unsigned int iIndex,TEveElement& oItemHolder, const FWViewContext*) override;
37 };
38 
39 //______________________________________________________________________________
40 
41 
42 void
43 FWGenParticleLegoProxyBuilder::build(const reco::GenParticle& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext*)
44  {
45  long markerStyle = item()->getConfig()->value<long>("MarkerStyle");
46  double markerSize = item()->getConfig()->value<double>("MarkerSize");
47 
48 
49  // workaround around for TEvePointSet marker styles indices
50  if (markerStyle == 0 )
51  markerStyle = 3;
52  else if (markerStyle == 1)
53  markerStyle = 4;
54  else if (markerStyle == 2)
55  markerStyle = 8;
56  std::cerr << std::endl;
57 
58  // scale non-pixel size marker
59  if (markerStyle == 3 )
60  markerSize /= 20;
61 
62  TEvePointSet* ps = new TEvePointSet();
63  ps->SetMarkerStyle(markerStyle);
64  ps->SetMarkerSize(markerSize);
65  ps->SetNextPoint(iData.eta(), iData.phi(), 0.001);
66  setupAddElement( ps, &oItemHolder );
67 
68  }
69 
71 
FWProxyBuilderConfiguration * getConfig() const
Definition: FWEventItem.h:169
#define REGISTER_PROXYBUILDER_METHODS()
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
double eta() const final
momentum pseudorapidity
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
const FWEventItem * item() const
virtual void setItem(const FWEventItem *iItem)
const FWGenParticleLegoProxyBuilder & operator=(const FWGenParticleLegoProxyBuilder &)=delete
FWGenericParameter< T > * assertParam(const std::string &name, T def)
void setItem(const FWEventItem *iItem) override
double phi() const final
momentum azimuthal angle