ATLAS Offline Software
Loading...
Searching...
No Matches
VertexHandle Class Reference

#include <VertexHandle.h>

Inheritance diagram for VertexHandle:
Collaboration diagram for VertexHandle:

Classes

class  Imp

Public Member Functions

 VertexHandle (VertexCollHandle *, const xAOD::Vertex *vertex)
virtual ~VertexHandle ()
virtual bool has3DObjects ()
 Returns true if the 3D objects have been created.
virtual SoNode * nodes ()
 Returns the 3Dobjects.
SoMaterial * determineMaterial ()
 Should be implemented by children, in order to change the material depending on the interface etc.
void updateMaterial ()
 Called after some configuration related to material changes.
virtual void clear3DObjects ()
 Delete objects.
QStringList baseInfo () const
virtual QStringList clicked () const
 Called when user selects the node (stringlist is displayed in messagebox).
virtual QString shortInfo () const
 returns position & type information about vertex
virtual QString type () const
 return very short word with type (maybe link with collection type?)
QString vertexType () const
double getPositionX () const
double getPositionY () const
double getPositionZ () const
const AODSysCommonDatacommon () const
void setVisible (bool)
 use by the collection handle.
bool visible () const
const AODCollHandleBasecollHandle () const
virtual void update3DObjects ()
 Called after some configuration changes, or when the object is first created. Must be overloaded by children.
virtual void rebuild3DObjects ()
virtual void attach3DObjects ()
 Connect to the scene graph.
virtual void detach3DObjects ()
 Remove from the scene graph.
SoMaterial * currentMaterial () const
 Returns the current material of the handle.
virtual void fillObjectBrowser (QList< QTreeWidgetItem * > &list)
 Create and fill the object browser QTreeWidgetItem.
void updateObjectBrowser ()
 Update object browser QTreeWidgetItem.
QTreeWidgetItem * browserTreeItem () const
 Return the QTreeWidgetItem;.
virtual void dumpToJSON (std::ofstream &) const

Static Public Member Functions

static int numberOfInstances ()
static double unknown ()

Protected Member Functions

virtual void visibleStateChanged ()
 Dummy implementation does nothing.
virtual void currentMaterialChanged ()

Private Member Functions

 VertexHandle (const VertexHandle &)
VertexHandleoperator= (const VertexHandle &)

Private Attributes

Impm_d
bool m_visible
AODCollHandleBasem_collhandle
SoMaterial * m_currentmaterial

Friends

class AssocObjAttachmentHandle

Detailed Description

Definition at line 39 of file VertexHandle.h.

Constructor & Destructor Documentation

◆ VertexHandle() [1/2]

VertexHandle::VertexHandle ( VertexCollHandle * ch,
const xAOD::Vertex * vertex )

Definition at line 69 of file VertexHandle.cxx.

70 : AODHandleBase(ch), m_d(new Imp(this,vertex))
71{
72 m_d->collHandle=ch;
74}
AODHandleBase(AODCollHandleBase *)
static std::atomic< int > nvtxhandles

◆ ~VertexHandle()

VertexHandle::~VertexHandle ( )
virtual

Definition at line 77 of file VertexHandle.cxx.

78{
79 delete m_d;
81}

◆ VertexHandle() [2/2]

VertexHandle::VertexHandle ( const VertexHandle & )
private

Member Function Documentation

◆ attach3DObjects()

void AODHandleBase::attach3DObjects ( )
virtualinherited

Connect to the scene graph.

Definition at line 157 of file AODHandleBase.cxx.

158{
159 VP1Msg::messageVerbose("AODHandleBase::attach3DObjects");
160
161 if (!m_currentmaterial) {
163 m_currentmaterial->ref();
165 }
166 if (has3DObjects() && m_collhandle->sepHelper()) {
167 VP1Msg::messageVerbose("Adding nodes to sep helper...");
168
169 m_collhandle->common()->registerHandle(this);
170
171 // debug
172 // std::cout<<"m_collhandle->sepHelper() = " << m_collhandle->sepHelper()<<std::endl;
173 SoNode* tmp = nodes();
174 // std::cout << "tmp nodes = "<< tmp << std::endl;
175
176 // m_collhandle->sepHelper()->addNodeUnderMaterial( nodes(), m_currentmaterial );
177 m_collhandle->sepHelper()->addNodeUnderMaterial( tmp, m_currentmaterial );
178
179 } else {
180 if (!has3DObjects()) {
181 VP1Msg::message("AODHandleBase::attach3DObjects() - No 3D objects to attach!");
182 }
183 if (!m_collhandle->sepHelper()) VP1Msg::message("AODHandleBase::attach3DObjects() - No sep helper!");
184 }
185 // if (label_sep && theclass->common()->textSep() && theclass->common()->controller()->doTrackLabels())
186 // theclass->common()->textSep()->addChild(label_sep);
187 //
188}
virtual void currentMaterialChanged()
SoMaterial * m_currentmaterial
virtual SoNode * nodes()=0
Returns the 3Dobjects.
virtual bool has3DObjects()
Returns true if the 3D objects have been created.
virtual SoMaterial * determineMaterial()=0
Should be implemented by children, in order to change the material depending on the interface etc.
AODCollHandleBase * m_collhandle
static void messageVerbose(const QString &)
Definition VP1Msg.cxx:84
static void message(const QString &, IVP1System *sys=0)
Definition VP1Msg.cxx:30

◆ baseInfo()

QStringList VertexHandle::baseInfo ( ) const
virtual

Reimplemented from AODHandleBase.

Definition at line 155 of file VertexHandle.cxx.

156{
157 QStringList l;
158 l << shortInfo() ;
159 // vertex position
160 l << "Vx: " << VP1Msg::str(m_d->vertex->x()) << "Vy: " << VP1Msg::str(m_d->vertex->y()) << "Vz: " << VP1Msg::str(m_d->vertex->z());
161 return l;
162}
static QString str(const QString &s)
Definition VP1String.h:49
virtual QString shortInfo() const
returns position & type information about vertex
l
Printing final latex table to .tex output file.

◆ browserTreeItem()

QTreeWidgetItem * AODHandleBase::browserTreeItem ( ) const
inherited

Return the QTreeWidgetItem;.

Definition at line 311 of file AODHandleBase.cxx.

311 {
312 return m_d->m_objBrowseTree;
313}

◆ clear3DObjects()

void VertexHandle::clear3DObjects ( )
virtual

Delete objects.

Implements AODHandleBase.

Definition at line 97 of file VertexHandle.cxx.

97 {
98 // VP1Msg::messageVerbose("VertexHandle::clear3DObjects()");
99
100 if (m_d->sphere) {
101 m_d->sphere->unref();
102 m_d->sphere = 0;
103 }
104 if (m_d->sep) {
105 m_d->sep->unref();
106 m_d->sep = 0;
107 }
108
109}

◆ clicked()

QStringList VertexHandle::clicked ( ) const
virtual

Called when user selects the node (stringlist is displayed in messagebox).

Reimplementations should add info momInfo() to get momentum, eta, phi, pid,charge, mass printed.

Implements AODHandleBase.

Definition at line 209 of file VertexHandle.cxx.

210{
211 QStringList l;
212 l << "--Vertex:";
214 #ifndef BUILDVP1LIGHT
215 try {
216 l<< "Has "<<VP1Msg::str(m_d->vertex->vxTrackAtVertex ().size()) <<" associated tracks.";
217 } catch ( SG::ExcBadAuxVar& ) {
218 l<<"Vertex is missing links to tracks!";
219 }
220 #endif
221 return l;
222}
QStringList baseInfo() const

◆ collHandle()

const AODCollHandleBase * AODHandleBase::collHandle ( ) const
inlineinherited

Definition at line 55 of file AODHandleBase.h.

55{ return m_collhandle; }

◆ common()

const AODSysCommonData * AODHandleBase::common ( ) const
inherited

Definition at line 93 of file AODHandleBase.cxx.

94{
95 return std::as_const(m_collhandle)->common();
96}

◆ currentMaterial()

SoMaterial * AODHandleBase::currentMaterial ( ) const
inlineinherited

Returns the current material of the handle.

Definition at line 76 of file AODHandleBase.h.

76{ return m_currentmaterial; }

◆ currentMaterialChanged()

virtual void AODHandleBase::currentMaterialChanged ( )
inlineprotectedvirtualinherited

Definition at line 111 of file AODHandleBase.h.

111{};

◆ detach3DObjects()

void AODHandleBase::detach3DObjects ( )
virtualinherited

Remove from the scene graph.

Definition at line 191 of file AODHandleBase.cxx.

192{
193 VP1Msg::messageVerbose("AODHandleBase::detach3DObjects");
194
196 return;//Can never have been attached!
197 if (has3DObjects() && m_collhandle->sepHelper()) {
198 m_collhandle->sepHelper()->removeNodeUnderMaterial(nodes(),m_currentmaterial);
199 }
200
201 m_collhandle->common()->deregisterHandle(this);
202
203 // if (label_sep && theclass->common()->textSep())
204 // theclass->common()->textSep()->removeChild(label_sep);
205}

◆ determineMaterial()

SoMaterial * VertexHandle::determineMaterial ( )
virtual

Should be implemented by children, in order to change the material depending on the interface etc.

This will (by default) return the collection material.

Implements AODHandleBase.

Definition at line 148 of file VertexHandle.cxx.

148 {
149 // By default we use the collection material.
150 // std::cout<<"VertexHandle::determineMaterial() - collHandle()->material()"<<collHandle()->material()<<std::endl;
151 return collHandle()->material();
152}
const AODCollHandleBase * collHandle() const
SoMaterial * material() const

◆ dumpToJSON()

virtual void AODHandleBase::dumpToJSON ( std::ofstream & ) const
inlinevirtualinherited

◆ fillObjectBrowser()

void AODHandleBase::fillObjectBrowser ( QList< QTreeWidgetItem * > & list)
virtualinherited

Create and fill the object browser QTreeWidgetItem.

Reimplemented in IParticleHandle_CaloCluster, IParticleHandle_Electron, IParticleHandle_Jet, IParticleHandle_Muon, IParticleHandle_TrackParticle, and MissingEtHandle.

Definition at line 288 of file AODHandleBase.cxx.

288 {
289
290 VP1Msg::messageDebug("AODHandleBase::fillObjectBrowser()");
291
292 if (m_d->m_objBrowseTree){
293 VP1Msg::message("ERROR: AODHandleBase::fillObjectBrowser - already have m_objBrowseTree. Aborting.");
294 return;
295 }
296
297 m_d->m_objBrowseTree = new QTreeWidgetItem();
298
299 QString l = shortInfo();
300
301 m_d->m_objBrowseTree->setText(0, type()+QString(QString::number(listOfItems.size())) );
302 m_d->m_objBrowseTree->setText(1, l );
303
304 if (!visible()) {
305 m_d->m_objBrowseTree->setFlags(Qt::ItemFlags()); // not selectable, not enabled
306 }
307 listOfItems << browserTreeItem();
308}
virtual QString type() const
return very short word with type (maybe link with collection type?)
bool visible() const
QTreeWidgetItem * browserTreeItem() const
Return the QTreeWidgetItem;.
virtual QString shortInfo() const
returns mom and hit information about track
static void messageDebug(const QString &)
Definition VP1Msg.cxx:39

◆ getPositionX()

double VertexHandle::getPositionX ( ) const

Definition at line 189 of file VertexHandle.cxx.

189 {
190 return m_d->vertex->x();
191}

◆ getPositionY()

double VertexHandle::getPositionY ( ) const

Definition at line 193 of file VertexHandle.cxx.

193 {
194 return m_d->vertex->y();
195}

◆ getPositionZ()

double VertexHandle::getPositionZ ( ) const

Definition at line 197 of file VertexHandle.cxx.

197 {
198 return m_d->vertex->z();
199}

◆ has3DObjects()

bool VertexHandle::has3DObjects ( )
virtual

Returns true if the 3D objects have been created.

Reimplemented from AODHandleBase.

Definition at line 91 of file VertexHandle.cxx.

92{
93 return 0!=m_d->sep;
94}

◆ nodes()

SoNode * VertexHandle::nodes ( )
virtual

Returns the 3Dobjects.

Implements AODHandleBase.

Definition at line 112 of file VertexHandle.cxx.

112 {
113
114 VP1Msg::messageVerbose("VertexHandle::nodes()");
115
116 if (m_d->sep) {
117 VP1Msg::messageVerbose("d->sep already defined (" + VP1Msg::str(m_d->sep) + "). Returning d->sep.");
118 return m_d->sep; // FIXME - do we need to check if anything need to be redrawn?
119 }
120 if (!m_d->sep) {
121 VP1Msg::messageVerbose("d->sep not defined. Creating shapes and a new d->sep.");
122 m_d->sep = new SoSeparator();
123 m_d->sep->ref();
124 }
125
126 // SbVec3f origin(0.,0.,0.);
127 /* TODO: ask if origin info is present in xAOD, like in the old Jet class
128 if ( m_d->m_jet->origin() ) {
129 origin.setValue(m_d->m_jet->origin()->position().x(),
130 m_d->m_jet->origin()->position().y(),
131 m_d->m_jet->origin()->position().z());
132 }
133 */
134
135 VP1Msg::messageVerbose("creating the shapes");
136
137 SoTranslation * translation = new SoTranslation;
138 translation->translation.setValue ( m_d->vertex->x(), m_d->vertex->y(), m_d->vertex->z() );
139 m_d->sep->addChild ( translation );
140 m_d->sphere = new SoSphere;
141 m_d->sphere->radius = m_d->collHandle->collSettingsButton().vertexSize();
142 m_d->sep->addChild ( m_d->sphere );
143
144 return m_d->sep;
145}

◆ numberOfInstances()

int VertexHandle::numberOfInstances ( )
static

Definition at line 84 of file VertexHandle.cxx.

85{
86 return Imp::nvtxhandles;
87}

◆ operator=()

VertexHandle & VertexHandle::operator= ( const VertexHandle & )
private

◆ rebuild3DObjects()

void AODHandleBase::rebuild3DObjects ( )
virtualinherited

Definition at line 137 of file AODHandleBase.cxx.

138{
139 QString tmp2 = (m_visible==true)?"True":"False";
140 VP1Msg::messageDebug("AODHandleBase::rebuild3DObjects() - with m_visible="+tmp2 );
141
142 //Ensure we are always detached while updating.
143 if (m_visible) {
145 }
146
148 nodes(); // rebuilds the 3D shapes
149
150 //Attach if visible:
151 if (m_visible) {
153 }
154}
virtual void clear3DObjects()=0
Delete objects.
virtual void detach3DObjects()
Remove from the scene graph.
virtual void attach3DObjects()
Connect to the scene graph.

◆ setVisible()

void AODHandleBase::setVisible ( bool vis)
inherited

use by the collection handle.

Definition at line 99 of file AODHandleBase.cxx.

100{
101 QString tmp = (vis==true)?"True":"False";
102 QString tmp2 = (m_visible==true)?"True":"False";
103 VP1Msg::messageDebug(QString("AODHandleBase calling setVisible with vis=")+tmp+QString(", and m_visible=")+tmp2 );
104 if (vis==m_visible)
105 return;
106
107 m_visible=vis;
108 if (vis) {
109 m_collhandle->incrementNShownHandles();
110
111 if (!has3DObjects())
112 rebuild3DObjects();//The call to rebuild also fixes attached state.
113 else
115 } else {
116 m_collhandle->decrementNShownHandles();
118 }
119
121}
virtual void rebuild3DObjects()
virtual void visibleStateChanged()
Dummy implementation does nothing.

◆ shortInfo()

QString VertexHandle::shortInfo ( ) const
virtual

returns position & type information about vertex

Reimplemented from AODHandleBase.

Definition at line 203 of file VertexHandle.cxx.

203 {
204 QString l = vertexType();
205 return l;
206}
QString vertexType() const

◆ type()

virtual QString VertexHandle::type ( ) const
inlinevirtual

return very short word with type (maybe link with collection type?)

Reimplemented from AODHandleBase.

Definition at line 68 of file VertexHandle.h.

◆ unknown()

double AODHandleBase::unknown ( )
inlinestaticinherited

Definition at line 93 of file AODHandleBase.h.

93{ return -999.0; }

◆ update3DObjects()

void AODHandleBase::update3DObjects ( )
virtualinherited

Called after some configuration changes, or when the object is first created. Must be overloaded by children.

Definition at line 125 of file AODHandleBase.cxx.

126{
127 if (m_visible) {
129 } else {
130 //Simply clear the present 3D objects. They will only be recreated if/when the track/jet becomes visible again.
132 }
133}

◆ updateMaterial()

void VertexHandle::updateMaterial ( )

Called after some configuration related to material changes.

◆ updateObjectBrowser()

void AODHandleBase::updateObjectBrowser ( )
inlineinherited

Update object browser QTreeWidgetItem.

Definition at line 102 of file AODHandleBase.h.

102{};

◆ vertexType()

QString VertexHandle::vertexType ( ) const

Definition at line 165 of file VertexHandle.cxx.

165 {
166 using namespace xAOD;
167
168 switch (m_d->vertex->vertexType()){
170 return QString("Type: Dummy");
172 return QString("Type: Primary");
174 return QString("Type: Secondary");
176 return QString("Type: Pileup");
178 return QString("Type: Conversion");
180 return QString("Type: Kink");
182 return QString("Type: Not specified (default)");
183 default:
184 return QString("Unknown vertex type - probably VP1 needs updating!");
185 }
186}
@ KinkVtx
Kink vertex.
@ PileUp
Pile-up vertex.
@ ConvVtx
Conversion vertex.
@ NotSpecified
Default value, no explicit type set.
@ PriVtx
Primary vertex.
@ SecVtx
Secondary vertex.
@ NoVtx
Dummy vertex. TrackParticle was not used in vertex fit.

◆ visible()

bool AODHandleBase::visible ( ) const
inlineinherited

Definition at line 54 of file AODHandleBase.h.

54{ return m_visible; }

◆ visibleStateChanged()

void AODHandleBase::visibleStateChanged ( )
protectedvirtualinherited

Dummy implementation does nothing.

override if need to take action in this case.

Definition at line 316 of file AODHandleBase.cxx.

317{
318 if ( !browserTreeItem()) {
319 VP1Msg::messageVerbose("visibleStateChanged: No m_objBrowseTree!");
320 return;
321 }
322
323 if (!visible()) {
324 browserTreeItem()->setFlags(Qt::ItemFlags()); // not selectable, not enabled
325 } else {
326 browserTreeItem()->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); // selectable, enabled
327 }
328 QFont itemFont = browserTreeItem()->font(0);
329 itemFont.setStrikeOut(!visible());
330 browserTreeItem()->setFont(0, itemFont);
331 browserTreeItem()->setFont(1, itemFont);
332}

◆ AssocObjAttachmentHandle

friend class AssocObjAttachmentHandle
friend

Definition at line 81 of file VertexHandle.h.

Member Data Documentation

◆ m_collhandle

AODCollHandleBase* AODHandleBase::m_collhandle
privateinherited

Definition at line 126 of file AODHandleBase.h.

◆ m_currentmaterial

SoMaterial* AODHandleBase::m_currentmaterial
privateinherited

Definition at line 127 of file AODHandleBase.h.

◆ m_d

Imp* VertexHandle::m_d
private

Definition at line 83 of file VertexHandle.h.

◆ m_visible

bool AODHandleBase::m_visible
privateinherited

Definition at line 125 of file AODHandleBase.h.


The documentation for this class was generated from the following files: