ATLAS Offline Software
Loading...
Searching...
No Matches
CaloClusterCollectionSettingsButton.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5// Local
9// UIs
10#include "ui_periparticlecollectionsettings_form.h"
11#include "ui_percaloclustercollectionsettings_form.h"
12
13//VP1
17#include "VP1Base/VP1Msg.h"
18
19//Coin3D
20#include "Inventor/nodes/SoDrawStyle.h"
21#include "Inventor/nodes/SoLightModel.h"
22#include "Inventor/nodes/SoMaterial.h"
23
24// Qt
25#include <QTimer>
26#include <QByteArray>
27#include <QBuffer>
28#include <QDataStream>
29#include <QMouseEvent>
30#include <QDragEnterEvent>
31#include <QDropEvent>
32#include <QShortcut>
33#include <QMimeData>
34#include <QDrag>
35
36// System of units
37#ifdef BUILDVP1LIGHT
38 #include "GeoModelKernel/Units.h"
39 #define SYSTEM_OF_UNITS GeoModelKernelUnits // --> 'GeoModelKernelUnits::cm'
40#else
41 #include "GaudiKernel/SystemOfUnits.h"
42 #define SYSTEM_OF_UNITS Gaudi::Units // --> 'Gaudi::Units::cm'
43#endif
44
45// Misc
46#include <iostream>
47
48//____________________________________________________________________
50public:
51
52// Imp():theclass(0),editwindow(0),matButton(0), trackDrawStyle(0), trackLightModel(0){}
53 Imp():dim(0),matButton(nullptr),theclass(nullptr),coll(nullptr),editwindow(nullptr),
56 //nop
57 }
58
59 int dim;
61
62 void initEditWindow();
63
64 // the material button
65 VP1MaterialButton* matButton;// main collection colour
66
67 // the main 'button' class
69
70 // the collHandle to the Collection
72
73 // setup the UI
74 QWidget * editwindow; // the main window
75 Ui::IParticleCollectionSettingsForm ui_commonsettings{}; // the common main UI window
76 Ui::CaloClusterSettingsDisplayForm ui_customsettings{}; // the custom jet cuts
77
78
79// QList<VP1MaterialButton*> parameterTypeMatButtons;// enum used to access the specific button
80
81// SoDrawStyle * trackDrawStyle;
82// SoLightModel * trackLightModel;
83
84 //GUI - last values
85
86 // common cuts
90 QList<VP1Interval> last_cutAllowedPhi;
93
94 // specific cuts
95 QPair<bool,double> last_scale;
97
99
100
101};
102
103
105//SoMaterial * CaloClusterCollectionSettingsButton::Imp::createMaterial(const int& r,const int& g,const int& b) const
106//{
107// return VP1MaterialButton::createMaterial(r/255.0,g/255.0,b/255.0,0.2/*brightness*/);
108//}
109
110//____________________________________________________________________
112{
113 if (editwindow)
114 return;
115 theclass->messageVerbose("Initialising material editor dialog");
116
117 // create a parent widget
118 editwindow = new QWidget(0,Qt::WindowStaysOnTopHint); // parent widget
119
120 // init UI, with the same parent widget
122 auto customsettings = new QWidget();
123 ui_commonsettings.verticalLayout_additional_widgets->addWidget(customsettings);
124 ui_customsettings.setupUi(customsettings); //JetSysSettingsDisplayForm
125
127 // change labels to match object's nomenclature
128 ui_commonsettings.groupBox_cuts_momentum->setTitle("Energy cuts");
129 ui_commonsettings.checkBox_cut_minpt->setText("Min Energy");
130 ui_commonsettings.checkBox_cut_maxpt->setText("Max Energy");
131
132 ui_commonsettings.comboBox_momtype->setItemText(0, "Et");
133 ui_commonsettings.comboBox_momtype->setItemText(1, "E");
134// ui_commonsettings.comboBox_momtype->setEnabled(false); // TODO: enable it back and make it working, now it is not connected
135
136 // change initial values to match jets' typical values
137 ui_commonsettings.doubleSpinBox_cut_minpt_gev->setValue(2.00);
138 ui_commonsettings.doubleSpinBox_cut_maxpt_gev->setValue(100.00);
139
140 // get a handle on the material button
141 matButton = ui_commonsettings.pushButton_matButton;
142
143// // set "Material" checked by default ("Skin" will be optional)
144// ui_customsettings.radioButton_material->setChecked(true);
145
146// defaultParametersMatButton = ui_commonsettings.matButton_parametersDefaultColour;
147// SoMaterial* defParamMat = new SoMaterial; // Default (for the moment)
148// defaultParametersMatButton->setMaterial(defParamMat);
149// ui_commonsettings.frame_parameterTypeColours->hide();
150
151 // // Set the default colours for the "colour by parameter type" section
152 // parameterTypeMatButtons.append(ui_commonsettings.pushButton_matButton_parameters_default_colour_2);
153 // parameterTypeMatButtons.append(ui_commonsettings.pushButton_matButton_parameters_default_colour_3);
154 // parameterTypeMatButtons.append(ui_commonsettings.pushButton_matButton_parameters_default_colour_4);
155 // parameterTypeMatButtons.append(ui_commonsettings.pushButton_matButton_parameters_default_colour_5);
156 // parameterTypeMatButtons.append(ui_commonsettings.pushButton_matButton_parameters_default_colour_6);
157 // parameterTypeMatButtons.append(ui_commonsettings.pushButton_matButton_parameters_default_colour_7);
158 // QList<QColor> colours;
159 // colours.append(QColor(0.0, 170.0, 255.0));
160 // colours.append(QColor(170, 85, 255));
161 // colours.append(QColor(255, 85, 0));
162 // colours.append(QColor(170, 0, 127));
163 // colours.append(QColor(170, 255, 0));
164 // colours.append(QColor(85, 0, 255));
165 //
166 // for (unsigned int i=0; i<6;++i){
167 // SoMaterial * mat = VP1MaterialButton::createMaterial(colours.at(i));
168 // (parameterTypeMatButtons.at(i))->setMaterial(mat);
169 // }
170
171
172// // when creating a new controller, check if b-tagging checkbox is enabled,
173// // for example from a config file or from a drag&drop from another collection
174// if (ui_customsettings.bTaggingCheckBox->isChecked())
175// theclass->possibleChange_bTaggingEnabled(true); // init the b-tagging toolbox as active
176// else
177// theclass->possibleChange_bTaggingEnabled(false); // init the b-tagging toolbox as not-active
178//
179//
180// // default material for b-jets
181// materialFallback = createMaterial(116,255,228);
182// materialFallback->ref();
183
184}
185
186//____________________________________________________________________
188{
189 VP1Msg::messageVerbose("CaloClusterCollectionSettingsButton::setMaterialText()");
190 if (m_d->editwindow)
191 m_d->editwindow->setWindowTitle(t);
192 setToolTip(t);
193}
194
195
196//____________________________________________________________________
198{
199 double val = m_d->ui_customsettings.doubleSpinBox_lengthOf10GeV->value();
200 VP1Msg::messageVerbose("CaloClusterCollectionSettingsButton::lengthOf10GeV() - value: " + QString::number(val));
201 return val;
202}
203
205//double CaloClusterCollectionSettingsButton::maxR()
206//{
207// double val = m_d->ui_customsettings.checkBox_maxR->isChecked() ? (m_d->ui_customsettings.doubleSpinBox_maxR->value() ) : -1; //m_d->ui_customsettings.doubleSpinBox_maxR->value();
208// VP1Msg::messageVerbose("CaloClusterCollectionSettingsButton::maxR() - value: " + QString::number(val));
209// return val;
210//}
211
212
213
214
215
216
217
218//____________________________________________________________________
221//: VP1CollectionSettingsButtonBase(parent,0,"VP1MaterialButton"), m_d(new Imp)
222{
223 m_d->dim = dim;
224
225 m_d->theclass = this;
226 m_d->initEditWindow();
227
228 m_d->m_transverseEnergy = true;
229 m_d->m_forceRebuild = false;
230
231// // default material for b-jets
232// m_d->materialFallback = m_d->createMaterial(116,255,228);
233// m_d->materialFallback->ref();
234
236 // Setup connections which monitor changes in the controller so that we may emit signals as appropriate: //
238
239 // COMMON SETTINGS
240
241 // -> cutAllowedP/Pt
242 connect(m_d->ui_commonsettings.checkBox_cut_minpt,SIGNAL(toggled(bool)),this,SLOT(possibleChange_cutAllowedPt()));
243 connect(m_d->ui_commonsettings.checkBox_cut_maxpt,SIGNAL(toggled(bool)),this,SLOT(possibleChange_cutAllowedPt()));
244 connect(m_d->ui_commonsettings.doubleSpinBox_cut_minpt_gev,SIGNAL(valueChanged(double)),this,SLOT(possibleChange_cutAllowedPt()));
245 connect(m_d->ui_commonsettings.doubleSpinBox_cut_maxpt_gev,SIGNAL(valueChanged(double)),this,SLOT(possibleChange_cutAllowedPt()));
246 connect(m_d->ui_commonsettings.checkBox_cut_minpt,SIGNAL(toggled(bool)),this,SLOT(possibleChange_cutAllowedPt()));
247 connect(m_d->ui_commonsettings.comboBox_momtype,SIGNAL(currentIndexChanged(int)),this,SLOT(setTransverseEnergy()));
248
249 // -> cutAllowedEta
250 connect(m_d->ui_commonsettings.etaPhiCutWidget,SIGNAL(allowedEtaChanged(const VP1Interval&)),this,SLOT(possibleChange_cutAllowedEta()));
251
252 // -> cutAllowedPhi
253 connect(m_d->ui_commonsettings.etaPhiCutWidget,SIGNAL(allowedPhiChanged(const QList<VP1Interval>&)),this,SLOT(possibleChange_cutAllowedPhi()));
254
255
256 // CUSTOM SETTINGS
257
258// //Draw Styles / Complexity:
259// VP1QtInventorUtils::setLimitsLineWidthSlider(m_d->ui_commonsettings.horizontalSlider_trackWidth);
260// VP1QtInventorUtils::setValueLineWidthSlider(m_d->ui_commonsettings.horizontalSlider_trackWidth,1.0);
261
262 // -> scale
263 connect(m_d->ui_customsettings.doubleSpinBox_lengthOf10GeV,SIGNAL(valueChanged(double)),this,SLOT(possibleChange_scale()));
264 connect(m_d->ui_customsettings.checkBox_logscale,SIGNAL(toggled(bool)),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()));
267
268
269
270
271
272// // random colors
273// connect(m_d->ui_customsettings.checkBox_randomColours, SIGNAL(toggled(bool)), this, SLOT(enableRandomColours(bool)));
274// connect(m_d->ui_customsettings.checkBox_randomColours, SIGNAL(toggled(bool)), this, SLOT(possibleChange_randomJetColours()));
275// connect(m_d->ui_customsettings.pushButton_colourbyrandom_rerandomise,SIGNAL(clicked()),this,SLOT(emitRerandomise()));
276// this->enableRandomColours(false);
277
278// // maxR
279// connect(m_d->ui_customsettings.checkBox_maxR, SIGNAL(toggled(bool)), this, SLOT(enableMaxR(bool)));
280// connect(m_d->ui_customsettings.checkBox_maxR, SIGNAL(toggled(bool)), this, SLOT(possibleChange_maxR()));
281// connect(m_d->ui_customsettings.doubleSpinBox_maxR, SIGNAL(valueChanged(double)), this, SLOT(possibleChange_maxR()));
282// this->enableMaxR(false);
283
284
285
286
287 // Material button
288 connect(this,SIGNAL(clicked()),this,SLOT(showEditMaterialDialog()));
289 connect(m_d->ui_commonsettings.pushButton_close,SIGNAL(clicked()),this,SLOT(showEditMaterialDialog()));
290 connect(m_d->matButton,SIGNAL(lastAppliedChanged()),this,SLOT(updateButton()));
291 connect(m_d->matButton,SIGNAL(lastAppliedChanged()),this,SIGNAL(lastAppliedChanged()));
292 setAcceptDrops(true);
293
294
295// // init material for b-tagged jet
296// m_d->ui_customsettings.matButton_btaggedJets->setMaterial(m_d->materialFallback);
297
298
299 QTimer::singleShot(0, this, SLOT(updateButton()));
300
301}
302
303// QWidget& CaloClusterCollectionSettingsButton::editWindow() {
304// if (!m_d->editwindow)
305// initEditWindow();
306// return *(m_d->editwindow);
307// }
309{
310 delete m_d->editwindow;
311// m_d->trackDrawStyle->unref();
312// m_d->trackLightModel->unref();
313 delete m_d;
314}
315
317{
318 if (objectName().isEmpty())
319 setObjectName("CaloClusterCollectionSettingsButton");
320 messageVerbose("setColButtonProperties: color=" + str(m_d->matButton->lastAppliedDiffuseColour()));
321 VP1ColorSelectButton::setColButtonProperties(this,m_d->matButton->lastAppliedDiffuseColour(),m_d->dim);
322}
323
325{
326 if (m_d->dim == dim)
327 return;
328 m_d->dim = dim;
329 updateButton();
330}
331
333{
334 if (!m_d->editwindow)
335 m_d->initEditWindow();
336
337 if (m_d->editwindow->isHidden())
338 m_d->editwindow->show();
339 else
340 m_d->editwindow->hide();
341}
342
344{
345 // std::cout<<"CaloClusterCollectionSettingsButton::setMaterial with mat="<<mat<<std::endl;
346 if (!m_d->matButton) m_d->initEditWindow();
347 m_d->matButton->setMaterial(mat);
348 return true;
349}
350
352{
353 if (!m_d->matButton) m_d->initEditWindow();
354 m_d->matButton->setMaterial(mat);
355}
357{
358 if (!m_d->matButton) m_d->initEditWindow();
359 return m_d->matButton->lastAppliedTransparency();
360}
362{
363 if (!m_d->matButton) m_d->initEditWindow();
364 return m_d->matButton->lastAppliedShininess();
365}
367{
368 if (!m_d->matButton) m_d->initEditWindow();
369 return m_d->matButton->lastAppliedBrightness();
370}
371
372
373
374//____________________________________________________________________
376{
377 if (event->button() == Qt::LeftButton)
378 m_d->dragStartPosition = event->pos();
379 QPushButton::mousePressEvent(event);
380}
381
382//____________________________________________________________________
384{
385 if (event->source()!=this && event->mimeData()->hasFormat("vp1/material"))
386 event->acceptProposedAction();
387}
388
389//____________________________________________________________________
391{
392 if (!(event->buttons() & Qt::LeftButton))
393 return;
394 if ((event->pos() - m_d->dragStartPosition).manhattanLength()
395 < QApplication::startDragDistance())
396 return;
397
398 QDrag *drag = new QDrag(this);
399 QMimeData *mimeData = new QMimeData;
400
402 // For dragging state onto other material buttons: //
404
405 QByteArray byteArray = saveState();
406
407 // buffer.close();
408 mimeData->setData("vp1/material", byteArray);
409
410 // ////////////////////////////////////////////////////////
411 // // For dragging c++ code for defining this material //
412 // // into e.g. an editor: //
413 // ////////////////////////////////////////////////////////
414 //
415 // QString s = "SoMaterial * mat = new SoMaterial;\n";
416 // QString str_ambient = m_d->toSbColTxt(m_d->lastapplied_ambient);
417 // if (str_ambient!="SbColor(0.2,0.2,0.2)")
418 // s += "mat->ambientColor.setValue("+str_ambient+");\n";
419 // QString str_diffuse = m_d->toSbColTxt(m_d->lastapplied_diffuse);
420 // if (str_diffuse!="SbColor(0.8,0.8,0.8)")
421 // s += "mat->diffuseColor.setValue("+str_diffuse+");\n";
422 // QString str_specular = m_d->toSbColTxt(m_d->lastapplied_specular);
423 // if (str_specular!="SbColor(0,0,0)")
424 // s += "mat->specularColor.setValue("+str_specular+");\n";
425 // QString str_emissive = m_d->toSbColTxt(m_d->lastapplied_emissive);
426 // if (str_emissive!="SbColor(0,0,0)")
427 // s += "mat->emissiveColor.setValue("+str_emissive+");\n";
428 // QString str_shininess = m_d->printFloat(m_d->lastapplied_shininess/100.0);
429 // if (str_shininess!="0.2")
430 // s += "mat->shininess.setValue("+str_shininess+");\n";
431 // QString str_transparency = m_d->printFloat(m_d->lastapplied_transparency/100.0);
432 // if (str_transparency!="0")
433 // s += "mat->transparency.setValue("+str_transparency+");\n";
434 // mimeData->setText(s);
435
436 //Execute drag:
437 drag->setMimeData(mimeData);//drag assumes ownership of mimeData
438 drag->exec(Qt::CopyAction | Qt::MoveAction);
439}
440
441//____________________________________________________________________
443{
444 QByteArray data = event->mimeData()->data("vp1/material");
445 event->acceptProposedAction();
447}
448
449
451
452 messageDebug("CaloClusterCollectionSettingsButton::saveState()");
453
454 // messageVerbose("getState");
455 // if (m_d->ui_commonsettings.checkBox_tracksUseBaseLightModel->isChecked()) messageVerbose("checked!");
456 VP1Serialise serialise(1/*version*/);
457
458
459 serialise.save(m_d->matButton);
460 //serialise.disableUnsavedChecks(); // TODO: what this does??
461
462 // COMMON SETTINGS
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);
469
470 // ETA-PHI CUTS (from VP1Base/VP1EtaPhiCutWidget.cxx)
471 serialise.save(m_d->ui_commonsettings.etaPhiCutWidget);
472
473 // CALO CLUSTER SETTINGS
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);
479
480
481
482// serialise.save(m_d->ui_customsettings.doubleSpinBox_radialScale);
483
484// serialise.save(m_d->ui_customsettings.bTaggingCheckBox);
485// serialise.save(m_d->ui_customsettings.bTaggingComboBox);
486// serialise.save(m_d->ui_customsettings.bTaggingSpinBox);
487// serialise.save(m_d->ui_customsettings.radioButton_material, m_d->ui_customsettings.radioButton_skins);
488// serialise.save(m_d->ui_customsettings.matButton_btaggedJets);
489// serialise.save(m_d->ui_customsettings.skinsComboBox);
490
491 // Parameters
492// serialise.save(m_d->ui_commonsettings.checkBox_showparameters);
493// serialise.save(m_d->ui_commonsettings.checkBox_parameters_colourByType);
494
495 serialise.widgetHandled(this);
496 serialise.warnUnsaved(this);
497 return serialise.result();
498}
499
501
502 messageDebug("CaloClusterCollectionSettingsButton::restoreFromState()");
503
504 VP1Deserialise state(ba,systemBase());
505 if (state.version()<0||state.version()>1) {
506 messageDebug("restoreFromState() - ignoring...");
507 return;//Ignore silently
508 }
509 state.restore(m_d->matButton);
510
511
512 // COMMON SETTINGS
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);
519
520 // ETA-PHI CUTS (from VP1Base/VP1EtaPhiCutWidget.cxx)
521 state.restore(m_d->ui_commonsettings.etaPhiCutWidget);
522
523 // CALO CLUSTER SETTINGS
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);
529
530
531
532// state.restore(m_d->ui_customsettings.doubleSpinBox_radialScale);
533
534// state.restore(m_d->ui_customsettings.bTaggingCheckBox);
535// state.restore(m_d->ui_customsettings.bTaggingComboBox);
536// state.restore(m_d->ui_customsettings.bTaggingSpinBox);
537// state.restore(m_d->ui_customsettings.radioButton_material, m_d->ui_customsettings.radioButton_skins);
538// state.restore(m_d->ui_customsettings.matButton_btaggedJets);
539// state.restore(m_d->ui_customsettings.skinsComboBox);
540
541
542 // // Parameters
543// state.restore(m_d->ui_commonsettings.checkBox_showparameters);
544// state.restore(m_d->ui_commonsettings.checkBox_parameters_colourByType);
545
546 state.widgetHandled(this);
547 state.warnUnrestored(this);
548
549// updateTrackTubeRadius();
550// updateTrackLightModel(m_d->ui_commonsettings.checkBox_tracksUseBaseLightModel);
551
552 updateButton();
553
554// // after restoring the state, check if b-tagging checkbox is enabled,
555// if (m_d->ui_customsettings.bTaggingCheckBox->isChecked())
556// possibleChange_bTaggingEnabled(true); // init the b-tagging toolbox as active
557// else
558// possibleChange_bTaggingEnabled(false); // init the b-tagging toolbox as not-active
559
560
561 //FIXME - anything else need updating?
562}
563
564
565//____________________________________________________________________
567{
568 return m_d->m_transverseEnergy;
569}
570
571//____________________________________________________________________
573{
574 if(m_d->ui_commonsettings.comboBox_momtype->currentText()=="Et")
575 m_d->m_transverseEnergy = true;
576 else
577 m_d->m_transverseEnergy = false;
578
579
580 messageDebug("setTransverseEnergy: "+QString::number(m_d->m_transverseEnergy));
581
582// // when we change Et<-->E we force the rebuild of all objects in the scene
583// m_d->m_forceRebuild = true;
584 // then, we rebuild all objects
585 emit energyTypeChanged();
586}
587
588//____________________________________________________________________
590{
591 if (!m_d->editwindow)
592 m_d->initEditWindow();
593
594 if (!m_d->ui_commonsettings.checkBox_cut_minpt)
595 return VP1Interval();
596
597 // will set range to negative if we have momcut=P
598 // if minCut unset then min=-inf
599 // if minCut set, and Pt selected, then min=-minCut
600 // if minCut set, and P selected, then min=-maxCut // TODO: Check this logic!!!!! ????
601 // etc
602 //bool EtCut = isTransverseEnergy();
603
604 const double minFromInterface=m_d->ui_commonsettings.doubleSpinBox_cut_minpt_gev->value()*1000; // from GeV to MeV
605 const double maxFromInterface=m_d->ui_commonsettings.doubleSpinBox_cut_maxpt_gev->value()*1000;
606
607 double min=0.0,max=0.0;
608
609 // TODO: I don't understand this logic...
610 // it looks wrong to me, and the E cut does not currently work...
611 // Moving to a simpler logic.
612 /*
613 if (EtCut) {
614 //Et cut
615 min = (m_d->ui_commonsettings.checkBox_cut_minpt->isChecked() ? minFromInterface : -std::numeric_limits<double>::infinity());
616 max = (m_d->ui_commonsettings.checkBox_cut_maxpt->isChecked() ? maxFromInterface : std::numeric_limits<double>::infinity());
617 } else {
618 //E cut
619 min = (m_d->ui_commonsettings.checkBox_cut_maxpt->isChecked() ? -maxFromInterface : -std::numeric_limits<double>::infinity());
620 max = (m_d->ui_commonsettings.checkBox_cut_minpt->isChecked() ? -minFromInterface : std::numeric_limits<double>::infinity());
621 }*/
622
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());
625
626 message("cutAllowedPt: min,max="+QString::number(min)+","+QString::number(max));
627
628 if (max<min)
629 return VP1Interval();
630
631 return VP1Interval( min, max );//fixme: closed interval??
632}
633
634//____________________________________________________________________
636{
637 if (!m_d->editwindow)
638 m_d->initEditWindow();
639 return m_d->ui_commonsettings.etaPhiCutWidget->allowedEta();
640}
641
642//____________________________________________________________________
644{
645 if (!m_d->editwindow)
646 m_d->initEditWindow();
647 return m_d->ui_commonsettings.etaPhiCutWidget->allowedPhi();
648}
649
650
651
652//____________________________________________________________________
654{
655 messageVerbose("possibleChange_cutAllowedPt() ");
656
657 if ( m_d->last_cutAllowedPt==cutAllowedPt()) return;
658// if ( !m_d->m_forceRebuild && m_d->last_cutAllowedPt==cutAllowedPt()) return;
659
660 messageVerbose("cutAllowedPt() changed");
661 m_d->last_cutAllowedPt= cutAllowedPt();
662 emit cutAllowedPtChanged(m_d->last_cutAllowedPt);
663}
664
665//____________________________________________________________________
667{
668 if (m_d->last_cutAllowedEta==cutAllowedEta()) return;
669 messageVerbose("cutAllowedEta() changed");
670 m_d->last_cutAllowedEta=cutAllowedEta();
671 emit cutAllowedEtaChanged(m_d->last_cutAllowedEta);
672}
673
674//____________________________________________________________________
676{
677 if (m_d->last_cutAllowedPhi==cutAllowedPhi()) return;
678 messageVerbose("cutAllowedPhi() changed");
679 m_d->last_cutAllowedPhi=cutAllowedPhi();
680 emit cutAllowedPhiChanged(m_d->last_cutAllowedPhi);
681}
682
683//____________________________________________________________________
685{
686 messageDebug("CaloClusterCollectionSettingsButton::possibleChange_scale() ");
687
688// if (m_d->last_scale == lengthOf10GeV()) return;
689 if (m_d->last_scale == scale()) return;
690
691// messageVerbose("lengthOf10GeV changed");
692// m_d->last_scale = lengthOf10GeV();
693
694 messageDebug("cluster size settings changed");
695 m_d->last_scale = scale();
696
697 emit scaleChanged(m_d->last_scale); // it will trigger an update in the collHandle
698}
699
700//____________________________________________________________________
705
706//____________________________________________________________________
708{
709 messageVerbose("CaloClusterCollectionSettingsButton::possibleChange_showVolumeOutLines() ");
710
711 message("CaloCluster - possibleChange_showVolumeOutLines(). to be implemented...");
712}
713
714
715//____________________________________________________________________
717{
718 messageVerbose("CaloClusterCollectionSettingsButton::possibleChange_useTransverseEnergies() ");
719
720 message("CaloCluster - possibleChange_useTransverseEnergies(). to be implemented...");
721}
722
723
724//____________________________________________________________________
726{
727 const bool relative = m_d->ui_customsettings.radioButton_relativeScale->isChecked();
728 const bool logscale = m_d->ui_customsettings.checkBox_logscale->isChecked();
729
730 double highestvisibleenergy=0*SYSTEM_OF_UNITS::eV;
731
732 QString colname = m_d->coll->name();
733 VP1Msg::messageDebug(colname);
734
735 //IParticleCollHandle_CaloCluster* col = dynamic_cast<IParticleCollHandle_CaloCluster*>(m_d->coll);
736 if (dynamic_cast<IParticleCollHandle_CaloCluster*>(m_d->coll)) {
737 if ( highestvisibleenergy < m_d->coll->highestVisibleClusterEnergy() )
738 highestvisibleenergy = m_d->coll->highestVisibleClusterEnergy();
739 }
740
742
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");
746 }
747
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);
753 double scl;
754 if (energy<=0)
755 scl = maxscale;
756 else
757 scl = logscale ? length/log(1+fabs(energy)) :length/energy;
758 if (scl!=scl||scl>maxscale)
759 scl = maxscale;
760 if (scl<minscale)
761 scl = minscale;
762 return QPair<bool,double>(logscale,scl);
763}
764
765
767//void CaloClusterCollectionSettingsButton::enableRandomColours(bool bb)
768//{
769// m_d->ui_customsettings.pushButton_colourbyrandom_rerandomise->setEnabled(bb);
770//}
771//
773//bool CaloClusterCollectionSettingsButton::randomJetColours() const
774//{
775// return m_d->ui_customsettings.checkBox_randomColours->isChecked();
776//}
777//
778//
780//void CaloClusterCollectionSettingsButton::emitRerandomise()
781//{
782// messageVerbose("CaloClusterCollectionSettingsButton - Emitting rerandomise");
783// emit rerandomise();
784//}
785
787//void CaloClusterCollectionSettingsButton::emitMaxR()
788//{
789// messageVerbose("CaloClusterCollectionSettingsButton - Emitting signalMaxR");
790// emit signalMaxR();
791//}
792
794//void CaloClusterCollectionSettingsButton::enableMaxR(bool bb)
795//{
796// m_d->ui_customsettings.doubleSpinBox_maxR->setEnabled(bb);
797//}
798
800//void CaloClusterCollectionSettingsButton::possibleChange_maxR()
801//{
802// messageVerbose("possibleChange_maxR() ");
803//
804// if ( ! m_d->ui_customsettings.checkBox_maxR->isChecked() ) {
805// messageVerbose("maxR unchecked --> setting maxR=0.0 and returning");
806// emit maxRChanged(0.0); // setting marR=0.0 disables the maxR option in handleJet
807// return;
808// }
809//
810// messageVerbose("setting maxR");
811// m_d->last_maxR = maxR();
812// emit maxRChanged(m_d->last_maxR);
813//}
814
816//void CaloClusterCollectionSettingsButton::possibleChange_bTaggingEnabled(bool bb)
817//{
818// messageVerbose("possibleChange_bTaggingEnabled()");
819//
820// m_d->ui_customsettings.bTaggingAlgLabel->setEnabled(bb);
821// m_d->ui_customsettings.bTagginWeightCutLabel->setEnabled(bb);
822// m_d->ui_customsettings.bTaggingComboBox->setEnabled(bb);
823// m_d->ui_customsettings.bTaggingSpinBox->setEnabled(bb);
824// m_d->ui_customsettings.groupBox_btagging_render->setEnabled(bb);
825// m_d->ui_customsettings.matButton_btaggedJets->setEnabled(bb);
826//
827// emit bTaggingEnabledChanged(bb);
828//}
829//
831//void CaloClusterCollectionSettingsButton::possibleChange_bTaggingTagger()
832//{
833// messageVerbose("possibleChange_bTaggingTagger() - " + bTaggingTagger() );
834// emit bTaggingTaggerChanged( bTaggingTagger() );
835//}
837//void CaloClusterCollectionSettingsButton::possibleChange_bTaggingCut()
838//{
839// messageVerbose("possibleChange_bTaggingCut() - " + QString::number(bTaggingCut()) );
840//
841// if (m_d->last_bTaggingCut == bTaggingCut() ) return;
842//
843// messageVerbose("bTaggingSpinBox changed");
844// m_d->last_bTaggingCut = bTaggingCut();
845//
846// emit bTaggingCutChanged( bTaggingCut() );
847//}
848
849
852//void CaloClusterCollectionSettingsButton::possibleChange_bTaggingRenderingMaterial(bool ok)
853//{
854// messageVerbose("possibleChange_bTaggingRenderingMaterial()");
855// messageVerbose("radioButton_material changed - " + QString::number(ok) );
856//
857// emit bTaggingRenderingMaterialChanged(ok);
858//}
859
860// not needed...
863//void CaloClusterCollectionSettingsButton::possibleChange_bTaggingMaterial()
864//{
865// messageVerbose("possibleChange_bTaggingMaterial()");
866//
867// if (m_d->last_bTaggingMaterial == bTaggingMaterial() ) {
868// messageVerbose("material not changed. Returning...");
869// return;
870// }
871//
872// messageVerbose("matButton_btaggedJets changed");
873// m_d->last_bTaggingMaterial = bTaggingMaterial();
874//
875// emit bTaggingMaterialChanged();
876//}
877
878
879
880
883//void CaloClusterCollectionSettingsButton::possibleChange_bTaggingRenderingSkin(bool ok)
884//{
885// messageVerbose("possibleChange_bTaggingRenderingSkin()");
886// messageVerbose("radioButton_skins changed - " + QString::number(ok) );
887//
888// emit bTaggingRenderingSkinChanged(ok);
889//}
double length(const pvec &v)
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
#define min(a, b)
Definition cfImp.cxx:40
#define max(a, b)
Definition cfImp.cxx:41
void cutAllowedPhiChanged(const QList< VP1Interval > &)
void cutAllowedPtChanged(const VP1Interval &)
void cutAllowedEtaChanged(const VP1Interval &)
QByteArray saveState() const
fill out with the state of the object (used for drag and drop etc)
void setCollHandle(IParticleCollHandle_CaloCluster *coll)
void scaleChanged(const QPair< bool, double > &scale)
CaloClusterCollectionSettingsButton(QWidget *parent=0, int dim=25)
VP1CollectionSettingsButtonBase(QWidget *parent=0, int dim=25)
static void setColButtonProperties(QPushButton *, const QColor &col, int dim)
void restore(QCheckBox *sb)
void warnUnrestored(QObject *)
void widgetHandled(QWidget *)
qint32 version() const
void messageVerbose(const QString &) const
void message(const QString &) const
IVP1System * systemBase() const
void messageDebug(const QString &) const
static void messageVerbose(const QString &)
Definition VP1Msg.cxx:84
static void messageDebug(const QString &)
Definition VP1Msg.cxx:39