ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
graphics
VP1
VP1Systems
VP1BanksSystems
src
VP1BanksSystem.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
VP1BanksSystems/VP1BanksSystem.h
"
6
#include "ui_vp1bankscontroller.h"
7
#include "
VP1Utils/VP1SGContentsHelper.h
"
8
#include "
VP1Base/VP1Serialise.h
"
9
#include "
VP1Base/VP1Deserialise.h
"
10
11
#include "GaudiKernel/IClassIDSvc.h"
12
#include "GaudiKernel/ISvcLocator.h"
13
14
//____________________________________________________________________
15
class
VP1BanksSystem::Imp
{
16
public
:
17
Imp
(
VP1BanksSystem
*
tc
) :
theclass
(
tc
),
allowRefresh
(false),
clidSvc
(0) {}
18
VP1BanksSystem
*
theclass
;
19
bool
useDetStore
();
20
bool
allowRefresh
;
21
Ui::VP1BanksSystemControllerForm
ui
{};
22
23
QString
idToName
(
const
CLID
&)
const
;
24
SmartIF<IClassIDSvc>
clidSvc
;
25
26
QStringList
lastEmitted_keys
;
27
QStringList
lastEmitted_types
;
28
QStringList
lastEmitted_ids
;
29
30
void
emitIfChanged
(
const
QStringList& keys,
const
QStringList&
types
,
const
QStringList& ids) {
31
if
(
lastEmitted_keys
==keys&&
lastEmitted_types
==
types
&&
lastEmitted_ids
==ids)
32
return
;
33
lastEmitted_keys
=keys;
34
lastEmitted_types
=
types
;
35
lastEmitted_ids
=ids;
36
theclass
->messageVerbose(
"emitting entriesChanged(..) with "
+
str
(keys.count())+
" entries"
);
37
theclass
->entriesChanged(keys,
types
,ids);
38
}
39
40
};
41
42
43
//____________________________________________________________________
44
VP1BanksSystem::VP1BanksSystem
()
45
:
IVP1System
(
"Banks"
,
46
"System for browsing the contents of StoreGate"
,
47
"Joe Boudreau <boudreau@pitt.edu> (original), Thomas.Kittelmann@cern.ch (VP1 implementation)"
),
48
m_d
(new
Imp
(this))
49
{
50
m_d
->ui.radioButton_store_event = 0;
51
m_d
->ui.radioButton_store_detector = 0;
52
m_d
->ui.pushButton_refresh = 0;
53
}
54
55
56
//____________________________________________________________________
57
VP1BanksSystem::~VP1BanksSystem
()
58
{
59
delete
m_d
;
m_d
=0;
60
}
61
62
//____________________________________________________________________
63
QString
VP1BanksSystem::Imp::idToName
(
const
CLID
&
id
)
const
64
{
65
if
(!
clidSvc
)
66
return
""
;
67
std::string n;
68
if
(
clidSvc
->getTypeNameOfID(
id
, n).isFailure())
69
return
"<unknown>"
;
70
return
n.c_str();
71
}
72
73
//____________________________________________________________________
74
bool
VP1BanksSystem::Imp::useDetStore
()
75
{
76
return
ui
.radioButton_store_event && !
ui
.radioButton_store_event->isChecked();
77
}
78
79
80
//____________________________________________________________________
81
void
VP1BanksSystem::create
(
StoreGateSvc
*
/*detstore*/
)
82
{
83
QWidget * controller =
new
QWidget;
84
m_d
->ui.setupUi(controller);
85
connect(
m_d
->ui.radioButton_store_event,SIGNAL(toggled(
bool
)),
this
,SLOT(
refreshList
()));
86
connect(
m_d
->ui.pushButton_refresh,SIGNAL(clicked()),
this
,SLOT(
refreshList
()));
87
registerController
(controller);
88
89
ISvcLocator* svcLoc =
serviceLocator
();
90
if
(!svcLoc) {
91
message
(
"Error: Got NULL pointer to the service locator!"
);
92
return
;
93
}
94
95
m_d
->clidSvc = svcLoc->service(
"ClassIDSvc"
);
96
if
(!
m_d
->clidSvc) {
97
message
(
"Error: Could not retrieve ClassIDSvc!!"
);
98
return
;
99
}
100
101
102
}
103
104
//____________________________________________________________________
105
void
VP1BanksSystem::refresh
(
StoreGateSvc
* )
106
{
107
m_d
->allowRefresh =
true
;
108
refreshList
();
109
}
110
111
//____________________________________________________________________
112
void
VP1BanksSystem::refreshList
()
113
{
114
if
(!
m_d
->allowRefresh)
115
return
;
116
messageVerbose
(
"Refreshing list for "
+QString(
m_d
->useDetStore()?
"detector"
:
"event"
)+
" store"
);
117
118
QStringList entry_key;
119
QStringList entry_type;
120
QStringList entry_id;
121
122
VP1SGContentsHelper
sgcont(
this
,
m_d
->useDetStore());
123
124
int
i(0);
125
for
(
CLID
id
: sgcont.
getPossibleCLIDs
()) {
126
QStringList keys = sgcont.
getKeys
(
id
);
127
if
(!keys.isEmpty()) {
128
QString typeName =
m_d
->idToName(
id
);
129
QString idstr = QString::number(
id
);
130
for
(
const
QString& key : keys) {
131
entry_key << key;
132
entry_type << typeName;
133
entry_id << idstr;
134
}
135
}
136
if
(!i++%20)
137
updateGUI
();
138
}
139
m_d
->emitIfChanged(entry_key,entry_type,entry_id);
140
}
141
142
//____________________________________________________________________
143
void
VP1BanksSystem::erase
()
144
{
145
m_d
->allowRefresh =
false
;
146
m_d
->emitIfChanged(QStringList(),QStringList(),QStringList());
147
}
148
149
150
//____________________________________________________________________
151
QByteArray
VP1BanksSystem::saveState
()
152
{
153
VP1Serialise
serialise(0
/*version*/
,
this
);
154
serialise.save(
IVP1System::saveState
());
//Info from base class
155
156
serialise.save(
m_d
->ui.radioButton_store_event,
m_d
->ui.radioButton_store_detector);
157
158
serialise.warnUnsaved(
controllerWidget
());
159
return
serialise.result();
160
161
}
162
163
//____________________________________________________________________
164
void
VP1BanksSystem::restoreFromState
(QByteArray ba)
165
{
166
VP1Deserialise
state
(ba,
this
);
167
if
(
state
.version()!=0) {
168
message
(
"Warning: State data in .vp1 file is in wrong format - ignoring!"
);
169
return
;
170
}
171
IVP1System::restoreFromState
(
state
.restoreByteArray());
172
173
state
.restore(
m_d
->ui.radioButton_store_event,
m_d
->ui.radioButton_store_detector);
174
175
state
.warnUnrestored(
controllerWidget
());
176
}
CLID
uint32_t CLID
The Class ID type.
Definition
Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
tc
static Double_t tc
Definition
LArPhysWaveHECTool.cxx:38
types
static const std::vector< std::string > types
Definition
MuonTriggerSFFilesTest.cxx:20
VP1BanksSystem.h
VP1Deserialise.h
VP1SGContentsHelper.h
VP1Serialise.h
IVP1System::messageVerbose
void messageVerbose(const QString &) const
Definition
IVP1System.cxx:354
IVP1System::restoreFromState
virtual void restoreFromState(QByteArray)
Definition
IVP1System.cxx:302
IVP1System::state
State state() const
Definition
IVP1System.cxx:129
IVP1System::controllerWidget
QWidget * controllerWidget()
Definition
IVP1System.cxx:202
IVP1System::updateGUI
void updateGUI()
Definition
IVP1System.cxx:262
IVP1System::IVP1System
IVP1System(const QString &name, const QString &information, const QString &contact_info)
Definition
IVP1System.cxx:68
IVP1System::message
void message(const QString &) const
Definition
IVP1System.cxx:336
IVP1System::registerController
void registerController(QWidget *)
Definition
IVP1System.cxx:224
IVP1System::serviceLocator
ISvcLocator * serviceLocator() const
Definition
IVP1System.cxx:324
IVP1System::saveState
virtual QByteArray saveState()
Definition
IVP1System.cxx:294
StoreGateSvc
The Athena Transient Store API.
Definition
StoreGateSvc.h:120
VP1BanksSystem::Imp
Definition
VP1BanksSystem.cxx:15
VP1BanksSystem::Imp::lastEmitted_keys
QStringList lastEmitted_keys
Definition
VP1BanksSystem.cxx:26
VP1BanksSystem::Imp::lastEmitted_types
QStringList lastEmitted_types
Definition
VP1BanksSystem.cxx:27
VP1BanksSystem::Imp::lastEmitted_ids
QStringList lastEmitted_ids
Definition
VP1BanksSystem.cxx:28
VP1BanksSystem::Imp::idToName
QString idToName(const CLID &) const
Definition
VP1BanksSystem.cxx:63
VP1BanksSystem::Imp::theclass
VP1BanksSystem * theclass
Definition
VP1BanksSystem.cxx:18
VP1BanksSystem::Imp::ui
Ui::VP1BanksSystemControllerForm ui
Definition
VP1BanksSystem.cxx:21
VP1BanksSystem::Imp::allowRefresh
bool allowRefresh
Definition
VP1BanksSystem.cxx:20
VP1BanksSystem::Imp::emitIfChanged
void emitIfChanged(const QStringList &keys, const QStringList &types, const QStringList &ids)
Definition
VP1BanksSystem.cxx:30
VP1BanksSystem::Imp::useDetStore
bool useDetStore()
Definition
VP1BanksSystem.cxx:74
VP1BanksSystem::Imp::clidSvc
SmartIF< IClassIDSvc > clidSvc
Definition
VP1BanksSystem.cxx:24
VP1BanksSystem::Imp::Imp
Imp(VP1BanksSystem *tc)
Definition
VP1BanksSystem.cxx:17
VP1BanksSystem::refresh
void refresh(StoreGateSvc *storegate)
Definition
VP1BanksSystem.cxx:105
VP1BanksSystem::erase
void erase()
Definition
VP1BanksSystem.cxx:143
VP1BanksSystem::~VP1BanksSystem
virtual ~VP1BanksSystem()
Definition
VP1BanksSystem.cxx:57
VP1BanksSystem::refreshList
void refreshList()
Definition
VP1BanksSystem.cxx:112
VP1BanksSystem::VP1BanksSystem
VP1BanksSystem()
Definition
VP1BanksSystem.cxx:44
VP1BanksSystem::m_d
Imp * m_d
Definition
VP1BanksSystem.h:44
VP1BanksSystem::create
void create(StoreGateSvc *detstore)
Definition
VP1BanksSystem.cxx:81
VP1BanksSystem::restoreFromState
void restoreFromState(QByteArray)
Definition
VP1BanksSystem.cxx:164
VP1BanksSystem::saveState
QByteArray saveState()
Definition
VP1BanksSystem.cxx:151
VP1Deserialise
Definition
VP1Deserialise.h:44
VP1SGContentsHelper
Definition
VP1SGContentsHelper.h:26
VP1SGContentsHelper::getKeys
QStringList getKeys() const
Definition
VP1SGContentsHelper.h:55
VP1SGContentsHelper::getPossibleCLIDs
QList< CLID > getPossibleCLIDs() const
Definition
VP1SGContentsHelper.cxx:113
VP1Serialise
Definition
VP1Serialise.h:45
str
Definition
BTagTrackIpAccessor.cxx:11
Generated on
for ATLAS Offline Software by
1.17.0