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 "TEveVSDStructs.h"
14 
16 
17 // include files
20 
22 
23 class FWSecVertexCandidateProxyBuilder : public FWSimpleProxyBuilderTemplate<reco::CandSecondaryVertexTagInfo> {
24 public:
27 
29 
30 private:
32  const FWSecVertexCandidateProxyBuilder& operator=(const FWSecVertexCandidateProxyBuilder&) = delete; // stop default
33 
34  // ---------- member data --------------------------------
36  void build(const reco::CandSecondaryVertexTagInfo& iData,
37  unsigned int iIndex,
38  TEveElement& oItemHolder,
39  const FWViewContext*) override;
40 };
41 
43  unsigned int iIndex,
44  TEveElement& oItemHolder,
45  const FWViewContext*) {
46  TEveGeoManagerHolder gmgr(TEveGeoShape::GetGeoMangeur());
47  TEvePointSet* pointSet = new TEvePointSet();
48  pointSet->SetMainColor(item()->defaultDisplayProperties().color());
49  for (unsigned int i = 0; i < iData.nVertices(); i++) {
51  // do we need this stuff?
52  TGeoSphere* sphere = new TGeoSphere(0, 0.002); //would that leak?
53  TGeoTranslation position(v.vx(), v.vy(), v.vz());
54  TEveGeoShape* shape = new TEveGeoShape();
55  sphere->SetBoxDimensions(2.5, 2.5, 2.5);
56  shape->SetShape(sphere);
57  shape->SetMainColor(item()->defaultDisplayProperties().color());
58  shape->SetMainTransparency(10);
59 
60  TEveTrans& t = shape->RefMainTrans();
61  reco::Vertex::Error e = v.error();
62  TMatrixDSym m(3);
63  for (int i = 0; i < 3; i++)
64  for (int j = 0; j < 3; j++) {
65  m(i, j) = e(i, j);
66  }
67  TMatrixDEigen eig(m);
68  TDecompSVD svd(m);
69  TMatrixD mm = svd.GetU();
70  // TMatrixD mm = eig.GetEigenVectors().Print();
71  for (int i = 0; i < 3; i++)
72  for (int j = 0; j < 3; j++) {
73  t(i + 1, j + 1) = mm(i, j);
74  }
75  TVectorD vv(eig.GetEigenValuesRe());
76  t.Scale(sqrt(vv(0)) * 1000., sqrt(vv(1)) * 1000., sqrt(vv(2)) * 1000.);
77  t.SetPos(v.vx(), v.vy(), v.vz());
78 
79  setupAddElement(shape, &oItemHolder);
80 
81  pointSet->SetNextPoint(v.vx(), v.vy(), v.vz());
82 
83  for (unsigned int j = 0; j < v.numberOfDaughters(); j++) {
84  const reco::Candidate* c = v.daughter(j);
85  std::cout << c << std::endl;
86  TEveTrack* trk = fireworks::prepareCandidate(*c, context().getTrackPropagator());
87 
88  trk->SetMainColor(item()->defaultDisplayProperties().color());
89  trk->MakeTrack();
90  setupAddElement(trk, &oItemHolder);
91  }
92  }
93  setupAddElement(pointSet, &oItemHolder);
94 }
95 
98  "SecVertexCand",
mps_fire.i
i
Definition: mps_fire.py:355
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
OrderedSet.t
t
Definition: OrderedSet.py:90
reco::TemplatedSecondaryVertexTagInfo::secondaryVertex
const VTX & secondaryVertex(unsigned int index) const
Definition: TemplatedSecondaryVertexTagInfo.h:107
FWSecVertexCandidateProxyBuilder::FWSecVertexCandidateProxyBuilder
FWSecVertexCandidateProxyBuilder()
Definition: FWSecVertexCandidateProxyBuilder.cc:25
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:23
FWSimpleProxyBuilderTemplate
Definition: FWSimpleProxyBuilderTemplate.h:30
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
FWSecVertexCandidateProxyBuilder::~FWSecVertexCandidateProxyBuilder
~FWSecVertexCandidateProxyBuilder() override
Definition: FWSecVertexCandidateProxyBuilder.cc:26
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37