ATLAS Offline Software
IVP1System.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // //
7 // Header file for class IVP1System //
8 // //
9 // Author: Thomas Kittelmann <Thomas.Kittelmann@cern.ch> //
10 // //
11 // Initial version: April 2007 //
12 // //
14 
15 #ifndef IVP1SYSTEM_H
16 #define IVP1SYSTEM_H
17 
18 #include "VP1Base/VP1String.h"
19 #include <QObject>
20 #include <QByteArray>
21 
22 // GeoModel
24 //
25 #include "GeoModelKernel/GeoVPhysVol.h"
26 
27 #ifdef BUILDVP1LIGHT
28  #include "xAODBase/IParticle.h"
29 #endif // BUILDVP1LIGHT
30 
31 class IVP1ChannelWidget;
32 class StoreGateSvc;
33 class ISvcLocator;
34 class IToolSvc;
35 // Base class for all systems:
36 class IVP1System : public QObject, public VP1String {
37 
38  Q_OBJECT
39 
40 public:
41 
42  // Constructor:
43  IVP1System(const QString & name, const QString & information, const QString & contact_info);
44 
45  // Destructor:
46  virtual ~IVP1System();
47 
48 protected:
49  // Initialize the system:
50  virtual void create( StoreGateSvc* detectorStore ) = 0;
51 
52  // Refresh event-per-event graphics (sg will be null for standalone apps):
53  virtual void refresh( StoreGateSvc* eventStore ) = 0;
54 
55  // Erase any event-per-event graphics:
56  virtual void erase() = 0;
57 
58  // Finalize the system:
59  virtual void uncreate();
60 
61  // Retrieve label information:
62 public:
63  const QString& name() const;
64  const QString& information() const;
65  const QString& contact_info() const;
66 
67  QWidget * controllerWidget();
68 
69 protected:
70  //If the systems needs a custom control widget to allow the user to
71  //control how it presents itself, call the follwing method in
72  //create() (and at most once). NB: It is up to a given channel
73  //whether to actually show this controller to the user by
74  //e.g. incorporating it into its own controller:
75  void registerController(QWidget*);
76 
77 public:
78  //Override the following if the system needs to be able to save info in the .vp1 files:
79  virtual QByteArray saveState();
80  virtual void restoreFromState(QByteArray);//If channel loaded from .vp1 files, this will be called
81  //after create() and before the first refresh().
82 
83  void message(const QString&) const; //calling this method causes a message show up in the text
84  //window of the application (through emission of the sysmessage signal below).
85  void messageDebug(const QString&) const;//Output only to stdout.
86  static bool verbose() { return s_vp1verbose; }// Returns true if env var VP1_VERBOSE_OUTPUT=1
87  void messageVerbose(const QString&) const;//Only outputs when verbose()
88 
89  //Overloaded convenience methods, for outputting several lines:
90  void message(const QStringList&, const QString& addtoend = "" ) const;
91  void messageDebug(const QStringList&, const QString& addtoend = "") const;
92  void messageVerbose(const QStringList&, const QString& addtoend = "") const;
93  void message(const QString& addtostart, const QStringList&, const QString& addtoend = "" ) const;
94  void messageDebug(const QString& addtostart, const QStringList&, const QString& addtoend = "") const;
95  void messageVerbose(const QString& addtostart, const QStringList&, const QString& addtoend = "") const;
96 
97 #ifdef BUILDVP1LIGHT
98  xAOD::TEvent* getEvent();
99  void setEvent(xAOD::TEvent* event );
100  QStringList getObjectList(xAOD::Type::ObjectType); // Pass the collection names
101  void setObjectList(QList<QStringList>);
102 #endif // BUILDVP1LIGHT
103 
104 signals:
105  void sysmessage(QString) const;
106 
107 #ifdef BUILDVP1LIGHT
108  void signalLoadEvent(IVP1System*);
109 #endif // BUILDVP1LIGHT
110 
111 public://Public for easier use in helper classes.
112 
113  void updateGUI();//Please call this occasionally if doing a lot of
114  //heavy calculations, to prevent the GUI from
115  //freezing up (for now we are single-threaded, so
116  //this is what we need to do).
117 
118  //Use these to access athena services (it is wise to check that they are not null):
119  StoreGateSvc * storeGate() const { return eventStore(); }//OBSOLETE NAME. Use eventStore() instead.
120  StoreGateSvc * eventStore() const;
121  StoreGateSvc * detectorStore() const;
122  ISvcLocator * serviceLocator() const;
123  IToolSvc * toolSvc() const;
124 
125 private:
126 
127  IVP1System( const IVP1System & );
129 
130  class Imp;
131  Imp * m_d;
132  friend class VP1ExecutionScheduler;
133  friend class VP1Prioritiser;
134  friend class IVP1ChannelWidget;
135  friend class VP1MainWindow;
136  void disallowUpdateGUI();
137  void allowUpdateGUI();
139 
140  IVP1ChannelWidget * channel() const;
141  void deleteController();
142 public:
144  enum ActiveState { ON=0, OFF };//Whether it is part of the erase/refresh cycle.
145  State state() const;
146  ActiveState activeState() const;
147 private:
148  void setState(const State&);
149  void setActiveState(const ActiveState&, const bool& donttriggererase=true);
150  bool isRefreshing();
151  void setRefreshing(const bool&);
152  void setCanRegisterController(const bool&);
153 signals:
154  void inactiveSystemTurnedActive();//Do NOT call this method in derived classes!!!
155  void needErase();//Do NOT call this method in derived classes!!!
156 
157 private:
158  static const bool s_vp1verbose;
159 
160 #ifdef BUILDVP1LIGHT
161  QList<QStringList> m_list;
162  xAOD::TEvent* m_event;
163 #endif // BUILDVP1LIGHT
164 
165 };
166 
167 #endif
IParticle.h
VP1String
Definition: VP1String.h:43
IVP1System::isRefreshing
bool isRefreshing()
Definition: IVP1System.cxx:108
ObjectType
ObjectType
Definition: BaseObject.h:11
VP1String.h
IVP1System::setChannel
void setChannel(IVP1ChannelWidget *)
Definition: IVP1System.cxx:94
IVP1System::CONSTRUCTED
@ CONSTRUCTED
Definition: IVP1System.h:143
IVP1System::information
const QString & information() const
Definition: IVP1System.cxx:56
IVP1System::uncreate
virtual void uncreate()
Definition: IVP1System.cxx:192
IVP1System::m_d
Imp * m_d
Definition: IVP1System.h:130
IVP1System::setCanRegisterController
void setCanRegisterController(const bool &)
Definition: IVP1System.cxx:285
IVP1System::inactiveSystemTurnedActive
void inactiveSystemTurnedActive()
IVP1System::disallowUpdateGUI
void disallowUpdateGUI()
Definition: IVP1System.cxx:250
IVP1System::deleteController
void deleteController()
Definition: IVP1System.cxx:213
IVP1System::storeGate
StoreGateSvc * storeGate() const
Definition: IVP1System.h:119
IVP1System::s_vp1verbose
static const bool s_vp1verbose
Definition: IVP1System.h:158
IVP1System::state
State state() const
Definition: IVP1System.cxx:129
IVP1System::saveState
virtual QByteArray saveState()
Definition: IVP1System.cxx:294
IVP1System::operator=
IVP1System & operator=(const IVP1System &)
IVP1System::setRefreshing
void setRefreshing(const bool &)
Definition: IVP1System.cxx:114
GeoPrimitives.h
IVP1System::needErase
void needErase()
IVP1System::activeState
ActiveState activeState() const
Definition: IVP1System.cxx:135
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:125
IVP1System
Definition: IVP1System.h:36
IVP1System::Imp
Definition: IVP1System.cxx:30
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
VP1Prioritiser
Definition: VP1Prioritiser.h:22
IVP1System::setState
void setState(const State &)
Definition: IVP1System.cxx:141
IVP1System::serviceLocator
ISvcLocator * serviceLocator() const
Definition: IVP1System.cxx:324
IVP1System::name
const QString & name() const
Definition: IVP1System.cxx:50
IVP1System::REFRESHED
@ REFRESHED
Definition: IVP1System.h:143
IVP1System::verbose
static bool verbose()
Definition: IVP1System.h:86
IVP1System::allowUpdateGUI
void allowUpdateGUI()
Definition: IVP1System.cxx:256
IVP1System::create
virtual void create(StoreGateSvc *detectorStore)=0
IVP1System::contact_info
const QString & contact_info() const
Definition: IVP1System.cxx:62
IVP1System::UNCREATED
@ UNCREATED
Definition: IVP1System.h:143
python.L1.Config.LegacyTopoMergerMap.signals
signals
Definition: LegacyTopoMergerMap.py:13
IVP1System::eventStore
StoreGateSvc * eventStore() const
Definition: IVP1System.cxx:312
IVP1System::sysmessage
void sysmessage(QString) const
IVP1ChannelWidget
Definition: IVP1ChannelWidget.h:34
IVP1System::ON
@ ON
Definition: IVP1System.h:144
VP1ExecutionScheduler
Definition: VP1ExecutionScheduler.h:42
IVP1System::State
State
Definition: IVP1System.h:143
IVP1System::channel
IVP1ChannelWidget * channel() const
Definition: IVP1System.cxx:275
IVP1System::messageDebug
void messageDebug(const QString &) const
Definition: IVP1System.cxx:347
IVP1System::detectorStore
StoreGateSvc * detectorStore() const
Definition: IVP1System.cxx:318
IVP1System::registerController
void registerController(QWidget *)
Definition: IVP1System.cxx:224
IVP1System::toolSvc
IToolSvc * toolSvc() const
Definition: IVP1System.cxx:330
IVP1System::refresh
virtual void refresh(StoreGateSvc *eventStore)=0
IVP1System::erase
virtual void erase()=0
IVP1System::updateGUI
void updateGUI()
Definition: IVP1System.cxx:262
IVP1System::ActiveState
ActiveState
Definition: IVP1System.h:144
IVP1System::IVP1System
IVP1System(const IVP1System &)
IVP1System::~IVP1System
virtual ~IVP1System()
Definition: IVP1System.cxx:79
VP1MainWindow
Definition: VP1MainWindow.h:82
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::OFF
@ OFF
Definition: IVP1System.h:144
xAOD::TEvent
Tool for accessing xAOD files outside of Athena.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:84
IVP1System::messageVerbose
void messageVerbose(const QString &) const
Definition: IVP1System.cxx:354
IVP1System::ERASED
@ ERASED
Definition: IVP1System.h:143
IVP1System::controllerWidget
QWidget * controllerWidget()
Definition: IVP1System.cxx:202
IVP1System::setActiveState
void setActiveState(const ActiveState &, const bool &donttriggererase=true)
Definition: IVP1System.cxx:162
IVP1System::restoreFromState
virtual void restoreFromState(QByteArray)
Definition: IVP1System.cxx:302