ATLAS Offline Software
Loading...
Searching...
No Matches
AODSysCommonData.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5
7// //
8// Implementation of class AODSysCommonData //
9// //
10// Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
11// Initial version: April 2008 //
12// //
14
15#include "AODSysCommonData.h"
18#include "AODHandleBase.h"
19
20#include <Inventor/C/errors/debugerror.h>
21#include <Inventor/nodes/SoVertexProperty.h>
22#include <Inventor/nodes/SoPointSet.h>
23#include <Inventor/nodes/SoSeparator.h>
24
25#include <QTreeWidgetItem>
26
27#include<map>
28#include "xAODBase/IParticle.h"
29#include <Inventor/SoPath.h>
30
31//____________________________________________________________________
33public:
34 std::map<SoNode*,AODHandleBase*> nodeToHandle;
36};
37
38//____________________________________________________________________
40 : VP1HelperClassBase(sys,"AODSysCommonData"), m_d(new Imp), m_3dsystem(sys),
42{
43 m_singlePoint = new SoPointSet;
44 m_singlePoint->ref();
45 SoVertexProperty * vertices = new SoVertexProperty;
46 vertices->vertex.set1Value(0,0.0f,0.0f,0.0f);
47 m_singlePoint->numPoints=1;
48 m_singlePoint->vertexProperty.setValue(vertices);
49
50 m_d->last_selectedHandle=0;
51}
52
53//____________________________________________________________________
55{
56 m_singlePoint->unref();
57 delete m_d;
58}
59
61 // if (m_d->nodeToHandle.find(node)!=m_d->nodeToHandle.end()){
62 // messageVerbose("AODSysCommonData::registerHandle - handle already registered.");
63 // }
64 m_d->nodeToHandle[h->nodes()]=h;
65}
66
68 // if (m_d->nodeToTrackHandle.find(node)==m_d->nodeToHandle.end()){
69 // message("AODSysCommonData::deregisterHandle - handle not registered!");
70 // }
71
72 for (auto it : m_d->nodeToHandle) {
73 if (it.second == h) {
74 m_d->nodeToHandle.erase(it.first);
75 break;
76 }
77 }
78}
80 auto it = m_d->nodeToHandle.find(node);
81 if (it==m_d->nodeToHandle.end()){
82 message("AODSysCommonData::getHandleFromNode - handle not registered!");
83 message("AODSysCommonData::getHandleFromNode - have this many handles:"+str(m_d->nodeToHandle.size()));
84
85 return 0;
86 }
87 return it->second;
88}
89
90//____________________________________________________________________
92 const int n(path?path->getLength():0);
93 AODHandleBase * handle(0);
94 for (int i = 0; i < n; ++i) {
95 if (path->getNodeFromTail(i)->getTypeId()==SoSeparator::getClassTypeId()) {
96 handle = getHandleFromNode(static_cast<SoSeparator*>(path->getNodeFromTail(i)));
97 if (handle)
98 return handle;
99 }
100 }
101 return 0;
102}
103
104SoNode* AODSysCommonData::getNodeFromBrowser( QTreeWidgetItem* item ){
105 message("AODSysCommonData::getNodeFromBrowser - about to loop over this many handles:"+str(m_d->nodeToHandle.size()));
106 if (!item)
107 return 0;
108 std::map<SoNode*,AODHandleBase*>::iterator it = m_d->nodeToHandle.begin(), itEnd=m_d->nodeToHandle.end();
109 for (; it!=itEnd;++it)
110 if (it->second->browserTreeItem()==item) return it->first;
111 return 0;
112}
113
114
115
117 m_d->last_selectedHandle=h;
118}
std::map< SoNode *, AODHandleBase * > nodeToHandle
AODHandleBase * last_selectedHandle
SoPointSet * m_singlePoint
const AODSystemController * controller() const
void registerHandle(AODHandleBase *h)
VP1AODSystem * m_3dsystem
AODHandleBase * getHandleFromNode(SoNode *node)
void deregisterHandle(AODHandleBase *h)
SoNode * getNodeFromBrowser(QTreeWidgetItem *item)
Trk::IExtrapolationEngine * m_extrapolator
void setLastSelectedHandle(AODHandleBase *h)
AODSystemController * m_controller
AODSysCommonData(VP1AODSystem *sys, AODSystemController *)
Header file for AthHistogramAlgorithm.
VP1HelperClassBase(IVP1System *sys=0, QString helpername="")
void message(const QString &) const
Definition node.h:24