CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
FWSecVertexCandidateProxyBuilder.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 #include <vector>
4 
5 #include "TMatrixDEigen.h"
6 #include "TMatrixDSym.h"
7 #include "TDecompSVD.h"
8 #include "TEveTrans.h"
9 #include "TEveTrack.h"
10 #include "TGeoSphere.h"
11 #include "TGeoMatrix.h"
12 #include "TEveGeoNode.h"
13 #include "TEveGeoShape.h"
14 #include "TEveVSDStructs.h"
15 
17 
18 // include files
21 
23 
24 class FWSecVertexCandidateProxyBuilder : public FWSimpleProxyBuilderTemplate<reco::CandSecondaryVertexTagInfo> {
25 public:
28 
30 
32  const FWSecVertexCandidateProxyBuilder& operator=(const FWSecVertexCandidateProxyBuilder&) = delete; // stop default
33 
34 private:
35  // ---------- member data --------------------------------
37  void build(const reco::CandSecondaryVertexTagInfo& iData,
38  unsigned int iIndex,
39  TEveElement& oItemHolder,
40  const FWViewContext*) override;
41 };
42 
44  unsigned int iIndex,
45  TEveElement& oItemHolder,
46  const FWViewContext*) {
47  TEveGeoManagerHolder gmgr(TEveGeoShape::GetGeoMangeur());
48  TEvePointSet* pointSet = new TEvePointSet();
49  pointSet->SetMainColor(item()->defaultDisplayProperties().color());
50  for (unsigned int i = 0; i < iData.nVertices(); i++) {
52  // do we need this stuff?
53  TGeoSphere* sphere = new TGeoSphere(0, 0.002); //would that leak?
54  TGeoTranslation position(v.vx(), v.vy(), v.vz());
55  TEveGeoShape* shape = new TEveGeoShape();
56  sphere->SetBoxDimensions(2.5, 2.5, 2.5);
57  shape->SetShape(sphere);
58  shape->SetMainColor(item()->defaultDisplayProperties().color());
59  shape->SetMainTransparency(10);
60 
61  TEveTrans& t = shape->RefMainTrans();
63  TMatrixDSym m(3);
64  for (int i = 0; i < 3; i++)
65  for (int j = 0; j < 3; j++) {
66  m(i, j) = e(i, j);
67  }
68  TMatrixDEigen eig(m);
69  TDecompSVD svd(m);
70  TMatrixD mm = svd.GetU();
71  // TMatrixD mm = eig.GetEigenVectors().Print();
72  for (int i = 0; i < 3; i++)
73  for (int j = 0; j < 3; j++) {
74  t(i + 1, j + 1) = mm(i, j);
75  }
76  TVectorD vv(eig.GetEigenValuesRe());
77  t.Scale(sqrt(vv(0)) * 1000., sqrt(vv(1)) * 1000., sqrt(vv(2)) * 1000.);
78  t.SetPos(v.vx(), v.vy(), v.vz());
79 
80  setupAddElement(shape, &oItemHolder);
81 
82  pointSet->SetNextPoint(v.vx(), v.vy(), v.vz());
83 
84  for (unsigned int j = 0; j < v.numberOfDaughters(); j++) {
85  const reco::Candidate* c = v.daughter(j);
86  std::cout << c << std::endl;
87  TEveTrack* trk = fireworks::prepareCandidate(*c, context().getTrackPropagator());
88 
89  trk->SetMainColor(item()->defaultDisplayProperties().color());
90  trk->MakeTrack();
91  setupAddElement(trk, &oItemHolder);
92  }
93  }
94  setupAddElement(pointSet, &oItemHolder);
95 }
96 
99  "SecVertexCand",
const fireworks::Context & context() const
#define REGISTER_PROXYBUILDER_METHODS()
const edm::EventSetup & c
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
static const int kAllRPZBits
Definition: FWViewType.h:67
double vz() const override
z coordinate of vertex position
const VTX & secondaryVertex(unsigned int index) const
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
double vy() const override
y coordinate of vertex position
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:44
const FWEventItem * item() const
T sqrt(T t)
Definition: SSEVec.h:19
double vx() const override
x coordinate of vertex position
size_t numberOfDaughters() const override
number of daughters
TEveTrack * prepareCandidate(const reco::Candidate &track, TEveTrackPropagator *propagator)
static int position[264][3]
Definition: ReadPGInfo.cc:289
tuple cout
Definition: gather_cfg.py:144
const Candidate * daughter(size_type) const override
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
const FWSecVertexCandidateProxyBuilder & operator=(const FWSecVertexCandidateProxyBuilder &)=delete