CMS 3D CMS Logo

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 
31 private:
33  const FWSecVertexCandidateProxyBuilder& operator=(const FWSecVertexCandidateProxyBuilder&) = delete; // stop default
34 
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();
62  reco::Vertex::Error e = v.error();
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",
mps_fire.i
i
Definition: mps_fire.py:428
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
reco::Vertex::Error
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:44
gather_cfg.cout
cout
Definition: gather_cfg.py:144
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
findQualityFiles.v
v
Definition: findQualityFiles.py:179
reco::VertexCompositePtrCandidate
Definition: VertexCompositePtrCandidate.h:16
FWSecVertexCandidateProxyBuilder::operator=
const FWSecVertexCandidateProxyBuilder & operator=(const FWSecVertexCandidateProxyBuilder &)=delete
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
reco::TemplatedSecondaryVertexTagInfo::secondaryVertex
const VTX & secondaryVertex(unsigned int index) const
Definition: TemplatedSecondaryVertexTagInfo.h:107
FWSecVertexCandidateProxyBuilder::FWSecVertexCandidateProxyBuilder
FWSecVertexCandidateProxyBuilder()
Definition: FWSecVertexCandidateProxyBuilder.cc:26
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
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
FWProxyBuilderBase::build
void build()
Definition: FWProxyBuilderBase.cc:110
FWEventItem.h
FWViewContext
Definition: FWViewContext.h:32
CandSecondaryVertexTagInfo.h
reco::Candidate
Definition: Candidate.h:27
FWProxyBuilderBase::item
const FWEventItem * item() const
Definition: FWProxyBuilderBase.h:64
CandidateUtils.h
fireworks::prepareCandidate
TEveTrack * prepareCandidate(const reco::Candidate &track, TEveTrackPropagator *propagator)
Definition: CandidateUtils.cc:9
FWViewType::k3DBit
Definition: FWViewType.h:50
FWProxyBuilderBase::context
const fireworks::Context & context() const
Definition: FWProxyBuilderBase.cc:412
FWSecVertexCandidateProxyBuilder
Definition: FWSecVertexCandidateProxyBuilder.cc:24
FWSimpleProxyBuilderTemplate
Definition: FWSimpleProxyBuilderTemplate.h:30
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
FWSecVertexCandidateProxyBuilder::~FWSecVertexCandidateProxyBuilder
~FWSecVertexCandidateProxyBuilder() override
Definition: FWSecVertexCandidateProxyBuilder.cc:27
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37