From 353872d353656ae26fe271b91952485e77a15288 Mon Sep 17 00:00:00 2001 From: Dave Casper <dcasper@uci.edu> Date: Mon, 4 Feb 2019 02:15:48 -0800 Subject: [PATCH] Add minimal schema for scintillator geometry --- .../GeoModel/FaserGeoModel/CMakeLists.txt | 1 + .../GeoModel/FaserGeoModel/data/geomDB.sql | 135 ++++++++++++++++-- 2 files changed, 124 insertions(+), 12 deletions(-) diff --git a/DetectorDescription/GeoModel/FaserGeoModel/CMakeLists.txt b/DetectorDescription/GeoModel/FaserGeoModel/CMakeLists.txt index 624967ca..233edb3e 100644 --- a/DetectorDescription/GeoModel/FaserGeoModel/CMakeLists.txt +++ b/DetectorDescription/GeoModel/FaserGeoModel/CMakeLists.txt @@ -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 ) diff --git a/DetectorDescription/GeoModel/FaserGeoModel/data/geomDB.sql b/DetectorDescription/GeoModel/FaserGeoModel/data/geomDB.sql index eb62b676..e214dab5 100644 --- a/DetectorDescription/GeoModel/FaserGeoModel/data/geomDB.sql +++ b/DetectorDescription/GeoModel/FaserGeoModel/data/geomDB.sql @@ -1,10 +1,26 @@ 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; -- GitLab