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:

CLICSiD-TGeo.png

Implementing ECal in the ILD model

The ILDEx example included with DD4hep will produce this:

ILDExDet.png

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"/>
        </material>
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>
            <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>
            <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" />
            </layer>
        </detector>
and its readout
        <readout name="EcalBarrelHits">
            <segmentation type="CartesianGridXY" grid_size_x="3.5*cm" grid_size_y="3.5*cm" />
            <id>system:8,barrel:3,module:4,layer:6,slice:5,x:32:-16,y:-16</id>
        </readout>

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:

ILDxECal.png

ECal geometries

The ECal 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

Troubleshooting

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" />
Topic attachments
I Attachment History Action Size Date Who Comment
PNGpng CLICSiD-TGeo.png r2 r1 manage 393.5 K 2014-06-03 - 15:46 DanProtopopescu CLICSiD example in the Root's GL viewer
PNGpng ILDExDet.png r1 manage 142.5 K 2014-06-04 - 12:11 DanProtopopescu Original ILDEx toy model
PNGpng ILDxECal.png r1 manage 31.4 K 2014-06-04 - 12:12 DanProtopopescu ILDxECal, i.e. ILDEx with the Barrel ECal added
Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r6 - 2014-06-19 - DanProtopopescu
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback