ATLAS Offline Software
TrackSysCommonData.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 TrackSysCommonData //
9 // //
10 // Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
11 // Initial version: April 2008 //
12 // //
14 
16 
25 
28 
30 
32 #include "VP1Base/VP1Msg.h"
34 
35 #include <Inventor/C/errors/debugerror.h>
36 #include <Inventor/nodes/SoVertexProperty.h>
37 #include <Inventor/nodes/SoPointSet.h>
38 #include <Inventor/nodes/SoSeparator.h>
39 
40 #include <QTreeWidgetItem>
41 
42 #include<map>
43 
44 //____________________________________________________________________
46 public:
47  std::map<SoNode*,TrackHandleBase*> nodeToTrackHandle;
48 };
49 
50 //____________________________________________________________________
52  : VP1HelperClassBase(sys,"TrackSysCommonData"), m_textSep(nullptr), m_d(new Imp),
53  m_ascObjSelectionManager(nullptr), m_controller(controller), m_lastSelectedTrack(nullptr)
54 {
55  m_3dsystem = sys;
63 
64  m_singlePoint = new SoPointSet;
65  m_singlePoint->ref();
66  SoVertexProperty * vertices = new SoVertexProperty;
67  vertices->vertex.set1Value(0,0.0f,0.0f,0.0f);
68  m_singlePoint->numPoints=1;
69  m_singlePoint->vertexProperty.setValue(vertices);
70 
71  m_trackLODManager = new TrackLODManager(nullptr,sys);
72  QObject::connect( m_controller,SIGNAL(assocObjDetailLevelChanged(TrackCommonFlags::DETAILLEVEL)),
73  m_trackLODManager,SLOT(setDetailLevel(TrackCommonFlags::DETAILLEVEL)) );
75 
76  QObject::connect(m_touchedMuonChamberHelper,SIGNAL(touchedMuonChambersChanged(const std::set<GeoPVConstLink>&)),
77  sys,SLOT(emitTouchedMuonChambersChanged(const std::set<GeoPVConstLink>&)));//Fixme: need track sys!!
78 
81  QObject::connect(m_visTrkTracksToMaterialHelper,SIGNAL(visibleObjectsChanged()),sys,SLOT(visibleObjectsChanged()));
82  QObject::connect(m_visTrkSegmentsToMaterialHelper,SIGNAL(visibleObjectsChanged()),sys,SLOT(visibleObjectsChanged()));
83 
84  // Get geometry context
85  if (!VP1SGAccessHelper(m_3dsystem).retrieve(m_geometryContext , "ActsAlignment")) {
86  message("Error: Could not retrieve ACTS alignment=");
87  }
88 
89 }
90 
91 //____________________________________________________________________
93 {
96  delete m_indetProjHelper_SCT;
97  delete m_indetProjHelper_TRT;
100  delete m_trackLODManager;
103  delete m_trackSanity;
104  m_singlePoint->unref();
105  if (m_textSep) {
106  m_textSep->unref();
107  m_textSep = nullptr;
108  }
109  delete m_d;
110 }
111 
112 //____________________________________________________________________
114 {
115  m_ascObjSelectionManager = aomgr;
116 }
117 
118 //____________________________________________________________________
120 {
121  m_ascObjSelectionManager->aboutTodelete();//To allow to emit signals.
123  m_ascObjSelectionManager = nullptr;
128  // m_d->nodeToTrackHandle.clear(); TrackHandle destructor already ensures that unregister... below is called.
129 }
130 
131 //____________________________________________________________________
133 {
134  if (VP1Msg::verbose()) {
135  if (!node||!handle) {
136  message("registerTrack ERROR: Received null pointer!");
137  return;
138  }
140  if (it!=m_d->nodeToTrackHandle.end())
141  message("registerTrack ERROR: Node already registered!");
142  }
143  m_d->nodeToTrackHandle[node]=handle;
144 }
145 
146 //____________________________________________________________________
148 {
149  if (VP1Msg::verbose()) {
150  if (!node) {
151  message("unregisterTrack ERROR: Received null pointer!");
152  return;
153  }
154  }
156  if (it==m_d->nodeToTrackHandle.end()) {
157  message("unregisterTrack ERROR: Not previously registered!");
158  return;
159  }
160  m_d->nodeToTrackHandle.erase(it);
161 }
162 
163 //____________________________________________________________________
165 {
166  if (!n)
167  return nullptr;
169  if (it!=m_d->nodeToTrackHandle.end())
170  return it->second;
171  return nullptr;
172 }
173 
174 //____________________________________________________________________
176 {
177  if (!h)
178  return nullptr;
180  for (; it!=itEnd;++it)
181  if (it->second==h) return it->first;
182  return nullptr;
183 }
184 
185 //____________________________________________________________________
186 SoNode* TrackSysCommonData::node(QTreeWidgetItem* item)
187 {
188  if (!item)
189  return nullptr;
191  for (; it!=itEnd;++it)
192  if (it->second->browserTreeItem()==item) return it->first;
193  return nullptr;
194 }
195 
197 {
198  if (!trk) {
199  messageVerbose("TrackSysCommonData::getHandle(): Received null pointer!");
200  return nullptr;
201  }
202 // messageVerbose("TrackSysCommonData::getHandle(): about to loop over this many elements:"+QString::number(m_d->nodeToTrackHandle.size()));
203 
205  for (; it!=itEnd;++it){
206  const TrackHandle_TrkTrack* trkHandle = dynamic_cast<const TrackHandle_TrkTrack*>(it->second);
207  if (trkHandle && trkHandle->trkTrackPointer()==trk) return trkHandle;
208  }
209  return nullptr;
210 }
211 
213  return *m_geometryContext;
214 }
215 
216 
218  if (m_idHelperSvc.retrieve().isFailure()) {
219  message("IMuonIdHelperSvc ERROR: Can not retrieve");
220  }
221  return m_idHelperSvc;
222  }
223 
224 
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
TrackPropagationHelper.h
MuonChamberProjectionHelper
Definition: MuonChamberProjectionHelper.h:32
TrackSysCommonData::m_visTrkSegmentsToMaterialHelper
VisibleObjectToMaterialHelper< Trk::Segment > * m_visTrkSegmentsToMaterialHelper
Definition: TrackSysCommonData.h:113
TrackSysCommonData::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: TrackSysCommonData.h:119
TrackSysCommonData::geometryContext
const ActsGeometryContext & geometryContext() const
Definition: TrackSysCommonData.cxx:212
AscObjSelectionManager::aboutTodelete
void aboutTodelete()
Definition: AscObjSelectionManager.cxx:97
InDetProjHelper.h
TrackLODManager::setDetailLevel
void setDetailLevel(TrackCommonFlags::DETAILLEVEL)
Definition: TrackLODManager.cxx:111
TrackSystemController.h
TrackSysCommonData::m_indetProjHelper_SCT
InDetProjHelper * m_indetProjHelper_SCT
Definition: TrackSysCommonData.h:107
TrackSysCommonData::TrackSysCommonData
TrackSysCommonData(VP1TrackSystem *sys, TrackSystemController *)
Definition: TrackSysCommonData.cxx:51
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
InDetProjHelper::createPixelHelper
static InDetProjHelper * createPixelHelper(IVP1System *sys=0)
Definition: InDetProjHelper.cxx:32
VisibleObjectToMaterialHelper::setNoVisibleObjects
void setNoVisibleObjects()
VP1Msg.h
VisibleObjectToMaterialHelper< Trk::Track >
VP1HelperClassBase::messageVerbose
void messageVerbose(const QString &) const
Definition: VP1HelperClassBase.cxx:78
TrackHandleBase.h
TrackSysCommonData::m_ascObjSelectionManager
AscObjSelectionManager * m_ascObjSelectionManager
Definition: TrackSysCommonData.h:103
TrackSysCommonData::m_textSep
SoSeparator * m_textSep
Definition: TrackSysCommonData.h:91
TrackSysCommonData::node
SoNode * node(TrackHandleBase *h)
Returns the node associated with this handle.
Definition: TrackSysCommonData.cxx:175
fillPileUpNoiseLumi.connect
string connect
Definition: fillPileUpNoiseLumi.py:70
CSV_InDetExporter.new
new
Definition: CSV_InDetExporter.py:145
skel.it
it
Definition: skel.GENtoEVGEN.py:396
TrackSystemController::assocObjDetailLevel
TrackCommonFlags::DETAILLEVEL assocObjDetailLevel() const
Definition: TrackSystemController.cxx:1764
TrackLODManager.h
InDetProjHelper::createSCTHelper
static InDetProjHelper * createSCTHelper(IVP1System *sys=0)
Definition: InDetProjHelper.cxx:50
TrackPropagationHelper
Definition: TrackPropagationHelper.h:40
TrackSysCommonData::registerTrack
void registerTrack(SoNode *, TrackHandleBase *)
Definition: TrackSysCommonData.cxx:132
VisibleObjectToMaterialHelper.h
TrackHandle_TrkTrack::trkTrackPointer
const Trk::Track * trkTrackPointer() const
Definition: TrackHandle_TrkTrack.h:43
VP1TrackSanity
Definition: VP1TrackSanity.h:34
TrackSysCommonData.h
TrackSysCommonData::~TrackSysCommonData
virtual ~TrackSysCommonData()
Definition: TrackSysCommonData.cxx:92
TrackSysCommonData::m_trackPropagationHelper
TrackPropagationHelper * m_trackPropagationHelper
Definition: TrackSysCommonData.h:110
TouchedMuonChamberHelper
Definition: TouchedMuonChamberHelper.h:30
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
TrackSysCommonData::m_indetProjHelper_Pixel
InDetProjHelper * m_indetProjHelper_Pixel
Definition: TrackSysCommonData.h:106
VP1TrackSanity.h
TrackSysCommonData::m_trackLODManager
TrackLODManager * m_trackLODManager
Definition: TrackSysCommonData.h:111
beamspotman.n
n
Definition: beamspotman.py:731
TrackSysCommonData::m_muonChamberProjectionHelper
MuonChamberProjectionHelper * m_muonChamberProjectionHelper
Definition: TrackSysCommonData.h:105
TrackHandle_TrkTrack
Definition: TrackHandle_TrkTrack.h:29
TrackSysCommonData::Imp
Definition: TrackSysCommonData.cxx:45
hist_file_dump.f
f
Definition: hist_file_dump.py:135
VP1TrackSystem
Definition: VP1TrackSystem.h:36
AscObjSelectionManager.h
VP1HelperClassBase
Definition: VP1HelperClassBase.h:28
ActsGeometryContext
Include the GeoPrimitives which need to be put first.
Definition: ActsGeometryContext.h:27
TrackSysCommonData::m_trackSanity
VP1TrackSanity * m_trackSanity
Definition: TrackSysCommonData.h:114
TrackSysCommonData::unregisterTrack
void unregisterTrack(SoNode *)
Definition: TrackSysCommonData.cxx:147
TrackSysCommonData::m_d
Imp * m_d
Definition: TrackSysCommonData.h:99
TrackSysCommonData::m_controller
TrackSystemController * m_controller
Definition: TrackSysCommonData.h:104
TrackSysCommonData::m_touchedMuonChamberHelper
TouchedMuonChamberHelper * m_touchedMuonChamberHelper
Definition: TrackSysCommonData.h:109
TrackSysCommonData::m_visTrkTracksToMaterialHelper
VisibleObjectToMaterialHelper< Trk::Track > * m_visTrkTracksToMaterialHelper
Definition: TrackSysCommonData.h:112
TrackSystemController
Definition: TrackSystemController.h:49
AscObjSelectionManager
Definition: AscObjSelectionManager.h:37
TrackSysCommonData::trackHandle
TrackHandleBase * trackHandle(SoNode *n)
Definition: TrackSysCommonData.cxx:164
item
Definition: ItemListSvc.h:43
TrackSysCommonData::Imp::nodeToTrackHandle
std::map< SoNode *, TrackHandleBase * > nodeToTrackHandle
Definition: TrackSysCommonData.cxx:47
TrackSysCommonData::m_indetProjHelper_TRT
InDetProjHelper * m_indetProjHelper_TRT
Definition: TrackSysCommonData.h:108
TrackSysCommonData::muonIdHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > & muonIdHelperSvc()
Definition: TrackSysCommonData.cxx:217
MuonChamberProjectionHelper.h
TrackHandle_TrkTrack.h
TrackSysCommonData::m_3dsystem
VP1TrackSystem * m_3dsystem
Definition: TrackSysCommonData.h:102
h
TrackSysCommonData::getHandle
const TrackHandleBase * getHandle(const Trk::Track *trk)
Definition: TrackSysCommonData.cxx:196
TouchedMuonChamberHelper::eraseEventData
void eraseEventData()
Definition: TouchedMuonChamberHelper.cxx:116
TrackSysCommonData::clearEventData
void clearEventData()
Definition: TrackSysCommonData.cxx:119
InDetProjHelper::createTRTHelper
static InDetProjHelper * createTRTHelper(IVP1System *sys=0)
Definition: InDetProjHelper.cxx:68
VP1HelperClassBase::message
void message(const QString &) const
Definition: VP1HelperClassBase.cxx:49
TrackCommonFlags::DETAILLEVEL
DETAILLEVEL
Definition: TrackCommonFlags.h:39
VP1Msg::verbose
static bool verbose()
Definition: VP1Msg.h:31
VP1SGAccessHelper
Definition: VP1SGAccessHelper.h:25
TouchedMuonChamberHelper.h
TrackLODManager
Definition: TrackLODManager.h:32
TrackHandleBase
Definition: TrackHandleBase.h:56
TrackSysCommonData::m_singlePoint
SoPointSet * m_singlePoint
Definition: TrackSysCommonData.h:115
VP1SGAccessHelper.h
TrackLODManager::eraseEventData
void eraseEventData()
Definition: TrackLODManager.cxx:151
node
Definition: memory_hooks-stdcmalloc.h:74
TrackSysCommonData::setEventData
void setEventData(AscObjSelectionManager *)
Definition: TrackSysCommonData.cxx:113
VP1TrackSystem.h
ServiceHandle< Muon::IMuonIdHelperSvc >
TrackSysCommonData::m_geometryContext
const ActsGeometryContext * m_geometryContext
Definition: TrackSysCommonData.h:118