ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
graphics
VP1
VP1Systems
VP1AODSystems
src
VertexHandle.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
7
// //
8
// Implementation of class VertexHandle //
9
// //
10
// //
12
13
#include "
VertexHandle.h
"
14
#include "
VertexCollHandle.h
"
15
#include "
VertexCollectionSettingsButton.h
"
16
#include "
VP1AODSystems/AODSystemController.h
"
17
#include "
VP1AODSystems/VP1AODSystem.h
"
18
#include "
VP1Utils/VP1LinAlgUtils.h
"
19
20
#include "
VP1Utils/VP1JobConfigInfo.h
"
21
#include "
VP1Base/VP1ExtraSepLayerHelper.h
"
22
#include "
VP1Base/VP1Msg.h
"
23
#include "
VP1Base/VP1MaterialButton.h
"
24
#include "
VP1Base/VP1QtUtils.h
"
25
26
#include "
VP1Utils/SurfaceToSoNode.h
"
27
28
#include <Inventor/C/errors/debugerror.h>
29
#include <Inventor/nodes/SoLineSet.h>
30
#include <Inventor/nodes/SoVertexProperty.h>
31
#include <Inventor/nodes/SoSeparator.h>
32
#include <Inventor/nodes/SoMaterial.h>
33
#include <Inventor/nodes/SoPickStyle.h>
34
#include <Inventor/nodes/SoSphere.h>
35
#include <Inventor/nodes/SoMatrixTransform.h>
36
#include <Inventor/SbRotation.h>
37
#include <Inventor/SbMatrix.h>
38
#include <Inventor/nodes/SoTranslation.h>
39
#include <Inventor/nodes/SoText2.h>
40
41
#include "
GeoPrimitives/AmgStringHelpers.h
"
42
#include "
GeoPrimitives/GeoPrimitives.h
"
43
44
#include <cassert>
45
46
//____________________________________________________________________
47
class
VertexHandle::Imp
{
48
public
:
49
static
double
dist
(
const
SbVec3f& p1,
const
SbVec3f& p2);
50
51
static
std::atomic<int>
nvtxhandles
;
52
53
Imp
(
VertexHandle
*
tc
,
const
xAOD::Vertex
* vtx) :
theclass
(
tc
),
vertex
(vtx),
collHandle
(nullptr),
sep
(nullptr),
sphere
(nullptr){}
54
~Imp
() { }
55
VertexHandle
*
theclass
;
56
const
xAOD::Vertex
*
vertex
;
57
VertexCollHandle
*
collHandle
;
58
59
SoSeparator *
sep
;
// everything hangs from this.
60
SoSphere *
sphere
;
//This represents the cone representing the jet.
61
};
62
63
64
//____________________________________________________________________
65
std::atomic<int>
VertexHandle::Imp::nvtxhandles
= 0;
66
67
//____________________________________________________________________
68
VertexHandle::VertexHandle
(
VertexCollHandle
*ch,
const
xAOD::Vertex
*vertex)
69
:
AODHandleBase
(ch),
m_d
(new
Imp
(this,vertex))
70
{
71
m_d
->collHandle=ch;
72
++
Imp::nvtxhandles
;
73
}
74
75
//____________________________________________________________________
76
VertexHandle::~VertexHandle
()
77
{
78
delete
m_d
;
79
--
Imp::nvtxhandles
;
80
}
81
82
//____________________________________________________________________
83
int
VertexHandle::numberOfInstances
()
84
{
85
return
Imp::nvtxhandles
;
86
}
87
88
89
//____________________________________________________________________
90
bool
VertexHandle::has3DObjects
()
91
{
92
return
0!=
m_d
->sep;
93
}
94
95
//____________________________________________________________________
96
void
VertexHandle::clear3DObjects
(){
97
// VP1Msg::messageVerbose("VertexHandle::clear3DObjects()");
98
99
if
(
m_d
->sphere) {
100
m_d
->sphere->unref();
101
m_d
->sphere = 0;
102
}
103
if
(
m_d
->sep) {
104
m_d
->sep->unref();
105
m_d
->sep = 0;
106
}
107
108
}
109
110
//____________________________________________________________________
111
SoNode*
VertexHandle::nodes
(){
112
113
VP1Msg::messageVerbose
(
"VertexHandle::nodes()"
);
114
115
if
(
m_d
->sep) {
116
VP1Msg::messageVerbose
(
"d->sep already defined ("
+
VP1Msg::str
(
m_d
->sep) +
"). Returning d->sep."
);
117
return
m_d
->sep;
// FIXME - do we need to check if anything need to be redrawn?
118
}
119
if
(!
m_d
->sep) {
120
VP1Msg::messageVerbose
(
"d->sep not defined. Creating shapes and a new d->sep."
);
121
m_d
->sep =
new
SoSeparator();
122
m_d
->sep->ref();
123
}
124
125
// SbVec3f origin(0.,0.,0.);
126
/* TODO: ask if origin info is present in xAOD, like in the old Jet class
127
if ( m_d->m_jet->origin() ) {
128
origin.setValue(m_d->m_jet->origin()->position().x(),
129
m_d->m_jet->origin()->position().y(),
130
m_d->m_jet->origin()->position().z());
131
}
132
*/
133
134
VP1Msg::messageVerbose
(
"creating the shapes"
);
135
136
SoTranslation * translation =
new
SoTranslation;
137
translation->translation.setValue (
m_d
->vertex->x(),
m_d
->vertex->y(),
m_d
->vertex->z() );
138
m_d
->sep->addChild ( translation );
139
m_d
->sphere =
new
SoSphere;
140
m_d
->sphere->radius =
m_d
->collHandle->collSettingsButton().vertexSize();
141
m_d
->sep->addChild (
m_d
->sphere );
142
143
return
m_d
->sep;
144
}
145
146
//____________________________________________________________________
147
SoMaterial *
VertexHandle::determineMaterial
() {
148
// By default we use the collection material.
149
// std::cout<<"VertexHandle::determineMaterial() - collHandle()->material()"<<collHandle()->material()<<std::endl;
150
return
collHandle
()->
material
();
151
}
152
153
//____________________________________________________________________
154
QStringList
VertexHandle::baseInfo
()
const
155
{
156
QStringList l;
157
l <<
shortInfo
() ;
158
// vertex position
159
l <<
"Vx: "
<<
VP1Msg::str
(
m_d
->vertex->x()) <<
"Vy: "
<<
VP1Msg::str
(
m_d
->vertex->y()) <<
"Vz: "
<<
VP1Msg::str
(
m_d
->vertex->z());
160
return
l;
161
}
162
163
//____________________________________________________________________
164
QString
VertexHandle::vertexType
()
const
{
165
using namespace
xAOD
;
166
167
switch
(
m_d
->vertex->vertexType()){
168
case
xAOD::VxType::NoVtx
:
169
return
QString(
"Type: Dummy"
);
170
case
xAOD::VxType::PriVtx
:
171
return
QString(
"Type: Primary"
);
172
case
xAOD::VxType::SecVtx
:
173
return
QString(
"Type: Secondary"
);
174
case
xAOD::VxType::PileUp
:
175
return
QString(
"Type: Pileup"
);
176
case
xAOD::VxType::ConvVtx
:
177
return
QString(
"Type: Conversion"
);
178
case
xAOD::VxType::KinkVtx
:
179
return
QString(
"Type: Kink"
);
180
case
xAOD::VxType::NotSpecified
:
181
return
QString(
"Type: Not specified (default)"
);
182
default
:
183
return
QString(
"Unknown vertex type - probably VP1 needs updating!"
);
184
}
185
}
186
187
//____________________________________________________________________
188
double
VertexHandle::getPositionX
()
const
{
189
return
m_d
->vertex->x();
190
}
191
//____________________________________________________________________
192
double
VertexHandle::getPositionY
()
const
{
193
return
m_d
->vertex->y();
194
}
195
//____________________________________________________________________
196
double
VertexHandle::getPositionZ
()
const
{
197
return
m_d
->vertex->z();
198
}
199
200
201
//____________________________________________________________________
202
QString
VertexHandle::shortInfo
()
const
{
203
QString l =
vertexType
();
204
return
l;
205
}
206
207
//____________________________________________________________________
208
QStringList
VertexHandle::clicked
()
const
209
{
210
QStringList l;
211
l <<
"--Vertex:"
;
212
l <<
VertexHandle::baseInfo
();
213
#ifndef BUILDVP1LIGHT
214
try
{
215
l<<
"Has "
<<
VP1Msg::str
(
m_d
->vertex->vxTrackAtVertex ().size()) <<
" associated tracks."
;
216
}
catch
(
SG::ExcBadAuxVar
& ) {
217
l<<
"Vertex is missing links to tracks!"
;
218
}
219
#endif
220
return
l;
221
}
222
223
224
225
AODSystemController.h
AmgStringHelpers.h
GeoPrimitives.h
tc
static Double_t tc
Definition
LArPhysWaveHECTool.cxx:38
SurfaceToSoNode.h
VP1AODSystem.h
VP1ExtraSepLayerHelper.h
VP1JobConfigInfo.h
VP1LinAlgUtils.h
VP1MaterialButton.h
VP1Msg.h
VP1QtUtils.h
VertexCollHandle.h
VertexCollectionSettingsButton.h
VertexHandle.h
AODHandleBase::collHandle
const AODCollHandleBase * collHandle() const
Definition
AODHandleBase.h:55
AODHandleBase::AODHandleBase
AODHandleBase(AODCollHandleBase *)
Definition
AODHandleBase.cxx:73
SG::ExcBadAuxVar
Exception — Attempt to retrieve nonexistent aux data item.
Definition
Control/AthContainers/AthContainers/exceptions.h:59
VP1Msg::messageVerbose
static void messageVerbose(const QString &)
Definition
VP1Msg.cxx:84
VP1StdCollection::material
SoMaterial * material() const
Definition
VP1StdCollection.cxx:220
VP1String::str
static QString str(const QString &s)
Definition
VP1String.h:49
VertexCollHandle
Definition
VertexCollHandle.h:42
VertexHandle::Imp
Definition
VertexHandle.cxx:47
VertexHandle::Imp::vertex
const xAOD::Vertex * vertex
Definition
VertexHandle.cxx:56
VertexHandle::Imp::sphere
SoSphere * sphere
Definition
VertexHandle.cxx:60
VertexHandle::Imp::sep
SoSeparator * sep
Definition
VertexHandle.cxx:59
VertexHandle::Imp::~Imp
~Imp()
Definition
VertexHandle.cxx:54
VertexHandle::Imp::dist
static double dist(const SbVec3f &p1, const SbVec3f &p2)
VertexHandle::Imp::nvtxhandles
static std::atomic< int > nvtxhandles
Definition
VertexHandle.cxx:51
VertexHandle::Imp::theclass
VertexHandle * theclass
Definition
VertexHandle.cxx:55
VertexHandle::Imp::Imp
Imp(VertexHandle *tc, const xAOD::Vertex *vtx)
Definition
VertexHandle.cxx:53
VertexHandle::Imp::collHandle
VertexCollHandle * collHandle
Definition
VertexHandle.cxx:57
VertexHandle::m_d
Imp * m_d
Definition
VertexHandle.h:83
VertexHandle::nodes
virtual SoNode * nodes()
Returns the 3Dobjects.
Definition
VertexHandle.cxx:111
VertexHandle::clear3DObjects
virtual void clear3DObjects()
Delete objects.
Definition
VertexHandle.cxx:96
VertexHandle::determineMaterial
SoMaterial * determineMaterial()
Should be implemented by children, in order to change the material depending on the interface etc.
Definition
VertexHandle.cxx:147
VertexHandle::VertexHandle
VertexHandle(VertexCollHandle *, const xAOD::Vertex *vertex)
Definition
VertexHandle.cxx:68
VertexHandle::baseInfo
QStringList baseInfo() const
Definition
VertexHandle.cxx:154
VertexHandle::getPositionZ
double getPositionZ() const
Definition
VertexHandle.cxx:196
VertexHandle::vertexType
QString vertexType() const
Definition
VertexHandle.cxx:164
VertexHandle::getPositionX
double getPositionX() const
Definition
VertexHandle.cxx:188
VertexHandle::clicked
virtual QStringList clicked() const
Called when user selects the node (stringlist is displayed in messagebox).
Definition
VertexHandle.cxx:208
VertexHandle::getPositionY
double getPositionY() const
Definition
VertexHandle.cxx:192
VertexHandle::numberOfInstances
static int numberOfInstances()
Definition
VertexHandle.cxx:83
VertexHandle::has3DObjects
virtual bool has3DObjects()
Returns true if the 3D objects have been created.
Definition
VertexHandle.cxx:90
VertexHandle::shortInfo
virtual QString shortInfo() const
returns position & type information about vertex
Definition
VertexHandle.cxx:202
VertexHandle::~VertexHandle
virtual ~VertexHandle()
Definition
VertexHandle.cxx:76
xAOD::VxType::KinkVtx
@ KinkVtx
Kink vertex.
Definition
TrackingPrimitives.h:595
xAOD::VxType::PileUp
@ PileUp
Pile-up vertex.
Definition
TrackingPrimitives.h:592
xAOD::VxType::ConvVtx
@ ConvVtx
Conversion vertex.
Definition
TrackingPrimitives.h:593
xAOD::VxType::NotSpecified
@ NotSpecified
Default value, no explicit type set.
Definition
TrackingPrimitives.h:596
xAOD::VxType::PriVtx
@ PriVtx
Primary vertex.
Definition
TrackingPrimitives.h:590
xAOD::VxType::SecVtx
@ SecVtx
Secondary vertex.
Definition
TrackingPrimitives.h:591
xAOD::VxType::NoVtx
@ NoVtx
Dummy vertex. TrackParticle was not used in vertex fit.
Definition
TrackingPrimitives.h:589
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition
ICaloAffectedTool.h:24
xAOD::Vertex
Vertex_v1 Vertex
Define the latest version of the vertex class.
Definition
Event/xAOD/xAODTracking/xAODTracking/Vertex.h:16
Generated on
for ATLAS Offline Software by
1.17.0