# How to read the parameters of the fit-model in Rooworkspace

**URL:** <https://root-forum.cern.ch/t/how-to-read-the-parameters-of-the-fit-model-in-rooworkspace/31378>\
**Category:** Newbie\
**Tags:** hist\
**Created:** [October 31, 2018, 2:28pm UTC](https://root-forum.cern.ch/t/how-to-read-the-parameters-of-the-fit-model-in-rooworkspace/31378 "2018-10-31T14:28:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![123](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/123/32/17154_2.png) [@123](https://root-forum.cern.ch/u/123)\
**Post date:** [October 31, 2018, 2:28pm UTC](https://root-forum.cern.ch/t/how-to-read-the-parameters-of-the-fit-model-in-rooworkspace/31378/1 "2018-10-31T14:28:17Z")

</div>

[exe2.C](https://root-forum.cern.ch/uploads/default/original/3X/d/4/d4fc09b1d66b71615c9ed61e5d80ddc01fabc65d.C) (2.2 KB)  
[hig.txt](https://root-forum.cern.ch/uploads/default/original/3X/6/7/67eb4a311abbc12c01f84dcc8565fb151e456988.txt) (330.5 KB)

 ![sig](https://root-forum.cern.ch/uploads/default/original/3X/7/c/7c64be7daff7f44ae29690977b56bdfe9163ef87.png)  
Hi everyone,  
\*\*1.\*\*As the picture(sig.png) shows, there is a signal above the background.  
Now I want to draw the peak(bkg) separately which are supposed to be below the blue line.  
The line I want to get is that it is very close to zero outside[120,125]and that it has a bkg “peak” in [120,125]. That is to say I want to extract the peak and draw it.  
**2** And I also want to get a picture like sample.jpeg. But still I don’t know how to extract the"bkg" data.  
 ![sample](https://root-forum.cern.ch/uploads/default/original/3X/c/7/c78afe461d9c67e001f76b08a17e0dcdb04e2063.jpeg)

I am not very good at English. Hopefully you can get me. Thanks very much for your patience!

xin

---

<div class="post-metadata">

**Author:** ![Axel](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/axel/32/11084_2.png) [@Axel](https://root-forum.cern.ch/u/Axel)\
**Post date:** [October 31, 2018, 4:31pm UTC](https://root-forum.cern.ch/t/how-to-read-the-parameters-of-the-fit-model-in-rooworkspace/31378/2 "2018-10-31T16:31:47Z")

</div>

@StephanH our new RooFit expert is on vacation this week. I hope he can help out when he’s back!

---

<div class="post-metadata">

**Author:** ![123](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/123/32/17154_2.png) [@123](https://root-forum.cern.ch/u/123)\
**Post date:** [November 1, 2018, 9:20am UTC](https://root-forum.cern.ch/t/how-to-read-the-parameters-of-the-fit-model-in-rooworkspace/31378/3 "2018-11-01T09:20:13Z")

</div>

Dear Axel ,  
Thanks for your information.

xin

---

<div class="post-metadata">

**Author:** ![StephanH](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/c68b51/32.png) [@StephanH](https://root-forum.cern.ch/u/StephanH)\
**Post date:** [November 5, 2018, 11:04am UTC](https://root-forum.cern.ch/t/how-to-read-the-parameters-of-the-fit-model-in-rooworkspace/31378/4 "2018-11-05T11:04:59Z")

</div>

Hello @123,

try this for plotting:

```auto
model->plotOn(plot, LineColor(kRed));
model->plotOn(plot, Components("sig_pdf"), LineColor(kRed), Range(120, 130));
model->plotOn(plot, Components("bkg_pdf"), LineColor(kBlue));

```

Is this what you had in mind?

More about plotting components you can find here:  
[https://root.cern.ch/root/html/tutorials/roofit/rf205\_compplot.C.html](https://root.cern.ch/root/html/tutorials/roofit/rf205_compplot.C.html)

---

<div class="post-metadata">

**Author:** ![123](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/123/32/17154_2.png) [@123](https://root-forum.cern.ch/u/123)\
**Post date:** [November 6, 2018, 8:54am UTC](https://root-forum.cern.ch/t/how-to-read-the-parameters-of-the-fit-model-in-rooworkspace/31378/5 "2018-11-06T08:54:57Z")

</div>

Hello Hageboeck,  
Yes , this is exactly what I want. Thanks for your kindly help!
