CMS 3D CMS Logo

FWSecVertexProxyBuilder.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 
16 // include files
19 
21 
22 class FWSecVertexProxyBuilder : public FWSimpleProxyBuilderTemplate<reco::SecondaryVertexTagInfo> {
23 public:
26 
28 
29 private:
30  FWSecVertexProxyBuilder(const FWSecVertexProxyBuilder&) = delete; // stop default
31  const FWSecVertexProxyBuilder& operator=(const FWSecVertexProxyBuilder&) = delete; // stop default
32 
33  // ---------- member data --------------------------------
35  void build(const reco::SecondaryVertexTagInfo& iData,
36  unsigned int iIndex,
37  TEveElement& oItemHolder,
38  const FWViewContext*) override;
39 };
40 
42  unsigned int iIndex,
43  TEveElement& oItemHolder,
44  const FWViewContext*) {
45  TEveGeoManagerHolder gmgr(TEveGeoShape::GetGeoMangeur());
46  TEvePointSet* pointSet = new TEvePointSet();
47  pointSet->SetMainColor(item()->defaultDisplayProperties().color());
48  for (unsigned int i = 0; i < iData.nVertices(); i++) {
49  const reco::Vertex& v = iData.secondaryVertex(i);
50  // do we need this stuff?
51  TGeoSphere* sphere = new TGeoSphere(0, 0.002); //would that leak?
52  TGeoTranslation position(v.x(), v.y(), v.z());
53  TEveGeoShape* shape = new TEveGeoShape();
54  sphere->SetBoxDimensions(2.5, 2.5, 2.5);
55  shape->SetShape(sphere);
56  shape->SetMainColor(item()->defaultDisplayProperties().color());
57  shape->SetMainTransparency(10);
58 
59  TEveTrans& t = shape->RefMainTrans();
60  reco::Vertex::Error e = v.error();
61  TMatrixDSym m(3);
62  for (int i = 0; i < 3; i++)
63  for (int j = 0; j < 3; j++) {
64  m(i, j) = e(i, j);
65  }
66  TMatrixDEigen eig(m);
67  TDecompSVD svd(m);
68  TMatrixD mm = svd.GetU();
69  // TMatrixD mm = eig.GetEigenVectors().Print();
70  for (int i = 0; i < 3; i++)
71  for (int j = 0; j < 3; j++) {
72  t(i + 1, j + 1) = mm(i, j);
73  }
74  TVectorD vv(eig.GetEigenValuesRe());
75  t.Scale(sqrt(vv(0)) * 1000., sqrt(vv(1)) * 1000., sqrt(vv(2)) * 1000.);
76  t.SetPos(v.x(), v.y(), v.z());
77 
78  setupAddElement(shape, &oItemHolder);
79 
80  pointSet->SetNextPoint(v.x(), v.y(), v.z());
81 
82  for (reco::Vertex::trackRef_iterator it = v.tracks_begin(), itEnd = v.tracks_end(); it != itEnd; ++it) {
83  const reco::Track& track = *it->get();
84  TEveRecTrack t;
85  t.fBeta = 1.;
86  t.fV = TEveVector(track.vx(), track.vy(), track.vz());
87  t.fP = TEveVector(track.px(), track.py(), track.pz());
88  t.fSign = track.charge();
89  TEveTrack* trk = new TEveTrack(&t, context().getTrackPropagator());
90  trk->SetMainColor(item()->defaultDisplayProperties().color());
91  trk->MakeTrack();
92  setupAddElement(trk, &oItemHolder);
93  }
94  }
95  setupAddElement(pointSet, &oItemHolder);
96 }
97 
100  "SecVertex",
reco::Vertex::trackRef_iterator
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
Definition: Vertex.h:38
mps_fire.i
i
Definition: mps_fire.py:428
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
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
FWSecVertexProxyBuilder::~FWSecVertexProxyBuilder
~FWSecVertexProxyBuilder() override
Definition: FWSecVertexProxyBuilder.cc:25
reco::Vertex::Error
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:44
reco::TemplatedSecondaryVertexTagInfo
Definition: TemplatedSecondaryVertexTagInfo.h:47
reco::TemplatedSecondaryVertexTagInfo::nVertices
unsigned int nVertices() const
Definition: TemplatedSecondaryVertexTagInfo.h:112
REGISTER_PROXYBUILDER_METHODS
#define REGISTER_PROXYBUILDER_METHODS()
Definition: register_dataproxybuilder_macro.h:28
FWSecVertexProxyBuilder::operator=
const FWSecVertexProxyBuilder & operator=(const FWSecVertexProxyBuilder &)=delete
findQualityFiles.v
v
Definition: findQualityFiles.py:179
SecondaryVertexTagInfo.h
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
reco::Track
Definition: Track.h:27
FWSecVertexProxyBuilder::FWSecVertexProxyBuilder
FWSecVertexProxyBuilder()
Definition: FWSecVertexProxyBuilder.cc:24
reco::TemplatedSecondaryVertexTagInfo::secondaryVertex
const VTX & secondaryVertex(unsigned int index) const
Definition: TemplatedSecondaryVertexTagInfo.h:107
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
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
FWEventItem.h
FWViewContext
Definition: FWViewContext.h:32
FWProxyBuilderBase::item
const FWEventItem * item() const
Definition: FWProxyBuilderBase.h:64
FWSecVertexProxyBuilder
Definition: FWSecVertexProxyBuilder.cc:22
FWViewType::k3DBit
Definition: FWViewType.h:50
FWProxyBuilderBase::context
const fireworks::Context & context() const
Definition: FWProxyBuilderBase.cc:412
FWSimpleProxyBuilderTemplate
Definition: FWSimpleProxyBuilderTemplate.h:30
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
reco::Vertex
Definition: Vertex.h:35
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37