TFormula error when loading gdml using matrix

I am trying to load a GDML file using matrix and variables. Here in an extract from the gdml:

<matrix name="someNumbers" coldim="1" values="4 3 2 3"/>
<variable name="testVariable" value="someNumbers[1]"/>

ROOT complains when parsing the GDML, with the following error:

input_line_155:2:81: error: subscripted value is not an array, pointer, or vector
Double_t TFormula____id2222353222929674449(Double_t *x,Double_t *p){ return p[0][1] ; }
Error in <prepareMethod>: Can't compile function TFormula____id2222353222929674449 prototype with arguments Double_t*,Double_t*
Error in <TFormula::InputFormulaIntoCling>: Error compiling formula expression in Cling
Error in <TFormula::ProcessFormula>: Formula "[someNumbers][1]" is invalid !
Error in <TFormula::Eval>: Formula is invalid and not ready to execute 
Fatal in <TGDMLParse::Value>: Got bad value nan from string 'someNumbers[1]'

Am I doing an obvious mistake in using the matrix elements to define another variable?

Thank you very much in advance!


ROOT Version: 6.26/10
Platform: fedora 38
Compiler: gcc 12.2.1

May be @moneta can help you.


It looks like you are using inside the TFormula the operator [] that is reserved for defining parameter names. I am not sure how GDML works and how it parses the values and create TFormula objects.
I would suggest you create a small reproducible and post it as a GitHub issue for GDML


Thank you for the comment! I will do that right now.


Here it is: TFormula error when loading gdml using matrix · Issue #13074 · root-project/root · GitHub

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.