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.
The DD4hep model of each SiD sub-detector contains two important components:
SiD/compact/SiD_o2_v01/SiTrackerBarrel_o2_v01_00.xml
detector/tracker/TrackerBarrel_o1_v03_geo.cpp
Note that the file paths above assume you are located in lcgeo/
.
To find which driver is used, have a look in the XML file, in the example above
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.
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_...
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
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.slcioyou 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.
I | Attachment | History | Action | Size | Date | Who | Comment |
---|---|---|---|---|---|---|---|
![]() |
genericdriver.png | r1 | manage | 70.9 K | 2016-10-25 - 01:14 | DanProtopopescu | A generic DD4hep driver is used here |
![]() |
genericecal.png | r1 | manage | 82.4 K | 2016-10-25 - 01:21 | DanProtopopescu | Another example of a custom driver |
![]() |
whichdriver.png | r3 r2 r1 | manage | 85.2 K | 2016-10-25 - 00:57 | DanProtopopescu | Identifying the C++ driver |