# How to overlap two different histograms of two different root files but its not working

**URL:** <https://root-forum.cern.ch/t/how-to-overlap-two-different-histograms-of-two-different-root-files-but-its-not-working/27170>\
**Category:** ROOT\
**Created:** [December 4, 2017, 9:39am UTC](https://root-forum.cern.ch/t/how-to-overlap-two-different-histograms-of-two-different-root-files-but-its-not-working/27170 "2017-12-04T09:39:35Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![ksmith](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ksmith/32/12567_2.png) [@ksmith](https://root-forum.cern.ch/u/ksmith)\
**Post date:** [December 5, 2017, 2:39pm UTC](https://root-forum.cern.ch/t/how-to-overlap-two-different-histograms-of-two-different-root-files-but-its-not-working/27170/12 "2017-12-05T14:39:13Z")

</div>

> [@sohail](#):
>
> i put these two root files in my public area of lxplus . work/i/isohail/public . sohail1\_OT\_2017, sohail2\_OT\_2017 , kindly check them bcz still am unable to understand why it give me this error

Many of us are not at CERN. I know very little about this “lxplus”, but have inferred that they are computers at CERN and as such I doubt I have access to them.

> [@sohail](#):
>
> thanks for your time. but its not working yet.

How is it not working? Do you get an error? Are you expecting a different result?

You have included your code inline which makes it difficult to read. Could you follow the suggestions in the following post and edit your post accordingly? Also, it appears that your code is still not following the normal tabbing where items of the same scope are at the same indentation, this also make it difficult to read and can help identify mistakes.

> [@Getting the same histograms after cuts](https://root-forum.cern.ch/t/getting-the-same-histograms-after-cuts/24719/2):
>
> Remark on the way to post code snippets: When you post pieces of code on the forum enclose it with ``` . That makes your post much more readable (I systematically edit your posts that way) . So do: ``` // this is a C++ piece of code. ``` And it will display as: // this is a C++ piece of code.

You should compile this script until you have improved your programming skills so that your errors are caught (you have a line with a missing semicolon, there are missing statements, missing curly brackets…). Use the following command to compile your scripts and get messages about errors.

```auto
root [0] .L script.C+

```

Please read through all my comments in your script above as you still have not addressed all of these. Finally, some of your code is out of order. Checking if the histograms are valid after trying to do something with them seems counterproductive. Printing the canvas before drawing on it will also leave you with a blank canvas.

---

_[View the full topic](https://root-forum.cern.ch/t/how-to-overlap-two-different-histograms-of-two-different-root-files-but-its-not-working/27170)._
