ATLAS Offline Software
VP1PartSpectController.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include "ui_partspectcontrollerform.h"
7 
9 #include "VP1Base/VP1Serialise.h"
10 #include "VP1Base/VP1Settings.h"
11 
12 #include <QFileDialog>
13 #include <QFileInfo>
14 
16 {
17 public:
19  ~Imp();
20 
22  Ui::frmPartSpectController ui{};
23 
25  QString lastInputDir;
26 };
27 
29  :theclass(the_class)
30  ,last_particleType(VP1PartSpect::Neutron)
31  ,lastInputDir(VP1Settings::defaultFileSelectDirectory())
32 {
33 }
34 
36 {
37 }
38 
40  :VP1Controller(sys,"PartSpectController")
41  ,m_d(new Imp(this))
42 {
43  m_d->theclass = this;
44  m_d->ui.setupUi(this);
45 
46  m_d->ui.lblFileName->setText("...");
47  connect(m_d->ui.pbtnOpenFile, SIGNAL(clicked()), this, SLOT(openFile()));
48 
49  connect(m_d->ui.rbtnBaryon, SIGNAL(toggled(bool)), this, SLOT(particleType()));
50  connect(m_d->ui.rbtnE, SIGNAL(toggled(bool)), this, SLOT(particleType()));
51  connect(m_d->ui.rbtnGamma, SIGNAL(toggled(bool)), this, SLOT(particleType()));
52  connect(m_d->ui.rbtnLepton, SIGNAL(toggled(bool)), this, SLOT(particleType()));
53  connect(m_d->ui.rbtnMeson, SIGNAL(toggled(bool)), this, SLOT(particleType()));
54  connect(m_d->ui.rbtnNeutron, SIGNAL(toggled(bool)), this, SLOT(particleType()));
55  connect(m_d->ui.rbtnNucleus, SIGNAL(toggled(bool)), this, SLOT(particleType()));
56  connect(m_d->ui.rbtnPi, SIGNAL(toggled(bool)), this, SLOT(particleType()));
57  connect(m_d->ui.rbtnProton, SIGNAL(toggled(bool)), this, SLOT(particleType()));
58  m_d->ui.rbtnNeutron->setChecked(true);
60 }
61 
63 {
64  delete m_d;
65 }
66 
68 {
69  if (s.version()!=0) {
70  message("Warning: State data in .vp1 file has unsupported version ("+str(s.version())+")");
71  return;
72  }
73 
74  s.restore(m_d->ui.rbtnBaryon
75  ,m_d->ui.rbtnE
76  ,m_d->ui.rbtnGamma
77  ,m_d->ui.rbtnLepton
78  ,m_d->ui.rbtnMeson
79  ,m_d->ui.rbtnNeutron
80  ,m_d->ui.rbtnNucleus
81  ,m_d->ui.rbtnPi
82  ,m_d->ui.rbtnProton);
83  particleType();
84 }
85 
86 
88 {
89  return 0;
90 }
91 
93 {
94  s.save(m_d->ui.rbtnBaryon
95  ,m_d->ui.rbtnE
96  ,m_d->ui.rbtnGamma
97  ,m_d->ui.rbtnLepton
98  ,m_d->ui.rbtnMeson
99  ,m_d->ui.rbtnNeutron
100  ,m_d->ui.rbtnNucleus
101  ,m_d->ui.rbtnPi
102  ,m_d->ui.rbtnProton);
103 }
104 
106 {
107  return m_d->last_particleType;
108 }
109 
111 {
112  QString fileName = QFileDialog::getOpenFileName(NULL
113  ,tr("Open File")
114  ,m_d->lastInputDir
115  ,tr("Root files (*.root)"));
116  if(!fileName.isEmpty()) {
117  QFileInfo fileInfo(fileName);
118  m_d->ui.lblFileName->setText(fileInfo.fileName());
120  m_d->lastInputDir = fileInfo.absolutePath();
121  }
122 }
123 
125 {
126  if(m_d->ui.rbtnBaryon->isChecked()) {
129  } else if(m_d->ui.rbtnE->isChecked()) {
132  } else if(m_d->ui.rbtnGamma->isChecked()) {
135  }else if(m_d->ui.rbtnLepton->isChecked()) {
138  }else if(m_d->ui.rbtnMeson->isChecked()) {
141  }else if(m_d->ui.rbtnNeutron->isChecked()) {
144  }else if(m_d->ui.rbtnNucleus->isChecked()) {
147  }else if(m_d->ui.rbtnPi->isChecked()) {
150  }else { // if(m_d->ui.rbtnProton->isChecked()) {
153  }
154 }
155 
156 
VP1Serialise.h
VP1PartSpectController::m_d
Imp * m_d
Definition: VP1PartSpectController.h:39
VP1Settings
Definition: VP1Settings.h:23
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
VP1Deserialise.h
VP1Serialise
Definition: VP1Serialise.h:45
VP1PartSpect::Nucleus
@ Nucleus
Definition: VP1PartSpectFlags.h:26
VP1PartSpectController::particleType
void particleType()
Definition: VP1PartSpectController.cxx:124
VP1PartSpect::Neutron
@ Neutron
Definition: VP1PartSpectFlags.h:25
VP1PartSpectController::actualRestoreSettings
void actualRestoreSettings(VP1Deserialise &)
Definition: VP1PartSpectController.cxx:67
VP1PartSpectController::Imp::~Imp
~Imp()
Definition: VP1PartSpectController.cxx:35
fillPileUpNoiseLumi.connect
string connect
Definition: fillPileUpNoiseLumi.py:70
CSV_InDetExporter.new
new
Definition: CSV_InDetExporter.py:145
VP1PartSpect::Gamma
@ Gamma
Definition: VP1PartSpectFlags.h:22
VP1PartSpectController::Imp::ui
Ui::frmPartSpectController ui
Definition: VP1PartSpectController.cxx:22
VP1String::str
static QString str(const QString &s)
Definition: VP1String.h:49
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
VP1PartSpect::ParticleType
ParticleType
Definition: VP1PartSpectFlags.h:19
VP1Settings.h
VP1PartSpectController::actualSaveSettings
void actualSaveSettings(VP1Serialise &) const
Definition: VP1PartSpectController.cxx:92
IVP1System
Definition: IVP1System.h:36
FortranAlgorithmOptions.fileName
fileName
Definition: FortranAlgorithmOptions.py:13
VP1PartSpectController::Imp::theclass
VP1PartSpectController * theclass
Definition: VP1PartSpectController.cxx:21
VP1PartSpectController::Imp
Definition: VP1PartSpectController.cxx:16
VP1Deserialise
Definition: VP1Deserialise.h:44
VP1PartSpectController
Definition: VP1PartSpectController.h:21
VP1PartSpectController::Imp::Imp
Imp(VP1PartSpectController *)
Definition: VP1PartSpectController.cxx:28
VP1PartSpectController::particleTypeChanged
void particleTypeChanged(VP1PartSpect::ParticleType)
VP1Controller
Definition: VP1Controller.h:45
VP1PartSpectController::openFile
void openFile()
Definition: VP1PartSpectController.cxx:110
VP1PartSpect::E
@ E
Definition: VP1PartSpectFlags.h:21
VP1PartSpectController.h
VP1PartSpect::Lepton
@ Lepton
Definition: VP1PartSpectFlags.h:23
VP1PartSpect::Baryon
@ Baryon
Definition: VP1PartSpectFlags.h:20
VP1PartSpect
Definition: VP1PartSpectFlags.h:18
VP1PartSpect::Proton
@ Proton
Definition: VP1PartSpectFlags.h:28
VP1PartSpectController::getParticleType
VP1PartSpect::ParticleType getParticleType()
Definition: VP1PartSpectController.cxx:105
VP1PartSpect::Meson
@ Meson
Definition: VP1PartSpectFlags.h:24
VP1HelperClassBase::message
void message(const QString &) const
Definition: VP1HelperClassBase.cxx:49
VP1PartSpectController::fileUpdated
void fileUpdated(const QString &)
VP1PartSpectController::currentSettingsVersion
int currentSettingsVersion() const
Definition: VP1PartSpectController.cxx:87
VP1PartSpectController::~VP1PartSpectController
virtual ~VP1PartSpectController()
Definition: VP1PartSpectController.cxx:62
VP1PartSpectController::Imp::last_particleType
VP1PartSpect::ParticleType last_particleType
Definition: VP1PartSpectController.cxx:24
VP1PartSpectController::VP1PartSpectController
VP1PartSpectController(IVP1System *sys)
Definition: VP1PartSpectController.cxx:39
VP1PartSpect::Pi
@ Pi
Definition: VP1PartSpectFlags.h:27
VP1PartSpectController::Imp::lastInputDir
QString lastInputDir
Definition: VP1PartSpectController.cxx:25