Difference: TweakingDrivers (1 vs. 3)

Revision 32017-10-18 - DanProtopopescu

Line: 1 to 1
 
META TOPICPARENT name="GlaSiDGettingStarted"

Tweaking the drivers

Line: 19 to 19
  To find which driver is used, have a look in the XML file, in the example above

Changed:
<
<
whichdriver.png
>
>
whichdriver.png
  In the example above, we use a custom driver which is normally located in the detector/ subdirectory. In other cases, a generic driver can be used, e.g.

Revision 22016-10-27 - DanProtopopescu

Line: 1 to 1
 
META TOPICPARENT name="GlaSiDGettingStarted"

Tweaking the drivers

Line: 25 to 25
  genericdriver.png
Changed:
<
<
Generic DD4hep drivers have names like DD4hep_.... A custom driver is very often a modified generic driver.
>
>
Generic DD4hep drivers have names like DD4hep_... and their source code can be found in
/cvmfs/ilc.desy.de/sw/x86_64_gcc48_sl6/v01-17-10/DD4hep/v00-16/DDDetectors/src/
A custom driver is very often a modified generic driver.
 Note that in the case below, a custom driver located in detector/calorimeter is used, even though it's named Generic_...

genericecal.png

Revision 12016-10-25 - DanProtopopescu

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="GlaSiDGettingStarted"

Tweaking the drivers

This is a very brief description of how one can tweaking the DD4hep drivers to change for example the way various detector sensors are placed, or simply to print detector id's and coordinates.

Model components

The DD4hep model of each SiD sub-detector contains two important components:

  1. geometry description, in an XML file, e.g. SiD/compact/SiD_o2_v01/SiTrackerBarrel_o2_v01_00.xml
  2. the driver, in a C++ file, e.g. detector/tracker/TrackerBarrel_o1_v03_geo.cpp

Note that the file paths above assume you are located in lcgeo/.

Identifying the driver

To find which driver is used, have a look in the XML file, in the example above

whichdriver.png

In the example above, we use a custom driver which is normally located in the detector/ subdirectory. In other cases, a generic driver can be used, e.g.

genericdriver.png

Generic DD4hep drivers have names like DD4hep_.... A custom driver is very often a modified generic driver. Note that in the case below, a custom driver located in detector/calorimeter is used, even though it's named Generic_...

genericecal.png

Customising a driver

Let us say we want to customise our ECalBarrel driver, which in the example above was GenericCalBarrel_o1_v01_geo.cpp. We make a copy:

cd detector/calorimeter/
cp GenericCalBarrel_o1_v01_geo.cpp MyECalBarrel_o1_v01_geo.cpp 
cd ../../
and then we edit SiD/compact/SiD_o2_v01/ECalBarrel_o2_v01_00.xml to say
... detector id="5" name="ECalBarrel" type="MyECalBarrel_o1_v01" ...
Now let's edit the driver MyECalBarrel_o1_v01_geo.cpp and make it print out the module info, e.g. in function placeStaves() add the line
std:cout <<   "Module: " << module <<   " X: " << posX << " Y: " << posY << " rotY: " << rotY << std:endl;
and also change
DECLARE_DETELEMENT(MyECalBarrel_o1_v01, create_detector)
And now we must recompile the drivers as described in here, and watch for a message like
[ 59%] Building CXX object CMakeFiles/lcgeo.dir/detector/calorimeter/MyECalBarrel_o1_v01_geo.cpp.o

Running with the new driver

Now if you run for example geoDisplay, or ddsim

ddsim --compactFile=SiD/compact/SiD_o2_v01/SiD_o2_v01.xml --runType=batch --inputFile mcparticles.slcio -N=1 --outputFile=testSiD_o2_v01.slcio
you will notice that when the ECalBarrel is built, the following will be printed to the screen
Module: 0 X: 34.5329 Y: 128.879 rotY: -0.261799
Module: 1 X: 94.3457 Y: 94.3457 rotY: -0.785398
Module: 2 X: 128.879 Y: 34.5329 rotY: -1.309
Module: 3 X: 128.879 Y: -34.5329 rotY: -1.8326
Module: 4 X: 94.3457 Y: -94.3457 rotY: -2.35619
Module: 5 X: 34.5329 Y: -128.879 rotY: -2.87979
Module: 6 X: -34.5329 Y: -128.879 rotY: -3.40339
Module: 7 X: -94.3457 Y: -94.3457 rotY: -3.92699
Module: 8 X: -128.879 Y: -34.5329 rotY: -4.45059
Module: 9 X: -128.879 Y: 34.5329 rotY: -4.97419
Module: 10 X: -94.3457 Y: 94.3457 rotY: -5.49779
Module: 11 X: -34.5329 Y: 128.879 rotY: -6.02139

Follow this example to modify the drivers as needed.

META FILEATTACHMENT attachment="whichdriver.png" attr="" comment="Identifying the C++ driver" date="1477357055" name="whichdriver.png" path="whichdriver.png" size="87220" user="DanProtopopescu" version="3"
META FILEATTACHMENT attachment="genericdriver.png" attr="" comment="A generic DD4hep driver is used here" date="1477358085" name="genericdriver.png" path="genericdriver.png" size="72591" user="DanProtopopescu" version="1"
META FILEATTACHMENT attachment="genericecal.png" attr="" comment="Another example of a custom driver" date="1477358498" name="genericecal.png" path="genericecal.png" size="84337" user="DanProtopopescu" version="1"
 
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