ATLAS Offline Software
Loading...
Searching...
No Matches
VP1GuideLineSystem.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5
7// //
8// Implementation of class VP1GuideLineSystem //
9// //
10// Author: Thomas Kittelmann <Thomas.Kittelmann@cern.ch> //
11// //
12// Initial version: July 2007 //
13// //
15
28
31#include "VP1Base/VP1Msg.h"
32
33#include <Inventor/nodes/SoDrawStyle.h>
34#include <Inventor/nodes/SoLineSet.h>
35#include <Inventor/nodes/SoMaterial.h>
36#include <Inventor/nodes/SoPointSet.h>
37#include <Inventor/nodes/SoSeparator.h>
38#include <Inventor/nodes/SoSwitch.h>
39#include <Inventor/nodes/SoText2.h>
40#include <Inventor/nodes/SoTranslation.h>
41#include <Inventor/nodes/SoVertexProperty.h>
42#include <Inventor/nodes/SoPickStyle.h>
43#include <Inventor/nodes/SoComplexity.h>
44#include <Inventor/SbVec3f.h>
45
46#include <QByteArray>
47#include <QMap>
48#include <algorithm>
49#include <map>
50#include <vector>
51
52#ifndef BUILDVP1LIGHT
56
61
62namespace {
63struct TruthHitPoint {
64 TruthHitPoint(double t, const HepGeom::Point3D<double>& p) : time(t), position(p) {}
65 double time;
66 HepGeom::Point3D<double> position;
67};
68
69struct TruthHitLabel {
70 TruthHitLabel(const HepGeom::Point3D<double>& p, const QString& l) : position(p), label(l) {}
71 HepGeom::Point3D<double> position;
72 QString label;
73};
74
75void addHGTDLabel(SoSwitch* labelsSwitch, const TruthHitLabel& label)
76{
77 if (!labelsSwitch || label.label.isEmpty())
78 return;
79
80 SoSeparator* oneLabelSep = new SoSeparator();
81 SoTranslation* labelTranslation = new SoTranslation();
82 labelTranslation->translation.setValue(label.position.x()+2.0,
83 label.position.y()+2.0,
84 label.position.z()+2.0);
85 SoText2* labelText = new SoText2();
86 QByteArray labelArray = label.label.toLatin1();
87 labelText->string.setValue(labelArray.data());
88 oneLabelSep->addChild(labelTranslation);
89 oneLabelSep->addChild(labelText);
90 labelsSwitch->addChild(oneLabelSep);
91}
92}
93#endif
94
96public:
98 controller(0),
100 floor(0),
101 cartesiangrid(0),
103 letters(0),
104 etacone1(0),
105 etacone2(0),
106 etacone3(0),
111 lastemit_pixel(InDetProjFlags::NoProjections),
112 lastemit_sct(InDetProjFlags::NoProjections),
113 lastemit_trt(InDetProjFlags::NoProjections) {}
126 VP1Lines * lines = nullptr;
127 SoSwitch* hgtdGuideRootSwitch = nullptr;
128 SoSwitch* hgtdHitSwitch = nullptr;
129 SoSwitch* hgtdTruthTrackSwitch = nullptr;
130 SoSwitch* hgtdPrimaryParticleSwitch = nullptr;
131 SoSwitch* hgtdSecondaryParticleSwitch = nullptr;
132 SoSwitch* hgtdUnlinkedParticleSwitch = nullptr;
136
140 InDetProjFlags::InDetProjPartsFlags lastemit_pixel;
141 InDetProjFlags::InDetProjPartsFlags lastemit_sct;
142 InDetProjFlags::InDetProjPartsFlags lastemit_trt;
143
144 //For knowing which ID parts are used by data systems:
145 std::map<QObject*,InDetProjFlags::DetTypeFlags> sender2iddettypeswithprojs;
146
148 if (!controller)
149 return;
150 const bool showHGTDGuides = controller->showHGTDGuideLines();
152 hgtdGuideRootSwitch->whichChild = showHGTDGuides ? SO_SWITCH_ALL : SO_SWITCH_NONE;
153 if (hgtdHitSwitch)
154 hgtdHitSwitch->whichChild = controller->showHGTDGuideHits() ? SO_SWITCH_ALL : SO_SWITCH_NONE;
156 hgtdTruthTrackSwitch->whichChild = controller->showHGTDTruthTracks() ? SO_SWITCH_ALL : SO_SWITCH_NONE;
158 hgtdPrimaryParticleSwitch->whichChild =
159 (controller->showHGTDGuideHits() && controller->showHGTDPrimaryParticles()) ? SO_SWITCH_ALL : SO_SWITCH_NONE;
161 hgtdSecondaryParticleSwitch->whichChild =
162 (controller->showHGTDGuideHits() && controller->showHGTDSecondaryParticles()) ? SO_SWITCH_ALL : SO_SWITCH_NONE;
164 hgtdUnlinkedParticleSwitch->whichChild =
165 (controller->showHGTDGuideHits() && controller->showHGTDUnlinkedParticles()) ? SO_SWITCH_ALL : SO_SWITCH_NONE;
166 const bool showLabels = controller->showHGTDGuideHits() && controller->showHGTDParticleNames();
168 hgtdPrimaryParticleLabelsSwitch->whichChild = showLabels ? SO_SWITCH_ALL : SO_SWITCH_NONE;
170 hgtdSecondaryParticleLabelsSwitch->whichChild = showLabels ? SO_SWITCH_ALL : SO_SWITCH_NONE;
172 hgtdUnlinkedParticleLabelsSwitch->whichChild = showLabels ? SO_SWITCH_ALL : SO_SWITCH_NONE;
173 }
174};
175
176//_____________________________________________________________________________________
178 : IVP13DSystemSimple("Guides",
179 "System providing visual guides",
180 "Thomas.Kittelmann@cern.ch"), m_d(new Imp(this))
181{
182}
183
184
185//_____________________________________________________________________________________
190
191//_____________________________________________________________________________________
193{
194 m_d->controller = new GuideSysController(this);
195 return m_d->controller;
196}
197
198//_____________________________________________________________________________________
200{
201 m_d->hgtdGuideRootSwitch = nullptr;
202 m_d->hgtdHitSwitch = nullptr;
203 m_d->hgtdTruthTrackSwitch = nullptr;
204 m_d->hgtdPrimaryParticleSwitch = nullptr;
205 m_d->hgtdSecondaryParticleSwitch = nullptr;
206 m_d->hgtdUnlinkedParticleSwitch = nullptr;
207 m_d->hgtdPrimaryParticleLabelsSwitch = nullptr;
208 m_d->hgtdSecondaryParticleLabelsSwitch = nullptr;
209 m_d->hgtdUnlinkedParticleLabelsSwitch = nullptr;
210
211#ifdef BUILDVP1LIGHT
212 (void)sg;
213 (void)root;
214#else
215 if (!m_d->controller || !sg || !root || !VP1JobConfigInfo::hasHGTDGeometry())
216 return;
217
218 const SiHitCollection* collection = nullptr;
219 if (sg->retrieve(collection,"HGTD_Hits")!=StatusCode::SUCCESS) {
220 message("Unable to retrieve HGTD Hits for guide lines");
221 return;
222 }
223
224 SoSwitch* hgtdGuideRootSwitch = new SoSwitch();
225 m_d->hgtdGuideRootSwitch = hgtdGuideRootSwitch;
226 root->addChild(hgtdGuideRootSwitch);
227
228 SoVertexProperty* primaryHitVtxProperty = new SoVertexProperty();
229 SoVertexProperty* secondaryHitVtxProperty = new SoVertexProperty();
230 SoVertexProperty* unlinkedHitVtxProperty = new SoVertexProperty();
231 SoPointSet* primaryHitPointSet = new SoPointSet();
232 SoPointSet* secondaryHitPointSet = new SoPointSet();
233 SoPointSet* unlinkedHitPointSet = new SoPointSet();
234 primaryHitVtxProperty->enableNotify(FALSE);
235 secondaryHitVtxProperty->enableNotify(FALSE);
236 unlinkedHitVtxProperty->enableNotify(FALSE);
237 primaryHitPointSet->enableNotify(FALSE);
238 secondaryHitPointSet->enableNotify(FALSE);
239 unlinkedHitPointSet->enableNotify(FALSE);
240 unsigned int primaryHitCount = 0;
241 unsigned int secondaryHitCount = 0;
242 unsigned int unlinkedHitCount = 0;
243 std::vector<TruthHitLabel> primaryHitLabels;
244 std::vector<TruthHitLabel> secondaryHitLabels;
245 std::vector<TruthHitLabel> unlinkedHitLabels;
246 QMap<QString, std::vector<TruthHitPoint> > truthHitPoints;
247
248 for (const SiHit& hit : *collection) {
249 GeoSiHit ghit(hit);
250 if(!ghit)
251 continue;
252
253 HepGeom::Point3D<double> pos = ghit.getGlobalPosition();
254 const HepMcParticleLink& particleLink = hit.particleLink();
255 const HepMC::ConstGenParticlePtr particle = particleLink.cptr();
256 QString particleLabel("unlinked");
257 QString trackKey;
258 if (particle) {
259 const int barcode = HepMC::barcode(particle);
260 trackKey = QString("truth:%1").arg(barcode);
261 bool particleNameOK = false;
262 particleLabel = VP1ParticleData::particleName(particle->pdg_id(), particleNameOK);
263 if (!particleNameOK || particleLabel.isEmpty())
264 particleLabel = QString("pdg %1").arg(particle->pdg_id());
265 }
266
267 if (!particle) {
268 unlinkedHitVtxProperty->vertex.set1Value(unlinkedHitCount++, pos.x(), pos.y(), pos.z());
269 unlinkedHitLabels.emplace_back(pos, particleLabel);
270 } else if (particle->status()==1) {
271 primaryHitVtxProperty->vertex.set1Value(primaryHitCount++, pos.x(), pos.y(), pos.z());
272 primaryHitLabels.emplace_back(pos, particleLabel);
273 } else {
274 secondaryHitVtxProperty->vertex.set1Value(secondaryHitCount++, pos.x(), pos.y(), pos.z());
275 secondaryHitLabels.emplace_back(pos, particleLabel);
276 }
277
278 if (!trackKey.isEmpty())
279 truthHitPoints[trackKey].emplace_back(hit.meanTime(), pos);
280 }
281
282 SoSwitch* hitSwitch = new SoSwitch();
283 m_d->hgtdHitSwitch = hitSwitch;
284 hgtdGuideRootSwitch->addChild(hitSwitch);
285
286 auto addParticleCategory = [](SoSwitch* rootSwitch,
287 SoSwitch*& categorySwitch,
288 SoSwitch*& labelsSwitch,
289 SoVertexProperty* vertexProperty,
290 SoPointSet* pointSet,
291 unsigned int count,
292 const SbColor& color,
293 const std::vector<TruthHitLabel>& labels) {
294 categorySwitch = new SoSwitch();
295 rootSwitch->addChild(categorySwitch);
296
297 SoMaterial* hitMaterial = new SoMaterial();
298 hitMaterial->diffuseColor.setValue(color);
299 categorySwitch->addChild(hitMaterial);
300 pointSet->numPoints=count;
301 pointSet->vertexProperty.setValue(vertexProperty);
302 categorySwitch->addChild(pointSet);
303
304 labelsSwitch = new SoSwitch();
305 for (const TruthHitLabel& label : labels)
306 addHGTDLabel(labelsSwitch, label);
307 categorySwitch->addChild(labelsSwitch);
308
309 pointSet->enableNotify(TRUE);
310 vertexProperty->enableNotify(TRUE);
311 };
312
313 addParticleCategory(hgtdGuideRootSwitch,
314 m_d->hgtdPrimaryParticleSwitch,
315 m_d->hgtdPrimaryParticleLabelsSwitch,
316 primaryHitVtxProperty,
317 primaryHitPointSet,
318 primaryHitCount,
319 SbColor(VP1ColorUtils::getSbColorFromRGB(255, 170, 0)),
320 primaryHitLabels);
321 addParticleCategory(hgtdGuideRootSwitch,
322 m_d->hgtdSecondaryParticleSwitch,
323 m_d->hgtdSecondaryParticleLabelsSwitch,
324 secondaryHitVtxProperty,
325 secondaryHitPointSet,
326 secondaryHitCount,
327 SbColor(VP1ColorUtils::getSbColorFromRGB(255, 0, 190)),
328 secondaryHitLabels);
329 addParticleCategory(hgtdGuideRootSwitch,
330 m_d->hgtdUnlinkedParticleSwitch,
331 m_d->hgtdUnlinkedParticleLabelsSwitch,
332 unlinkedHitVtxProperty,
333 unlinkedHitPointSet,
334 unlinkedHitCount,
335 SbColor(VP1ColorUtils::getSbColorFromRGB(170, 170, 170)),
336 unlinkedHitLabels);
337
338 SoVertexProperty* truthTrackVtxProperty = new SoVertexProperty();
339 SoLineSet* truthTrackLineSet = new SoLineSet();
340 truthTrackVtxProperty->enableNotify(FALSE);
341 truthTrackLineSet->enableNotify(FALSE);
342 unsigned int truthTrackVertexCount = 0;
343 unsigned int truthTrackCount = 0;
344 for (auto it = truthHitPoints.begin(); it != truthHitPoints.end(); ++it) {
345 std::vector<TruthHitPoint>& points = it.value();
346 if (points.empty())
347 continue;
348 std::sort(points.begin(), points.end(),
349 [](const TruthHitPoint& a, const TruthHitPoint& b) { return a.time < b.time; });
350
351 const int verticesInTrack = points.size() == 1 ? 2 : static_cast<int>(points.size());
352 truthTrackLineSet->numVertices.set1Value(truthTrackCount++, verticesInTrack);
353 if (points.size()==1)
354 truthTrackVtxProperty->vertex.set1Value(truthTrackVertexCount++, 0.0, 0.0, 0.0);
355 for (const TruthHitPoint& point : points)
356 truthTrackVtxProperty->vertex.set1Value(truthTrackVertexCount++,
357 point.position.x(),
358 point.position.y(),
359 point.position.z());
360 }
361
362 SoSwitch* trackSwitch = new SoSwitch();
363 m_d->hgtdTruthTrackSwitch = trackSwitch;
364 hgtdGuideRootSwitch->addChild(trackSwitch);
365 if (truthTrackCount>0) {
366 SoSeparator* trackSep = new SoSeparator();
367 SoDrawStyle* trackDrawStyle = new SoDrawStyle();
368 trackDrawStyle->style.setValue(SoDrawStyle::LINES);
369 trackDrawStyle->lineWidth = 2;
370 trackSep->addChild(trackDrawStyle);
371 SoMaterial* trackMaterial = new SoMaterial();
372 trackMaterial->diffuseColor.setValue(SbColor(VP1ColorUtils::getSbColorFromRGB(0, 255, 190)));
373 trackSep->addChild(trackMaterial);
374 truthTrackLineSet->vertexProperty.setValue(truthTrackVtxProperty);
375 trackSep->addChild(truthTrackLineSet);
376 trackSwitch->addChild(trackSep);
377 truthTrackLineSet->enableNotify(TRUE);
378 truthTrackVtxProperty->enableNotify(TRUE);
379 }
380
381 m_d->updateHGTDGuideVisibility();
382#endif
383}
384
385//_____________________________________________________________________________________
386void VP1GuideLineSystem::buildPermanentSceneGraph(StoreGateSvc* /*detstore*/, SoSeparator *root)
387{
388 if(VP1Msg::verbose()){
389 messageVerbose("buildPermanentSceneGraph");
390 }
391 //No guidelines are pickable:
392 SoPickStyle *pickStyle = new SoPickStyle;
393 pickStyle->style=SoPickStyle::UNPICKABLE;
394 root->addChild(pickStyle);
395
396 //High complexity val for eta cones:
397 SoComplexity * complexity = new SoComplexity;
398 complexity->value.setValue(2.0f);
399 root->addChild(complexity);
400
401 //Floor:
402 m_d->floor = new VP1Floor(root,this);
403 connect(m_d->controller,SIGNAL(floorExtentChanged(const double&)),m_d->floor,SLOT(setExtent(const double&)));
404 m_d->floor->setExtent(m_d->controller->floorExtent());
405 connect(m_d->controller,SIGNAL(floorSpacingChanged(const double&)),m_d->floor,SLOT(setSpacing(const double&)));
406 m_d->floor->setSpacing(m_d->controller->floorSpacing());
407 connect(m_d->controller,SIGNAL(floorHeightChanged(const double&)),m_d->floor,SLOT(setVerticalPosition(const double&)));
408 m_d->floor->setVerticalPosition(m_d->controller->floorHeight());
409 connect(m_d->controller,SIGNAL(floorColourAndTranspChanged( const SbColor4f&)),m_d->floor,SLOT(setColourAndTransp(const SbColor4f&)));
410 m_d->floor->setColourAndTransp(m_d->controller->floorColourAndTransp());
411 connect(m_d->controller,SIGNAL(showFloorChanged(bool)),m_d->floor,SLOT(setShown(bool)));
412 m_d->floor->setShown(m_d->controller->showFloor());
413
414 //CartesianGrid:
415 m_d->cartesiangrid = new VP1CartesianGrid(root,this);
416 connect(m_d->controller,SIGNAL(gridExtentChanged(const double&)),m_d->cartesiangrid,SLOT(setExtent(const double&)));
417 m_d->cartesiangrid->setExtent(m_d->controller->gridExtent());
418 connect(m_d->controller,SIGNAL(gridSpacingChanged(const double&)),m_d->cartesiangrid,SLOT(setSpacing(const double&)));
419 m_d->cartesiangrid->setSpacing(m_d->controller->gridSpacing());
420 connect(m_d->controller,SIGNAL(gridColourAndTranspChanged( const SbColor4f&)),m_d->cartesiangrid,SLOT(setColourAndTransp(const SbColor4f&)));
421 m_d->cartesiangrid->setColourAndTransp(m_d->controller->gridColourAndTransp());
422 connect(m_d->controller,SIGNAL(showCartesianGridChanged(bool)),m_d->cartesiangrid,SLOT(setShown(bool)));
423 m_d->cartesiangrid->setShown(m_d->controller->showCartesianGrid());
424
425 //CylindricalGrid:
426 m_d->cylindricalgrid = new VP1CylindricalGrid(root,this);
427 connect(m_d->controller,SIGNAL(gridExtentChanged(const double&)),m_d->cylindricalgrid,SLOT(setExtent(const double&)));
428 m_d->cylindricalgrid->setExtent(m_d->controller->gridExtent());
429 connect(m_d->controller,SIGNAL(gridSpacingChanged(const double&)),m_d->cylindricalgrid,SLOT(setSpacing(const double&)));
430 m_d->cylindricalgrid->setSpacing(m_d->controller->gridSpacing());
431 connect(m_d->controller,SIGNAL(gridColourAndTranspChanged( const SbColor4f&)),m_d->cylindricalgrid,SLOT(setColourAndTransp(const SbColor4f&)));
432 m_d->cylindricalgrid->setColourAndTransp(m_d->controller->gridColourAndTransp());
433 connect(m_d->controller,SIGNAL(showCylindricalGridChanged(bool)),m_d->cylindricalgrid,SLOT(setShown(bool)));
434 m_d->cylindricalgrid->setShown(m_d->controller->showCylindricalGrid());
435
436 //Letters:
437 m_d->letters = new VP1Letters(m_d->controller->lettersMaterial(),root,this);
438 connect(m_d->controller,SIGNAL(lettersZPosChanged(const double&)),m_d->letters,SLOT(setZPos(const double&)));
439 m_d->letters->setZPos(m_d->controller->lettersZPos());
440 connect(m_d->controller,SIGNAL(lettersVerticalPosChanged(const double&)),m_d->letters,SLOT(setVerticalPosition(const double&)));
441 m_d->letters->setVerticalPosition(m_d->controller->lettersVerticalPos());
442 connect(m_d->controller,SIGNAL(showLettersChanged(bool)),m_d->letters,SLOT(setShown(bool)));
443 m_d->letters->setShown(m_d->controller->showLetters());
444
445 //People:
446 m_d->people = new VP1People(m_d->controller->peopleMaterial(),root,this);
447 // connect(m_d->controller,SIGNAL(peopleZPosChanged(const double&)),m_d->people,SLOT(setZPos(const double&)));
448 m_d->people->setZPos(m_d->controller->peopleZPos());
449 connect(m_d->controller,SIGNAL(peopleVerticalPosChanged(const double&)),m_d->people,SLOT(setVerticalPosition(const double&)));
450 m_d->people->setVerticalPosition(m_d->controller->peopleVerticalPos());
451 connect(m_d->controller,SIGNAL(showPeopleChanged(bool)),m_d->people,SLOT(setShown(bool)));
452 m_d->people->setShown(m_d->controller->showPeople());
453 connect(m_d->controller,SIGNAL(peopleColourAndTranspChanged( const SbColor4f&)),m_d->people,SLOT(setColourAndTransp(const SbColor4f&)));
454 m_d->people->setColourAndTransp(m_d->controller->peopleColourAndTransp());
455
456 //Coordinate axes:
457 m_d->coordinateaxes = new VP1CoordinateAxes(m_d->controller->xAxisMaterial(),
458 m_d->controller->yAxisMaterial(),
459 m_d->controller->zAxisMaterial(),
460 root,this);
461 connect(m_d->controller,SIGNAL(axesLengthChanged(const double&)),m_d->coordinateaxes,SLOT(setLength(const double&)));
462 m_d->coordinateaxes->setLength(m_d->controller->axesLength());
463 connect(m_d->controller,SIGNAL(axesPositionChanged(const SbVec3f&)),m_d->coordinateaxes,SLOT(setPosition(const SbVec3f&)));
464 m_d->coordinateaxes->setPosition(m_d->controller->axesPosition());
465 connect(m_d->controller,SIGNAL(relAxesThicknessChanged(const double&)),m_d->coordinateaxes,SLOT(setRelativeAxisThickness(const double&)));
466 m_d->coordinateaxes->setRelativeAxisThickness(m_d->controller->relAxesThickness());
467 connect(m_d->controller,SIGNAL(showAxesChanged(bool)),m_d->coordinateaxes,SLOT(setShown(bool)));
468 m_d->coordinateaxes->setShown(m_d->controller->showAxes());
469
470 //Eta cones:
471 m_d->etacone1 = new VP1EtaCone(m_d->controller->etaCone1Material(),root,this);
472 connect(m_d->controller,SIGNAL(etaExtentChanged(const double&)),m_d->etacone1,SLOT(setExtent(const double&)));
473 m_d->etacone1->setExtent(m_d->controller->etaExtent());
474 connect(m_d->controller,SIGNAL(etaConeValue1Changed(const double&)),m_d->etacone1,SLOT(setEtaValue(const double&)));
475 m_d->etacone1->setEtaValue(m_d->controller->etaConeValue1());
476 connect(m_d->controller,SIGNAL(showEtaCone1Changed(bool)),m_d->etacone1,SLOT(setShown(bool)));
477 m_d->etacone1->setShown(m_d->controller->showEtaCone1());
478
479 m_d->etacone2 = new VP1EtaCone(m_d->controller->etaCone2Material(),root,this);
480 connect(m_d->controller,SIGNAL(etaExtentChanged(const double&)),m_d->etacone2,SLOT(setExtent(const double&)));
481 m_d->etacone2->setExtent(m_d->controller->etaExtent());
482 connect(m_d->controller,SIGNAL(etaConeValue2Changed(const double&)),m_d->etacone2,SLOT(setEtaValue(const double&)));
483 m_d->etacone2->setEtaValue(m_d->controller->etaConeValue2());
484 connect(m_d->controller,SIGNAL(showEtaCone2Changed(bool)),m_d->etacone2,SLOT(setShown(bool)));
485 m_d->etacone2->setShown(m_d->controller->showEtaCone2());
486
487 m_d->etacone3 = new VP1EtaCone(m_d->controller->etaCone3Material(),root,this);
488 connect(m_d->controller,SIGNAL(etaExtentChanged(const double&)),m_d->etacone3,SLOT(setExtent(const double&)));
489 m_d->etacone3->setExtent(m_d->controller->etaExtent());
490 connect(m_d->controller,SIGNAL(etaConeValue3Changed(const double&)),m_d->etacone3,SLOT(setEtaValue(const double&)));
491 m_d->etacone3->setEtaValue(m_d->controller->etaConeValue3());
492 connect(m_d->controller,SIGNAL(showEtaCone3Changed(bool)),m_d->etacone3,SLOT(setShown(bool)));
493 m_d->etacone3->setShown(m_d->controller->showEtaCone3());
494
495 //Tracking Volumes:
496 m_d->trackingVolumes = new VP1TrackingVolumes(m_d->controller->idTrkVolumesMaterial(),
497 m_d->controller->caloTrkVolumesMaterial(),
498 m_d->controller->msTrkVolumesMaterial(),
499 m_d->controller->showInnerDetector(),
500 m_d->controller->showCalorimeters(),
501 m_d->controller->showMuonSpectrometer(),
502 root,this);
503 connect(m_d->controller,SIGNAL(showTrackingVolumesChanged(bool)),m_d->trackingVolumes,SLOT(setShown(bool)));
504 connect(m_d->controller,SIGNAL(showInnerDetectorChanged(bool)),m_d->trackingVolumes,SLOT(setShownID(bool)));
505 connect(m_d->controller,SIGNAL(showCalorimetersChanged(bool)),m_d->trackingVolumes,SLOT(setShownCalo(bool)));
506 connect(m_d->controller,SIGNAL(showMuonSpectrometerChanged(bool)),m_d->trackingVolumes,SLOT(setShownMS(bool)));
507 m_d->trackingVolumes->setShown(m_d->controller->showTrackingVolumes());
508
509 //Lines
510 m_d->lines = new VP1Lines(root, this);
511 connect(m_d->controller,SIGNAL(showLinesChanged(bool)),m_d->lines,SLOT(setShown(bool)));
512 m_d->lines->setShown(m_d->controller->showLines());
513 connect(m_d->controller,SIGNAL(lineDirectionChanged(const SbVec3f&)),m_d->lines,SLOT(setDirection(const SbVec3f&)));
514 m_d->lines->setDirection(m_d->controller->lineDirection());
515
516 connect(m_d->controller,SIGNAL(showHGTDGuideLinesChanged(bool)),this,SLOT(updateHGTDGuideVisibility()));
517 connect(m_d->controller,SIGNAL(showHGTDGuideHitsChanged(bool)),this,SLOT(updateHGTDGuideVisibility()));
518 connect(m_d->controller,SIGNAL(showHGTDTruthTracksChanged(bool)),this,SLOT(updateHGTDGuideVisibility()));
519 connect(m_d->controller,SIGNAL(showHGTDParticleNamesChanged(bool)),this,SLOT(updateHGTDGuideVisibility()));
520 connect(m_d->controller,SIGNAL(showHGTDPrimaryParticlesChanged(bool)),this,SLOT(updateHGTDGuideVisibility()));
521 connect(m_d->controller,SIGNAL(showHGTDSecondaryParticlesChanged(bool)),this,SLOT(updateHGTDGuideVisibility()));
522 connect(m_d->controller,SIGNAL(showHGTDUnlinkedParticlesChanged(bool)),this,SLOT(updateHGTDGuideVisibility()));
523
524 SoSeparator * projsep = new SoSeparator;
525 root->addChild(projsep);
526
527 m_d->projsurfhelper_pixel = ProjectionSurfacesHelper::createPixelHelper(m_d->controller->pixelProjSurfMaterial(),projsep,this,this);
528 m_d->projsurfhelper_sct = ProjectionSurfacesHelper::createSCTHelper(m_d->controller->sctProjSurfMaterial(),projsep,this,this);
529 m_d->projsurfhelper_trt = ProjectionSurfacesHelper::createTRTHelper(m_d->controller->trtProjSurfMaterial(),projsep,this,this);
530
531 connect(m_d->controller,SIGNAL(shownPixelProjSurfacesChanged(InDetProjFlags::InDetProjPartsFlags)),
532 m_d->projsurfhelper_pixel,SLOT(setSurfaces(InDetProjFlags::InDetProjPartsFlags)));
533 m_d->projsurfhelper_pixel->setSurfaces(m_d->controller->shownPixelProjSurfaces());
534
535 connect(m_d->controller,SIGNAL(shownSCTProjSurfacesChanged(InDetProjFlags::InDetProjPartsFlags)),
536 m_d->projsurfhelper_sct,SLOT(setSurfaces(InDetProjFlags::InDetProjPartsFlags)));
537 m_d->projsurfhelper_sct->setSurfaces(m_d->controller->shownSCTProjSurfaces());
538
539 connect(m_d->controller,SIGNAL(shownTRTProjSurfacesChanged(InDetProjFlags::InDetProjPartsFlags)),
540 m_d->projsurfhelper_trt,SLOT(setSurfaces(InDetProjFlags::InDetProjPartsFlags)));
541 m_d->projsurfhelper_trt->setSurfaces(m_d->controller->shownTRTProjSurfaces());
542
543 connect(m_d->controller,SIGNAL(applicablePixelProjPartsChanged(InDetProjFlags::InDetProjPartsFlags)),this,SLOT(possiblyEmit_ApplicableProjectionsChanged()));
544 connect(m_d->controller,SIGNAL(applicableSCTProjPartsChanged(InDetProjFlags::InDetProjPartsFlags)),this,SLOT(possiblyEmit_ApplicableProjectionsChanged()));
545 connect(m_d->controller,SIGNAL(applicableTRTProjPartsChanged(InDetProjFlags::InDetProjPartsFlags)),this,SLOT(possiblyEmit_ApplicableProjectionsChanged()));
546
547 possiblyEmit_ApplicableProjectionsChanged();//fixme; late enough??? Problem with new delayed init: until guides are enabled, proper projections won't be known!!
548 //Thus, the channel should call this slot explicitly after making all connections!!!
549}
550
551//_____________________________________________________________________________________
553{
554 delete m_d->coordinateaxes; m_d->coordinateaxes = 0;
555 delete m_d->floor; m_d->floor = 0;
556 delete m_d->cartesiangrid; m_d->cartesiangrid = 0;
557 delete m_d->cylindricalgrid; m_d->cylindricalgrid = 0;
558 delete m_d->letters; m_d->letters = 0;
559 delete m_d->etacone1; m_d->etacone1 = 0;
560 delete m_d->etacone2; m_d->etacone2 = 0;
561 delete m_d->etacone3; m_d->etacone3 = 0;
562 delete m_d->projsurfhelper_pixel; m_d->projsurfhelper_pixel = 0;
563 delete m_d->projsurfhelper_sct; m_d->projsurfhelper_sct = 0;
564 delete m_d->projsurfhelper_trt; m_d->projsurfhelper_trt = 0;
565 delete m_d->trackingVolumes; m_d->trackingVolumes = 0;
566
567 m_d->controller=0;
568}
569
570//_____________________________________________________________________________________
572{
573 m_d->updateHGTDGuideVisibility();
574}
575
576
577//_____________________________________________________________________________________
579
581
582 VP1Serialise serialise(4/*version*/,this);
583 serialise.save(IVP13DSystemSimple::saveState());
584 serialise.save(m_d->controller->saveSettings());
585 serialise.disableUnsavedChecks();//We do the testing in the controller
586 return serialise.result();
587}
588
589//_____________________________________________________________________________________
591
592 VP1Deserialise state(ba,this);
593 if (state.version()<0||state.version()>4) {
594 message("Warning: State data in .vp1 file is in wrong format - ignoring!");
595 state.disableUnrestoredChecks();//We do the testing in the controller
596 return;
597 }
598 if (state.version()>=0&&state.version()<=3) {
599 message("Warning: State data in .vp1 file is in obsolete format - ignoring!");
600 state.disableUnrestoredChecks();//We do the testing in the controller
601 return;
602 }
604
606 m_d->controller->restoreSettings(state.restoreByteArray());
607 state.disableUnrestoredChecks();//We do the testing in the controller
608}
609
610//_____________________________________________________________________________________
611void VP1GuideLineSystem::setIDDetTypesUsingProjections( InDetProjFlags::DetTypeFlags f )
612{
614 if (!m_d->controller)
615 return;//if receiving signals after uncreate
616 if(VP1Msg::verbose()){
617 messageVerbose("Signal received in setIDDetTypesUsingProjections("+str(f)+") slot (from "
618 +QString(sender()?sender()->objectName():"NULL sender")+")");
619 }
620 m_d->sender2iddettypeswithprojs[sender()] = f;
621 InDetProjFlags::DetTypeFlags used(InDetProjFlags::NoDet);
622 std::map<QObject*,InDetProjFlags::DetTypeFlags>::iterator it, itE = m_d->sender2iddettypeswithprojs.end();
623 for (it=m_d->sender2iddettypeswithprojs.begin();it!=itE;++it)
624 used |= it->second;
625 m_d->controller->setInDetDetTypesUsingProjections(used);
626}
627
628//_____________________________________________________________________________________
630{
632 if (!m_d->controller)
633 return;//if receiving signals after uncreate
634 InDetProjFlags::InDetProjPartsFlags new_pixel = m_d->controller->applicablePixelProjParts();
635 InDetProjFlags::InDetProjPartsFlags new_sct = m_d->controller->applicableSCTProjParts();
636 InDetProjFlags::InDetProjPartsFlags new_trt = m_d->controller->applicableTRTProjParts();
637 if (m_d->lastemit_pixel==new_pixel&&m_d->lastemit_sct==new_sct&&m_d->lastemit_trt==new_trt)
638 return;
639 m_d->lastemit_pixel=new_pixel;
640 m_d->lastemit_sct=new_sct;
641 m_d->lastemit_trt=new_trt;
642 if(VP1Msg::verbose()){
643 messageVerbose("Emitting applicableProjectionsChanged("+str(m_d->lastemit_pixel)+", "+str(m_d->lastemit_sct)+", "+str(m_d->lastemit_trt)+")");
644 }
645 emit applicableProjectionsChanged( m_d->lastemit_pixel,m_d->lastemit_sct,m_d->lastemit_trt );
646}
bool hit(const Container &ids, int pdgId)
static Double_t a
static Double_t tc
AtlasHitsVector< SiHit > SiHitCollection
HepGeom::Point3D< double > getGlobalPosition() const
IVP13DSystemSimple(const QString &name, const QString &information, const QString &contact_info)
void messageVerbose(const QString &) const
virtual void restoreFromState(QByteArray)
State state() const
void message(const QString &) const
virtual QByteArray saveState()
static ProjectionSurfacesHelper * createSCTHelper(SoMaterial *, SoSeparator *attachsep, QObject *parent=0, IVP1System *sys=0)
static ProjectionSurfacesHelper * createTRTHelper(SoMaterial *, SoSeparator *attachsep, QObject *parent=0, IVP1System *sys=0)
static ProjectionSurfacesHelper * createPixelHelper(SoMaterial *, SoSeparator *attachsep, QObject *parent=0, IVP1System *sys=0)
Definition SiHit.h:19
The Athena Transient Store API.
StatusCode retrieve(const T *&ptr) const
Retrieve the default object into a const T*.
static SbColor getSbColorFromRGB(const unsigned int r, const unsigned int g, const unsigned int b)
InDetProjFlags::InDetProjPartsFlags lastemit_sct
VP1GuideLineSystem * theclass
VP1CylindricalGrid * cylindricalgrid
VP1CartesianGrid * cartesiangrid
VP1CoordinateAxes * coordinateaxes
Imp(VP1GuideLineSystem *tc)
ProjectionSurfacesHelper * projsurfhelper_trt
InDetProjFlags::InDetProjPartsFlags lastemit_trt
ProjectionSurfacesHelper * projsurfhelper_pixel
InDetProjFlags::InDetProjPartsFlags lastemit_pixel
ProjectionSurfacesHelper * projsurfhelper_sct
VP1TrackingVolumes * trackingVolumes
GuideSysController * controller
std::map< QObject *, InDetProjFlags::DetTypeFlags > sender2iddettypeswithprojs
void possiblyEmit_ApplicableProjectionsChanged()
void buildEventSceneGraph(StoreGateSvc *, SoSeparator *)
void setIDDetTypesUsingProjections(InDetProjFlags::DetTypeFlags)
void buildPermanentSceneGraph(StoreGateSvc *detstore, SoSeparator *root)
void applicableProjectionsChanged(InDetProjFlags::InDetProjPartsFlags pixel, InDetProjFlags::InDetProjPartsFlags sct, InDetProjFlags::InDetProjPartsFlags trt)
void restoreFromState(QByteArray ba)
static bool hasHGTDGeometry()
static bool verbose()
Definition VP1Msg.h:31
static QString particleName(const int &pdgcode, bool &ok)
holding In fact this class is here in order to allow STL container for all features This class is sho...
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:148
std::string label(const std::string &format, int i)
Definition label.h:19
int barcode(const T *p)
Definition Barcode.h:15
HepMC3::ConstGenParticlePtr ConstGenParticlePtr
Definition GenParticle.h:20
l
Printing final latex table to .tex output file.
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.