43
M.Frank CERN/LHCb Detector Description Motivations and goals Review and overview Geant4 interface Mokka drivers

M.Frank CERN/LHCb Detector Description Motivations and goals Review and overview Geant4 interface Mokka drivers …

Embed Size (px)

Citation preview

Page 1: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Detector Description

Motivations and goals Review and overview Geant4 interface Mokka drivers …

Page 2: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

DD4hep Status

Page 3: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Design Principles (1)

Separation of data and behavior Data are fully accessible (no encapsulation!) Behavioral classes are wrappers around

objects containing data only There may be many behavioral wrapper

implementations using the same data objects User chooses “most suitable” behavior

One “data-object” may be shared among many behavioral wrapper instances

Page 4: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Design Principles (2)

The geometry implementation is based on TGeo(ROOT) Take advantage of existing functionality

if necessary extend TGeo has support for alignment, visualization, etc. Increasing usage of the ROOT plugin mechanism

instantiate specialized components Detector elements Readout segmentations Sensitive detectors

Page 5: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

[My] Goals for These Two Days

Establish a roadmap how to proceed Get an idea which activity to emphasize

Use of the detector description in simulationeventually replace existing simulation

Use of the detector description in reconstructionemulate (or replace) gear?

Use for alignment …

Page 6: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Geometry Expansion

From compact xml file No strict dtd Cascaded xml parsing. Example:

Geometry description Geant4 setup

Expansion with python possible (=>Pere)

Page 7: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Display

Geometry

Recon-struction G

ea

nt4

Detector Description: LCDD Sections and Clients

Implicitly contains geometry description

Page 8: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

DD4Hep: DetElement Description

Detectors

Readout

Visualization

DetElementidnametype

Envelope[TGeoShape]

Log.Volume[TGeoVolume]

0…n

volume: 1

visattr: 0…1

0…1

mother 1

Material[TGeoMedium]

1

volumeRef 1

[TGeoMatrix]

transform: 1

solidRef 1

detector: 1

materialRef 1

GDML content

children 1..n

PlacedVolume[TGeoNode]

placements: 0…1

Alignment

Conditions

ROOT onlyprovides the geometry

Rest is us

Page 9: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Shapes and Solids

Palette ~complete. New shapes added on demand.

Page 10: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Specialized Detector Elements

Central element of the detector description Describes subdetector hierarchy Requires flexibility and extensibility

Flexibility: Specialize the behavior of your DetElement Specialized access to the (sub)detector hierarchy tree Implement specialized wrapper using existing

detector element hierarchy Possibility to cache 3 transformations

to parent to world to self-defined detector element

Page 11: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Extended Detector Elements

The “flexible” approach with wrappers defines flexible behavior using the same data Pure wrappers tend to be slow if complicated

calculations need to be redone for every query It is not possible to store subdetector specific

parameters, which are not described by the geometryexample: TPC pad-height, pad-width etc.

To ensure fast operations specialized wrappers must be able to store extra subdetector parameters and take advantage of local cache local extensible cache must be provided Cannot be planned:

different wrappers for the same DetElementmay maintain different caches

Page 12: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Extended Detector Elements

Two approaches implemented Extend underlying data object using inheritance Possible once, at construction

Attach extension object (see Astrid’s work) Identified by typeinfo Any number of objects Attachments for

Simulation Reconstruction …

Page 13: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

DetElement Extensions: Example

MyExtension* e = new MyExtension(. . .);DetElement* d = lcdd.detector(“TPC”);d.addExtension<MyExtension>(e);

. . . . . . . . . . . . . . . . . . . .

Extension* e = d.extension<Extension>();

Extensions exist for “DetElement”, “SensitiveDetector” and “Segmentation” objects

Extension using inheritance exist for “Segmentation”objects for building fleaxible readout-descriptions

Extensions must have a destructor and a copy constructor

Page 14: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Detector Element Status

Detector reflections Require deep copies of DetElement trees Clones extensions For inherited extensions, subclasses must implement

“clone” method – acceptable or confusing ?

Page 15: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Fields

Interface present Backend for constant, homogeneous or dipole field User defined fields supported with plugin mechanism

<fields> <field type="SolenoidMagnet"

name="GlobalSolenoid" inner_field="5.0*tesla"

outer_field="-1.5*tesla" zmax="SolenoidCoilOuterZ“outer_radius="SolenoidalFieldRadius" />

</fields>

Page 16: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Conventions & GuidelinesStuff to sort out

Several decisions should be taken (next slides) Technical stuff – should be simple Need policies for homogeneous code

No detector description framework does liberate a user To use the brain

It is mandatory, that the DetElement hierarchyis sensible Otherwise you may display the detector but the detector description may not be useful

to serve other tasks It would be good if we could establish a set of guidelines

how to partition a given subdetector into detector elements

Page 17: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Conventions: Rotations

Rotations: is the notation correct ?theta/phi/psi <=> theta/psi/phi(closer to cylindrical) (around x,y,z axis)

(into ring, up, beam) ROOT uses Euler angles (phi, theta, psi)

or Geant3 (polar,azimut of all 3 axis)

Triviality, things only need to be consistent Need a convention – otherwise this will lead to

confusion no end Which is the usual convention ?

Page 18: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Conventions: Compact Detector Conversion

Callbacks now support 1 sensitive detector/subdetector Looks like not suitable for Mokka

endcap A – barrel - endcap B are one subdetectorBut typically have different sensitive detectors

Maybe create and register sensitive detectors by hand? No real restriction, but things may become confusing

static Ref_t create(LCDD& lcdd, const xml_h& elt, SensitiveDetector& sens) { ECAL ecal(lcdd,elt,sens); return ecal;}DECLARE_DETELEMENT(SEcal03,create);

Page 19: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Conventions: Compact Detector Conversion

Currently 1 high level DetElement/subdetector Obviously OK for SLIC: model design Mokka: endcapA, endcapB and barrel are 1 subdetector

Can be combined, but is this good? Possible solution – like for sensitive detectors

Drivers create and register the detector elements But why should then be the basic DetElement “special”?

Page 20: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Thanks, which do not work

Wireframe displays currently do not work + probably various other aspects, which only show up

once the feature is used (ask Astrid!)

Page 21: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Next: Geant4

Page 22: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Geant 4 Gateway (1)

Idea: - walk through the geometry starting from “world”- convert the geometry from ROOT to Geant4- all runs by magic unfortunately this was a little bit naive

Geometry is automatically converted to Geant4 Materials Solids Limit sets Regions Logical volumes Placed volumes / physical volumes Fields Sensitive detectors

Page 23: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Geant 4 Gateway (2)

The problem are the sensitive detectors Coupled to the detector construction Coupled to the reconstruction, MC truth

and Hit production At LHC each experiment has it’s own set of SDets

Is this necessary ? I added two simple sensitive detector types

one for tracking devices one for calorimeter devices

But I doubt these two are sufficient Hope: a well organized palette of useful SDets Unfortunately I am not very experienced with this topic

Page 24: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Geant 4 Gateway (3)

How should the sensitive detectors be organized ? Sensitive detector hierarchy ?

One per subdetector, then dispatch Is it enough to provide a palette of sensitive detectors ?

Which fit all possible detectors ? How should they look like ? Which stepping information must be stored ?

Sorting out this issue will be essential for “generic” simulation programs

Page 25: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Geant 4 GatewayInstantiation of sensitive detectors

Geant4 setup is performed by cascaded interpretation of second xml input Avoid proliferation of geometry description

Setup Geant4 sensitive detectors

<geant4> <sensitive_detectors> <sd name="SiVertexBarrel" type="Geant4Tracker" ecut="10.0*MeV" verbose="true" hit_aggregation="position"> </sd></geant4>

Page 26: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Geant 4 GatewayField, Steppers & Co.

Setup arbitrary objects with name value pairs Used to define steppers and motion equations

<geant4> <properties> <attributes name="geant4_field" id="0" type="Geant4FieldSetup" object="GlobalSolenoid" global="true“ . . . . . . . eps_max="0.001*mm" stepper="HelixSimpleRunge" equation="Mag_UsualEqRhs"> </attributes> </properties></geant4>

Page 27: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Geant4: Proof

The basic mechanism works Tried out with the ILDExDet(ector) Geant4 ran on it Saving the ROOT converted Geant4 geometry to GDML

and reading it back with ROOT gives an identical result

(no vis.attrs.)

Page 28: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Mokka Conversion

First attempt Code not terribly structured Let’s finish with a few nice pictures… All previously encountered problems were encountered

Page 29: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Model: LDC00_01Sc

vxd03

Page 30: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Model: LDC00_01Sc

mask04

sit00

ftd01

lumicalX

Page 31: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Model: LDC00_01Sc

coil00

yoke02

tpc02

lumicalX

Page 32: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Model: LDC00_01Sc

SEcal03

Page 33: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Model: LDC00_01Sc

Geometry needs debugging Visual inspection is probably

not enough… I see a gap between ECAL

barrel and endcap Is it real (for cables ….)? or is it simply a bug?

SEcal03

Page 34: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

This Exercise …

Has effectively shown all issues to be sorted out Only the geometry is described

Hence the nice pictures but besides these, this detector description

is of limited usefulness… say: the brain was not used effectively

No sensitive detectors were assigned No logical division into individual DetElements was done

Will be next step Should not be too difficult, since logical detector parts

tend to follow the main geometrical partitioningsuch as: Barrel => Staves => Modules

Page 35: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Alignment

Page 36: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Alignment

Rotate and/orreposition

Page 37: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Alignment: Usage in xml file

<alignments> <alignment

name="/world_volume_1/B1_vol_0" shortcut="Box1">

<!-- <position x="0" y="0" z="0"/> <rotation x="0.5" y="0" z="0"/>--> <position x="-20" y="-10" z="-5"/> <rotation x="0" y="0" z="0"/> </alignment> </alignments>

Page 38: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Alignment

The interface is quite rudimentary and primitive Allow the basic actions

rotate and reposition shapes defined in the ideal geometry

Must evolve with input from users Several uncertainties

The addressing of placed volumes is difficult to understand. “Copy” number of volume in mother

Is xml the appropriate database format ? How to improve ?

Page 39: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Backup slides

Page 40: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Motivation and Goal (1)

One detector description for the experiment’s lifecycle DD requirements are not fixed …they depend on experiment life cycle Parameterization of ideal detector

After TDR: Transition from parameterizeddetector to real description

Readout structure Alignment constants Calibration constants

Detector opt.

CDR / LOI

Detector opt.

Construction

TDR

Operation

LCD is hereShown summer 2011

Page 41: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

Motivation and Goal (2)

One detector description for all activities of the experiment Simulation Reconstruction Analysis Operation: Alignment, calibration, etc. Visualization

Page 42: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

[My] Goals for These Two Days

Establish a roadmap how to proceed Get an idea which activity to emphasize

Use of the detector description in simulationeventually replace existing simulation

Use of the detector description in reconstructionemulate (or replace) gear?

Use for alignment …

Page 43: M.Frank CERN/LHCb Detector Description  Motivations and goals  Review and overview  Geant4 interface  Mokka drivers  …

M.Frank CERN/LHCb

This is where we want to arrive:

SLIC

Generic G4Driver

Database(Mokka)

getparams

Geant4

Detailed Geometry

create volumes / vis attrs

-Reconstruction-Alignment-Analysis

Processor(s)

Access according to needs

detailed geo+ visualization attrs

Geant4Visualization

Event Display

Parametrized Geo.

geometry+ visualization attrs

There would be only one leftfor all subdetectors and all models

Alignment const.

Calibration const.

Visualization attrs.

Detector DescriptionGeometryExpansion

feeddetailed

geometry

Shown summer 2011