CMS 3D CMS Logo

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 private:
16  FWTracksterProxyBuilder(const FWTracksterProxyBuilder &) = delete; // stop default
17  const FWTracksterProxyBuilder &operator=(const FWTracksterProxyBuilder &) = delete; // stop default
18 
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",
ticl::Trackster::Vector
math::XYZVector Vector
Definition: Trackster.h:21
ticl::Trackster::barycenter
const Vector & barycenter() const
Definition: Trackster.h:134
Trackster.h
FWSimpleProxyBuilderTemplate.h
FWViewType::kAllRPZBits
static const int kAllRPZBits
Definition: FWViewType.h:67
REGISTER_FWPROXYBUILDER
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
Definition: FWProxyBuilderFactory.h:33
REGISTER_PROXYBUILDER_METHODS
#define REGISTER_PROXYBUILDER_METHODS()
Definition: register_dataproxybuilder_macro.h:27
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
FWTracksterProxyBuilder::~FWTracksterProxyBuilder
~FWTracksterProxyBuilder(void) override
Definition: FWTracksterProxyBuilder.cc:11
FWTracksterProxyBuilder
Definition: FWTracksterProxyBuilder.cc:8
FWProxyBuilderBase::setupAddElement
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
Definition: FWProxyBuilderBase.cc:350
FWProxyBuilderBase::build
void build()
Definition: FWProxyBuilderBase.cc:110
FWViewContext
Definition: FWViewContext.h:32
DDAxes::phi
FWViewType::k3DBit
Definition: FWViewType.h:50
ticl::Trackster::eigenvalues
const std::array< float, 3 > & eigenvalues() const
Definition: Trackster.h:135
FWSimpleProxyBuilderTemplate
Definition: FWSimpleProxyBuilderTemplate.h:30
ticl::Trackster
Definition: Trackster.h:19
FWTracksterProxyBuilder::operator=
const FWTracksterProxyBuilder & operator=(const FWTracksterProxyBuilder &)=delete
FWTracksterProxyBuilder::FWTracksterProxyBuilder
FWTracksterProxyBuilder(void)
Definition: FWTracksterProxyBuilder.cc:10