10#include "ui_periparticlecollectionsettings_form.h"
11#include "ui_percaloclustercollectionsettings_form.h"
20#include "Inventor/nodes/SoDrawStyle.h"
21#include "Inventor/nodes/SoLightModel.h"
22#include "Inventor/nodes/SoMaterial.h"
30#include <QDragEnterEvent>
38 #include "GeoModelKernel/Units.h"
39 #define SYSTEM_OF_UNITS GeoModelKernelUnits
41 #include "GaudiKernel/SystemOfUnits.h"
42 #define SYSTEM_OF_UNITS Gaudi::Units
115 theclass->messageVerbose(
"Initialising material editor dialog");
118 editwindow =
new QWidget(0,Qt::WindowStaysOnTopHint);
122 auto customsettings =
new QWidget();
191 m_d->editwindow->setWindowTitle(t);
199 double val =
m_d->ui_customsettings.doubleSpinBox_lengthOf10GeV->value();
200 VP1Msg::messageVerbose(
"CaloClusterCollectionSettingsButton::lengthOf10GeV() - value: " + QString::number(val));
225 m_d->theclass =
this;
226 m_d->initEditWindow();
228 m_d->m_transverseEnergy =
true;
229 m_d->m_forceRebuild =
false;
247 connect(
m_d->ui_commonsettings.comboBox_momtype,SIGNAL(currentIndexChanged(
int)),
this,SLOT(
setTransverseEnergy()));
263 connect(
m_d->ui_customsettings.doubleSpinBox_lengthOf10GeV,SIGNAL(valueChanged(
double)),
this,SLOT(
possibleChange_scale()));
265 connect(
m_d->ui_customsettings.radioButton_relativeScale,SIGNAL(toggled(
bool)),
this,SLOT(
possibleChange_scale()));
266 connect(
m_d->ui_customsettings.doubleSpinBox_lengthOfMostEnergetic,SIGNAL(valueChanged(
double)),
this,SLOT(
possibleChange_scale()));
292 setAcceptDrops(
true);
310 delete m_d->editwindow;
318 if (objectName().isEmpty())
319 setObjectName(
"CaloClusterCollectionSettingsButton");
320 messageVerbose(
"setColButtonProperties: color=" +
str(
m_d->matButton->lastAppliedDiffuseColour()));
334 if (!
m_d->editwindow)
335 m_d->initEditWindow();
337 if (
m_d->editwindow->isHidden())
338 m_d->editwindow->show();
340 m_d->editwindow->hide();
346 if (!
m_d->matButton)
m_d->initEditWindow();
347 m_d->matButton->setMaterial(mat);
353 if (!
m_d->matButton)
m_d->initEditWindow();
354 m_d->matButton->setMaterial(mat);
358 if (!
m_d->matButton)
m_d->initEditWindow();
359 return m_d->matButton->lastAppliedTransparency();
363 if (!
m_d->matButton)
m_d->initEditWindow();
364 return m_d->matButton->lastAppliedShininess();
368 if (!
m_d->matButton)
m_d->initEditWindow();
369 return m_d->matButton->lastAppliedBrightness();
377 if (event->button() == Qt::LeftButton)
378 m_d->dragStartPosition =
event->pos();
379 QPushButton::mousePressEvent(event);
385 if (event->source()!=
this && event->mimeData()->hasFormat(
"vp1/material"))
386 event->acceptProposedAction();
392 if (!(event->buttons() & Qt::LeftButton))
394 if ((event->pos() -
m_d->dragStartPosition).manhattanLength()
395 < QApplication::startDragDistance())
398 QDrag *drag =
new QDrag(
this);
399 QMimeData *mimeData =
new QMimeData;
408 mimeData->setData(
"vp1/material", byteArray);
437 drag->setMimeData(mimeData);
438 drag->exec(Qt::CopyAction | Qt::MoveAction);
444 QByteArray
data =
event->mimeData()->data(
"vp1/material");
445 event->acceptProposedAction();
452 messageDebug(
"CaloClusterCollectionSettingsButton::saveState()");
459 serialise.save(
m_d->matButton);
463 serialise.save(
m_d->ui_commonsettings.checkBox_tracksUseBaseLightModel);
464 serialise.save(
m_d->ui_commonsettings.checkBox_cut_minpt);
465 serialise.save(
m_d->ui_commonsettings.doubleSpinBox_cut_minpt_gev);
466 serialise.save(
m_d->ui_commonsettings.checkBox_cut_maxpt);
467 serialise.save(
m_d->ui_commonsettings.doubleSpinBox_cut_maxpt_gev);
468 serialise.save(
m_d->ui_commonsettings.comboBox_momtype);
471 serialise.save(
m_d->ui_commonsettings.etaPhiCutWidget);
474 serialise.save(
m_d->ui_customsettings.radioButton_absoluteScale,
m_d->ui_customsettings.radioButton_relativeScale);
475 serialise.save(
m_d->ui_customsettings.doubleSpinBox_lengthOf10GeV);
476 serialise.save(
m_d->ui_customsettings.doubleSpinBox_lengthOfMostEnergetic);
477 serialise.save(
m_d->ui_customsettings.checkBox_logscale);
478 serialise.save(
m_d->ui_customsettings.checkBox_showVolumeOutLines);
495 serialise.widgetHandled(
this);
496 serialise.warnUnsaved(
this);
497 return serialise.result();
502 messageDebug(
"CaloClusterCollectionSettingsButton::restoreFromState()");
513 state.
restore(
m_d->ui_commonsettings.checkBox_tracksUseBaseLightModel);
514 state.
restore(
m_d->ui_commonsettings.checkBox_cut_minpt);
515 state.
restore(
m_d->ui_commonsettings.doubleSpinBox_cut_minpt_gev);
516 state.
restore(
m_d->ui_commonsettings.checkBox_cut_maxpt);
517 state.
restore(
m_d->ui_commonsettings.doubleSpinBox_cut_maxpt_gev);
518 state.
restore(
m_d->ui_commonsettings.comboBox_momtype);
521 state.
restore(
m_d->ui_commonsettings.etaPhiCutWidget);
524 state.
restore(
m_d->ui_customsettings.radioButton_absoluteScale,
m_d->ui_customsettings.radioButton_relativeScale);
525 state.
restore(
m_d->ui_customsettings.doubleSpinBox_lengthOf10GeV);
526 state.
restore(
m_d->ui_customsettings.doubleSpinBox_lengthOfMostEnergetic);
527 state.
restore(
m_d->ui_customsettings.checkBox_logscale);
528 state.
restore(
m_d->ui_customsettings.checkBox_showVolumeOutLines);
568 return m_d->m_transverseEnergy;
574 if(
m_d->ui_commonsettings.comboBox_momtype->currentText()==
"Et")
575 m_d->m_transverseEnergy =
true;
577 m_d->m_transverseEnergy =
false;
580 messageDebug(
"setTransverseEnergy: "+QString::number(
m_d->m_transverseEnergy));
591 if (!
m_d->editwindow)
592 m_d->initEditWindow();
594 if (!
m_d->ui_commonsettings.checkBox_cut_minpt)
604 const double minFromInterface=
m_d->ui_commonsettings.doubleSpinBox_cut_minpt_gev->value()*1000;
605 const double maxFromInterface=
m_d->ui_commonsettings.doubleSpinBox_cut_maxpt_gev->value()*1000;
623 min = (
m_d->ui_commonsettings.checkBox_cut_minpt->isChecked() ? minFromInterface : -std::numeric_limits<double>::infinity());
624 max = (
m_d->ui_commonsettings.checkBox_cut_maxpt->isChecked() ? maxFromInterface : std::numeric_limits<double>::infinity());
626 message(
"cutAllowedPt: min,max="+QString::number(
min)+
","+QString::number(
max));
637 if (!
m_d->editwindow)
638 m_d->initEditWindow();
639 return m_d->ui_commonsettings.etaPhiCutWidget->allowedEta();
645 if (!
m_d->editwindow)
646 m_d->initEditWindow();
647 return m_d->ui_commonsettings.etaPhiCutWidget->allowedPhi();
686 messageDebug(
"CaloClusterCollectionSettingsButton::possibleChange_scale() ");
689 if (
m_d->last_scale ==
scale())
return;
703 m_d->coll = collHandle;
709 messageVerbose(
"CaloClusterCollectionSettingsButton::possibleChange_showVolumeOutLines() ");
711 message(
"CaloCluster - possibleChange_showVolumeOutLines(). to be implemented...");
718 messageVerbose(
"CaloClusterCollectionSettingsButton::possibleChange_useTransverseEnergies() ");
720 message(
"CaloCluster - possibleChange_useTransverseEnergies(). to be implemented...");
727 const bool relative =
m_d->ui_customsettings.radioButton_relativeScale->isChecked();
728 const bool logscale =
m_d->ui_customsettings.checkBox_logscale->isChecked();
730 double highestvisibleenergy=0*SYSTEM_OF_UNITS::eV;
732 QString colname =
m_d->coll->name();
737 if ( highestvisibleenergy < m_d->coll->highestVisibleClusterEnergy() )
738 highestvisibleenergy =
m_d->coll->highestVisibleClusterEnergy();
743 if (
m_d->gui_mostEnergetic!=highestvisibleenergy) {
744 m_d->gui_mostEnergetic=highestvisibleenergy;
745 m_d->ui_customsettings.label_current_most_energetic->setText(
"Current value: "+QString::number(
m_d->gui_mostEnergetic/SYSTEM_OF_UNITS::GeV,
'f',2)+
" GeV");
748 const double length = (relative ?
m_d->ui_customsettings.doubleSpinBox_lengthOfMostEnergetic->value()*SYSTEM_OF_UNITS::m
749 :
m_d->ui_customsettings.doubleSpinBox_lengthOf10GeV->value()*SYSTEM_OF_UNITS::m );
750 const double energy = relative ? highestvisibleenergy : 10*SYSTEM_OF_UNITS::GeV;
751 const double minscale = 1*SYSTEM_OF_UNITS::mm/(1*SYSTEM_OF_UNITS::GeV);
752 const double maxscale = 1*SYSTEM_OF_UNITS::m/(1*SYSTEM_OF_UNITS::MeV);
757 scl = logscale ?
length/log(1+fabs(energy)) :
length/energy;
758 if (scl!=scl||scl>maxscale)
762 return QPair<bool,double>(logscale,scl);
char data[hepevt_bytes_allocation_ATLAS]
void restore(QCheckBox *sb)
void warnUnrestored(QObject *)
void widgetHandled(QWidget *)
void messageVerbose(const QString &) const
void message(const QString &) const
IVP1System * systemBase() const
void messageDebug(const QString &) const
static void messageVerbose(const QString &)
static void messageDebug(const QString &)