ATLAS Offline Software
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 
24 #include "VP1Base/VP1Serialise.h"
25 #include "VP1Base/VP1Deserialise.h"
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 //____________________________________________________________________
35 public:
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) {
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 //____________________________________________________________________
82  {
83  delete m_d;
84 }
85 
86 //_____________________________________________________________________________________
88 {
89  //Save present states and then clear all event data and related gui elements.
90  if (m_d->controller)
92 
93  if (m_d->common)
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:
112 
113  //Add collections to event scenegraph:
115  root->addChild(col->collSwitch());
116 }
117 
118 //_____________________________________________________________________________________
120 {
122  return m_d->controller;
123 }
124 
125 //_____________________________________________________________________________________
126 void VP1RawDataSystem::userPickedNode(SoNode*, SoPath * pickedPath) {
127  messageVerbose("userPickedNode");
128 
129  //Look for separator whose first child is known transform (also pop a few times).
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()) {
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 
171 
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  }
189  IVP13DSystemSimple::restoreFromState(state.restoreByteArray());
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 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
VP1Serialise.h
VP1RawDataSystem::Imp::createCollections
QList< VP1RawDataCollBase * > createCollections()
Definition: VP1RawDataSystem.cxx:52
VP1RawDataSystem::VP1RawDataSystem
VP1RawDataSystem()
Definition: VP1RawDataSystem.cxx:72
VP1RawDataColl_BCM_RDO.h
VP1RawDataColl_TRT_RDO.h
VP1Deserialise.h
VP1Serialise
Definition: VP1Serialise.h:45
IVP13DSystemSimple
Definition: IVP13DSystemSimple.h:24
VP1RawDataSystem::Imp::theclass
VP1RawDataSystem * theclass
Definition: VP1RawDataSystem.cxx:37
VP1RawDataSystem
Definition: VP1RawDataSystem.h:23
VP1RawDataHandleBase
Definition: VP1RawDataHandleBase.h:34
VP1RawDataSystem::systemuncreate
void systemuncreate()
Definition: VP1RawDataSystem.cxx:98
RoiUtil::serialise
void serialise(const std::vector< const IRoiDescriptor * > &rois, roiserial_type &s)
serialise an entire vector of IRoiDescriptors
Definition: RoiSerialise.cxx:45
VP1RawDataSystem::m_d
Imp * m_d
Definition: VP1RawDataSystem.h:39
VP1RawDataSysController::zoomOnClick
bool zoomOnClick() const
Definition: VP1RawDataSysController.cxx:206
VP1RawDataCommonData::getHandle
VP1RawDataHandleBase * getHandle(SoTransform *)
Definition: VP1RawDataCommonData.cxx:68
VP1RawDataColl_LUCID.h
VP1RawDataHandleBase::clicked
virtual QStringList clicked(bool verbose) const =0
VP1CameraHelper.h
VP1RawDataColl_SCT_RDO.h
CSV_InDetExporter.new
new
Definition: CSV_InDetExporter.py:145
VP1CollectionWidget::setCollections
void setCollections(const QList< VP1Collection * > &, bool applySavedStates=true)
Definition: VP1CollectionWidget.cxx:258
skel.it
it
Definition: skel.GENtoEVGEN.py:396
VP1Controller::restoreSettings
void restoreSettings(const QByteArray &)
Definition: VP1Controller.cxx:387
VP1RawDataSystem::userPickedNode
void userPickedNode(SoNode *pickedNode, SoPath *pickedPath)
Definition: VP1RawDataSystem.cxx:126
VP1RawDataSystem::Imp::createSpecificCollections
QList< VP1RawDataCollBase * > createSpecificCollections()
Definition: VP1RawDataSystem.cxx:42
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
VP1RawDataSysController
Definition: VP1RawDataSysController.h:24
sendEI_SPB.root
root
Definition: sendEI_SPB.py:34
VP1CameraHelper::animatedZoomToPath
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)
Definition: VP1CameraHelper.cxx:371
VP1CollectionWidget::clear
void clear(bool deleteCollections=true, bool deleteGuiElements=false)
Definition: VP1CollectionWidget.cxx:81
VP1RawDataSystem::Imp::Imp
Imp(VP1RawDataSystem *tc)
Definition: VP1RawDataSystem.cxx:36
VP1Controller::saveSettings
QByteArray saveSettings() const
Definition: VP1Controller.cxx:405
TruthTest.itE
itE
Definition: TruthTest.py:25
VP1CollectionWidget.h
IVP1System::state
State state() const
Definition: IVP1System.cxx:129
IVP1System::saveState
virtual QByteArray saveState()
Definition: IVP1System.cxx:294
VP1RawDataSystem.h
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:125
VP1RawDataSystem::Imp
Definition: VP1RawDataSystem.cxx:34
VP1RawDataColl_PixelRDO.h
lumiFormat.i
int i
Definition: lumiFormat.py:85
VP1RawDataSysController.h
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
VP1RawDataSystem::buildEventSceneGraph
void buildEventSceneGraph(StoreGateSvc *sg, SoSeparator *root)
Definition: VP1RawDataSystem.cxx:105
IVP1System::name
const QString & name() const
Definition: IVP1System.cxx:50
VP1RawDataSystem::saveState
QByteArray saveState()
Definition: VP1RawDataSystem.cxx:165
VP1RawDataSystem::restoreFromState
void restoreFromState(QByteArray)
Definition: VP1RawDataSystem.cxx:181
IVP13DSystemSimple::ensureBuildController
void ensureBuildController()
Definition: IVP13DSystemSimple.cxx:90
VP1Deserialise
Definition: VP1Deserialise.h:44
VP1RawDataSysController::printInfoOnClick
bool printInfoOnClick() const
Definition: VP1RawDataSysController.cxx:204
VP1RawDataSystem::systemerase
void systemerase()
Definition: VP1RawDataSystem.cxx:87
VP1RawDataSystem::Imp::ensureInitCommonData
void ensureInitCommonData()
Definition: VP1RawDataSystem.cxx:62
grepfile.sep
sep
Definition: grepfile.py:38
VP1RawDataCommonData.h
VP1RawDataSystem::buildController
virtual QWidget * buildController()
Definition: VP1RawDataSystem.cxx:119
VP1CollectionWidget::collections
const QList< VP1Collection * > & collections() const
Definition: VP1CollectionWidget.cxx:61
query_example.col
col
Definition: query_example.py:7
VP1RawDataSystem::Imp::controller
VP1RawDataSysController * controller
Definition: VP1RawDataSystem.cxx:38
VP1RawDataSysController::printVerboseInfoOnClick
bool printVerboseInfoOnClick() const
Definition: VP1RawDataSysController.cxx:205
IVP13DSystem::getCameraList
CamList getCameraList()
Definition: IVP13DSystem.cxx:395
VP1RawDataSystem::~VP1RawDataSystem
virtual ~VP1RawDataSystem()
Definition: VP1RawDataSystem.cxx:81
VP1RawDataSysController::collWidget
VP1CollectionWidget * collWidget() const
Definition: VP1RawDataSysController.cxx:192
VP1StdCollection::collSep
SoSeparator * collSep() const
All 3D objects from this coll.
Definition: VP1StdCollection.cxx:212
VP1RawDataCommonData::clearEventData
void clearEventData()
Definition: VP1RawDataCommonData.cxx:62
VP1RawDataHandleBase::coll
VP1RawDataCollBase * coll() const
Definition: VP1RawDataHandleBase.h:40
VP1RawDataSystem::Imp::common
VP1RawDataCommonData * common
Definition: VP1RawDataSystem.cxx:39
VP1RawDataHandleBase.h
VP1RawDataCommonData
Definition: VP1RawDataCommonData.h:31
VP1StdCollection
Definition: VP1StdCollection.h:31
VP1RawDataSysController::drawOptions
SoGroup * drawOptions() const
Definition: VP1RawDataSysController.cxx:198
IVP1System::message
void message(const QString &) const
Definition: IVP1System.cxx:336
IVP1System::messageVerbose
void messageVerbose(const QString &) const
Definition: IVP1System.cxx:354
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
common
Definition: common.py:1
IVP1System::restoreFromState
virtual void restoreFromState(QByteArray)
Definition: IVP1System.cxx:302