agdd: atlas generic detector description in xml

31
AGDD: Atlas Generic Detector Description in XML Christian Arnault, Stan Bentvelsen, Steven Goldfarb, Julius Hrivnac, Jean-François Laporte, Christopher Lester, RD Schaffer, Marc Virchaux XML workshop Berkeley - May 2000

Upload: sinjin

Post on 20-Jan-2016

49 views

Category:

Documents


1 download

DESCRIPTION

AGDD: Atlas Generic Detector Description in XML. Christian Arnault, Stan Bentvelsen, Steven Goldfarb, Julius Hrivnac, Jean-François Laporte, Christopher Lester, RD Schaffer, Marc Virchaux. XML workshop Berkeley - May 2000. Detector description framework. Goal AGDD database - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: AGDD: Atlas Generic Detector Description in XML

AGDD:Atlas Generic Detector Descriptionin XML

Christian Arnault, Stan Bentvelsen, Steven Goldfarb, Julius Hrivnac, Jean-François Laporte, Christopher Lester,

RD Schaffer, Marc Virchaux

XML workshop Berkeley - May 2000

Page 2: AGDD: Atlas Generic Detector Description in XML

XML Workshop Berkeley May 2000

Stan Bentvelsen

Detector description framework

• Goal• AGDD database

– geometry database– material database– identifier scheme

• The generic model– parsing to transient C++ objects

• Tools– Visualisation– Geant4 builder

• Conclusions

Page 3: AGDD: Atlas Generic Detector Description in XML

XML Workshop Berkeley May 2000

Stan Bentvelsen

Detector description: Goals

• Goals– single source generic detector description

information– independent of client: visualisation, simulation, reconstruction, ...

– not depend on client specific constraints – such as Geant optimisations, reconstruction algorithms, ...

– not limited to geometrical information– (independent) logical organisation of the detector– geometry vs readout tree– additional parameters - reconstruction,...– description of materials

– support simple relationship with alignment database– simple and portable implementation: XML– flexible & extensible description

Page 4: AGDD: Atlas Generic Detector Description in XML

XML Workshop Berkeley May 2000

Stan Bentvelsen

The architecture

AGDDxml-files

Generic ModelTransient C++ objects

Geant4 generic builderPERSINT

visualisation

GraXMLvisualisation

Persistency-Objectivity-

Reconstruction

Factory

Visitor

Visitor

Factory

Page 5: AGDD: Atlas Generic Detector Description in XML

XML Workshop Berkeley May 2000

Stan Bentvelsen

The geometry database

• Creation of ‘Volumes’– Generic and descriptive

• Elementairy Solids– Basic building blocks,

described by shape, dimensions and material

» box» tube, etc...

• Boolean Solids– Boolean operations

» union» subtraction, etc...

• Logical grouping of Volumes

– Create composite volumes» composition» stack, etc...

• Positioning of ‘Volumes’– Description of the

instantiation of the volumes• Absolute or relative,

single or multiple positioners

– Define the translation and rotation matrix of a volume wrt the origin of the constituents, through parameterized algorithms

» posXYZ» mposPhi» axisPos, etc...

Inspired by Geant

Page 6: AGDD: Atlas Generic Detector Description in XML

XML Workshop Berkeley May 2000

Stan Bentvelsen

Transient model: volume hierarchy

AGDD_Volume

AGDD_Solid AGDD_CompositionAGDD_Boolean AGDD_Stack

AGDD_Box AGDD_Trapezoid AGDD_Tubes AGDD_Cons

AGDD_Union AGDD_Subtraction AGDD_Intersection

AGDD_StackX AGDD_StackY AGDD_StackZ

Logical grouping of volumes

Page 7: AGDD: Atlas Generic Detector Description in XML

XML Workshop Berkeley May 2000

Stan Bentvelsen

Creation of Volumes

Documentation

Volume specificname ID, units,

parameters

Solid specificmaterial IDREF

Definition box

<!--1.4.1.1) Box (element tag "box") :

A Box is a cuboid of given total lengths X,Y and Z. The Box is centred on the origin with sides parallel to the x/y/z axes.

NB: Note the factor two difference in the dimensions wrt the 'Geant4 - Box'

Its dimensions are given by :

X_Y_Z="X Y Z"-->

<!ENTITY % units 'unit_length ( mm | m ) "mm" unit_angle ( deg | mrad ) "deg"'>

<!ENTITY % volume_properties 'name ID #REQUIRED parameters IDREF #IMPLIED'>

<!ENTITY % solid_properties '%volume_properties; material IDREF #REQUIRED sensitive ( true | false ) "false"'>

<!ELEMENT box EMPTY ><!ATTLIST box X_Y_Z CDATA #REQUIRED %solid_properties; %units;>

• Definition ‘box’ in DTD:

Page 8: AGDD: Atlas Generic Detector Description in XML

XML Workshop Berkeley May 2000

Stan Bentvelsen

AGDD implementation: box

• Solid creation with shape, dimensions & material• IDREF to a parameter block

– allow to attach arbitrary numbers to any volume• detector view specific information• useful in e.g. Reconstruction

– parameters acquire name, value, unit and comment attributes

• Holadieje

<!-- create the BML 1 Station --><box name="MU_BML1_RPC1" X_Y_Z="100. 3440. 1440." material="Honeycomb" parameters="inner_RPC_1" />

<parameters name="inner_MDT_1" type="MDT"> <real name="layers" value="3" unit="none" comment="number of layers" /> <real name="radiative_thickness" value="0.80" unit="cm" comment="total radiative thickness" /> <real_array name="dimensions" values="30. 55.98 81.96" unit="cm" /> <real_array name="z_positions" values="30. 14.60 96.96" unit="cm" comment="z positions of layers" /> <real_array name="x_positions" values="15. 30. 15." unit="cm" comment="x positions of first tube" /></parameters>

Page 9: AGDD: Atlas Generic Detector Description in XML

XML Workshop Berkeley May 2000

Stan Bentvelsen

Positioning volumes

O OO

O

O1

XYZRPhiZ

O1

O1

R0Phi0Z0

dRdPhidZ

O1

O2

gap a

gap b

shift

shift

shift0 a0

shift0 b0

O1

O1

O1

O2

O2

gap0

gap

gapshift a

gap0

gap

shift a

shift b

<composition ...> <posXYZ volume=O1 ../></composition>

<composition ...> <mposZ volume=O1 ../></composition>

SingleAbsolute

Positioners

MultipleAbsolute

Positioners

Multiple RelativePositioners

SingleRelative

Positioners

<stackZ ...> <axisMPos volume=O1 shift0=a0 shift=a ../> <axisMPos volume=O2 shift0=b0 shift=b ../></stackZ>

<stackZ ...> <axisPos volume=O1 gap=a ../> <axisPos volume=O2 gap=b ../></stackZ>

Page 10: AGDD: Atlas Generic Detector Description in XML

XML Workshop Berkeley May 2000

Stan Bentvelsen

Stack example

Stack: reduce number-dependencies in AGDD source

<!-- Build the Doublet ********************** -->

<stackY name="MU_RPC1_Doublet"> <axisPos volume="MU_RPC1_Frame" /> <axisPos volume="MU_RPC1_LowerFoam" /> <axisPos volume="MU_RPC1_LowerActive" > <identifier field="gas_gap" value="0"/> </axisPos> <axisPos volume="MU_RPC1_MiddleFoam" /> <axisPos volume="MU_RPC1_UpperActive" > <identifier field="gas_gap" value="1"/> </axisPos> <axisPos volume="MU_RPC1_UpperFoam" /> <axisPos volume="MU_RPC1_Frame" /> </stackY>

Page 11: AGDD: Atlas Generic Detector Description in XML

XML Workshop Berkeley May 2000

Stan Bentvelsen

Transient model positioning hierarchy

This hierarchy is subject to future changes/modifications

AGDD_AbsolutePosition

AGDD_SinglePosition AGDD_MultiplePosition

AGDD_PosXYZ

AGDD_RelativePosition

AGDD_AxisPos AGDD_AxisMPos

AGDD_MPosPhi AGDD_MPosR

AGDD_MPosX AGDD_MPosZAGDD_MPosY

AGDD_PosRPhiZ

Used in Stack Volumes

Used in Composition Volumes

Page 12: AGDD: Atlas Generic Detector Description in XML

XML Workshop Berkeley May 2000

Stan Bentvelsen

Administration & versioning• Impose file-hierarchy on geometry description

– Place all geometries inside a ‘section’ – typically one section in a file– all attributes are required

– Name– Short descriptive name; each volume is prepended with this name

– Version, date, author– To keep track of the geometry version

– Top_volume– Envelope volume name corresponding to the section

– DTD_version – Only allowed value equals current DTD version

• Allow parallel development various parts of description implementation

<section name = “SCT” version = “1.1” date = “Thu Oct 7” author = “N. O. Body” top_volume = “SCT_Barrel” DTD_version= “v4” >

Page 13: AGDD: Atlas Generic Detector Description in XML

XML Workshop Berkeley May 2000

Stan Bentvelsen

The material database

• Material definitions in separate XML tree

• Rudimentary DB for materials set-up

–define the elements–create composite

materials

• Material name provide the XML ID

–Reference (IDREF) to materials in definition of ‘Solids’

• todo: •material forms, pressure,

state, etc.

<!ELEMENT materials ( element | composite )+><!ATTLIST materials version CDATA #REQUIRED date CDATA #REQUIRED author CDATA #REQUIRED %DTD_constraint;>

<!ELEMENT element EMPTY><!ATTLIST element symbol CDATA #IMPLIED name ID #REQUIRED z CDATA #REQUIRED aweight CDATA #REQUIRED density CDATA #IMPLIED>

<!ELEMENT composite ( addmaterial )+><!ATTLIST composite name ID #REQUIRED density CDATA #REQUIRED>

<!ELEMENT addmaterial ( fractionmass | natoms ) ><!ATTLIST addmaterial material IDREF #REQUIRED>

<!ELEMENT fractionmass EMPTY><!ATTLIST fractionmass fraction CDATA #REQUIRED>

<!ELEMENT natoms EMPTY><!ATTLIST natoms n CDATA #REQUIRED>

Page 14: AGDD: Atlas Generic Detector Description in XML

XML Workshop Berkeley May 2000

Stan Bentvelsen

<materials version="1.2" date="Tue Mar 21, 2000"

author="Stan Bentvelsen + Alexandre Rozanov" DTD_version="v4" >

<!-- Define the elements -->

<element name="Hydrogen " symbol="H " z=" 1" aweight="1.00797" density="0.0708" /> <element name="Deuterium " symbol="D " z=" 1" aweight="2.01" density="0.162" /> <element name="Helium " symbol="He" z=" 2" aweight="4.0026" density="0.125" /> <element name="Lithium " symbol="Li" z=" 3" aweight="6.9410" density="0.534" /> <element name="Beryllium " symbol="Be" z=" 4" aweight="9.0122" density="1.8480" /> <element name="Boron10 " symbol="B10" z=" 5" aweight="10.0" density="2.34" /> <element name="Boron11 " symbol="B11" z=" 5" aweight="11.0" density="2.34" /> . . .<!-- Define the composite materials -->

<composite name="Scintillator" density="1.032"> <addmaterial material="Carbon"> <natoms n="9"/> </addmaterial> <addmaterial material="Hydrogen"> <natoms n="10"/> </addmaterial> </composite>

<composite name="Air" density="0.001214"> <addmaterial material="Nitrogen"> <fractionmass fraction="0.7494"/> </addmaterial> <addmaterial material="Oxygen"> <fractionmass fraction="0.2369"/> </addmaterial> <addmaterial material="Argon"> <fractionmass fraction="0.0129"/> </addmaterial> <addmaterial material="Hydrogen"> <fractionmass fraction="0.0008"/> </addmaterial> </composite>

<composite name="CO2" density="0.001977"> <addmaterial material="Carbon"> <natoms n="1"/> </addmaterial> <addmaterial material="Oxygen"> <natoms n="2"/> </addmaterial> </composite> </materials>

Excerpt from the material DB

Some elements

Some materials

Page 15: AGDD: Atlas Generic Detector Description in XML

XML Workshop Berkeley May 2000

Stan Bentvelsen

Example: XML implementation

<?xml version="1.0"?><!DOCTYPE AGDD SYSTEM "AGDD_1.04.dtd">

<AGDD DTD_version=”v4”>

<!-- Workshop example file **********************--><section name = "WK" version = "1.0" date = "Wed Oct 27" author = "Detector Description group" top_volume = "ATLAS" DTD_version= ”v4” >

<tubs name="WK_tube" material="Aluminum" Rio_Z="0. 15. 1000." />

<composition name="WK_layer" > <mposZ volume="WK_tube" ncopy="10" dZ="30." rot="0 90 0" /></composition>

<composition name="WK_multilayer" > <posXYZ volume="WK_layer" X_Y_Z=" 0 0 0" /> <posXYZ volume="WK_layer" X_Y_Z=" 0 30 0" /> <posXYZ volume="WK_layer" X_Y_Z=" 0 60 0" /> <posXYZ volume="WK_layer" X_Y_Z=" 0 90 0" /></composition>

<composition name="ATLAS" > <posXYZ volume="WK_multilayer" /></composition>

</section></AGDD>

AGDD Header, version of DTD

Creation solid: tube

Section: sub-detector + author + version

Various positioning of volumes

Page 16: AGDD: Atlas Generic Detector Description in XML

XML Workshop Berkeley May 2000

Stan Bentvelsen

The identification scheme

• Logical identifiers– Identify each copy of each

positioned volume – independent from the specific

design of the geometry tree– ordered (can be used to key a

map) • Mechanism to obtain the identifier

in positioning algorithms– increment for multiple

positioning

• Identifier– field=“name”

– value=“1” (step=“1”)

• Ring– field= “ring”

– value=“1” (step=“1”)

• Layer– field=“layer”, value, step

• Sector– field=“sector”, value, step

Use ‘pre-defined’ identifiers, as well as introducing new ones

Pre-defined

<!-- place stations in Muon barrel --><composition name="MU_Barrel"> <mposPhi volume="MU_Stat_BML1" ncopy="8" R_Z="6730.54 150."> <ring value="1" step="1" /> <sector value="1" /> </mposPhi></composition>

Page 17: AGDD: Atlas Generic Detector Description in XML

XML Workshop Berkeley May 2000

Stan Bentvelsen

Use of Identifier

• Interaction with generic model via identifiers– Ranges of identifiers– specify a sub-set within a

collection

• Specialized collection– contains identifiable

objects– interfaced with ranges

Identifier a (“4/5/5”); Identifier b;

b << 1;b << 23;b << 4;int system_id = a[0];if (a < b) ...

IdentifierMap detectors;

detectors[a] = ecal;detectors[b] = muon;

Identifier a (“4/5/5”); Identifier b;

b << 1;b << 23;b << 4;int system_id = a[0];if (a < b) ...

IdentifierMap detectors;

detectors[a] = ecal;detectors[b] = muon;

Range r1 (“1/*/3-4”); Range r2;

r2.add (1);r2.add ();r2.add (3, 4);if (r2.match (a)) ...

Range r1 (“1/*/3-4”); Range r2;

r2.add (1);r2.add ();r2.add (3, 4);if (r2.match (a)) ...

MuonSpectrometer/StationName/eta/phi_sector/MDT/multilayer/tube_layer/tubeMuonSpectrometer/StationName/eta/phi_sector/RPC/doublet/strip_layer_pair/strip_layer/stripMuonSpectrometer/StationName/eta/phi_sector/TGC/chamber_layer/chamber/strip

Page 18: AGDD: Atlas Generic Detector Description in XML

XML Workshop Berkeley May 2000

Stan Bentvelsen

Graphical tools : GraXML (Java)

Page 19: AGDD: Atlas Generic Detector Description in XML

XML Workshop Berkeley May 2000

Stan Bentvelsen

Converting AGDD XML (1)

• Various tools to convert the AGDD geometry to standard visualisation formats:– VRML 97– X3D

• See the next presentation of J. Hrivnac.

• Inspect & debug geometry in 3D ‘cave’– SARA Amsterdam– LBL Berkeley

• Example of VRML 97 display of ATLAS Muon chamber

Page 20: AGDD: Atlas Generic Detector Description in XML

XML Workshop Berkeley May 2000

Stan Bentvelsen

Graphical tools : Persint

Page 21: AGDD: Atlas Generic Detector Description in XML

XML Workshop Berkeley May 2000

Stan Bentvelsen

Example: SCT in PERSINT

• DICE geometry• AGDD file

provided by Lester

• PERSINT visualisation

• Nice features like

» interactive selection

» material colouring» object removal

Page 22: AGDD: Atlas Generic Detector Description in XML

XML Workshop Berkeley May 2000

Stan Bentvelsen

G4Builder: interface to GEANT4

• Set of classes, as client to the generic model, to transform the AGDD description to Geant4 geometry– Make use of the Material

database in AGDD

• Generic, i.e. Detector independent.– Price paid in speed

• Track particles through geometry– Example: Scan geantinos in

(,) to determine characteristics of the ATLAS SCT geometry

Page 23: AGDD: Atlas Generic Detector Description in XML

XML Workshop Berkeley May 2000

Stan Bentvelsen

G4Builder: scan (,) space

• Accumulate observables along the trajectories

• Lego plots – show the radiation

lengths as a function of (,)

• Tool to improve understanding and debug geometry?

Example of Geant4 utility

Page 24: AGDD: Atlas Generic Detector Description in XML

XML Workshop Berkeley May 2000

Stan Bentvelsen

Parameters in AGDD

• Creation and positioning of volumes require explicit numbers– dimensions– explicit positionings

• AGDD elements like ‘stack’ greatly reduced dependencies on numbers.– Still dependencies remain,

e.g.

• Users requests:– possebility for

expressions and evaluation of expressions in AGDD

– Do not want to extend AGDD syntax to include those.

• Possibilities?– XSL– Preprocessor like ‘m4’

AA

Page 25: AGDD: Atlas Generic Detector Description in XML

XML Workshop Berkeley May 2000

Stan Bentvelsen

Parameters in AGDD: XSL

• XSL (eXtensible Stylesheet Language)– Infinite more ‘natural’

choice on top of XML– possible to create a

‘calculator style sheet’ that resolves references?

• Needs more investigation and understanding– AGDD to HTML

conversion no problem

XML source file

with parameters

AGDDfile

XSL stylesheetcalculator

I am very curious to see a working example!

Xalan

Page 26: AGDD: Atlas Generic Detector Description in XML

XML Workshop Berkeley May 2000

Stan Bentvelsen

Parameters in AGDD: m4

• ‘m4’ preprocessor– define global parameters

(m4-tags) in file-header• reference to parameters

inside attribute values

– can use ‘external’ shell calculator to perform simple arithmetic on parameters

– preprocessed file is XML-valid

– after pre-processing using m4:• all parameters resolved

<!--## Define the external program that performs# the arithmetic.#define(calc,`esyscmd(dpcalc $1 $2 $3)')## Define the parameters here#define(`p_boardWidth', 63.6 )define(`p_boardLength', 128.2 )

--> ...

<!-- create a wafer+hybrid board --><box name="SCT_board" material="Silicon" X_Y_Z="1. p_boardWidth p_boardLength" />

...

<!-- create a ski of 12 boards --><composition name="SCT_ski"> <mposZ volume="SCT_board" ncopy="12" dZ="p_boardLength" Z0="-calc(mul,6,p_boardLength)"/></composition>

Page 27: AGDD: Atlas Generic Detector Description in XML

XML Workshop Berkeley May 2000

Stan Bentvelsen

Conclusions

• AGDD framework in XML provide useful and flexible DB for geometry, material and logical identifiers.

• Parsing AGDD to transient C++ generic model, with clients connected via visitor pattern

• Implement more ATLAS sub-detectors soon– bits and pieces of SCT, pixel, muon

• Solve problem of variables and variable syntax (XML schema?)

Page 28: AGDD: Atlas Generic Detector Description in XML

XML Workshop Berkeley May 2000

Stan Bentvelsen

The DTD<!ENTITY % DTD_constraint 'DTD_version ( v4 ) #REQUIRED'>

<!ELEMENT AGDD ( materials | section )+><!ATTLIST AGDD %DTD_constraint;>

<!ELEMENT section ( box | trd | tubs | cons | union | intersection | subtraction | composition | stackX | stackY | stackZ | parameters )+><!ATTLIST section name CDATA #REQUIRED top_volume IDREF #REQUIRED %DTD_constraint;>

<!ENTITY % units 'unit_length ( mm | m ) "mm” unit_angle ( deg | mrad ) "deg"'>

<!ELEMENT identifier EMPTY><!ATTLIST identifier field CDATA #REQUIRED value CDATA "0” step CDATA "0">

<!ENTITY % solid_properties '%volume_properties; material IDREF #REQUIRED sensitive ( true | false ) "false"'><!ELEMENT box EMPTY ><!ATTLIST box X_Y_Z CDATA #REQUIRED %solid_properties; %units;>

<!ENTITY % any_position ' posXYZ | posRPhiZ | mposR | mposPhi | mposX | mposY | mposZ '>

<!ELEMENT composition ( %any_position; )+ ><!ATTLIST composition %volume_properties; envelope IDREF #IMPLIED>

<!ENTITY % any_relative_position ' axisPos | axisMPos '>

<!ELEMENT stackX ( %any_relative_position; )+ ><!ATTLIST stackX %volume_properties;>

<!ENTITY % position_properties 'volume IDREF #REQUIRED rot CDATA "0 0 0” %units; '>

<!ELEMENT posXYZ ( %any_identifier; )* ><!ATTLIST posXYZ X_Y_Z CDATA "0 0 0” %position_properties;>

DTD keyword

element or entity

attribute

value

reference

Page 29: AGDD: Atlas Generic Detector Description in XML

XML Workshop Berkeley May 2000

Stan Bentvelsen

The identification scheme

Identifier

Identifier ();Identifier (const Identifier& other);Identifier (int numbers, ...);Identifier (const char* text);void add (int value);Identifier& operator << (int value);int& operator [] (int index);void clear ();int operator [] (int index) const;int fields () const;int operator == (const Identifier& other) const;int operator != (const Identifier& other) const;int operator < (const Identifier& other) const;int operator > (const Identifier& other) const;error_code last_error () const;operator string () const;

Range

Range (const char* text);Range (const Identifier& min, const Identifier& max);void add ();void add (int value);void add (int minimum, int maximum);void add_minimum (int minimum);void add_maximum (int maximum);int match (const Identifier& id) const;const field& operator [] (int index) const;int fields () const;Identifier minimum () const;Identifier maximum () const;identifier_factory factory_begin ();const_identifier_factory factory_begin () const;identifier_factory factory_end ();const_identifier_factory factory_end () const;operator string () const;

IdentifierMap

iterator& end ();iterator begin ();iterator begin (const Identifier& id);iterator begin (const Range& r);void add (const Identifier& id, T* t);

Identifiable

Identifier Identify ()

n

Page 30: AGDD: Atlas Generic Detector Description in XML

XML Workshop Berkeley May 2000

Stan Bentvelsen

The C++ framework

Decode the source file,instanciate objects:

Sections,Volumes,Positions,Shapes,

Materials

Navigate the genericdescription, and appliesspecific algorithms on

each object.

class G4_BuildMaterial : public AGDD_Visitor{ void visit_element (AGDD_Element* material); void visit_composite (AGDD_Composite* material);};

class G4_BuildDetector : public AGDD_Visitor{ void visit_section (...) { std::cout << ... } void visit_solid (...);};

AGDD_Factory

AGDD_Visitor

AGDD_Strategy

Expat_Factory

XML4C_Factory

My_Visitor

My_Strategy

Page 31: AGDD: Atlas Generic Detector Description in XML

XML Workshop Berkeley May 2000

Stan Bentvelsen

The C++ framework

XML source file..........

Generic description

Void main (){ G4_BuildMaterial material_builder; G4_BuildDetector detector_builder;

AGDD* agdd = factory.get_detector_description ();

material_builder.run (agdd); detector_builder.run (agdd);}

Specific views to the detector description

FormatterG4 volumes

VisualisationReconstruction model

...

AGDD_Factory

AGDD_Factory& Expat_instance ();AGDD_Factory& XML4C_instance ();

void build_materials (file_name);void build_detector_description (file_name);

AGDD* get_detector_description ();