# Trouble running the Macro in ROOT

**URL:** <https://root-forum.cern.ch/t/trouble-running-the-macro-in-root/35007>\
**Category:** Newbie\
**Created:** [July 4, 2019, 8:27pm UTC](https://root-forum.cern.ch/t/trouble-running-the-macro-in-root/35007 "2019-07-04T20:27:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shahina](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/shahina/32/19464_2.png) [@shahina](https://root-forum.cern.ch/u/shahina)\
**Post date:** [July 4, 2019, 8:27pm UTC](https://root-forum.cern.ch/t/trouble-running-the-macro-in-root/35007/1 "2019-07-04T20:27:47Z")

</div>

I am having trouble running this macro. Can someone help me with this?

[extractSpectra\_new.C](https://root-forum.cern.ch/uploads/short-url/qYh9r2b2qf6qiLLVgst8Tk196CE.C) (3.1 KB)

---

<div class="post-metadata">

**Author:** ![shahina](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/shahina/32/19464_2.png) [@shahina](https://root-forum.cern.ch/u/shahina)\
**Post date:** [July 4, 2019, 8:53pm UTC](https://root-forum.cern.ch/t/trouble-running-the-macro-in-root/35007/3 "2019-07-04T20:53:36Z")

</div>

When I am using the exactSpectra function inside my main function it is having trouble. I don’t know how to use this function to get the histograms from the root files and how to save those histograms.

> **[compass\_run\_324.root](https://drive.google.com/file/d/1W6iUMmJJg7SbGaTjPxPDz5zlaPUMQANK/view?usp=sharing)**
>
> Google Drive file.

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [July 4, 2019, 9:56pm UTC](https://root-forum.cern.ch/t/trouble-running-the-macro-in-root/35007/6 "2019-07-04T21:56:01Z")

</div>

[extractSpectra\_new.C](https://root-forum.cern.ch/uploads/short-url/mwlHJrpIXasSWsjEsiMCrVPTh83.C) (3.4 KB)
