Skip to content
Snippets Groups Projects
Commit 353872d3 authored by Dave Casper's avatar Dave Casper
Browse files

Add minimal schema for scintillator geometry

parent 7285b761
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,7 @@ atlas_subdir( FaserGeoModel )
add_custom_command (
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/geomDB.db
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/data/geomDB.sql
COMMAND cat ${CMAKE_CURRENT_SOURCE_DIR}/data/geomDB.sql | sqlite3 ${CMAKE_CURRENT_BINARY_DIR}/geomDB.db
)
......
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "HVS_TAGCACHE" (
"ROOTTAG" TEXT,
"CHILDNODE" TEXT,
"CHILDTAG" TEXT,
"CHILDTAGID" SLONGLONG
--
-- ALL sql commands must be terminated with a semi-colon!
--
-- This table contains one entry per node.
-- Nodes may be either leaves (data tables) or branches (containers).
-- Branches may contain both branches and leaves.
DROP TABLE IF EXISTS "HVS_NODE";
CREATE TABLE IF NOT EXISTS "HVS_NODE" (
"NODE_ID" SLONGLONG UNIQUE,
"NODE_NAME" TEXT UNIQUE,
"PARENT_ID" SLONGLONG,
"BRANCH_FLAG" BOOLEAN,
"NODE_COMMENT" TEXT
);
-- This table contains one row per tag.
-- A given tag can apply to a single node.
-- A branch tag "contains" the tags of daughter nodes (branch and leaf).
-- A leaf tag can apply to multiple rows of the table in question.
-- Tags can be locked, which must lock all daughter tags.
-- The REPLICATED field does not appear to be used by ATLAS.
-- The SUPPORTED field corresponds to the last supported software release.
DROP TABLE IF EXISTS "HVS_TAG2NODE";
CREATE TABLE IF NOT EXISTS "HVS_TAG2NODE" (
"NODE_ID" SLONGLONG,
"TAG_NAME" TEXT UNIQUE,
......@@ -16,17 +32,112 @@ CREATE TABLE IF NOT EXISTS "HVS_TAG2NODE" (
"DATE_LOCKED" DATE,
"SUPPORTED" INT
);
CREATE TABLE IF NOT EXISTS "HVS_NODE" (
"NODE_ID" SLONGLONG UNIQUE,
"NODE_NAME" TEXT UNIQUE,
"PARENT_ID" SLONGLONG,
"BRANCH_FLAG" BOOLEAN,
"NODE_COMMENT" TEXT
);
-- This table implements the many <--> many relationship between child
-- and parent tags.
-- Each tag may "own" multiple tags at below it, and be owned by multiple
-- tags above it.
-- For example, a given tag on the root FASER node owns concurrent tags
-- for each component (tracker, calorimeter) of the experiment.
-- And each tag for a component may be owned by multiple different root
-- level tags.
DROP TABLE IF EXISTS "HVS_LTAG2LTAG";
CREATE TABLE IF NOT EXISTS "HVS_LTAG2LTAG" (
"PARENT_NODE" SLONGLONG,
"PARENT_TAG" SLONGLONG,
"CHILD_NODE" SLONGLONG,
"CHILD_TAG" SLONGLONG
);
-- This table holds all the tags directly or indirectly contained by
-- each root level tag.
-- In principle it should be populated from the other HVS tables which
-- contain the same information.
DROP TABLE IF EXISTS "HVS_TAGCACHE";
CREATE TABLE IF NOT EXISTS "HVS_TAGCACHE" (
"ROOTTAG" TEXT,
"CHILDNODE" TEXT,
"CHILDTAG" TEXT,
"CHILDTAGID" SLONGLONG
);
-- Tables for describing scintillator plates (and passive radiators)
DROP TABLE IF EXISTS "SCINTPLATE_DATA";
CREATE TABLE IF NOT EXISTS "SCINTPLATE_DATA" (
"SCINTPLATE_DATA_ID" SLONGLONG UNIQUE,
"MODEL" SLONGLONG,
"WIDTH" DOUBLE,
"HEIGHT" DOUBLE,
"THICKNESS" DOUBLE,
"MATERIAL" TEXT,
"SENSITIVE" SLONGLONG
);
-- The DATA2TAG tables associate specific rows of the corresponding
-- _DATA table with the referenced tag (from the HVS_TAG2NODE table).
-- This is a many-to-many relationship: each row may belong to
-- several tags, and each tag may apply to several rows.
DROP TABLE IF EXISTS "SCINTPLATE_DATA2TAG";
CREATE TABLE IF NOT EXISTS "SCINTPLATE_DATA2TAG" (
"SCINTPLATE_TAG_ID" SLONGLONG,
"SCINTPLATE_DATA_ID" SLONGLONG
);
-- Tables for describing scintillator stations (placements)
DROP TABLE IF EXISTS "SCINTSTATION_DATA";
CREATE TABLE IF NOT EXISTS "SCINTSTATION_DATA" (
"SCINTSTATION_DATA_ID" SLONGLONG UNIQUE,
"NAME" TEXT,
"MODEL" SLONGLONG,
"ENV_XMIN" DOUBLE,
"ENV_XMAX" DOUBLE,
"ENV_YMIN" DOUBLE,
"ENV_YMAX" DOUBLE,
"ENV_ZMIN" DOUBLE,
"ENV_ZMAX" DOUBLE,
"XPOS" DOUBLE,
"YPOS" DOUBLE,
"ZPOS" DOUBLE
-- unclear whether default rotation is needed; start by assuming it isn't
-- the orientation will be alignable in any case
);
DROP TABLE IF EXISTS "SCINTSTATION_DATA2TAG";
CREATE TABLE IF NOT EXISTS "SCINTSTATION_DATA2TAG" (
"SCINTSTATION_TAG_ID" SLONGLONG,
"SCINTSTATION_DATA_ID" SLONGLONG
);
-- Tables for scintillator materials.
-- Materials are recorded in two related nodes.
-- One stores the name and density of the material.
-- The second stores the composition in terms of other materials.
DROP TABLE IF EXISTS "SCINTMATERIALS_DATA";
CREATE TABLE IF NOT EXISTS "SCINTMATERIALS_DATA" (
"SCINTMATERIALS_DATA_ID" SLONGLONG UNIQUE,
"NAME" TEXT,
"DENSITY" DOUBLE
);
DROP TABLE IF EXISTS "SCINTMATERIALS_DATA2TAG";
CREATE TABLE IF NOT EXISTS "SCINTMATERIALS_DATA2TAG" (
"SCINTMATERIALS_TAG_ID" SLONGLONG,
"SCINTMATERIALS_DATA_ID" SLONGLONG
);
--
DROP TABLE IF EXISTS "SCINTMATCOMPONENTS_DATA";
CREATE TABLE IF NOT EXISTS "SCINTMATCOMPONENTS_DATA" (
"SCINTMATCOMPONENTS_DATA_ID" SLONGLONG UNIQUE,
"MATERIAL_ID" SLONGLONG,
"COMPNAME" TEXT,
"FRACTION" DOUBLE
);
DROP TABLE IF EXISTS "SCINTMATCOMPONENTS_DATA2TAG";
CREATE TABLE IF NOT EXISTS "SCINTMATCOMPONENTS_DATA2TAG" (
"SCINTMATCOMPONENTS_TAG_ID" SLONGLONG,
"SCINTMATCOMPONENTS_DATA_ID" SLONGLONG
);
-- Data for the HVS_NODE table
INSERT INTO "HVS_NODE" VALUES (0, "FASER", 0, 1, NULL);
INSERT INTO "HVS_NODE" VALUES (1, "Scintillators", 0, 1, NULL);
INSERT INTO "HVS_NODE" VALUES (2, "Tracker", 0, 1, NULL);
INSERT INTO "HVS_NODE" VALUES (3, "Calorimeter", 0, 1, NULL);
INSERT INTO "HVS_NODE" VALUES (4, "Magnet", 0, 1, NULL);
INSERT INTO "HVS_NODE" VALUES (1001, "ScintPlate", 1, 0, NULL);
INSERT INTO "HVS_NODE" VALUES (1002, "ScintStation", 1, 0, NULL);
INSERT INTO "HVS_NODE" VALUES (1003, "ScintMaterials", 1, 0, NULL);
INSERT INTO "HVS_NODE" VALUES (1004, "ScintMatComponents", 1, 0, NULL);
-- Data for the HVS_TAG2NODE table
COMMIT;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment