ATLAS Offline Software
Loading...
Searching...
No Matches
VP1RawDataSystem.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
7// //
8// Implementation of class VP1RawDataSystem //
9// //
10// Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
11// Initial version: June 2008 (rewritten January 2009) //
12// //
14
28#include <Inventor/nodes/SoSeparator.h>
29#include <Inventor/nodes/SoSwitch.h>
30#include <Inventor/nodes/SoTransform.h>
31#include <Inventor/SoPath.h>
32
33//____________________________________________________________________
35public:
40
41 template <class T>
42 QList<VP1RawDataCollBase*> createSpecificCollections() {
43 QList<VP1RawDataCollBase*> l;
44 for (const QString& name : T::availableCollections(theclass)) {
46 T * col = new T(common,name);
47 col->init();
48 l << col;
49 }
50 return l;
51 }
52 QList<VP1RawDataCollBase*> createCollections() {
53 QList<VP1RawDataCollBase*> l;
54 l << createSpecificCollections<VP1RawDataColl_PixelRDO>();
55 l << createSpecificCollections<VP1RawDataColl_SCT_RDO>();
56 l << createSpecificCollections<VP1RawDataColl_TRT_RDO>();
57 l << createSpecificCollections<VP1RawDataColl_BCM_RDO>();
58 l << createSpecificCollections<VP1RawDataColl_LUCID>();
59 return l;
60 }
61
63 if (!common) {
64 theclass->ensureBuildController();
66 }
67 }
68
69};
70
71//_____________________________________________________________________________________
73 : IVP13DSystemSimple("RawHits",
74 "System showing Raw Data (RDO's, BCM hits, ...)",
75 "Thomas.Kittelmann@cern.ch"),
76 m_d(new Imp(this))
77{
78}
79
80//____________________________________________________________________
85
86//_____________________________________________________________________________________
88{
89 //Save present states and then clear all event data and related gui elements.
90 if (m_d->controller)
91 m_d->controller->collWidget()->clear();
92
93 if (m_d->common)
94 m_d->common->clearEventData();
95}
96
97//_____________________________________________________________________________________
99{
100 delete m_d->common;
101 m_d->common = 0;
102}
103
104//_____________________________________________________________________________________
106{
107 root->addChild(m_d->controller->drawOptions());
108
109 //Create collection list based on contents of event store, populate
110 //gui and apply states:
111 m_d->controller->collWidget()->setCollections(m_d->createCollections());
112
113 //Add collections to event scenegraph:
114 for (VP1StdCollection* col : m_d->controller->collWidget()->collections<VP1StdCollection>())
115 root->addChild(col->collSwitch());
116}
117
118//_____________________________________________________________________________________
120{
121 m_d->controller = new VP1RawDataSysController(this);
122 return m_d->controller;
123}
124
125//_____________________________________________________________________________________
126void VP1RawDataSystem::userPickedNode(SoNode*, SoPath * pickedPath) {
127 messageVerbose("userPickedNode");
128
129 //Look for separator whose first child is known transform (also pop a few times).
130 m_d->ensureInitCommonData();
131 VP1RawDataHandleBase* handle(0);
132 int i(1);
133 for (; i < pickedPath->getLength(); ++i) {
134 if (pickedPath->getNodeFromTail(i)->getTypeId()==SoSeparator::getClassTypeId()) {
135 SoSeparator * sep = static_cast<SoSeparator*>(pickedPath->getNodeFromTail(i));
136 if (sep->getNumChildren()>0&&sep->getChild(0)->getTypeId()==SoTransform::getClassTypeId()) {
137 SoTransform * transform = static_cast<SoTransform*>(sep->getChild(0));
138 handle = m_d->common->getHandle(transform);
139 if (handle)
140 break;
141 }
142 }
143 }
144 for (int j=0;j<i;++j)
145 pickedPath->pop();
146
147 if (!handle) {
148 message("WARNING: Unknown node clicked.");
149 return;
150 }
151
152 if (m_d->controller->printInfoOnClick()) {
153 message(handle->clicked(m_d->controller->printVerboseInfoOnClick()));
154 }
155 if (m_d->controller->zoomOnClick()) {
156 std::set<SoCamera*> cameras(getCameraList());
157 std::set<SoCamera*>::iterator it,itE = cameras.end();
158 for (it=cameras.begin();it!=itE;++it)
159 VP1CameraHelper::animatedZoomToPath(*it,handle->coll()->collSep(),pickedPath,2.0,1.0);
160 }
161
162}
163
164//_____________________________________________________________________________________
166{
167 VP1Serialise serialise(0/*version*/,this);
169
170 serialise.save(IVP13DSystemSimple::saveState());
171
172 serialise.save(m_d->controller->collWidget());
173 serialise.save(m_d->controller->saveSettings());
174
175 serialise.disableUnsavedChecks();//We do the testing in the controller
176
177 return serialise.result();
178}
179
180//_____________________________________________________________________________________
182{
183 VP1Deserialise state(ba,this);
184 if (state.version()<0||state.version()>0) {
185 message("Warning: State data in .vp1 file is in wrong format - ignoring!");
186 return;
187 }
190
191 state.restore(m_d->controller->collWidget());
192 m_d->controller->restoreSettings(state.restoreByteArray());
193
194 state.disableUnrestoredChecks();//We do the testing in the controller
195}
static Double_t tc
IVP13DSystemSimple(const QString &name, const QString &information, const QString &contact_info)
CamList getCameraList()
void messageVerbose(const QString &) const
virtual void restoreFromState(QByteArray)
const QString & name() const
State state() const
void message(const QString &) const
virtual QByteArray saveState()
The Athena Transient Store API.
static VP1CameraHelper * animatedZoomToPath(SoCamera *camera, SoGroup *sceneroot, SoPath *path, double duration_in_secs=1.0, double clipVolPercent=100.0, double slack=1.0, const SbVec3f &lookat=SbVec3f(999, 999, 999), const SbVec3f &upvec=SbVec3f(999, 999, 999), bool varySpeed=true, bool forceCircular=false)
virtual QStringList clicked(bool verbose) const =0
VP1RawDataCollBase * coll() const
QList< VP1RawDataCollBase * > createCollections()
VP1RawDataSysController * controller
Imp(VP1RawDataSystem *tc)
QList< VP1RawDataCollBase * > createSpecificCollections()
VP1RawDataSystem * theclass
virtual QWidget * buildController()
void buildEventSceneGraph(StoreGateSvc *sg, SoSeparator *root)
void restoreFromState(QByteArray)
void userPickedNode(SoNode *pickedNode, SoPath *pickedPath)
SoSeparator * collSep() const
All 3D objects from this coll.