Difference: AddDetDD4hep (5 vs. 6)

Revision 62014-06-19 - DanProtopopescu

Line: 1 to 1

Implementing a detector in DD4hep

The way detector models are defined is quite different between Mokka and DD4hep. DD4hep provides representations of all TGeo shapes and means to place them in a hierarchy of detector elements with additional information, and this is the core feature of DD4hep. This wiki shows how one would add a detector, e.g. the ECal, in DD4hep.

Prototype implementations in DD4hep

These can be found in the examples/ directory:
  • CLICSiD (CLIC Silicon Detector CDR by C.Grefe) - contains the ECal parameters
  • ILDEx (ILD Detector Toy model by F. Gaede) - does not contain any ECal components

The CLICSiD example in the Root's OGL viewer:


Implementing ECal in the ILD model

The ILDEx example included with DD4hep will produce this:


As a first step, one can copy the ECal components from the CLICSiD to the existing ILDEx model. I will call my new test detector ILDxECal:

cd ~/myDD4hep
cp -r /afs/phas.gla.ac.uk/data/ilc/software/DD4hep/examples/ILDEx ILDxECal
Clean up its contents a bit
cd  ILDxECal
rm -rf build bin/* lib/*
and rename all ILDEx instances to ILDxECal.

Use copy and paste to add to compact/ILDxECal.xml all relevant EcalBarrel dimensions, materials, visualisation options and geometry definitions (Warning, important in the respective sections of the XML). First define:

        <constant name="CaloSides" value="12"/>
        <constant name="EcalBarrel_rmin" value="126.50*cm"/>
        <constant name="EcalBarrel_zmax" value="176.50*cm"/>
then in materials add
        <material name="TungstenDens24">
            <D value="17.8" unit="g/cm3"/>
            <fraction n="0.93" ref="W"/>
            <fraction n="0.061" ref="Ni"/>
            <fraction n="0.009" ref="Fe"/>
then add some visualisation options
        <vis name="EcalBarrelVis" alpha="1.0" r="0" g="0" b="0.3" showDaughters="true" visible="true"/>
        <vis name="EcalBarrelStaveVis" alpha="1.0" r="1" g="0.9" b="0.5" showDaughters="false" visible="true"/>
Add now the EcalBarrel geometry:
        <detector id="6" name="EcalBarrel" type="EcalBarrel" readout="EcalBarrelHits" vis="EcalBarrelVis" calorimeterType="EM_BARREL">
            <comment>EM Calorimeter Barrel</comment>
            <comment> Copied by protopop@cern.ch from CLICSiD example </comment>
            <dimensions numsides="(int) CaloSides" rmin="EcalBarrel_rmin" z="EcalBarrel_zmax*2" />
            <staves vis="EcalBarrelStaveVis"/>
            <layer repeat="1">
                <slice material = "Silicon" thickness = "0.032*cm" sensitive = "yes" limits="cal_limits" />
                <slice material = "Copper"  thickness = "0.005*cm" />
                <slice material = "Kapton"  thickness = "0.030*cm" />
                <slice material = "Air"     thickness = "0.033*cm" />
            <layer repeat="20">
                <slice material = "TungstenDens24" thickness = "0.25*cm" />
                <slice material = "Air"     thickness = "0.025*cm" />
                <slice material = "Silicon" thickness = "0.032*cm" sensitive = "yes" limits="cal_limits" />
                <slice material = "Copper"  thickness = "0.005*cm" />
                <slice material = "Kapton"  thickness = "0.030*cm" />
                <slice material = "Air"     thickness = "0.033*cm" />
            <layer repeat="10">
                <slice material = "TungstenDens24" thickness = "0.5*cm" />
                <slice material = "Air"     thickness = "0.025*cm" />
      <slice material = "Silicon" thickness = "0.032*cm" sensitive = "yes" limits="cal_limits" />
                <slice material = "Copper"  thickness = "0.005*cm" />
                <slice material = "Kapton"  thickness = "0.030*cm" />
                <slice material = "Air"     thickness = "0.033*cm" />
and its readout
        <readout name="EcalBarrelHits">
            <segmentation type="CartesianGridXY" grid_size_x="3.5*cm" grid_size_y="3.5*cm" />

One will need the C++ code snippet that interprets the BarellEcal XML data and expands the geometry:

cd ~/myDD4hep
cp /afs/phas.gla.ac.uk/data/ilc/software/DD4hep/examples/CLICSiD/src/EcalBarrel_geo.cpp 

Now one can build the new test detector:

source /afs/phas.gla.ac.uk/data/ilc/software/ilcsoft/v01-17/init_ilcsoft.sh
source /afs/phas.gla.ac.uk/data/ilc/software/DD4hep/bin/thisdd4hep.sh 
cd ~/myDD4hep/ILDxECal/build
cmake ..
make -j install
cd ../
source bin/thisILDxECal.sh
./geoDisplay compact/ILDxECal.xml
and one obtains this:


ECal geometries

The ECal

<--Mokka (ILD, C++) and GeomConverter (SiD, Java)-->
geometry parameters can be compared with the values from:

  • ilcsoft/v01-17/gear/v01-03/example/gear_ILD_o1_v05.xml or gear_TGeoILD00.xml
  • ilcsoft/v01-17/Clupatra/v00-09-01/examples/gear_CLIC_CDR.xml


Make sure units are present when dimensions and parameters are set in the compact XML file:

<segmentation type="CartesianGridXY" grid_size_x="3.5*cm" grid_size_y="3.5*cm" />

META FILEATTACHMENT attachment="CLICSiD-TGeo.png" attr="" comment="CLICSiD example in the Root's GL viewer" date="1401810366" name="CLICSiD-TGeo.png" path="CLICSiD-TGeo.png" size="402933" user="DanProtopopescu" version="2"
META FILEATTACHMENT attachment="ILDExDet.png" attr="" comment="Original ILDEx toy model" date="1401883913" name="ILDExDet.png" path="ILDExDet.png" size="145917" user="DanProtopopescu" version="1"
META FILEATTACHMENT attachment="ILDxECal.png" attr="" comment="ILDxECal, i.e. ILDEx with the Barrel ECal added" date="1401883952" name="ILDxECal.png" path="ILDxECal.png" size="32180" user="DanProtopopescu" version="1"
META TOPICMOVED by="DanProtopopescu" date="1402925780" from="LinearCollider.EcalDD4hep" to="LinearCollider.AddDetDD4hep"
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback