ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
graphics
VP1
VP1Systems
VP1PRDSystems
src
PRDCollHandle_SpacePoints.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 PRDCollHandle_SpacePoints //
9
// //
10
// Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
11
// Initial version: September 2008 //
12
// //
14
15
#include "
VP1PRDSystems/PRDCollHandle_SpacePoints.h
"
16
#include "
VP1PRDSystems/PRDHandle_SpacePoint.h
"
17
#include "
VP1PRDSystems/PRDSystemController.h
"
18
#include "
VP1Base/IVP1System.h
"
19
#include "
VP1Utils/VP1JobConfigInfo.h
"
20
#include "
VP1Utils/VP1SGContentsHelper.h
"
21
#include "
VP1Utils/VP1SGAccessHelper.h
"
22
#include "
TrkSpacePoint/SpacePointContainer.h
"
23
#include <QColor>
24
25
//____________________________________________________________________
26
QStringList
PRDCollHandle_SpacePoints::availableCollections
(
IVP1System
*sys)
27
{
28
if
(!
VP1JobConfigInfo::hasSCTGeometry
()&&!
VP1JobConfigInfo::hasPixelGeometry
())
29
return
QStringList();
30
QStringList keys =
VP1SGContentsHelper
(sys).
getKeys
<
SpacePointContainer
>();
31
QStringList unsafekeys;
32
if
(!
VP1JobConfigInfo::hasSCTGeometry
()) {
33
for
(
const
QString& key : keys) {
34
if
(key.contains(
"sct"
,Qt::CaseInsensitive))
35
unsafekeys << key;
36
}
37
}
38
if
(!
VP1JobConfigInfo::hasPixelGeometry
()) {
39
for
(
const
QString& key : keys) {
40
if
(key.contains(
"pixel"
,Qt::CaseInsensitive))
41
unsafekeys << key;
42
}
43
}
44
for
(
const
QString& unsafekey : unsafekeys)
45
keys.removeAll(unsafekey);
46
return
keys;
47
}
48
49
//____________________________________________________________________
50
class
PRDCollHandle_SpacePoints::Imp
{
51
public
:
52
PRDCommonFlags::InDetPartsFlags
indetpartsflags
;
53
};
54
55
56
//____________________________________________________________________
57
PRDCollHandle_SpacePoints::PRDCollHandle_SpacePoints
(
PRDSysCommonData
*
common
,
const
QString& key)
58
:
PRDCollHandleBase
(
PRDDetType
::SpacePoints,
common
,key),
m_d
(new
Imp
)
59
{
60
m_d
->indetpartsflags = (
PRDCommonFlags::BarrelPositive
|
PRDCommonFlags::BarrelNegative
|
PRDCommonFlags::EndCapPositive
|
PRDCommonFlags::EndCapNegative
);
61
}
62
63
//____________________________________________________________________
64
PRDCollHandle_SpacePoints::~PRDCollHandle_SpacePoints
()
65
{
66
delete
m_d
;
67
}
68
69
//____________________________________________________________________
70
QColor
PRDCollHandle_SpacePoints::defaultColor
()
const
71
{
72
if
(
text
().
contains
(
"pixel"
,Qt::CaseInsensitive))
73
return
QColor::fromRgbF(1.0, 0.666667, 0.5 );
//beige
74
else
75
return
QColor::fromRgbF(1.0, 1.0, 0.5 );
//light yellow
76
}
77
78
//____________________________________________________________________
79
bool
PRDCollHandle_SpacePoints::load
()
80
{
82
// Retrieve element container from event store:
83
const
SpacePointContainer
* container;
84
if
(!
VP1SGAccessHelper
(
systemBase
()).retrieve(container,
text
()))
85
return
false
;
86
87
int
isp(0);
88
SpacePointContainer::const_iterator
itElement, itElementE(container->end());
89
for
(itElement=container->begin();itElement!=itElementE;++itElement) {
90
SpacePointContainer::base_value_type::const_iterator it, itE((*itElement)->end());
91
for
(it=(*itElement)->begin();it!=itE;++it) {
92
const
Trk::SpacePoint
*
sp
= *it;
93
++isp;
94
if
(!
sp
) {
95
message
(
"WARNING - ignoring null spacepoint pointer."
);
96
continue
;
97
}
98
if
(!
sp
->clusterList().first) {
99
message
(
"WARNING - ignoring spacepoint with null first cluster."
);
100
continue
;
101
}
102
PRDHandleBase
* handle =
new
PRDHandle_SpacePoint
(
this
,
sp
);
103
if
(handle) {
104
addHandle
(handle);
105
//We just register the first of the (possibly) two prds here (fixme: check that it works):
106
common
()->
registerPRD2Handle
(handle->getPRD(),handle);
107
}
else
{
108
message
(
"WARNING - ignoring null handle pointer."
);
109
}
110
if
(!(isp%100))
111
systemBase
()->
updateGUI
();
112
}
113
}
114
return
true
;
115
}
116
117
//____________________________________________________________________
118
bool
PRDCollHandle_SpacePoints::cut
(
PRDHandleBase
*handlebase)
119
{
120
PRDHandle_SpacePoint
* handle =
static_cast<
PRDHandle_SpacePoint
*
>
(handlebase);
121
assert(handle);
122
123
if
(
m_d
->indetpartsflags!=
PRDCommonFlags::All
) {
124
if
(handle->isBarrel()) {
125
if
(!(handle->isPositiveZ()?(
m_d
->indetpartsflags&
PRDCommonFlags::BarrelPositive
):(
m_d
->indetpartsflags&
PRDCommonFlags::BarrelNegative
)))
126
return
false
;
127
}
else
{
128
if
(!(handle->isPositiveZ()?(
m_d
->indetpartsflags&
PRDCommonFlags::EndCapPositive
):(
m_d
->indetpartsflags&
PRDCommonFlags::EndCapNegative
)))
129
return
false
;
130
}
131
}
132
return
true
;
133
}
134
135
//____________________________________________________________________
136
void
PRDCollHandle_SpacePoints::eraseEventDataSpecific
()
137
{
138
}
139
140
//____________________________________________________________________
141
void
PRDCollHandle_SpacePoints::postLoadInitialisation
()
142
{
143
}
144
145
//____________________________________________________________________
146
void
PRDCollHandle_SpacePoints::setupSettingsFromControllerSpecific
(
PRDSystemController
*controller)
147
{
148
connect(controller,SIGNAL(inDetPartsFlagsChanged(PRDCommonFlags::InDetPartsFlags)),
149
this
,SLOT(
setPartsFlags
(PRDCommonFlags::InDetPartsFlags)));
150
setPartsFlags
(controller->
inDetPartsFlags
());
151
}
152
153
//____________________________________________________________________
154
void
PRDCollHandle_SpacePoints::setPartsFlags
(PRDCommonFlags::InDetPartsFlags flags)
155
{
156
//NB: The code is this method is very similar in PRDCollHandle_Pixel::setPartsFlags, PRDCollHandle_SCT::setPartsFlags,
157
//PRDCollHandle_TRT::setPartsFlags and and PRDCollHandle_SpacePoints::setPartsFlags
158
//Fixme: base decision to recheck on visibility also!
159
160
if
(
m_d
->indetpartsflags==flags)
161
return
;
162
163
bool
barrelPosChanged = (
m_d
->indetpartsflags&
PRDCommonFlags::BarrelPositive
)!=(flags&
PRDCommonFlags::BarrelPositive
);
164
bool
barrelNegChanged = (
m_d
->indetpartsflags&
PRDCommonFlags::BarrelNegative
)!=(flags&
PRDCommonFlags::BarrelNegative
);
165
bool
endcapPosChanged = (
m_d
->indetpartsflags&
PRDCommonFlags::EndCapPositive
)!=(flags&
PRDCommonFlags::EndCapPositive
);
166
bool
endcapNegChanged = (
m_d
->indetpartsflags&
PRDCommonFlags::EndCapNegative
)!=(flags&
PRDCommonFlags::EndCapNegative
);
167
bool
barrelChanged = (barrelPosChanged || barrelNegChanged);
168
bool
endcapChanged = (endcapPosChanged || endcapNegChanged);
169
m_d
->indetpartsflags=flags;
170
171
largeChangesBegin
();
172
std::vector<PRDHandleBase*>::iterator it(
getPrdHandles
().begin()),itE(
getPrdHandles
().end());
173
for
(;it!=itE;++it) {
174
PRDHandle_SpacePoint
* handle =
static_cast<
PRDHandle_SpacePoint
*
>
(*it);
175
if
(handle->isBarrel()) {
176
if
(barrelChanged&&(handle->isPositiveZ()?barrelPosChanged:barrelNegChanged))
177
recheckCutStatus
(handle);
178
}
else
{
179
if
(endcapChanged&&(handle->isPositiveZ()?endcapPosChanged:endcapNegChanged))
180
recheckCutStatus
(handle);
181
}
182
}
183
largeChangesEnd
();
184
}
IVP1System.h
sp
static Double_t sp
Definition
LArPhysWaveHECTool.cxx:37
PRDCollHandle_SpacePoints.h
PRDHandle_SpacePoint.h
PRDSystemController.h
SpacePointContainer.h
VP1JobConfigInfo.h
VP1SGAccessHelper.h
VP1SGContentsHelper.h
IVP1System
Definition
IVP1System.h:36
IVP1System::updateGUI
void updateGUI()
Definition
IVP1System.cxx:262
IdentifiableContainerMT::const_iterator
Definition
IdentifiableContainerMT.h:82
PRDCollHandleBase::PRDCollHandleBase
PRDCollHandleBase(PRDDetType::Type, PRDSysCommonData *, const QString &key)
Definition
PRDCollHandleBase.cxx:80
PRDCollHandleBase::getPrdHandles
std::vector< PRDHandleBase * > & getPrdHandles()
Definition
PRDCollHandleBase.cxx:507
PRDCollHandleBase::addHandle
void addHandle(PRDHandleBase *)
Definition
PRDCollHandleBase.cxx:500
PRDCollHandleBase::common
PRDSysCommonData * common() const
Definition
PRDCollHandleBase.h:49
PRDCollHandleBase::recheckCutStatus
void recheckCutStatus(PRDHandleBase *)
Definition
PRDCollHandleBase.cxx:519
PRDCollHandle_SpacePoints::Imp
Definition
PRDCollHandle_SpacePoints.cxx:50
PRDCollHandle_SpacePoints::Imp::indetpartsflags
PRDCommonFlags::InDetPartsFlags indetpartsflags
Definition
PRDCollHandle_SpacePoints.cxx:52
PRDCollHandle_SpacePoints::eraseEventDataSpecific
virtual void eraseEventDataSpecific() override
Definition
PRDCollHandle_SpacePoints.cxx:136
PRDCollHandle_SpacePoints::setupSettingsFromControllerSpecific
virtual void setupSettingsFromControllerSpecific(PRDSystemController *) override
Definition
PRDCollHandle_SpacePoints.cxx:146
PRDCollHandle_SpacePoints::m_d
Imp * m_d
Definition
PRDCollHandle_SpacePoints.h:52
PRDCollHandle_SpacePoints::postLoadInitialisation
virtual void postLoadInitialisation() override
Definition
PRDCollHandle_SpacePoints.cxx:141
PRDCollHandle_SpacePoints::PRDCollHandle_SpacePoints
PRDCollHandle_SpacePoints(PRDSysCommonData *, const QString &key)
Definition
PRDCollHandle_SpacePoints.cxx:57
PRDCollHandle_SpacePoints::setPartsFlags
void setPartsFlags(PRDCommonFlags::InDetPartsFlags)
Definition
PRDCollHandle_SpacePoints.cxx:154
PRDCollHandle_SpacePoints::availableCollections
static QStringList availableCollections(IVP1System *)
Definition
PRDCollHandle_SpacePoints.cxx:26
PRDCollHandle_SpacePoints::~PRDCollHandle_SpacePoints
virtual ~PRDCollHandle_SpacePoints()
Definition
PRDCollHandle_SpacePoints.cxx:64
PRDCollHandle_SpacePoints::defaultColor
virtual QColor defaultColor() const override
Definition
PRDCollHandle_SpacePoints.cxx:70
PRDCollHandle_SpacePoints::cut
virtual bool cut(PRDHandleBase *) override
Definition
PRDCollHandle_SpacePoints.cxx:118
PRDCollHandle_SpacePoints::load
virtual bool load() override
Definition
PRDCollHandle_SpacePoints.cxx:79
PRDCommonFlags::BarrelPositive
@ BarrelPositive
Definition
PRDCommonFlags.h:24
PRDCommonFlags::All
@ All
Definition
PRDCommonFlags.h:30
PRDCommonFlags::BarrelNegative
@ BarrelNegative
Definition
PRDCommonFlags.h:25
PRDCommonFlags::EndCapPositive
@ EndCapPositive
Definition
PRDCommonFlags.h:26
PRDCommonFlags::EndCapNegative
@ EndCapNegative
Definition
PRDCommonFlags.h:27
PRDDetType
Definition
PRDDetTypes.h:10
PRDHandleBase
Definition
PRDHandleBase.h:35
PRDHandle_SpacePoint
Definition
PRDHandle_SpacePoint.h:33
PRDSysCommonData
Definition
PRDSysCommonData.h:35
PRDSysCommonData::registerPRD2Handle
void registerPRD2Handle(const Trk::PrepRawData *prd, PRDHandleBase *handle)
Definition
PRDSysCommonData.cxx:97
PRDSystemController
Definition
PRDSystemController.h:34
PRDSystemController::inDetPartsFlags
PRDCommonFlags::InDetPartsFlags inDetPartsFlags() const
Definition
PRDSystemController.cxx:378
SpacePointContainer
Definition
Tracking/TrkEvent/TrkSpacePoint/TrkSpacePoint/SpacePointContainer.h:29
Trk::SpacePoint
Definition
Tracking/TrkEvent/TrkSpacePoint/TrkSpacePoint/SpacePoint.h:35
VP1HelperClassBase::message
void message(const QString &) const
Definition
VP1HelperClassBase.cxx:49
VP1HelperClassBase::systemBase
IVP1System * systemBase() const
Definition
VP1HelperClassBase.h:50
VP1JobConfigInfo::hasPixelGeometry
static bool hasPixelGeometry()
Definition
VP1JobConfigInfo.cxx:130
VP1JobConfigInfo::hasSCTGeometry
static bool hasSCTGeometry()
Definition
VP1JobConfigInfo.cxx:132
VP1SGAccessHelper
Definition
VP1SGAccessHelper.h:25
VP1SGContentsHelper
Definition
VP1SGContentsHelper.h:26
VP1SGContentsHelper::getKeys
QStringList getKeys() const
Definition
VP1SGContentsHelper.h:55
VP1StdCollection::largeChangesEnd
virtual void largeChangesEnd()
Definition
VP1StdCollection.cxx:239
VP1StdCollection::largeChangesBegin
virtual void largeChangesBegin()
Definition
VP1StdCollection.cxx:228
VP1StdCollection::text
QString text() const
Definition
VP1StdCollection.cxx:132
contains
bool contains(const std::string &s, const std::string ®x)
does a string contain the substring
Definition
hcg.cxx:116
common
Definition
common.py:1
Generated on
for ATLAS Offline Software by
1.17.0