ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
graphics
VP1
VP1Systems
VP1TrackSystems
src
TrackCollHandle_TrkTrack.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
7
// //
8
// Implementation of class TrackCollHandle_TrkTrack //
9
// //
10
// Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
11
// Initial version: February 2008 //
12
// //
14
15
#include "
VP1TrackSystems/TrackCollHandle_TrkTrack.h
"
16
#include "
VP1TrackSystems/TrackHandle_TrkTrack.h
"
17
#include "
VP1Base/IVP1System.h
"
18
#include "
VP1TrackSystems/TrackSystemController.h
"
19
#include "
VP1Base/VP1QtUtils.h
"
20
#include "
VP1Utils/VP1JobConfigInfo.h
"
21
#include "
VP1Utils/VP1SGContentsHelper.h
"
22
#include "
VP1Utils/VP1SGAccessHelper.h
"
23
24
#include "
TrkTrack/Track.h
"
25
#include "
TrkTrack/TrackCollection.h
"
26
27
#include <QRegExp>
28
29
//____________________________________________________________________
30
class
TrackCollHandle_TrkTrack::Imp
{
31
public
:
32
static
bool
isFatrasTruthTrack
(
const
QString& key);
33
static
bool
alwaysShowAllTrackColls
;
34
TrackCollHandle_TrkTrack
*
theclass
=
nullptr
;
35
TrackCommonFlags::DETAILLEVEL
detailLevel
{};
36
37
};
38
39
bool
TrackCollHandle_TrkTrack::Imp::alwaysShowAllTrackColls
40
=
VP1QtUtils::environmentVariableIsOn
(
"VP1_ALWAYS_SHOW_ALL_TRACK_COLLECTIONS"
);
41
42
//____________________________________________________________________
43
QStringList
TrackCollHandle_TrkTrack::availableCollections
(
IVP1System
*sys)
44
{
45
//There must be at least one of the trackers available for this to make sense.
46
if
( ! (
VP1JobConfigInfo::hasPixelGeometry
()||
VP1JobConfigInfo::hasSCTGeometry
()
47
||
VP1JobConfigInfo::hasTRTGeometry
()||
VP1JobConfigInfo::hasMuonGeometry
() ) ) {
48
sys->messageDebug(
"TrackCollHandle_TrkTrack::availableCollections: Neither"
49
" Pixel, SCT, TRT or Muon geometry available. Won't"
50
" look in event store for Trk::Track collections"
);
51
return
{};
52
}
53
54
QStringList keysInSG;
55
for
(
const
QString& key :
VP1SGContentsHelper
(sys).getKeys<TrackCollection>()) {
56
// if ( key=="CombinedInDetTracks") // Useful for debugging to limit to one collection
57
keysInSG<<key;
58
}
59
60
if
(keysInSG.isEmpty()||
Imp::alwaysShowAllTrackColls
)
61
return
keysInSG;
62
63
QRegExp needsMuonsPattern(
"Converted.*|.*MBoy.*|.*Moore.*|.*Mu.*|.*Staco.*"
);
64
QRegExp needsTRTPattern(
".*trt.*|.*TRT.*|.*Trt.*"
);
65
QRegExp needsAllIDPattern(
"ExtendedTracks|ResolvedTracks|Tracks|.*Id.*|.*ID.*|.*InDet.*|.*Inner.*"
);
66
67
const
bool
jobcfgAllID
68
=
VP1JobConfigInfo::hasPixelGeometry
()
69
&&
VP1JobConfigInfo::hasSCTGeometry
()
70
&&
VP1JobConfigInfo::hasTRTGeometry
();
71
72
QStringList outkeys;
73
74
for
(
const
QString& key : keysInSG) {
75
if
(!
VP1JobConfigInfo::hasMuonGeometry
() && needsMuonsPattern.exactMatch(key)) {
76
sys->messageDebug(
"TrackCollHandle_TrkTrack::availableCollections: Ignoring key '"
77
+key+
"' since muon geometry is not present in job."
);
78
continue
;
79
}
80
if
(!jobcfgAllID && needsAllIDPattern.exactMatch(key)) {
81
sys->messageDebug(
"TrackCollHandle_TrkTrack::availableCollections: Ignoring key '"
82
+key+
"' since pixel, sct and trt geometry are not all present in job."
);
83
continue
;
84
}
85
if
(!
VP1JobConfigInfo::hasTRTGeometry
()&&needsTRTPattern.exactMatch(key)) {
86
sys->messageDebug(
"TrackCollHandle_TrkTrack::availableCollections: Ignoring key '"
87
+key+
"' since trt geometry is not present in job."
);
88
continue
;
89
}
90
91
outkeys<<key;
92
}
93
return
outkeys;
94
95
}
96
97
//____________________________________________________________________
98
TrackCollHandle_TrkTrack::TrackCollHandle_TrkTrack
(
TrackSysCommonData
* cd,
99
const
QString&
name
,
100
TrackType::Type
type
)
101
:
TrackCollHandleBase
(cd,
name
,
type
),
m_d
(new
Imp
)
102
{
103
m_d
->theclass =
this
;
104
m_d
->detailLevel =
TrackCommonFlags::AUTO
;
105
}
106
107
//____________________________________________________________________
108
TrackCollHandle_TrkTrack::~TrackCollHandle_TrkTrack
()
109
{
110
delete
m_d
;
111
}
112
113
//____________________________________________________________________
114
bool
TrackCollHandle_TrkTrack::Imp::isFatrasTruthTrack
(
const
QString& key)
115
{
116
QString env =
VP1QtUtils::environmentVariableValue
(
"VP1_FATRAS_TRACKCOLLS_PATTERN"
);
117
return
QRegExp((env.isEmpty()?
"*fatras*"
:env),Qt::CaseInsensitive,QRegExp::Wildcard).exactMatch(key);
118
}
119
120
//____________________________________________________________________
121
bool
TrackCollHandle_TrkTrack::load
()
122
{
123
//Get collection:
124
const
TrackCollection
* trackColl(
nullptr
);
125
if
(!
VP1SGAccessHelper
(
systemBase
()).retrieve(trackColl,
name
())) {
126
message
(
"Error: Could not retrieve track collection with key="
+
name
());
127
return
false
;
128
}
129
130
//Make appropriate trk::track handles:
131
hintNumberOfTracksInEvent
(trackColl->
size
());
132
int
i(0);
133
TrackCollection::const_iterator
trackItr, trackItrEnd = trackColl->
end
();
134
for
( trackItr = trackColl->
begin
() ; trackItr != trackItrEnd; ++trackItr) {
135
if
(*trackItr)
136
addTrackHandle
(
new
TrackHandle_TrkTrack
(
this
,*trackItr));
137
else
138
messageDebug
(
"WARNING: Ignoring null Trk::Track pointer."
);
139
if
(!(i++%100))
140
systemBase
()->
updateGUI
();
141
}
142
143
//Maybe we need to show measurements, etc.:
144
// updateVisibleAssociatedObjects();
145
146
return
true
;
147
}
148
149
//____________________________________________________________________
150
bool
TrackCollHandle_TrkTrack::cut
(
TrackHandleBase
* handle)
151
{
152
if
(!
TrackCollHandleBase::cut
(handle))
153
return
false
;
154
155
//fixme: more?
156
return
true
;
157
}
158
159
//____________________________________________________________________
160
void
TrackCollHandle_TrkTrack::visibleStateUpdated
(
TrackHandle_TrkTrack
* trkhandle)
161
{
162
common
()->
visTrkTracksToMaterialHelper
()->
setState
(trkhandle->
trkTrackPointer
(), (trkhandle->
visible
() ? trkhandle->
currentMaterial
() :
nullptr
));
163
}
164
165
IVP1System.h
TrackCollHandle_TrkTrack.h
TrackCollection.h
TrackCollection
DataVector< Trk::Track > TrackCollection
This typedef represents a collection of Trk::Track objects.
Definition
TrackCollection.h:19
TrackHandle_TrkTrack.h
TrackSystemController.h
Track.h
VP1JobConfigInfo.h
VP1QtUtils.h
VP1SGAccessHelper.h
VP1SGContentsHelper.h
DataVector< Trk::Track >::const_iterator
DataModel_detail::const_iterator< DataVector > const_iterator
Definition
DataVector.h:838
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
IVP1System
Definition
IVP1System.h:36
IVP1System::updateGUI
void updateGUI()
Definition
IVP1System.cxx:262
TrackCollHandleBase::common
TrackSysCommonData * common() const
Definition
TrackCollHandleBase.h:79
TrackCollHandleBase::hintNumberOfTracksInEvent
void hintNumberOfTracksInEvent(unsigned)
Definition
TrackCollHandleBase.cxx:509
TrackCollHandleBase::name
const QString & name() const
Definition
TrackCollHandleBase.cxx:310
TrackCollHandleBase::cut
virtual bool cut(TrackHandleBase *)
Definition
TrackCollHandleBase.cxx:316
TrackCollHandleBase::addTrackHandle
void addTrackHandle(TrackHandleBase *)
Definition
TrackCollHandleBase.cxx:515
TrackCollHandleBase::TrackCollHandleBase
TrackCollHandleBase(TrackSysCommonData *, const QString &name, TrackType::Type)
Definition
TrackCollHandleBase.cxx:97
TrackCollHandle_TrkTrack::Imp
Definition
TrackCollHandle_TrkTrack.cxx:30
TrackCollHandle_TrkTrack::Imp::isFatrasTruthTrack
static bool isFatrasTruthTrack(const QString &key)
Definition
TrackCollHandle_TrkTrack.cxx:114
TrackCollHandle_TrkTrack::Imp::theclass
TrackCollHandle_TrkTrack * theclass
Definition
TrackCollHandle_TrkTrack.cxx:34
TrackCollHandle_TrkTrack::Imp::alwaysShowAllTrackColls
static bool alwaysShowAllTrackColls
Definition
TrackCollHandle_TrkTrack.cxx:33
TrackCollHandle_TrkTrack::Imp::detailLevel
TrackCommonFlags::DETAILLEVEL detailLevel
Definition
TrackCollHandle_TrkTrack.cxx:35
TrackCollHandle_TrkTrack::visibleStateUpdated
void visibleStateUpdated(TrackHandle_TrkTrack *)
Definition
TrackCollHandle_TrkTrack.cxx:160
TrackCollHandle_TrkTrack::~TrackCollHandle_TrkTrack
virtual ~TrackCollHandle_TrkTrack()
Definition
TrackCollHandle_TrkTrack.cxx:108
TrackCollHandle_TrkTrack::cut
virtual bool cut(TrackHandleBase *)
Definition
TrackCollHandle_TrkTrack.cxx:150
TrackCollHandle_TrkTrack::TrackCollHandle_TrkTrack
TrackCollHandle_TrkTrack(TrackSysCommonData *, const QString &name, TrackType::Type type=TrackType::TrkTrack)
Definition
TrackCollHandle_TrkTrack.cxx:98
TrackCollHandle_TrkTrack::availableCollections
static QStringList availableCollections(IVP1System *)
Definition
TrackCollHandle_TrkTrack.cxx:43
TrackCollHandle_TrkTrack::load
virtual bool load()
Definition
TrackCollHandle_TrkTrack.cxx:121
TrackCollHandle_TrkTrack::m_d
Imp * m_d
Definition
TrackCollHandle_TrkTrack.h:55
TrackCommonFlags::DETAILLEVEL
DETAILLEVEL
Definition
TrackCommonFlags.h:39
TrackCommonFlags::AUTO
@ AUTO
Definition
TrackCommonFlags.h:39
TrackHandleBase
Definition
TrackHandleBase.h:57
TrackHandleBase::currentMaterial
SoMaterial * currentMaterial() const
Definition
TrackHandleBase.h:77
TrackHandleBase::visible
bool visible() const
Definition
TrackHandleBase.h:68
TrackHandle_TrkTrack
Definition
TrackHandle_TrkTrack.h:29
TrackHandle_TrkTrack::trkTrackPointer
const Trk::Track * trkTrackPointer() const
Definition
TrackHandle_TrkTrack.h:43
TrackSysCommonData
Definition
TrackSysCommonData.h:50
TrackSysCommonData::visTrkTracksToMaterialHelper
VisibleObjectToMaterialHelper< Trk::Track > * visTrkTracksToMaterialHelper() const
Definition
TrackSysCommonData.h:132
TrackType::Type
Type
Definition
TrackTypes.h:13
VP1HelperClassBase::message
void message(const QString &) const
Definition
VP1HelperClassBase.cxx:49
VP1HelperClassBase::systemBase
IVP1System * systemBase() const
Definition
VP1HelperClassBase.h:50
VP1HelperClassBase::messageDebug
void messageDebug(const QString &) const
Definition
VP1HelperClassBase.cxx:65
VP1JobConfigInfo::hasTRTGeometry
static bool hasTRTGeometry()
Definition
VP1JobConfigInfo.cxx:133
VP1JobConfigInfo::hasPixelGeometry
static bool hasPixelGeometry()
Definition
VP1JobConfigInfo.cxx:130
VP1JobConfigInfo::hasSCTGeometry
static bool hasSCTGeometry()
Definition
VP1JobConfigInfo.cxx:132
VP1JobConfigInfo::hasMuonGeometry
static bool hasMuonGeometry()
Definition
VP1JobConfigInfo.cxx:138
VP1QtUtils::environmentVariableIsOn
static bool environmentVariableIsOn(const QString &name)
Definition
VP1QtUtils.cxx:127
VP1QtUtils::environmentVariableValue
static QString environmentVariableValue(const QString &name)
Definition
VP1QtUtils.cxx:117
VP1SGAccessHelper
Definition
VP1SGAccessHelper.h:25
VP1SGContentsHelper
Definition
VP1SGContentsHelper.h:26
VisibleObjectToMaterialHelper::setState
void setState(const objectT *, SoMaterial *mat)
type
Generated on
for ATLAS Offline Software by
1.17.0