ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
graphics
VP1
VP1Systems
VP1TrackSystems
src
TrackCollHandle_TrkSegment.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
7
// //
8
// Implementation of class TrackCollHandle_TrkSegment //
9
// //
10
// Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
11
// Initial version: February 2008 //
12
// //
14
15
#include "
VP1TrackSystems/TrackCollHandle_TrkSegment.h
"
16
#include "
VP1TrackSystems/VP1TrackSystem.h
"
17
#include "
VP1TrackSystems/TrackHandle_TrkSegment.h
"
18
#include "
VP1Base/IVP1System.h
"
19
#include "
VP1Base/VP1QtUtils.h
"
20
#include "
VP1Utils/VP1JobConfigInfo.h
"
21
#include "
VP1Utils/VP1SGContentsHelper.h
"
22
#include "
VP1Utils/VP1SGAccessHelper.h
"
23
#include "
TrkSegment/Segment.h
"
24
#include "
TrkSegment/SegmentCollection.h
"
25
26
//____________________________________________________________________
27
class
TrackCollHandle_TrkSegment::Imp
{
28
public
:
29
static
bool
alwaysShowAllTrackColls
;
30
};
31
32
33
bool
TrackCollHandle_TrkSegment::Imp::alwaysShowAllTrackColls
34
=
VP1QtUtils::environmentVariableIsOn
(
"VP1_ALWAYS_SHOW_ALL_TRACK_COLLECTIONS"
);
35
36
//____________________________________________________________________
37
QStringList
TrackCollHandle_TrkSegment::availableCollections
(
IVP1System
*sys)
38
{
39
//There must be at least one of the trackers available for this to make sense.
40
if
( ! (
VP1JobConfigInfo::hasPixelGeometry
()||
VP1JobConfigInfo::hasSCTGeometry
()
41
||
VP1JobConfigInfo::hasTRTGeometry
()||
VP1JobConfigInfo::hasMuonGeometry
() ) ) {
42
sys->messageDebug(
"TrackCollHandle_TrkSegment::availableCollections: Neither"
43
" Pixel, SCT, TRT or Muon geometry available. Won't"
44
" look in event store for Trk::Track collections"
);
45
return
{};
46
}
47
48
QStringList keysInSG =
VP1SGContentsHelper
(sys).
getKeys
<
Trk::SegmentCollection
>();
49
if
(keysInSG.isEmpty()||
Imp::alwaysShowAllTrackColls
)
50
return
keysInSG;
51
52
QRegExp needsMuonsPattern(
"Converted.*|.*MBoy.*|.*Moore.*|.*Mu.*|.*Staco.*"
);
53
QRegExp needsAllIDPattern(
".*Id.*|.*ID.*|.*InDet.*|.*Inner.*"
);
54
QRegExp needsTRTPattern(
".*Trt.*|.*TRT.*|.*trt.*"
);
55
56
const
bool
jobcfgAllID
57
=
VP1JobConfigInfo::hasPixelGeometry
()
58
&&
VP1JobConfigInfo::hasSCTGeometry
()
59
&&
VP1JobConfigInfo::hasTRTGeometry
();
60
61
QStringList outkeys;
62
63
for
(
const
QString& key : keysInSG) {
64
if
(!
VP1JobConfigInfo::hasMuonGeometry
() && needsMuonsPattern.exactMatch(key)) {
65
sys->messageDebug(
"TrackCollHandle_TrkSegment::availableCollections: Ignoring key '"
66
+key+
"' since muon geometry is not present in job."
);
67
continue
;
68
}
69
if
(!
VP1JobConfigInfo::hasTRTGeometry
() && needsTRTPattern.exactMatch(key)) {
70
sys->messageDebug(
"TrackCollHandle_TrkSegment::availableCollections: Ignoring key '"
71
+key+
"' since TRT geometry is not present in job."
);
72
continue
;
73
}
74
if
(!jobcfgAllID && needsAllIDPattern.exactMatch(key)) {
75
sys->messageDebug(
"TrackCollHandle_TrkSegment::availableCollections: Ignoring key '"
76
+key+
"' since pixel, sct and trt geometry are not all present in job."
);
77
continue
;
78
}
79
outkeys<<key;
80
}
81
return
outkeys;
82
83
}
84
85
//____________________________________________________________________
86
TrackCollHandle_TrkSegment::TrackCollHandle_TrkSegment
(
TrackSysCommonData
* cd,
87
const
QString&
name
)
88
:
TrackCollHandleBase
(cd,
name
,
TrackType
::TrkSegment),
m_d
(new
Imp
)
89
{
90
}
91
92
//____________________________________________________________________
93
TrackCollHandle_TrkSegment::~TrackCollHandle_TrkSegment
()
94
{
95
delete
m_d
;
96
}
97
98
//____________________________________________________________________
99
void
TrackCollHandle_TrkSegment::setupSettingsFromControllerSpecific
(
TrackSystemController
*)
100
{
101
102
}
103
104
//____________________________________________________________________
105
bool
TrackCollHandle_TrkSegment::load
()
106
{
107
//Get collection:
108
const
Trk::SegmentCollection
*segmentColl(
nullptr
);
109
if
(!
VP1SGAccessHelper
(
systemBase
()).retrieve(segmentColl,
name
())) {
110
common
()->
systemBase
()->
message
(
"Error: Could not retrieve segment collection with key="
+
name
());
111
return
false
;
112
}
113
114
//Make appropriate trk::segment handles:
115
hintNumberOfTracksInEvent
(segmentColl->
size
());
116
int
i(0);
117
Trk::SegmentCollection::const_iterator
segItr, segItrEnd = segmentColl->
end
();
118
for
( segItr = segmentColl->
begin
() ; segItr != segItrEnd; ++segItr) {
119
if
(*segItr)
120
addTrackHandle
(
new
TrackHandle_TrkSegment
(
this
,*segItr));
121
else
122
common
()->
systemBase
()->
messageDebug
(
"WARNING: Ignoring null Trk::Segment pointer."
);
123
124
if
(!(i++%100))
125
common
()->
systemBase
()->
updateGUI
();
126
}
127
128
return
true
;
129
}
130
131
//____________________________________________________________________
132
bool
TrackCollHandle_TrkSegment::cut
(
TrackHandleBase
* handle)
133
{
134
if
(!
TrackCollHandleBase::cut
(handle))
135
return
false
;
136
137
//fixme: more?
138
return
true
;
139
}
140
141
//____________________________________________________________________
142
void
TrackCollHandle_TrkSegment::visibleStateUpdated
(
TrackHandle_TrkSegment
* handle)
143
{
144
common
()->
visTrkSegmentsToMaterialHelper
()->
setState
(handle->trkSegmentPointer(), (handle->visible() ? handle->currentMaterial() :
nullptr
));
145
}
IVP1System.h
SegmentCollection.h
TrackCollHandle_TrkSegment.h
TrackHandle_TrkSegment.h
Segment.h
VP1JobConfigInfo.h
VP1QtUtils.h
VP1SGAccessHelper.h
VP1SGContentsHelper.h
VP1TrackSystem.h
DataVector< Trk::Segment >::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::messageDebug
void messageDebug(const QString &) const
Definition
IVP1System.cxx:347
IVP1System::updateGUI
void updateGUI()
Definition
IVP1System.cxx:262
IVP1System::message
void message(const QString &) const
Definition
IVP1System.cxx:336
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_TrkSegment::Imp
Definition
TrackCollHandle_TrkSegment.cxx:27
TrackCollHandle_TrkSegment::Imp::alwaysShowAllTrackColls
static bool alwaysShowAllTrackColls
Definition
TrackCollHandle_TrkSegment.cxx:29
TrackCollHandle_TrkSegment::~TrackCollHandle_TrkSegment
virtual ~TrackCollHandle_TrkSegment()
Definition
TrackCollHandle_TrkSegment.cxx:93
TrackCollHandle_TrkSegment::visibleStateUpdated
void visibleStateUpdated(TrackHandle_TrkSegment *)
Definition
TrackCollHandle_TrkSegment.cxx:142
TrackCollHandle_TrkSegment::TrackCollHandle_TrkSegment
TrackCollHandle_TrkSegment(TrackSysCommonData *, const QString &name)
Definition
TrackCollHandle_TrkSegment.cxx:86
TrackCollHandle_TrkSegment::setupSettingsFromControllerSpecific
void setupSettingsFromControllerSpecific(TrackSystemController *)
Definition
TrackCollHandle_TrkSegment.cxx:99
TrackCollHandle_TrkSegment::load
bool load()
Definition
TrackCollHandle_TrkSegment.cxx:105
TrackCollHandle_TrkSegment::availableCollections
static QStringList availableCollections(IVP1System *)
Definition
TrackCollHandle_TrkSegment.cxx:37
TrackCollHandle_TrkSegment::cut
bool cut(TrackHandleBase *)
Definition
TrackCollHandle_TrkSegment.cxx:132
TrackCollHandle_TrkSegment::m_d
Imp * m_d
Definition
TrackCollHandle_TrkSegment.h:52
TrackHandleBase
Definition
TrackHandleBase.h:57
TrackHandle_TrkSegment
Definition
TrackHandle_TrkSegment.h:28
TrackSysCommonData
Definition
TrackSysCommonData.h:50
TrackSysCommonData::visTrkSegmentsToMaterialHelper
VisibleObjectToMaterialHelper< Trk::Segment > * visTrkSegmentsToMaterialHelper() const
Definition
TrackSysCommonData.h:133
TrackSystemController
Definition
TrackSystemController.h:50
TrackType
Definition
TrackTypes.h:10
VP1HelperClassBase::systemBase
IVP1System * systemBase() const
Definition
VP1HelperClassBase.h:50
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
VP1SGAccessHelper
Definition
VP1SGAccessHelper.h:25
VP1SGContentsHelper
Definition
VP1SGContentsHelper.h:26
VP1SGContentsHelper::getKeys
QStringList getKeys() const
Definition
VP1SGContentsHelper.h:55
VisibleObjectToMaterialHelper::setState
void setState(const objectT *, SoMaterial *mat)
Trk::SegmentCollection
DataVector< Trk::Segment > SegmentCollection
Definition
SegmentCollection.h:13
Generated on
for ATLAS Offline Software by
1.17.0