AIDASoft / DD4hep

Detector Description Toolkit for High Energy Physics
http://dd4hep.cern.ch
GNU Lesser General Public License v3.0
49 stars 96 forks source link

How to retrieve a property defined in the XML file? #1323

Closed atolosadelgado closed 1 month ago

atolosadelgado commented 1 month ago

Hi,

I was playing with the ARC_detector, which is compiled as usual,

git clone https://github.com/atolosadelgado/ARC_detector
cd ARC_detector
cmake -B build -S . -D CMAKE_INSTALL_PREFIX=install 
cmake --build build -j 4 -- install
export LD_LIBRARY_PATH=$PWD/install/lib:$LD_LIBRARY_PATH

I was trying to retrieve an optical property from a compact file, but the map of 'properties' seems to be empty. You can reproduce the issue with the following code, in a ROOT terminal

#include "DD4hep/Detector.h"
R__LOAD_LIBRARY(libDDCore) 
auto lcdd = &(dd4hep::Detector::getInstance());
lcdd->fromCompact("./compact/arc_v0.xml")
lcdd->properties().size()

Are there other ways to retrieve the properties defined in a compact file?

Thank you very much for your time.

Alvaro

andresailer commented 1 month ago

Where is the property you want to retrieve defined?

atolosadelgado commented 1 month ago

Where is the property you want to retrieve defined?

Any of the properties defined in the material.xml would be ok, e.g. this.

Retrieving a matrix floating in the XML would be another option, like this, but I am not sure if that is even possible.

Thank you for checking it!

MarkusFrankATcernch commented 1 month ago

Alvaro,

The accessor Detector::properties() only gives access to key value pairs defined in the compact xml in order to chain in some user defined "generic" constants. If this is useful or ever used - I do not know. The usage in XML is:

 *      <properties>
 *        <attributes name="key" type="" .... />
 *  ... </properties>

To be seen e.g. in the example file DD4hep_CHECKOUT/examples/CLICSiD/sim/field.xml. Since we use python to configure Geant4 this is not not used anymore.

The material or optical properties you mean can only be accessed from the material (or if you know the details also from the TGeoManager). With the accessor you use they are not available. It was never necessary so far to have access to material related properties.

atolosadelgado commented 1 month ago

ok, thank you for the clarifications :)