Commit 65fb3023 authored by Pawel Sznajder's avatar Pawel Sznajder
Browse files

add creation of mysql tables corresponding to collinear distribution

parent cf9386e2
......@@ -24,6 +24,11 @@ scenario_task_index_number INTEGER,
scenario_id INTEGER NOT NULL,
computation_id INTEGER NOT NULL);
CREATE TABLE collinear_distribution_type (
collinear_distribution_type_id INTEGER NOT NULL PRIMARY KEY,
collinear_distribution_type_short_name VARCHAR(10),
collinear_distribution_type_long_name VARCHAR(255));
CREATE TABLE gpd_type (
gpd_type_id INTEGER NOT NULL PRIMARY KEY,
gpd_type_short_name VARCHAR(10),
......@@ -52,6 +57,32 @@ INNER JOIN scenario_computation sc ON sc.computation_id = c.computation_id
INNER JOIN scenario s ON sc.scenario_id = s.scenario_id
ORDER BY c.computation_id;
/* === collinear_distribution_type === */
INSERT INTO collinear_distribution_type (collinear_distribution_type_id, collinear_distribution_type_short_name, collinear_distribution_type_long_name)
VALUES ('0', 'UNDEFINED', 'UNDEFINED');
INSERT INTO collinear_distribution_type (collinear_distribution_type_id, collinear_distribution_type_short_name, collinear_distribution_type_long_name)
VALUES ('1', 'ALL', 'ALL');
INSERT INTO collinear_distribution_type (collinear_distribution_type_id, collinear_distribution_type_short_name, collinear_distribution_type_long_name)
VALUES ('2', 'UnpolPDF', 'UnpolPDF');
INSERT INTO collinear_distribution_type (collinear_distribution_type_id, collinear_distribution_type_short_name, collinear_distribution_type_long_name)
VALUES ('3', 'PolPDF', 'PolPDF');
INSERT INTO collinear_distribution_type (collinear_distribution_type_id, collinear_distribution_type_short_name, collinear_distribution_type_long_name)
VALUES ('4', 'TransPDF', 'TransPDF');
INSERT INTO collinear_distribution_type (collinear_distribution_type_id, collinear_distribution_type_short_name, collinear_distribution_type_long_name)
VALUES ('5', 'UnpolFF', 'UnpolFF');
INSERT INTO collinear_distribution_type (collinear_distribution_type_id, collinear_distribution_type_short_name, collinear_distribution_type_long_name)
VALUES ('6', 'PolFF', 'PolFF');
INSERT INTO collinear_distribution_type (collinear_distribution_type_id, collinear_distribution_type_short_name, collinear_distribution_type_long_name)
VALUES ('7', 'TransFF', 'TransFF');
/* === gpd_type === */
INSERT INTO gpd_type (gpd_type_id, gpd_type_short_name, gpd_type_long_name)
......
/* MYSQL syntax */
CREATE TABLE collinear_distribution_kinematic (
collinear_distribution_kinematic_id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
x DOUBLE,
x_unit INTEGER NOT NULL,
MuF2 DOUBLE,
MuF2_unit INTEGER NOT NULL,
MuR2 DOUBLE,
MuR2_unit INTEGER NOT NULL,
hash_sum VARCHAR(40) NOT NULL);
CREATE INDEX collinear_distribution_kinematic_index ON collinear_distribution_kinematic (hash_sum);
CREATE TABLE gpd_kinematic (
gpd_kinematic_id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
x DOUBLE,
......@@ -15,6 +26,13 @@ MuR2_unit INTEGER NOT NULL,
hash_sum VARCHAR(40) NOT NULL);
CREATE INDEX gpd_kinematic_index ON gpd_kinematic (hash_sum);
CREATE TABLE collinear_distribution_result (
collinear_distribution_result_id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
computation_module_name VARCHAR(255) NOT NULL,
collinear_distribution_kinematic_id INTEGER NOT NULL,
computation_id INTEGER NOT NULL);
CREATE INDEX collinear_distribution_result_index ON collinear_distribution_result (computation_id);
CREATE TABLE gpd_result (
gpd_result_id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
computation_module_name VARCHAR(255) NOT NULL,
......@@ -26,6 +44,14 @@ CREATE TABLE parton_distribution (
parton_distribution_id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
gluon_distribution_value DOUBLE);
CREATE TABLE collinear_distribution_result_parton_distribution (
collinear_distribution_result_parton_distribution_id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
collinear_distribution_type_id INTEGER NOT NULL,
collinear_distribution_result_id INTEGER NOT NULL,
parton_distribution_id INTEGER NOT NULL);
CREATE INDEX cdrpd_index_a ON collinear_distribution_result_parton_distribution (parton_distribution_id, collinear_distribution_result_id);
CREATE INDEX cdrpd_index_b ON collinear_distribution_result_parton_distribution (collinear_distribution_result_id);
CREATE TABLE gpd_result_parton_distribution (
gpd_result_parton_distribution_id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
gpd_type_id INTEGER NOT NULL,
......@@ -50,11 +76,26 @@ CREATE INDEX pdqd_index_b ON parton_distribution_quark_distribution (parton_dist
/* view */
CREATE VIEW collinear_distribution_kinematic_view AS
SELECT k.collinear_distribution_kinematic_id, k.x, k.x_unit, k.MuF2, k.MuF2_unit, k.MuR2, k.MuR2_unit, k.hash_sum
FROM collinear_distribution_kinematic k
ORDER BY k.collinear_distribution_kinematic_id;
CREATE VIEW gpd_kinematic_view AS
SELECT k.gpd_kinematic_id, k.x, k.x_unit, k.xi, k.xi_unit, k.t, k.t_unit, k.MuF2, k.MuF2_unit, k.MuR2, k.MuR2_unit, k.hash_sum
FROM gpd_kinematic k
ORDER BY k.gpd_kinematic_id;
CREATE VIEW collinear_distribution_result_view AS
SELECT gr.collinear_distribution_result_id, pd.parton_distribution_id, gr.computation_module_name, grpd.collinear_distribution_type_id, pd.gluon_distribution_value, qd.quark_flavor_id, qd.quark_distribution, qd.quark_distribution_plus, qd.quark_distribution_minus, gr.computation_id, gr.collinear_distribution_kinematic_id
FROM collinear_distribution_result gr
INNER JOIN computation c ON gr.computation_id = c.computation_id
INNER JOIN collinear_distribution_result_parton_distribution grpd ON gr.collinear_distribution_result_id = grpd.collinear_distribution_result_id
INNER JOIN parton_distribution pd ON grpd.parton_distribution_id = pd.parton_distribution_id
INNER JOIN parton_distribution_quark_distribution pdqd ON pd.parton_distribution_id = pdqd.parton_distribution_id
INNER JOIN quark_distribution qd ON pdqd.quark_distribution_id = qd.quark_distribution_id
ORDER BY pd.parton_distribution_id;
CREATE VIEW gpd_result_view AS
SELECT gr.gpd_result_id, pd.parton_distribution_id, gr.computation_module_name, grpd.gpd_type_id, pd.gluon_distribution_value, qd.quark_flavor_id, qd.quark_distribution, qd.quark_distribution_plus, qd.quark_distribution_minus, gr.computation_id, gr.gpd_kinematic_id
FROM gpd_result gr
......@@ -67,6 +108,29 @@ ORDER BY pd.parton_distribution_id;
/* view for plots */
CREATE VIEW collinear_distribution_plot_2d_view AS
SELECT gr.computation_id, gk.collinear_distribution_kinematic_id,
gk.x, gk.x_unit,
gk.MuF2, gk.MuF2_unit,
gk.MuR2, gk.MuR2_unit,
gr.collinear_distribution_result_id, gr.computation_module_name,
gt.collinear_distribution_type_short_name,
pd.gluon_distribution_value, '1' as 'gluon_distribution_value_unit',
qf.quark_flavor_short_name,
qd.quark_distribution, '1' as 'quark_distribution_unit',
qd.quark_distribution_plus, '1' as 'quark_distribution_plus_unit',
qd.quark_distribution_minus, '1' as 'quark_distribution_minus_unit'
FROM collinear_distribution_result gr
INNER JOIN collinear_distribution_kinematic gk ON gr.collinear_distribution_kinematic_id = gk.collinear_distribution_kinematic_id
INNER JOIN computation c ON gr.computation_id = c.computation_id
INNER JOIN collinear_distribution_result_parton_distribution grpd ON gr.collinear_distribution_result_id = grpd.collinear_distribution_result_id
INNER JOIN parton_distribution pd ON grpd.parton_distribution_id = pd.parton_distribution_id
INNER JOIN parton_distribution_quark_distribution pdqd ON pd.parton_distribution_id = pdqd.parton_distribution_id
INNER JOIN quark_distribution qd ON pdqd.quark_distribution_id = qd.quark_distribution_id
INNER JOIN collinear_distribution_type gt ON grpd.collinear_distribution_type_id = gt.collinear_distribution_type_id
INNER JOIN quark_flavor qf ON qd.quark_flavor_id = qf.quark_flavor_id
ORDER BY gr.collinear_distribution_result_id;
CREATE VIEW gpd_plot_2d_view AS
SELECT gr.computation_id, gk.gpd_kinematic_id,
gk.x, gk.x_unit,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment