ATLAS Offline Software
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 //____________________________________________________________________
33 public:
34  std::map<SoNode*,AODHandleBase*> nodeToHandle;
36 };
37 
38 //____________________________________________________________________
40  : VP1HelperClassBase(sys,"AODSysCommonData"), m_d(new Imp), m_3dsystem(sys),
41  m_controller(controller), m_extrapolator(0)
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 
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 
104 SoNode* 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;
109  for (; it!=itEnd;++it)
110  if (it->second->browserTreeItem()==item) return it->first;
111  return 0;
112 }
113 
114 
115 
118 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
AODSysCommonData::getHandleFromNode
AODHandleBase * getHandleFromNode(SoNode *node)
Definition: AODSysCommonData.cxx:79
athena.path
path
python interpreter configuration --------------------------------------—
Definition: athena.py:128
IParticle.h
AODHandleBase
Definition: AODHandleBase.h:43
VP1AODSystem
Definition: VP1AODSystem.h:34
AODSysCommonData::Imp::last_selectedHandle
AODHandleBase * last_selectedHandle
Definition: AODSysCommonData.cxx:35
CSV_InDetExporter.new
new
Definition: CSV_InDetExporter.py:145
AODSystemController.h
skel.it
it
Definition: skel.GENtoEVGEN.py:396
AODSysCommonData::Imp::nodeToHandle
std::map< SoNode *, AODHandleBase * > nodeToHandle
Definition: AODSysCommonData.cxx:34
VP1String::str
static QString str(const QString &s)
Definition: VP1String.h:49
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
AODSysCommonData::Imp
Definition: AODSysCommonData.cxx:32
lumiFormat.i
int i
Definition: lumiFormat.py:85
AODSysCommonData::AODSysCommonData
AODSysCommonData(VP1AODSystem *sys, AODSystemController *)
Definition: AODSysCommonData.cxx:39
beamspotman.n
n
Definition: beamspotman.py:731
extractSporadic.h
list h
Definition: extractSporadic.py:97
AODSystemController
Definition: AODSystemController.h:43
hist_file_dump.f
f
Definition: hist_file_dump.py:135
AODSysCommonData::setLastSelectedHandle
void setLastSelectedHandle(AODHandleBase *h)
Definition: AODSysCommonData.cxx:116
VP1AODSystem.h
AODSysCommonData::deregisterHandle
void deregisterHandle(AODHandleBase *h)
Definition: AODSysCommonData.cxx:67
VP1HelperClassBase
Definition: VP1HelperClassBase.h:28
AODSysCommonData.h
AODSysCommonData::~AODSysCommonData
virtual ~AODSysCommonData()
Definition: AODSysCommonData.cxx:54
AODSysCommonData::getNodeFromBrowser
SoNode * getNodeFromBrowser(QTreeWidgetItem *item)
Definition: AODSysCommonData.cxx:104
item
Definition: ItemListSvc.h:43
AODSysCommonData::m_d
Imp * m_d
Definition: AODSysCommonData.h:72
h
AODHandleBase.h
AODSysCommonData::m_singlePoint
SoPointSet * m_singlePoint
Definition: AODSysCommonData.h:77
VP1HelperClassBase::message
void message(const QString &) const
Definition: VP1HelperClassBase.cxx:49
AODSysCommonData::registerHandle
void registerHandle(AODHandleBase *h)
Definition: AODSysCommonData.cxx:60
node
Definition: memory_hooks-stdcmalloc.h:74