ATLAS Offline Software
Loading...
Searching...
No Matches
PRDCollHandleBase.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
17#include "VP1Base/VP1Msg.h"
18
29
31
32#include <Inventor/nodes/SoSeparator.h>
33#include <Inventor/nodes/SoLevelOfDetail.h>
34#include <Inventor/nodes/SoMaterial.h>
35
36#include <QComboBox>
37
38//____________________________________________________________________
40public:
42
43 //Collection definition:
46
47 template <class T>
48 bool actualLoad();//Templated according to collection type.
49
52 SoSeparator * sep_lods = nullptr;
53 std::map<int,std::pair<SoLevelOfDetail*,std::pair<VP1ExtraSepLayerHelper*,VP1ExtraSepLayerHelper*> > > regionindex2lodhelpers;//idx->(sephelperdetailed,sephelpersimple)
56
57 SoMaterial * highlightmaterial = nullptr;
58 bool highlightoutliers = false;
59 bool drawerrors = false;
60 bool drawrdos = false;
61
63 QList<VP1Interval> allowedPhi;
64
65 bool ensureLoaded();//first call each event will attempt to load
66 //PRDs from storegate. Returns false in case of
67 //problems this events. (This is inexpensive to
68 //call)
69
70 //Vector of prd handles:
71 std::vector<PRDHandleBase*> prdhandles;
72
74
75 //Extra widgets:
76 QComboBox * comboBox_detailLevel = nullptr;
77};
78
79//____________________________________________________________________
81 : VP1StdCollection(cd->system(),"PRDCollHandle_"+PRDDetType::typeToString(type)+"_"+key), m_d(new Imp), m_common(cd),m_nshownhandles(0),
83{
84 m_d->theclass = this;
85 m_d->detType = type;
86 m_d->storegate_key = key;
87 m_d->highlightmaterial = 0;
88 m_d->highlightoutliers = false;
89 m_d->drawerrors = false;
90 m_d->drawrdos = false;
91 m_d->sephelper_detail = 0;
92 m_d->sephelper_simple = 0;
93 m_d->sep_lods = 0;
94 m_d->comboBox_detailLevel = new QComboBox;
95 m_d->comboBox_detailLevel->setToolTip("Level of realism in representation"
96 " (\"Auto\" switches mode based on distance to camera)");
97 m_d->comboBox_detailLevel->addItems(QStringList()<<"Low"<<"Auto"<<"High");//Low==simple, High==detailed. Don't change order.
98 m_d->generalprddetaillevel = SIMPLE;
99 m_d->comboBox_detailLevel->setCurrentIndex(0);//corresponds to simple.
100 connect(m_d->comboBox_detailLevel,SIGNAL(currentIndexChanged(int)),this,SLOT(detailComboBoxItemChanged()));
101 connect(this,SIGNAL(visibilityChanged(bool)),this,SLOT(collVisibilityChanged(bool)));
102}
103
104//____________________________________________________________________
106{
107 VP1StdCollection::init();//this call is required
108
109 SoSeparator * sep_detail = new SoSeparator;
110 sep_detail->setName("PRDColl_sep_detail");
111 SoSeparator * sep_simple = new SoSeparator;
112 sep_simple->setName("PRDColl_sep_simple");
113 m_d->sep_lods = new SoSeparator;
114 m_d->sep_lods->setName("PRDColl_sep_lods");
115 sep_detail->ref();
116 sep_simple->ref();
117 m_d->sep_lods->ref();
118
119 m_d->sephelper_detail = new VP1ExtraSepLayerHelper(sep_detail,128);
120 m_d->sephelper_simple = new VP1ExtraSepLayerHelper(sep_simple,128);
121
122 setupSettingsFromController(common()->controller());
123
124 //Setup detail level:
126 m_d->updateDetailSepAttachments();
127
128}
129
130
131//____________________________________________________________________
133{
134 //Lod sep-helpers:
135 std::map<int,std::pair<SoLevelOfDetail*,std::pair<VP1ExtraSepLayerHelper*,VP1ExtraSepLayerHelper*> > >::iterator it, itE = m_d->regionindex2lodhelpers.end();
136 for (it = m_d->regionindex2lodhelpers.begin();it!=itE;++it) {
137 delete it->second.second.first;
138 delete it->second.second.second;
139 it->second.first->unref();
140 }
141 m_d->regionindex2lodhelpers.clear();
142
143 //Cleanup separators:
144 if (m_d->sephelper_detail) {
145 SoSeparator * sep_detail = m_d->sephelper_detail->topSeparator();
146 delete m_d->sephelper_detail;
147 sep_detail->unref();
148 }
149 if (m_d->sephelper_simple) {
150 SoSeparator * sep_simple = m_d->sephelper_simple->topSeparator();
151 delete m_d->sephelper_simple;
152 sep_simple->unref();
153 }
154 if (m_d->sep_lods)
155 m_d->sep_lods->unref();
156
157 cleanupPtrContainer(m_d->prdhandles);
158
159 if (m_d->highlightmaterial)
160 m_d->highlightmaterial->unref();
161
162 delete m_d;
163}
164
165//____________________________________________________________________
167 bool safeToLoad(false);
168 switch (m_d->detType){
169 case PRDDetType::TRT:
171 break;
174 break;
175 case PRDDetType::SCT:
177 break;
178 case PRDDetType::CSC:
180 case PRDDetType::RPC:
181 case PRDDetType::TGC:
182 case PRDDetType::MDT:
183 case PRDDetType::MM:
184 case PRDDetType::sTGC:
186 break;
187 default:
188 safeToLoad = false;
189 }
190
191 if (!safeToLoad){
192 message("Required geometry not enabled in job.");
193 return false;
194 }
195
196 switch (m_d->detType){
197 case PRDDetType::TRT: return m_d->actualLoad<InDet::TRT_DriftCircleContainer>();
198 case PRDDetType::Pixel: return m_d->actualLoad<InDet::PixelClusterContainer>();
199 case PRDDetType::SCT: return m_d->actualLoad<InDet::SCT_ClusterContainer>();
200 case PRDDetType::CSC: return m_d->actualLoad<Muon::CscPrepDataContainer>();
201 case PRDDetType::CSCstrip: return m_d->actualLoad<Muon::CscStripPrepDataContainer>();
202 case PRDDetType::RPC: return m_d->actualLoad<Muon::RpcPrepDataContainer>();
203 case PRDDetType::TGC: return m_d->actualLoad<Muon::TgcPrepDataContainer>();
204 case PRDDetType::MDT: return m_d->actualLoad<Muon::MdtPrepDataContainer>();
205 case PRDDetType::MM: return m_d->actualLoad<Muon::MMPrepDataContainer>();
206 case PRDDetType::sTGC: return m_d->actualLoad<Muon::sTgcPrepDataContainer>();
207 //SpacePoints implements their own load.
208 default:
209 return false;
210 }
211}
212
213//____________________________________________________________________
215{
216 if (VP1Msg::verbose())
217 messageVerbose("TrackCollHandleBase::collVisibilityChanged => "+str(vis));
218 if (vis)
219 recheckCutStatusOfAllNotVisibleHandles();//Fixme -> ofallhandles? All must be not visible anyway...
220 else
222}
223
224//____________________________________________________________________
225template <class T>
227{
229 // Retrieve element container from event store:
230 const T* container;
231 VP1SGAccessHelper sg_access(theclass->systemBase());
232 if(!sg_access.retrieve(container,storegate_key))
233 return false;
234
235 typename T::const_iterator element, lastElement(container->end());
236
238 // Sanity check:
239 if ( container->size()==0 && container->begin()!=lastElement ) {
240 theclass->message("ERROR: container '"+storegate_key+"' has size()==0, but different begin() and end() iterators!");
241 return false;
242 }
243
245 // In case the container was created incorrectly we must fallback to a different method of getting the prds:
246 bool fallback(false);
247 SG::ConstIterator<typename T::base_value_type> firstElementD, lastElementD;
248 if ( container->size()!=0 && container->begin()==lastElement ) {
249 //This is either an empty container, or it is a case of an incorrectly created container which we must get by SG::ConstIterator's.
250 theclass->messageDebug("Retrieved empty container. This might be misleading. Now going to attempt to load prds via iterators instead.");
251 if (VP1SGContentsHelper(theclass->systemBase()).getKeys<T>().count()!=1) {
252 theclass->messageDebug("But seems that there is not exactly one collection of type "+QString(typeid(T).name())
253 +", so we won't attempt that anyway!! Thus we assume there there are simply no prd's.");
254 } else {
255 if(sg_access.retrieve(firstElementD, lastElementD,true)) {
256 if (firstElementD==lastElementD) {
257 theclass->messageDebug("No prd's found when accessed by iterators either. It seems that there really are just no prds in this collection.");
258 } else {
259 fallback = true;
260 }
261 } else {
262 theclass->messageDebug("Failed retrieval by iterators. We take that as a sign that there really are just no prds in this collection ");
263 }
264 }
265 }
266
267 theclass->messageVerbose("Loop over actual prd's and create handles");
268 //Retrieve prds and create handles:
269
270 int ignoredUnsafeHandle_NoPRD(0);
271 int ignoredUnsafeHandle_NoDetElem(0);
272 int ignoredUnsafeHandle_NotSane(0);
273 typename T::base_value_type::const_iterator prd, prdLast;
274 int iprds(0);
275 if (!fallback) {
276 // element = container->begin();
277 // prd = (*element)->begin();
278 // ++iprds;
279 // PRDHandleBase * handle = theclass->addPRD(*prd);
280 // theclass->addHandle(handle);
281 // theclass->common()->registerPRD2Handle(*prd,handle);
282 // theclass->systemBase()->updateGUI();
283 for ( element = container->begin(); element!=lastElement ; ++element) {
284 prd = (*element)->begin(), prdLast = (*element)->end();
285 for ( ; prd!=prdLast ; ++prd) {
286 ++iprds;
287 if (!*prd) {
288 ++ignoredUnsafeHandle_NoPRD;
289 continue;
290 }
291 PRDHandleBase * handle = theclass->addPRD(*prd);
292 if (handle) {
293 if (!handle->isSane()) ignoredUnsafeHandle_NotSane++;
294 if (!handle->getPRD()->detectorElement()) {
295 ++ignoredUnsafeHandle_NoDetElem;
296 delete handle;
297 } else {
298 theclass->addHandle(handle);
299 theclass->common()->registerPRD2Handle(*prd,handle);
300 }
301 }
302 }
303 if (!(iprds%100))
304 theclass->systemBase()->updateGUI();
305 }
306
307 } else {
308
309 for (; firstElementD!=lastElementD; ++firstElementD ) {
310 prd = firstElementD->begin(), prdLast = firstElementD->end();
311 for ( ; prd!=prdLast ; ++prd) {
312 ++iprds;
313 if (!*prd) {
314 ++ignoredUnsafeHandle_NoPRD;
315 continue;
316 }
317 PRDHandleBase * handle = theclass->addPRD(*prd);
318 if (handle) {
319 if (!handle->isSane()) ignoredUnsafeHandle_NotSane++;
320
321 if (!handle->getPRD()->detectorElement()) {
322 ++ignoredUnsafeHandle_NoDetElem;
323 delete handle;
324 } else {
325 theclass->addHandle(handle);
326 theclass->common()->registerPRD2Handle(*prd,handle);
327 }
328 }
329 if (!(iprds%100))
330 theclass->systemBase()->updateGUI();
331 }
332 }
333 }
334 theclass->systemBase()->updateGUI();
335 prdhandles.resize(prdhandles.size());
336
337 if (ignoredUnsafeHandle_NoPRD)
338 theclass->message("WARNING - ignoring "+str(ignoredUnsafeHandle_NoPRD)+" null prd pointer(s).");
339 if (ignoredUnsafeHandle_NoDetElem)
340 theclass->message("WARNING - ignoring "+str(ignoredUnsafeHandle_NoDetElem)+" prd pointer(s) with null detector elements.");
341 if (ignoredUnsafeHandle_NotSane)
342 theclass->message("WARNING - found "+str(ignoredUnsafeHandle_NotSane)+" prd pointer(s) which fail sanity checks (i.e. contain NaNs).");
343
344 //Perform initialisation needed for cuts (e.g. those of the "global" type, such as requiring a number of PRDs in the same detector module):
345 theclass->messageVerbose("postLoadInitialisation");
346 theclass->postLoadInitialisation();
347
348 theclass->systemBase()->updateGUI();
349
350 //Show the handles that need to be shown:
351 theclass->recheckCutStatusOfAllNotVisibleHandles();//Use this method to not get the deselectAll call
352
353 theclass->message("Found "+QString::number(iprds)+" ("+QString::number(theclass->nShownHandles())+" shown) PRDs in container '"+storegate_key+"'");
354
355 return true;
356
357}
358
359//____________________________________________________________________
361{
362 SoSeparator * collsep = theclass->collSep();
363 if (!collsep)
364 return;
365 bool save = collsep->enableNotify(false);
367 //Detail
368 if (collsep->findChild(sephelper_detail->topSeparator())<0)
369 collsep->addChild(sephelper_detail->topSeparator());
370 } else {
371 //No detail
372 if (collsep->findChild(sephelper_detail->topSeparator())>-1)
373 collsep->removeChild(sephelper_detail->topSeparator());
374 }
376 //Simple
377 if (collsep->findChild(sephelper_simple->topSeparator())<0)
378 collsep->addChild(sephelper_simple->topSeparator());
379 } else {
380 //No simple
381 if (collsep->findChild(sephelper_simple->topSeparator())>-1)
382 collsep->removeChild(sephelper_simple->topSeparator());
383 }
385 //LOD
386 if (collsep->findChild(sep_lods)<0)
387 collsep->addChild(sep_lods);
388 } else {
389 //No LOD
390 if (collsep->findChild(sep_lods)>-1)
391 collsep->removeChild(sep_lods);
392 }
393 if (save) {
394 collsep->enableNotify(true);
395 collsep->touch();
396 }
397}
398
399//____________________________________________________________________
401{
402 return m_d->sephelper_detail;
403}
404
405//____________________________________________________________________
407{
408 return m_d->sephelper_simple;
409}
410
411//____________________________________________________________________
413{
414 messageVerbose("Collection detail level combo box changed index");
415 switch(m_d->comboBox_detailLevel->currentIndex()) {
416 case 1:
418 break;
419 case 2:
421 break;
422 default:
423 case 0:
425 break;
426 }
427}
428
429//____________________________________________________________________
431{
432 return m_d->generalprddetaillevel;
433}
434
435//____________________________________________________________________
437{
438 if (m_d->generalprddetaillevel==dm)
439 return;
440 m_d->generalprddetaillevel = dm;
441 messageVerbose("Detail level changed");
442// common()->system()->deselectAll();
443
444 //Update gui combobox:
445 int targetIndex(0);
446 switch(m_d->generalprddetaillevel) {
447 case AUTO:
448 targetIndex = 1;
449 break;
450 case DETAILED:
451 targetIndex = 2;
452 break;
453 default:
454 case SIMPLE:
455 targetIndex = 0;
456 break;
457 }
458 if (targetIndex!=m_d->comboBox_detailLevel->currentIndex()) {
459 bool save = m_d->comboBox_detailLevel->blockSignals(true);
460 m_d->comboBox_detailLevel->setCurrentIndex(targetIndex);
461 m_d->comboBox_detailLevel->blockSignals(save);
462 }
463
464 //Actual changes to 3D representation:
465 m_d->updateDetailSepAttachments();
466
468
469}
470
471//____________________________________________________________________
473{
474 const float complexity = 0.3f;//Fixme: Hardcoded here.
475 std::map<int,std::pair<SoLevelOfDetail*,std::pair<VP1ExtraSepLayerHelper*,VP1ExtraSepLayerHelper*> > >::iterator it = m_d->regionindex2lodhelpers.find(index);
476 if (it!=m_d->regionindex2lodhelpers.end()) {
477 sephelper_detail = it->second.second.first;
478 sephelper_simple = it->second.second.second;
479 //To try to scale somehow different regions to change at "the same time":
480 it->second.first->screenArea.setValue(lodArea()*(sephelper_detail->topSeparator()->getNumChildren()+1)/(complexity+0.5f));
481 return;
482 }
483 SoLevelOfDetail * lod = new SoLevelOfDetail;
484 SoSeparator * sep_detail = new SoSeparator;
485 SoSeparator * sep_simple = new SoSeparator;
486 lod->addChild(sep_detail);
487 lod->addChild(sep_simple);
488 lod->screenArea.setValue(lodArea()/(complexity+0.5f));
489 m_d->sep_lods->addChild(lod);
490 sephelper_detail = new VP1ExtraSepLayerHelper(sep_detail);
491 sephelper_simple = new VP1ExtraSepLayerHelper(sep_simple);
492
493 lod->ref();
494 m_d->regionindex2lodhelpers[index] =
495 std::pair<SoLevelOfDetail*,std::pair<VP1ExtraSepLayerHelper*,VP1ExtraSepLayerHelper*> >
496 (lod,std::pair<VP1ExtraSepLayerHelper*,VP1ExtraSepLayerHelper*>(sephelper_detail,sephelper_simple));
497}
498
499//____________________________________________________________________
501{
502 if (handle)
503 m_d->prdhandles.push_back(handle);
504}
505
506//____________________________________________________________________
507std::vector<PRDHandleBase*>& PRDCollHandleBase::getPrdHandles()
508{
509 return m_d->prdhandles;
510}
511
512//____________________________________________________________________
513const std::vector<PRDHandleBase*>& PRDCollHandleBase::getPrdHandles() const
514{
515 return m_d->prdhandles;
516}
517
518//____________________________________________________________________
520{
521 handle->setVisible( visible() && cut(handle) && m_d->etaPhiCut(handle) );
522}
523
524//Fixme: A few of the methods of this class should be inlined (requires a few more public data members)
525
526//____________________________________________________________________
528{
529 assert(controller);
531
532 collSep()->addChild(controller->drawOptions(m_d->detType));
533
534 m_d->highlightmaterial = controller->getHighLightMaterial();
535 m_d->highlightmaterial->ref();
536
537 connect(controller,SIGNAL(highLightOutliersChanged(bool)),this,SLOT(setHighLightOutliers(bool)));
539
540 connect(controller,SIGNAL(colourMethodChanged(PRDCollHandleBase::COLOURMETHOD)),this,SLOT(setColourMethod(PRDCollHandleBase::COLOURMETHOD)));
541 setColourMethod(controller->colourMethod());
542
543 connect(controller,SIGNAL(drawErrorsChanged(bool)),this,SLOT(setDrawErrors(bool)));
544 setDrawErrors(controller->drawErrors());
545
546 connect(controller,SIGNAL(drawRDOsChanged(bool)),this,SLOT(setDrawRDOs(bool)));
547 setDrawRDOs(controller->drawRDOs());
548
549 connect(controller,SIGNAL(highLightMaterialWeightChanged(const double&)),this,SLOT(setHighLightWeight(const double&)));
551
552 connect(controller,SIGNAL(cutAllowedEtaChanged(const VP1Interval&)),
553 this,SLOT(setAllowedEta(const VP1Interval&)));
554 setAllowedEta(controller->cutAllowedEta());
555
556 connect(controller,SIGNAL(cutAllowedPhiChanged(const QList<VP1Interval>&)),
557 this,SLOT(setAllowedPhi(const QList<VP1Interval>&)));
558 setAllowedPhi(controller->cutAllowedPhi());
559
562}
563
564
565//____________________________________________________________________
567{
568 messageVerbose("PRDCollHandleBase::recheckCutStatusOfAllHandles");
569
570 common()->system()->deselectAll();
571
573 std::vector<PRDHandleBase*>::iterator it(m_d->prdhandles.begin()),itE(m_d->prdhandles.end());
574 int i(0);
575 for (;it!=itE;++it) {
576 recheckCutStatus(*it);
577 if (!(i++%200))
578 systemBase()->updateGUI();//since called from ::actualLoad<..>(..)
579 }
581 if (visible()) message("Have "+QString::number(getPrdHandles().size())+" ("+QString::number(nShownHandles())+" shown) PRDs");
582}
583
584//____________________________________________________________________
586{
587 messageVerbose("PRDCollHandleBase::recheckCutStatusOfAllVisibleHandles");
588 if (!visible()) return;
589 //This method is called when a cut is tightened - thus we better start by deselectAll to avoid weird highlighting issues.
590 common()->system()->deselectAll();
591
593 std::vector<PRDHandleBase*>::iterator it(m_d->prdhandles.begin()),itE(m_d->prdhandles.end());
594 for (;it!=itE;++it) {
595 if ((*it)->visible())
596 recheckCutStatus(*it);
597 }
599 if (visible()) message("Have "+QString::number(getPrdHandles().size())+" ("+QString::number(nShownHandles())+" shown) PRDs");
600}
601
602//____________________________________________________________________
604{
605 messageVerbose("PRDCollHandleBase::recheckCutStatusOfAllNotVisibleHandles");
606
608 std::vector<PRDHandleBase*>::iterator it(m_d->prdhandles.begin()),itE(m_d->prdhandles.end());
609 for (;it!=itE;++it) {
610 if (!(*it)->visible())
611 recheckCutStatus(*it);
612 }
614 if (visible()) message("Have "+QString::number(getPrdHandles().size())+" ("+QString::number(nShownHandles())+" shown) PRDs");
615}
616
617
618//____________________________________________________________________
620{
621 return m_d->highlightoutliers;
622}
623
624//____________________________________________________________________
626{
627 return m_d->drawerrors;
628}
629
630//____________________________________________________________________
632{
633 return m_d->drawrdos;
634}
635
636//____________________________________________________________________
638{
639 return m_d->highlightmaterial;
640}
641
642//____________________________________________________________________
644{
645 if (m_d->highlightoutliers==b)
646 return;
647 m_d->highlightoutliers = b;
649 std::vector<PRDHandleBase*>::iterator it(m_d->prdhandles.begin()),itE(m_d->prdhandles.end());
650 for (;it!=itE;++it) {
651 (*it)->updateMaterial();
652 //Fixme: Improve performance by only calling updateMaterial() on
653 //those that are outliers on at least one track.
654 }
656}
657
658//____________________________________________________________________
660{
661 if (m_d->drawerrors==b)
662 return;
663 m_d->drawerrors = b;
665 std::vector<PRDHandleBase*>::iterator it(m_d->prdhandles.begin()),itE(m_d->prdhandles.end());
666 for (;it!=itE;++it) {
667 (*it)->update3DObjects();
668 //Fixme: Improve performance by only calling updateMaterial() on
669 //those that are outliers on at least one track.
670 }
672}
673
674//____________________________________________________________________
676{
677 if (m_d->drawrdos==b)
678 return;
679 m_d->drawrdos = b;
681 std::vector<PRDHandleBase*>::iterator it(m_d->prdhandles.begin()),itE(m_d->prdhandles.end());
682 for (;it!=itE;++it) {
683 (*it)->update3DObjects();
684 //Fixme: Improve performance by only calling updateMaterial() on
685 //those that are outliers on at least one track.
686 }
688}
689
690
691//____________________________________________________________________
693{
694 if (m_highlightweight == hlw)
695 return;
696 m_highlightweight = hlw;
698 std::vector<PRDHandleBase*>::iterator it(m_d->prdhandles.begin()),itE(m_d->prdhandles.end());
699 for (;it!=itE;++it) {
700 if (m_d->highlightoutliers || (*it)->highLight())
701 (*it)->updateMaterial();
702 //Fixme: We can improve performance here by investigating whether
703 //the handle actually is an outlier for at least one track, or if
704 //highlighting is at all applicable for the collection (maybe it is turned off).
705 }
707}
708
709//____________________________________________________________________
711{
712 if (m_colourmethod==cm)
713 return;
715
717 std::vector<PRDHandleBase*>::iterator it(m_d->prdhandles.begin()),itE(m_d->prdhandles.end());
718 for (;it!=itE;++it) {
719 (*it)->updateMaterial();
720 //Fixme: Improve performance by only calling on those that are on tracks/segments as relevant.
721 }
723
724}
725
726//____________________________________________________________________
728{
729 switch (d) {
730 case SIMPLE: return "SIMPLE";
731 case DETAILED: return "DETAILED";
732 case AUTO: return "AUTO";
733 default: return "Unknown (ERROR)";
734 }
735}
736
737//____________________________________________________________________
739{
740 switch (cm) {
741 case ByTechOnly: return "ByTechOnly";
742 case BySegment: return "BySegment";
743 case ByTrack: return "ByTrack";
744 case BySegmentAndTrack: return "BySegmentAndTrack";
745 default: return "Unknown (ERROR)";
746 }
747}
748
749//____________________________________________________________________
751{
752 return PRDDetType::typeToInt(m_d->detType);
753}
754
755//____________________________________________________________________
757{
758 return m_d->storegate_key;
759}
760
761//____________________________________________________________________
763{
764 VP1QtInventorUtils::setMatColor( m, defaultColor(), 0.18/*brightness*/ );
765}
766
767//____________________________________________________________________
769{
770 switch (m_d->detType) {
772 case PRDDetType::SCT:
773 case PRDDetType::TRT:
774 return "Inner Detector PRDs";
776 return "ID Space Points";
777 case PRDDetType::CSC:
779 case PRDDetType::RPC:
780 case PRDDetType::TGC:
781 case PRDDetType::MDT:
782 case PRDDetType::MM:
783 case PRDDetType::sTGC:
784 return "Muon Spectrometer PRDs";
785 default: return "Unknown Section";
786 }
787}
788
789//____________________________________________________________________
791{
792 switch (m_d->detType) {
794 case PRDDetType::SCT:
795 case PRDDetType::TRT:
796 return "Inner Detector PRD collections in event";
798 return "Space Point collections in event";
799 case PRDDetType::CSC:
801 case PRDDetType::RPC:
802 case PRDDetType::TGC:
803 case PRDDetType::MDT:
804 return "Muon Spectrometer PRD collections in event";
805 default: return "Error: PRDDetType not recognised.";
806 }
807}
808
809//____________________________________________________________________
811{
812 return QList<QWidget*>() << m_d->comboBox_detailLevel;
813}
814
815//____________________________________________________________________
817{
818 VP1Serialise serialise(0/*version*/,systemBase());
819 serialise.save(m_d->comboBox_detailLevel);
820 serialise.disableUnsavedChecks();
821 return serialise.result();
822}
823
824//____________________________________________________________________
826{
827 VP1Deserialise state(ba, systemBase());
828 if (state.version()!=0)
829 return;//just ignore silently... i guess we ought to warn?
830 state.restore(m_d->comboBox_detailLevel);
833}
834
835//____________________________________________________________________
837{
838 if (m_d->allowedEta==e)
839 return;
840 bool relaxed(e.contains(m_d->allowedEta));
841 bool tightened(m_d->allowedEta.contains(e));
842 m_d->allowedEta=e;
843 if (relaxed)
845 else if (tightened)
847 else
849}
850
851//____________________________________________________________________
852void PRDCollHandleBase::setAllowedPhi(const QList<VP1Interval>& l)
853{
854 if (m_d->allowedPhi==l)
855 return;
856 m_d->allowedPhi=l;
858}
859
860//____________________________________________________________________
862{
863 bool allPhiAllowed = allowedPhi.count()==1&&allowedPhi.at(0).isAllR();
864 bool allEtaAllowed = allowedEta.isAllR();
865 if (allEtaAllowed&&allPhiAllowed)
866 return true;
867 if (allowedPhi.isEmpty()||allowedEta.isEmpty())
868 return false;
869 Amg::Vector3D p = handle->center();
870 if (!allEtaAllowed) {
871 if (!allowedEta.contains(p.eta()))
872 return false;
873 }
874 if (!allPhiAllowed) {
875 double phi(p.phi());
876 for(const VP1Interval& i : allowedPhi) {
877 if (i.contains(phi)||i.contains(phi+2*M_PI)||i.contains(phi-2*M_PI))
878 return true;
879 }
880 return false;
881 }
882 return true;
883}
#define M_PI
Scalar phi() const
phi method
virtual void deselectAll(SoCooperativeSelection *exception_sel=0)
void updateGUI()
PRDCollHandleBase * theclass
std::vector< PRDHandleBase * > prdhandles
VP1ExtraSepLayerHelper * sephelper_simple
VP1ExtraSepLayerHelper * sephelper_detail
QList< VP1Interval > allowedPhi
bool etaPhiCut(PRDHandleBase *)
std::map< int, std::pair< SoLevelOfDetail *, std::pair< VP1ExtraSepLayerHelper *, VP1ExtraSepLayerHelper * > > > regionindex2lodhelpers
void setupSettingsFromController(PRDSystemController *)
void recheckCutStatusOfAllNotVisibleHandles()
PRDCollHandleBase(PRDDetType::Type, PRDSysCommonData *, const QString &key)
VP1ExtraSepLayerHelper * sephelperDetailedNodes() const
std::vector< PRDHandleBase * > & getPrdHandles()
virtual void assignDefaultMaterial(SoMaterial *) const
void setGeneralPRDDetailLevel(DETAIL)
qint32 provideCollTypeID() const
static QString toString(const DETAIL &)
VP1ExtraSepLayerHelper * sephelperSimpleNodes() const
void addHandle(PRDHandleBase *)
bool highLightOutliers() const
SoMaterial * highLightMaterial() const
void setColourMethod(PRDCollHandleBase::COLOURMETHOD)
void getLODSeparators(int index, VP1ExtraSepLayerHelper *&sephelper_detail, VP1ExtraSepLayerHelper *&sephelper_simple)
virtual float lodArea() const
void setHighLightWeight(const double &)
void setExtraWidgetsState(const QByteArray &)
virtual QColor defaultColor() const =0
DETAIL detailLevel() const
QString provideSectionToolTip() const
PRDSysCommonData * m_common
virtual bool cut(PRDHandleBase *)=0
PRDSysCommonData * common() const
void setAllowedPhi(const QList< VP1Interval > &)
QString provideSection() const
virtual void init(VP1MaterialButtonBase *mat=0)
void recheckCutStatus(PRDHandleBase *)
void detailLevelChanged()
void setAllowedEta(const VP1Interval &)
virtual void setupSettingsFromControllerSpecific(PRDSystemController *)
virtual QString provideText() const
virtual DETAIL defaultDetailLevel() const
COLOURMETHOD m_colourmethod
void recheckCutStatusOfAllVisibleHandles()
QByteArray extraWidgetsState() const
void cleanupPtrContainer(T &) const
QList< QWidget * > provideExtraWidgetsForGuiRow() const
static qint32 typeToInt(const Type &t)
virtual const Trk::PrepRawData * getPRD() const =0
void setVisible(bool)
virtual bool isSane() const
Returns false if the PRD is not safe to draw.
virtual Amg::Vector3D center() const
IVP13DSystem * system() const
SoMaterial * getHighLightMaterial()
PRDCollHandleBase::COLOURMETHOD colourMethod() const
SoGroup * drawOptions(PRDDetType::Type) const
VP1Interval cutAllowedEta() const
double highLightMaterialWeight() const
QList< VP1Interval > cutAllowedPhi() const
a const_iterator facade to DataHandle.
Definition SGIterator.h:164
virtual const TrkDetElementBase * detectorElement() const =0
return the detector element corresponding to this PRD The pointer will be zero if the det el is not d...
void disableUnrestoredChecks()
void restore(QCheckBox *sb)
qint32 version() const
SoSeparator * topSeparator() const
void messageVerbose(const QString &) const
void message(const QString &) const
IVP1System * systemBase() const
static bool hasTRTGeometry()
static bool hasPixelGeometry()
static bool hasSCTGeometry()
static bool hasMuonGeometry()
static bool verbose()
Definition VP1Msg.h:31
static void setMatColor(SoMaterial *, const double &r, const double &g, const double &b, const double &brightness=0.0, const double &transp=0.0)
bool retrieve(const T *&, const QString &key) const
QStringList getKeys() const
virtual void largeChangesEnd()
virtual void init(VP1MaterialButtonBase *button=0)
SoSeparator * collSep() const
All 3D objects from this coll.
virtual void largeChangesBegin()
void visibilityChanged(bool)
VP1StdCollection(IVP1System *, const QString &helperClassName)
Eigen::Matrix< double, 3, 1 > Vector3D
MuonPrepDataContainerT< RpcPrepData > RpcPrepDataContainer
MuonPrepDataContainerT< TgcPrepData > TgcPrepDataContainer
MuonPrepDataContainerT< MdtPrepData > MdtPrepDataContainer
MuonPrepDataContainerT< CscStripPrepData > CscStripPrepDataContainer
MuonPrepDataContainerT< sTgcPrepData > sTgcPrepDataContainer
MuonPrepDataContainerT< MMPrepData > MMPrepDataContainer
MuonPrepDataContainerT< CscPrepData > CscPrepDataContainer
Definition index.py:1