CMS 3D CMS Logo

FWGenParticleLegoProxyBuilder.cc
Go to the documentation of this file.
1 #include "TEvePointSet.h"
2 
7 
10 
12 public:
15 
16  void setItem(const FWEventItem* iItem) override {
18  if (iItem) {
19  iItem->getConfig()->assertParam("MarkerStyle", 0l, -1l, 3l);
20  iItem->getConfig()->assertParam("MarkerSize", 2., 0.1, 10.);
21  }
22  }
23 
24  // ---------- member functions ---------------------------
26 
27  FWGenParticleLegoProxyBuilder(const FWGenParticleLegoProxyBuilder&) = delete; // stop default
28 
29  const FWGenParticleLegoProxyBuilder& operator=(const FWGenParticleLegoProxyBuilder&) = delete; // stop default
30 
31 private:
33  void build(const reco::GenParticle& iData,
34  unsigned int iIndex,
35  TEveElement& oItemHolder,
36  const FWViewContext*) override;
37 };
38 
39 //______________________________________________________________________________
40 
42  unsigned int iIndex,
43  TEveElement& oItemHolder,
44  const FWViewContext*) {
45  long markerStyle = item()->getConfig()->value<long>("MarkerStyle");
46  double markerSize = item()->getConfig()->value<double>("MarkerSize");
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 
#define REGISTER_PROXYBUILDER_METHODS()
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
FWProxyBuilderConfiguration * getConfig() const
Definition: FWEventItem.h:150
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
const FWEventItem * item() const
double eta() const final
momentum pseudorapidity