# Filling a TH1D with diffenrces between two ULong64\_t numbers?

**URL:** <https://root-forum.cern.ch/t/filling-a-th1d-with-diffenrces-between-two-ulong64-t-numbers/59294>\
**Category:** Newbie\
**Created:** [May 10, 2024, 10:11am UTC](https://root-forum.cern.ch/t/filling-a-th1d-with-diffenrces-between-two-ulong64-t-numbers/59294 "2024-05-10T10:11:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![utkarsh-2000](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/u/e47774/32.png) [@utkarsh-2000](https://root-forum.cern.ch/u/utkarsh-2000)\
**Post date:** [May 10, 2024, 10:11am UTC](https://root-forum.cern.ch/t/filling-a-th1d-with-diffenrces-between-two-ulong64-t-numbers/59294/1 "2024-05-10T10:11:05Z")

</div>

Hi all,

I am dealing with `ULong64_t ` for the first time so have little ideas how do they work, and have the following problem at hand.

I have two timestamps

```auto
ULong64_t t1 = 439742383004780 ;
ULong64_t t2 = 439742383004750 ;

```

I am trying to subtract them to get the time between them and fill it in a histogram (TH1D)

```auto
h->Fill(t1-t2);

```

is it okay to directly do this or I need to do some conversions before extracting the time ?

Thanking You

---

<div class="post-metadata">

**Author:** ![Danilo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/danilo/32/34528_2.png) [@Danilo](https://root-forum.cern.ch/u/Danilo)\
**Post date:** [May 10, 2024, 12:39pm UTC](https://root-forum.cern.ch/t/filling-a-th1d-with-diffenrces-between-two-ulong64-t-numbers/59294/2 "2024-05-10T12:39:01Z")

</div>

Hi,

In your code, a difference between the two variables is performed, and the result will be cast to a `double`. If that’s what you are after, that is the way to go.

Cheers,  
Danilo

---

<div class="post-metadata">

**Author:** ![utkarsh-2000](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/u/e47774/32.png) [@utkarsh-2000](https://root-forum.cern.ch/u/utkarsh-2000)\
**Post date:** [May 10, 2024, 1:05pm UTC](https://root-forum.cern.ch/t/filling-a-th1d-with-diffenrces-between-two-ulong64-t-numbers/59294/3 "2024-05-10T13:05:42Z")

</div>

Thank You for reply,

Is it possible to get the result as an integer itself ?

---

<div class="post-metadata">

**Author:** ![ferhue](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ferhue/32/29462_2.png) [@ferhue](https://root-forum.cern.ch/u/ferhue)\
**Post date:** [May 21, 2024, 10:09am UTC](https://root-forum.cern.ch/t/filling-a-th1d-with-diffenrces-between-two-ulong64-t-numbers/59294/4 "2024-05-21T10:09:08Z")

</div>

The x axis of the TH1 histogram will always be double, so there’s no way to get the result as integer.  
The y axis of the TH1 histogram will be int or double depending on if you choose TH1L or TH1D. But that is just for counting how many entries per bin, it has nothing to do with t1 and t2.
