CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
FWTracksterProxyBuilder.cc
Go to the documentation of this file.
3 
4 #include "TEveTrans.h"
5 #include "TGeoSphere.h"
6 #include "TEveGeoShape.h"
7 
8 class FWTracksterProxyBuilder : public FWSimpleProxyBuilderTemplate<ticl::Trackster> {
9 public:
11  ~FWTracksterProxyBuilder(void) override {}
12 
14 
15  FWTracksterProxyBuilder(const FWTracksterProxyBuilder &) = delete; // stop default
16  const FWTracksterProxyBuilder &operator=(const FWTracksterProxyBuilder &) = delete; // stop default
17 
18 private:
19  void build(const ticl::Trackster &iData,
20  unsigned int iIndex,
21  TEveElement &oItemHolder,
22  const FWViewContext *) override;
23 };
24 
26  unsigned int iIndex,
27  TEveElement &oItemHolder,
28  const FWViewContext *) {
29  const ticl::Trackster &trackster = iData;
30  const ticl::Trackster::Vector &barycenter = trackster.barycenter();
31  const std::array<float, 3> &eigenvalues = trackster.eigenvalues();
32  const double theta = barycenter.Theta();
33  const double phi = barycenter.Phi();
34 
35  auto eveEllipsoid = new TEveGeoShape("Ellipsoid");
36  auto sphere = new TGeoSphere(0., 1.);
37  eveEllipsoid->SetShape(sphere);
38  eveEllipsoid->InitMainTrans();
39  eveEllipsoid->RefMainTrans().Move3PF(barycenter.x(), barycenter.y(), barycenter.z());
40  eveEllipsoid->RefMainTrans().SetRotByAnyAngles(theta, phi, 0., "xzy");
41  eveEllipsoid->RefMainTrans().SetScale(sqrt(eigenvalues[2]), sqrt(eigenvalues[1]), sqrt(eigenvalues[0]));
42  setupAddElement(eveEllipsoid, &oItemHolder);
43 }
44 
47  "Trackster",
#define REGISTER_PROXYBUILDER_METHODS()
math::XYZVector Vector
Definition: Trackster.h:21
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
static const int kAllRPZBits
Definition: FWViewType.h:67
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
Geom::Theta< T > theta() const
T sqrt(T t)
Definition: SSEVec.h:19
const FWTracksterProxyBuilder & operator=(const FWTracksterProxyBuilder &)=delete