As the error message says (or tries to say) when you do a.T() you are calling the non-const method T() on the const TMatrix variable a. The error goes away if you change
Thanks! That worked.
I understood the other way around, so introduced this const TMatrixD in my actual code. But, it was a mistake. Now my code is working fine.