How can I access Detector Information via a Macro?

Greetings to everyone,

I would like to know if there is a way to extract information like the pixel pitch, global detector position of a detector in a root file via code. Needless to say, it is exhausting to set const global variables and change them according to the root file at hand. Could someone demonstrate how that could be done? Thank you very much in advance.

Kind Regards,


PS: I am aware of the Detector.hpp header file, which contains all of the methods that I would like to use, but I do not know how to create a detector class instance in code that points to my detector in the configuration. There is the alternative of working with
ifstream and doing everything manually but was wondering if there is any neat allpix based shortcut.

Hi @Andrew

We store the full configuration of your simulation in the output root file - it’s even possible to recover the original configuration files from a single data file. I guess you can use that information with a bit of parsing to get all info you need.

In the repository there is an example of how to access this information: tools/root_analysis_macros/recoverConfiguration.C · master · Allpix Squared / Allpix Squared - in this case a tool that writes out the config files again.

The parsing might be a bit cumbersome because we store the full string values for maximum flexibility…

If you have any example analysis macro that you think could be useful for others, we’d be more than happy to add it to the repo…


1 Like