32#include <Inventor/nodes/SoSeparator.h>
33#include <Inventor/nodes/SoLevelOfDetail.h>
34#include <Inventor/nodes/SoMaterial.h>
53 std::map<int,std::pair<SoLevelOfDetail*,std::pair<VP1ExtraSepLayerHelper*,VP1ExtraSepLayerHelper*> > >
regionindex2lodhelpers;
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;
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");
99 m_d->comboBox_detailLevel->setCurrentIndex(0);
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");
117 m_d->sep_lods->ref();
126 m_d->updateDetailSepAttachments();
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();
141 m_d->regionindex2lodhelpers.clear();
144 if (
m_d->sephelper_detail) {
145 SoSeparator * sep_detail =
m_d->sephelper_detail->topSeparator();
146 delete m_d->sephelper_detail;
149 if (
m_d->sephelper_simple) {
150 SoSeparator * sep_simple =
m_d->sephelper_simple->topSeparator();
151 delete m_d->sephelper_simple;
155 m_d->sep_lods->unref();
159 if (
m_d->highlightmaterial)
160 m_d->highlightmaterial->unref();
167 bool safeToLoad(
false);
168 switch (
m_d->detType){
192 message(
"Required geometry not enabled in job.");
196 switch (
m_d->detType){
235 typename T::const_iterator element, lastElement(
container->end());
240 theclass->message(
"ERROR: container '"+
storegate_key+
"' has size()==0, but different begin() and end() iterators!");
246 bool fallback(
false);
250 theclass->messageDebug(
"Retrieved empty container. This might be misleading. Now going to attempt to load prds via iterators instead.");
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.");
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.");
262 theclass->messageDebug(
"Failed retrieval by iterators. We take that as a sign that there really are just no prds in this collection ");
267 theclass->messageVerbose(
"Loop over actual prd's and create handles");
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;
283 for ( element =
container->begin(); element!=lastElement ; ++element) {
284 prd = (*element)->begin(), prdLast = (*element)->end();
285 for ( ; prd!=prdLast ; ++prd) {
288 ++ignoredUnsafeHandle_NoPRD;
293 if (!handle->
isSane()) ignoredUnsafeHandle_NotSane++;
295 ++ignoredUnsafeHandle_NoDetElem;
299 theclass->common()->registerPRD2Handle(*prd,handle);
304 theclass->systemBase()->updateGUI();
309 for (; firstElementD!=lastElementD; ++firstElementD ) {
310 prd = firstElementD->begin(), prdLast = firstElementD->end();
311 for ( ; prd!=prdLast ; ++prd) {
314 ++ignoredUnsafeHandle_NoPRD;
319 if (!handle->
isSane()) ignoredUnsafeHandle_NotSane++;
322 ++ignoredUnsafeHandle_NoDetElem;
326 theclass->common()->registerPRD2Handle(*prd,handle);
330 theclass->systemBase()->updateGUI();
334 theclass->systemBase()->updateGUI();
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).");
345 theclass->messageVerbose(
"postLoadInitialisation");
348 theclass->systemBase()->updateGUI();
351 theclass->recheckCutStatusOfAllNotVisibleHandles();
353 theclass->message(
"Found "+QString::number(iprds)+
" ("+QString::number(
theclass->nShownHandles())+
" shown) PRDs in container '"+
storegate_key+
"'");
362 SoSeparator * collsep =
theclass->collSep();
365 bool save = collsep->enableNotify(
false);
390 if (collsep->findChild(
sep_lods)>-1)
394 collsep->enableNotify(
true);
402 return m_d->sephelper_detail;
408 return m_d->sephelper_simple;
414 messageVerbose(
"Collection detail level combo box changed index");
415 switch(
m_d->comboBox_detailLevel->currentIndex()) {
432 return m_d->generalprddetaillevel;
438 if (
m_d->generalprddetaillevel==dm)
440 m_d->generalprddetaillevel = dm;
446 switch(
m_d->generalprddetaillevel) {
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);
465 m_d->updateDetailSepAttachments();
474 const float complexity = 0.3f;
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;
480 it->second.first->screenArea.setValue(
lodArea()*(sephelper_detail->
topSeparator()->getNumChildren()+1)/(complexity+0.5f));
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);
494 m_d->regionindex2lodhelpers[
index] =
495 std::pair<SoLevelOfDetail*,std::pair<VP1ExtraSepLayerHelper*,VP1ExtraSepLayerHelper*> >
496 (lod,std::pair<VP1ExtraSepLayerHelper*,VP1ExtraSepLayerHelper*>(sephelper_detail,sephelper_simple));
503 m_d->prdhandles.push_back(handle);
509 return m_d->prdhandles;
515 return m_d->prdhandles;
535 m_d->highlightmaterial->ref();
537 connect(controller,SIGNAL(highLightOutliersChanged(
bool)),
this,SLOT(
setHighLightOutliers(
bool)));
543 connect(controller,SIGNAL(drawErrorsChanged(
bool)),
this,SLOT(
setDrawErrors(
bool)));
546 connect(controller,SIGNAL(drawRDOsChanged(
bool)),
this,SLOT(
setDrawRDOs(
bool)));
549 connect(controller,SIGNAL(highLightMaterialWeightChanged(
const double&)),
this,SLOT(
setHighLightWeight(
const double&)));
552 connect(controller,SIGNAL(cutAllowedEtaChanged(
const VP1Interval&)),
556 connect(controller,SIGNAL(cutAllowedPhiChanged(
const QList<VP1Interval>&)),
568 messageVerbose(
"PRDCollHandleBase::recheckCutStatusOfAllHandles");
573 std::vector<PRDHandleBase*>::iterator it(
m_d->prdhandles.begin()),itE(
m_d->prdhandles.end());
575 for (;it!=itE;++it) {
587 messageVerbose(
"PRDCollHandleBase::recheckCutStatusOfAllVisibleHandles");
593 std::vector<PRDHandleBase*>::iterator it(
m_d->prdhandles.begin()),itE(
m_d->prdhandles.end());
594 for (;it!=itE;++it) {
595 if ((*it)->visible())
605 messageVerbose(
"PRDCollHandleBase::recheckCutStatusOfAllNotVisibleHandles");
608 std::vector<PRDHandleBase*>::iterator it(
m_d->prdhandles.begin()),itE(
m_d->prdhandles.end());
609 for (;it!=itE;++it) {
610 if (!(*it)->visible())
621 return m_d->highlightoutliers;
627 return m_d->drawerrors;
633 return m_d->drawrdos;
639 return m_d->highlightmaterial;
645 if (
m_d->highlightoutliers==b)
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();
661 if (
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();
677 if (
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();
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();
717 std::vector<PRDHandleBase*>::iterator it(
m_d->prdhandles.begin()),itE(
m_d->prdhandles.end());
718 for (;it!=itE;++it) {
719 (*it)->updateMaterial();
730 case SIMPLE:
return "SIMPLE";
732 case AUTO:
return "AUTO";
733 default:
return "Unknown (ERROR)";
743 case ByTrack:
return "ByTrack";
745 default:
return "Unknown (ERROR)";
758 return m_d->storegate_key;
770 switch (
m_d->detType) {
774 return "Inner Detector PRDs";
776 return "ID Space Points";
784 return "Muon Spectrometer PRDs";
785 default:
return "Unknown Section";
792 switch (
m_d->detType) {
796 return "Inner Detector PRD collections in event";
798 return "Space Point collections in event";
804 return "Muon Spectrometer PRD collections in event";
805 default:
return "Error: PRDDetType not recognised.";
812 return QList<QWidget*>() <<
m_d->comboBox_detailLevel;
819 serialise.save(
m_d->comboBox_detailLevel);
820 serialise.disableUnsavedChecks();
821 return serialise.result();
838 if (
m_d->allowedEta==e)
840 bool relaxed(e.contains(
m_d->allowedEta));
841 bool tightened(
m_d->allowedEta.contains(e));
854 if (
m_d->allowedPhi==l)
865 if (allEtaAllowed&&allPhiAllowed)
870 if (!allEtaAllowed) {
874 if (!allPhiAllowed) {
Scalar phi() const
phi method
virtual void deselectAll(SoCooperativeSelection *exception_sel=0)
SoMaterial * highlightmaterial
PRDCollHandleBase * theclass
void updateDetailSepAttachments()
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
QComboBox * comboBox_detailLevel
DETAIL generalprddetaillevel
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 &)
void collVisibilityChanged(bool)
VP1ExtraSepLayerHelper * sephelperSimpleNodes() const
void addHandle(PRDHandleBase *)
bool highLightOutliers() const
SoMaterial * highLightMaterial() const
virtual ~PRDCollHandleBase()
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
void detailComboBoxItemChanged()
QString provideSectionToolTip() const
void recheckCutStatusOfAllHandles()
PRDSysCommonData * m_common
virtual bool cut(PRDHandleBase *)=0
PRDSysCommonData * common() const
void setHighLightOutliers(bool)
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
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
bool highLightOutliers() const
VP1Interval cutAllowedEta() const
double highLightMaterialWeight() const
QList< VP1Interval > cutAllowedPhi() const
a const_iterator facade to DataHandle.
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)
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 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