ATLAS Offline Software
Loading...
Searching...
No Matches
VP1RawDataSystem.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 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// Main updates:
13// - 2025, 05 -- R.M.Bianchi, Adding Muon digits (RDOs)
14// //
16
18#include <QVariant>
36#include <Inventor/nodes/SoSeparator.h>
37#include <Inventor/nodes/SoSwitch.h>
38#include <Inventor/nodes/SoTransform.h>
39#include <Inventor/SoPath.h>
40
41//____________________________________________________________________
43public:
48
49 template <class T>
50 QList<VP1RawDataCollBase*> createSpecificCollections() {
51 QList<VP1RawDataCollBase*> l;
52 for (const QString& name : T::availableCollections(theclass)) {
54 T * col = new T(common,name);
55 col->init();
56 l << col;
57 }
58 return l;
59 }
60 QList<VP1RawDataCollBase*> createCollections() {
61 QList<VP1RawDataCollBase*> l;
62 l << createSpecificCollections<VP1RawDataColl_PixelRDO>();
63 l << createSpecificCollections<VP1RawDataColl_SCT_RDO>();
64 l << createSpecificCollections<VP1RawDataColl_TRT_RDO>();
65 l << createSpecificCollections<VP1RawDataColl_BCM_RDO>();
66 l << createSpecificCollections<VP1RawDataColl_LUCID>();
67 l << createSpecificCollections<VP1RawDataColl_MDT_RDO>();
68 l << createSpecificCollections<VP1RawDataColl_TGC_Digit>();
69 l << createSpecificCollections<VP1RawDataColl_RPC_Digit>();
70 l << createSpecificCollections<VP1RawDataColl_MM_RDO>();
71 l << createSpecificCollections<VP1RawDataColl_sTGC_RDO>();
72 return l;
73 }
74
76 if (!common) {
77 theclass->ensureBuildController();
79 }
80 }
81
82};
83
84//_____________________________________________________________________________________
86 : IVP13DSystemSimple("RawHits",
87 "System showing raw data and digits (RDOs, muon digits, BCM hits, ...)",
88 "Thomas.Kittelmann@cern.ch, Riccardo.Maria.Bianchi@cern.ch"),
89 m_d(new Imp(this))
90{
91 // Keep "RawHits" as the persistent identity and controller-tab name.
92 setProperty("vp1SystemLabel", "RawHits and Digits");
93}
94
95//____________________________________________________________________
100
101//_____________________________________________________________________________________
103{
104 //Save present states and then clear all event data and related gui elements.
105 if (m_d->controller)
106 m_d->controller->collWidget()->clear();
107
108 if (m_d->common)
109 m_d->common->clearEventData();
110}
111
112//_____________________________________________________________________________________
114{
115 delete m_d->common;
116 m_d->common = 0;
117}
118
119//_____________________________________________________________________________________
121{
122 root->addChild(m_d->controller->drawOptions());
123
124 //Create collection list based on contents of event store, populate
125 //gui and apply states:
126 m_d->controller->collWidget()->setCollections(m_d->createCollections());
127
128 //Add collections to event scenegraph:
129 for (VP1StdCollection* col : m_d->controller->collWidget()->collections<VP1StdCollection>())
130 root->addChild(col->collSwitch());
131}
132
133//_____________________________________________________________________________________
135{
136 m_d->controller = new VP1RawDataSysController(this);
137 return m_d->controller;
138}
139
140//_____________________________________________________________________________________
141void VP1RawDataSystem::userPickedNode(SoNode*, SoPath * pickedPath) {
142 messageVerbose("userPickedNode");
143
144 //Look for separator whose first child is known transform (also pop a few times).
145 m_d->ensureInitCommonData();
146 VP1RawDataHandleBase* handle(0);
147 int i(1);
148 for (; i < pickedPath->getLength(); ++i) {
149 if (pickedPath->getNodeFromTail(i)->getTypeId()==SoSeparator::getClassTypeId()) {
150 SoSeparator * sep = static_cast<SoSeparator*>(pickedPath->getNodeFromTail(i));
151 if (sep->getNumChildren()>0&&sep->getChild(0)->getTypeId()==SoTransform::getClassTypeId()) {
152 SoTransform * transform = static_cast<SoTransform*>(sep->getChild(0));
153 handle = m_d->common->getHandle(transform);
154 if (handle)
155 break;
156 }
157 }
158 }
159 for (int j=0;j<i;++j)
160 pickedPath->pop();
161
162 if (!handle) {
163 message("WARNING: Unknown node clicked.");
164 return;
165 }
166
167 if (m_d->controller->printInfoOnClick()) {
168 message(handle->clicked(m_d->controller->printVerboseInfoOnClick()));
169 }
170 if (m_d->controller->zoomOnClick()) {
171 std::set<SoCamera*> cameras(getCameraList());
172 std::set<SoCamera*>::iterator it,itE = cameras.end();
173 for (it=cameras.begin();it!=itE;++it)
174 VP1CameraHelper::animatedZoomToPath(*it,handle->coll()->collSep(),pickedPath,2.0,1.0);
175 }
176
177}
178
179//_____________________________________________________________________________________
181{
182 VP1Serialise serialise(0/*version*/,this);
184
185 serialise.save(IVP13DSystemSimple::saveState());
186
187 serialise.save(m_d->controller->collWidget());
188 serialise.save(m_d->controller->saveSettings());
189
190 serialise.disableUnsavedChecks();//We do the testing in the controller
191
192 return serialise.result();
193}
194
195//_____________________________________________________________________________________
197{
198 VP1Deserialise state(ba,this);
199 if (state.version()<0||state.version()>0) {
200 message("Warning: State data in .vp1 file is in wrong format - ignoring!");
201 return;
202 }
205
206 state.restore(m_d->controller->collWidget());
207 m_d->controller->restoreSettings(state.restoreByteArray());
208
209 state.disableUnrestoredChecks();//We do the testing in the controller
210}
static Double_t tc
void setProperty(columnar::PythonToolHandle &self, const std::string &key, nb::object value)
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)
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)