# Histograms with same name

**URL:** <https://root-forum.cern.ch/t/histograms-with-same-name/28988>\
**Category:** ROOT\
**Created:** [May 12, 2018, 4:21pm UTC](https://root-forum.cern.ch/t/histograms-with-same-name/28988 "2018-05-12T16:21:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![calbet](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/4af34b/32.png) [@calbet](https://root-forum.cern.ch/u/calbet)\
**Post date:** [May 12, 2018, 4:21pm UTC](https://root-forum.cern.ch/t/histograms-with-same-name/28988/1 "2018-05-12T16:21:17Z")

</div>

Dear experts,  
I have a root file with several different histograms with the same name (1), they differ with only a number at the end of the name (1). How can I specify a specific histogram? If I open this root file and get an histogram, which one it will take by default?  
Regards

(1)  
 ![image](https://root-forum.cern.ch/uploads/default/original/3X/a/7/a7520f1878617687be425aad0f3ef74b47a12db6.png)

---

<div class="post-metadata">

**Author:** ![sbinet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/sbinet/32/13166_2.png) [@sbinet](https://root-forum.cern.ch/u/sbinet)\
**Post date:** [May 12, 2018, 5:45pm UTC](https://root-forum.cern.ch/t/histograms-with-same-name/28988/2 "2018-05-12T17:45:41Z")

</div>

That number is the ‘cycle’ of the object.  
Think of it as a revision.

If you don’t specify any cycle, the last one (the largest) will be automatically selected.

---

<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:** [May 12, 2018, 7:29pm UTC](https://root-forum.cern.ch/t/histograms-with-same-name/28988/3 "2018-05-12T19:29:56Z")

</div>

Either:

> [@Aux;1 aux;2 aux3;](https://root-forum.cern.ch/t/aux-1-aux-2-aux3/13345/2):
>
> Search for “cycle” and/or “namecycle”, for example in: In a Nutshell: [Input and Output](https://root.cern.ch/d/input-and-output) . ROOT User’s Guide: [Input/Output](https://root.cern.ch/root/htmldoc/guides/users-guide/ROOTUsersGuide.html#inputoutput) : [Retrieving Objects from Disk](https://root.cern.ch/root/htmldoc/guides/users-guide/ROOTUsersGuide.html#retrieving-objects-from-disk) , [Subdirectories and Navigation](https://root.cern.ch/root/htmldoc/guides/users-guide/ROOTUsersGuide.html#subdirectories-and-navigation) . Just for reference: [some additional notes about GetObject, Get, FindObjectAny, FindKeyAny, ReadObj, ReadObjAny](https://root-forum.cern.ch/t/broken-tdirectoryfile-findobjectany-and-tdirectoryfile-findkeyany/20943/16) .

or:

> [@Problem with Reading Root File](https://root-forum.cern.ch/t/problem-with-reading-root-file/12164/2):
>
> An expert’s advice is needed, why there is a “segmentation violation” in the code below. [8-[] { TFile \*TPCTOFEfffile = TFile::Open("EFFTPCTOF.root", "read"); #if 1 /\* 0 or 1 \*/ // This method works well. TH1F \*TPCTOFEFFDeltapp = (TH1F\*)(TPCTOFEfffile-\>FindObjectAny("hEff;1")); TH1F \*TPCTOFEFFDeltamm = (TH1F\*)(TPCTOFEfffile-\>FindObjectAny("hEff;2")); TH1F \*TPCTOFEFFAverage = (TH1F\*)(TPCTOFEfffile-\>FindObjectAny("hEff;3")); #else /\* 0 or 1 \*/ // This method should also work, I get…

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [May 26, 2018, 7:29pm UTC](https://root-forum.cern.ch/t/histograms-with-same-name/28988/4 "2018-05-26T19:29:58Z")

</div>

Closed on May 26, 2018, 7:29pm UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
