Help me write code to invert matrix 4x4

Hi everyone!!!
I using Root with FSA method for spectrum gamma analysis. However when I used Invert() matrix, It failed. Who can i help write code to invert matrix 4x4?
Thank you so much everyone!!!

What do you mean by “it failed”?
Did you check the determinant of your matrix (if it is zero, the inverse does not exist)?
Note also: for matrices up to 6x6, you’d better try the “InvertFast” method instead of “Invert”.

this is code, when i run, it notify " non class, non struct, union objec alpha used with . or -> E:/Data/FSA2(107)"
please,Can you fix this fail?
Thank you.
FSA2.cpp (2.92 KB)

[quote=“Pepe Le Pew”]What do you mean by “it failed”?
Did you check the determinant of your matrix (if it is zero, the inverse does not exist)?
Note also: for matrices up to 6x6, you’d better try the “InvertFast” method instead of “Invert”.[/quote]
I run Root on Window, i attached code.
I hope that you will fix these fails for me.
I’m write English very bad, so hope you sympathy for me
FSA2.cpp (2.92 KB)

Try the attached macro.
FSA2.cpp (3.2 KB)

Error in : matrix in sigular
Error determinant(epsilon)=0
a = 0 0 0 0
ss a = 0 0 0 0
I attch histogram, you try run them.
In code of me, I caculated phomau, pho chuan. Right?
Thank you very much
hopnuoc20_truphong.root (16.9 KB)
hopximang20_truphong.root (16.9 KB)
hopcat20_truphong.root (16.9 KB)
hopdami20_truphong.root (16.9 KB)
hopdami20betong_truphong.root (16.8 KB)
FSA2.cpp (3.29 KB)

Download corrected macro from my previous post.

I run your macro from previous post, this bug
“Error in : matrix in sigular
Error determinant(epsilon)=0
a = 0 0 0 0
ss a = 0 0 0 0”

thank you so much, i ran your macro. I will very remember help of you.

this results " a = -114.337 22.1152 43.0254 50.6329 "
Value of ‘‘a’’ can’t negative number. Because a1 a2 a3 a4, they are mass percentage.
Thank you for you.