Page MenuHomeHEPForge

No OneTemporary

diff --git a/HEJview/.gitignore b/HEJview/.gitignore
deleted file mode 100644
index a9098d9..0000000
--- a/HEJview/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-*~
-._*
-*.o
-build/*
\ No newline at end of file
diff --git a/HEJview/CMakeLists.txt b/HEJview/CMakeLists.txt
deleted file mode 100644
index e5a479e..0000000
--- a/HEJview/CMakeLists.txt
+++ /dev/null
@@ -1,49 +0,0 @@
-cmake_minimum_required(VERSION 2.8)
-
-project(HEJview)
-set(HEJview_VERSION_MAJOR 0)
-set(HEJview_VERSION_MINOR 0)
-set(HEJview_VERSION_PATCH 0)
-set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
-
-set(CMAKE_CXX_STANDARD 14)
-
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-missing-braces")
-
-include(CheckIncludeFileCXX)
-
-set(RHEJ_dir "${PROJECT_SOURCE_DIR}/..")
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${RHEJ_dir}/cmake/Modules/")
-find_package(Qt5Widgets)
-
-set(req_libraries Qt5::Widgets rhej)
-
-set(header_dir "${CMAKE_CURRENT_SOURCE_DIR}/include/")
-set(gui_header_dir "${header_dir}/HEJview/gui/")
-file(GLOB header_files "${header_dir}/*.hh")
-file(GLOB gui_header_files "${gui_header_dir}/*.hh")
-set(src_dir "${CMAKE_CURRENT_SOURCE_DIR}/src/")
-file(GLOB src_files "${src_dir}/*.cc")
-file(GLOB tst_files "${CMAKE_CURRENT_SOURCE_DIR}/t/*.cc")
-link_directories(${ROOT_LIBRARY_DIR})
-include_directories(
- ${header_dir} ${gui_header_dir} ${ROOT_INCLUDE_DIR}
- ${fastjet_INCLUDE_PATH}
- )
-
-qt_wrap_cpp(hejview moc ${gui_header_files})
-add_library(hejview SHARED ${src_files} ${moc})
-target_link_libraries(hejview ${req_libraries} ${ROOT_LIBRARIES} ${FASTJET_LIBRARIES})
-
-add_executable("HEJview" "${src_dir}/main/HEJview")
-target_link_libraries (HEJview ${req_libraries} ${ROOT_LIBRARIES} hejview)
-
-enable_testing()
-foreach(tst ${tst_files})
- get_filename_component(tst_exe ${tst} NAME_WE)
- add_executable(${tst_exe} ${tst})
- target_link_libraries (${tst_exe} ${req_libraries} hejview)
- add_test("t_${tst_exe}" ${tst_exe})
-endforeach()
-
-install(TARGETS HEJview DESTINATION bin)
diff --git a/HEJview/include/HEJview/HistSelection.hh b/HEJview/include/HEJview/HistSelection.hh
deleted file mode 100644
index 2996dcb..0000000
--- a/HEJview/include/HEJview/HistSelection.hh
+++ /dev/null
@@ -1,11 +0,0 @@
-#pragma once
-
-#include <QWidget>
-
-namespace HEJview{
- class HistSelection: public QWidget{
-
- public:
- HistSelection(QWidget * parent);
- };
-}
diff --git a/HEJview/include/HEJview/gui/DoubleSlider.hh b/HEJview/include/HEJview/gui/DoubleSlider.hh
deleted file mode 100644
index 223d2e5..0000000
--- a/HEJview/include/HEJview/gui/DoubleSlider.hh
+++ /dev/null
@@ -1,25 +0,0 @@
-#pragma once
-
-#include <QSlider>
-class QWidget;
-
-namespace HEJview{
-
- class DoubleSlider : public QSlider{
-
- Q_OBJECT
-
- public:
- DoubleSlider(
- double min, double max, int steps,
- Qt::Orientation,
- QWidget * parent = nullptr
- );
-
- double value() const;
- void setValue(double);
-
- private:
- double min_, stretch_;
- };
-}
diff --git a/HEJview/include/HEJview/gui/MainWindow.hh b/HEJview/include/HEJview/gui/MainWindow.hh
deleted file mode 100644
index 74a3b87..0000000
--- a/HEJview/include/HEJview/gui/MainWindow.hh
+++ /dev/null
@@ -1,38 +0,0 @@
-#pragma once
-
-#include <memory>
-
-#include <QMainWindow>
-
-#include "RHEJ/Analysis.hh"
-
-class QLabel;
-class QListWidget;
-
-namespace HEJview{
- class ParameterWidget;
-
- class MainWindow : public QMainWindow{
- Q_OBJECT
-
- public:
- explicit MainWindow(
- std::unique_ptr<RHEJ::DynamicAnalysis> analysis
- );
-
- private:
- void redraw_histogram(std::string const & name);
- void initHistList();
- void updateWtwtCut(double new_cut);
-
- std::unique_ptr<RHEJ::DynamicAnalysis> analysis_;
- QLabel * image_label_;
- QListWidget * hist_list_;
- std::vector<ParameterWidget*> param_;
-
- private slots:
- void parameterChanged(std::string const & name, double value);
- void updateHistogram();
- };
-
-}
diff --git a/HEJview/include/HEJview/gui/ParameterWidget.hh b/HEJview/include/HEJview/gui/ParameterWidget.hh
deleted file mode 100644
index 8df6727..0000000
--- a/HEJview/include/HEJview/gui/ParameterWidget.hh
+++ /dev/null
@@ -1,35 +0,0 @@
-#pragma once
-
-#include <QWidget>
-
-class QLineEdit;
-
-namespace HEJview{
- class DoubleSlider;
-
- class ParameterWidget: public QWidget{
- Q_OBJECT
-
- public:
- ParameterWidget(
- QWidget* parent,
- std::string name,
- double value, double min, double max
- );
- double value() const;
-
- signals:
- void valueChanged(std::string const & name, double new_value);
-
- private:
- QLineEdit* edit_;
- DoubleSlider* slider_;
- std::string name_;
- double value_;
-
- private slots:
- void updateParameterFromText();
- void updateParameterFromSlider();
- };
-
-}
diff --git a/HEJview/include/HEJview/load_analysis.hh b/HEJview/include/HEJview/load_analysis.hh
deleted file mode 100644
index 62893d4..0000000
--- a/HEJview/include/HEJview/load_analysis.hh
+++ /dev/null
@@ -1,15 +0,0 @@
-#pragma once
-
-#include <string>
-#include <memory>
-
-namespace RHEJ{
- struct DynamicAnalysis;
-}
-
-namespace HEJview{
- std::unique_ptr<RHEJ::DynamicAnalysis> load_analysis(
- std::string const & analysis_lib,
- std::string const & analysis_save_file
- );
-}
diff --git a/HEJview/src/DoubleSlider.cc b/HEJview/src/DoubleSlider.cc
deleted file mode 100644
index cbe2783..0000000
--- a/HEJview/src/DoubleSlider.cc
+++ /dev/null
@@ -1,33 +0,0 @@
-#include "DoubleSlider.hh"
-
-#include <cmath>
-
-#include <QWidget>
-
-namespace HEJview{
-
- DoubleSlider::DoubleSlider(
- double min, double max, int steps,
- Qt::Orientation o, QWidget * parent
- ):
- QSlider{o, parent},
- min_{min},
- stretch_{(max - min)/steps}
- {
- if(steps <= 0){
- throw std::invalid_argument("Invalid number of steps <= 0");
- }
- QSlider::setMinimum(0);
- QSlider::setMaximum(steps);
- }
-
- double DoubleSlider::value() const{
- return stretch_ * QSlider::value() + min_;
- }
-
- void DoubleSlider::setValue(double value){
- const double transformed = std::round((value - min_)/stretch_);
- QSlider::setValue(static_cast<int>(transformed));
- }
-
-}
diff --git a/HEJview/src/MainWindow.cc b/HEJview/src/MainWindow.cc
deleted file mode 100644
index a84165e..0000000
--- a/HEJview/src/MainWindow.cc
+++ /dev/null
@@ -1,110 +0,0 @@
-#include "HEJview/gui/MainWindow.hh"
-#include "HEJview/gui/ParameterWidget.hh"
-
-#include <exception>
-#include <cstdlib>
-
-#include <QAction>
-#include <QMenuBar>
-#include <QApplication>
-#include <QListWidget>
-#include <QVBoxLayout>
-#include <QPixmap>
-#include <QErrorMessage>
-#include <QLabel>
-
-#include "RHEJ/Analysis.hh"
-
-namespace HEJview{
- namespace {
- void init_menu(MainWindow & win){
- auto * quit = new QAction("&Quit", &win);
- QMenu * file_menu = win.menuBar()->addMenu("&File");
- file_menu->addAction(quit);
- quit->setShortcut(win.tr("CTRL+Q"));
- win.connect(quit, &QAction::triggered, qApp, QApplication::quit);
- }
-
- }
-
- MainWindow::MainWindow(std::unique_ptr<RHEJ::DynamicAnalysis> analysis):
- QMainWindow{},
- analysis_{std::move(analysis)},
- image_label_{new QLabel(this)},
- hist_list_{new QListWidget(this)}
- {
- Q_ASSERT(analysis_ != nullptr);
-
- image_label_->setScaledContents(true);
-
- init_menu(*this);
-
- initHistList();
-
- auto * upper_box = new QHBoxLayout;
- upper_box->addWidget(hist_list_);
- upper_box->addWidget(image_label_);
-
- auto * lower_box = new QHBoxLayout;
- for(auto const & param: analysis_->parameters()){
- param_.emplace_back(
- new ParameterWidget{
- this,
- param.name, param.value, param.min, param.max
- }
- );
- lower_box->addWidget(param_.back());
- connect(
- param_.back(), &ParameterWidget::valueChanged,
- this, &MainWindow::parameterChanged
- );
- }
-
- auto * layout = new QVBoxLayout;
- layout->addLayout(upper_box);
- layout->addLayout(lower_box);
-
- auto * main_widget = new QWidget;
- main_widget->setLayout(layout);
- setCentralWidget(main_widget);
-
- setWindowTitle("HEJview");
- show();
- }
-
- void MainWindow::initHistList(){
- Q_ASSERT(analysis_ != nullptr);
- for(auto && hist: analysis_->histogram_names()){
- hist_list_->addItem(QString::fromStdString(hist));
- }
- connect(
- hist_list_, &QListWidget::itemSelectionChanged,
- this, &MainWindow::updateHistogram
- );
- if(hist_list_->count() > 0) hist_list_->setCurrentRow(0);
- Q_ASSERT(hist_list_->currentItem() != nullptr);
- updateHistogram();
- }
-
-
- void MainWindow::updateHistogram(){
- const auto selected = hist_list_->currentItem();
- Q_ASSERT(selected != nullptr);
- const auto name = selected->text().toStdString();
-
- redraw_histogram(name);
- }
-
- void MainWindow::parameterChanged(std::string const & name, double value){
- const bool update_needed = analysis_->update_parameter(name, value);
- if(update_needed) updateHistogram();
- }
-
- void MainWindow::redraw_histogram(std::string const & name){
- static const auto file = std::tmpnam(nullptr);
-
- analysis_->draw_histogram(name, file);
- const QPixmap cur_hist{file};
- image_label_->setPixmap(cur_hist);
- }
-}
diff --git a/HEJview/src/ParameterWidget.cc b/HEJview/src/ParameterWidget.cc
deleted file mode 100644
index c6e3b42..0000000
--- a/HEJview/src/ParameterWidget.cc
+++ /dev/null
@@ -1,75 +0,0 @@
-#include "HEJview/gui/ParameterWidget.hh"
-
-#include <QLineEdit>
-#include <QDoubleValidator>
-#include <QHBoxLayout>
-#include <QLabel>
-
-#include "HEJview/gui/DoubleSlider.hh"
-
-namespace HEJview{
- namespace{
- constexpr double ep = 1e-3;
- }
-
- ParameterWidget::ParameterWidget(
- QWidget* parent,
- std::string name,
- double value, double min, double max
- ):
- QWidget{parent},
- edit_{new QLineEdit(this)},
- slider_{
- new DoubleSlider(min*(1-ep), max*(1+ep), 100, Qt::Horizontal, this)
- },
- name_{std::move(name)},
- value_{value}
- {
- static const int box_width = edit_->fontMetrics().width("2.000000000e-09");
- edit_->setFixedWidth(box_width);
- edit_->setText(QString::number(value_));
- edit_->setValidator(new QDoubleValidator{edit_});
-
- slider_->setValue(value_);
-
- auto * layout = new QHBoxLayout(this);
- layout->addWidget(new QLabel{name_.c_str(), this});
- layout->addWidget(edit_);
- layout->addWidget(slider_);
- setLayout(layout);
-
- connect(
- edit_, &QLineEdit::editingFinished,
- this, &ParameterWidget::updateParameterFromText
- );
- connect(
- slider_, &DoubleSlider::valueChanged,
- this, &ParameterWidget::updateParameterFromSlider
- );
- }
-
- double ParameterWidget::value() const{
- return value_;
- }
-
- void ParameterWidget::updateParameterFromText(){
- double new_value = edit_->text().toDouble();
- if(new_value == value_) return;
- value_ = new_value;
- const bool old_state = slider_->blockSignals(true);
- slider_->setValue(new_value);
- slider_->blockSignals(old_state);
- emit valueChanged(name_, value_);
- }
-
- void ParameterWidget::updateParameterFromSlider(){
- double new_value = slider_->value();
- if(new_value == value_) return;
- value_ = new_value;
- const bool old_state = edit_->blockSignals(true);
- edit_->setText(QString::number(new_value));
- edit_->blockSignals(old_state);
- emit valueChanged(name_, value_);
- }
-
-}
diff --git a/HEJview/src/load_analysis.cc b/HEJview/src/load_analysis.cc
deleted file mode 100644
index 6c51e07..0000000
--- a/HEJview/src/load_analysis.cc
+++ /dev/null
@@ -1,26 +0,0 @@
-#include "HEJview/load_analysis.hh"
-
-#include <dlfcn.h>
-
-#include "RHEJ/Analysis.hh"
-
-namespace HEJview{
- std::unique_ptr<RHEJ::DynamicAnalysis> load_analysis(
- std::string const & analysis_lib,
- std::string const & analysis_save_file
- ){
- using AnalysisLoader =
- std::unique_ptr<RHEJ::DynamicAnalysis> (*)(std::string const &);
-
- auto handle = dlopen(analysis_lib.c_str(), RTLD_NOW);
- char * error = dlerror();
- if(error != nullptr) throw std::runtime_error(error);
-
- void * sym = dlsym(handle, "load_analysis");
- error = dlerror();
- if(error != nullptr) throw std::runtime_error(error);
- auto make_analysis = reinterpret_cast<AnalysisLoader>(sym);
-
- return make_analysis(analysis_save_file);
- }
-}
diff --git a/HEJview/src/main/HEJview.cc b/HEJview/src/main/HEJview.cc
deleted file mode 100644
index 7c187a4..0000000
--- a/HEJview/src/main/HEJview.cc
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <QApplication>
-#include "HEJview/gui/MainWindow.hh"
-#include "HEJview/load_analysis.hh"
-
-#include <iostream>
-#include <memory>
-
-using namespace HEJview;
-
-
-
-int main(int argc, char** argv){
- if(argc < 3 || std::string(argv[1]) == "--help"){
- std::cerr << "Usage: ./HEJview analysis_lib analysis_save\n";
- return EXIT_FAILURE;
- }
-
- QApplication app(argc, argv);
-
- MainWindow m{load_analysis(argv[1], argv[2])};
- return app.exec();
-}

File Metadata

Mime Type
text/x-diff
Expires
Mon, Jan 20, 9:14 PM (1 d, 1 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4242437
Default Alt Text
(13 KB)

Event Timeline