Please help me solve the problem.
Thank you in advance
See point 7 on this page.
The RooFit tutorials contain all the code snippets you’ll need to solve this, in particular the rf201_composite.C tutorial will be helpful! There are also Python versions for all the tutorials.