# How can I get the absolute value of all the values in a RooRealVar?

**URL:** <https://root-forum.cern.ch/t/how-can-i-get-the-absolute-value-of-all-the-values-in-a-roorealvar/37182>\
**Category:** Newbie\
**Tags:** roofit\
**Created:** [December 12, 2019, 5:12pm UTC](https://root-forum.cern.ch/t/how-can-i-get-the-absolute-value-of-all-the-values-in-a-roorealvar/37182 "2019-12-12T17:12:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Federico\_G](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/f/ecd19e/32.png) [@Federico\_G](https://root-forum.cern.ch/u/Federico_G)\
**Post date:** [December 12, 2019, 5:12pm UTC](https://root-forum.cern.ch/t/how-can-i-get-the-absolute-value-of-all-the-values-in-a-roorealvar/37182/1 "2019-12-12T17:12:32Z")

</div>

* * *

Hi, I have a very basic question but I’ve been struggling to find a solution. I have around a million entries in a RooRealVar that I have taken from a TBranch which range from -2.5 to 2.5, how can I turn all the negative values into positives? I need to then cut a different dataset in ranges of 0 -\>1 and 1-\>2.5. Thanks for your help.  
_ROOT Version:_ 6.14  
_RooFit Version:_ 3.60  
_Platform:_ Windows 10(?)  
_Compiler:_ Mobatek

* * *

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [December 13, 2019, 8:28am UTC](https://root-forum.cern.ch/t/how-can-i-get-the-absolute-value-of-all-the-values-in-a-roorealvar/37182/2 "2019-12-13T08:28:26Z")

</div>

Hi

RooDataSet does not allow you to manipulate values. So the easiest solution is to create a new DataSet filled with the absolute values

Lorenzo

---

<div class="post-metadata">

**Author:** ![Federico\_G](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/f/ecd19e/32.png) [@Federico\_G](https://root-forum.cern.ch/u/Federico_G)\
**Post date:** [December 13, 2019, 10:29am UTC](https://root-forum.cern.ch/t/how-can-i-get-the-absolute-value-of-all-the-values-in-a-roorealvar/37182/3 "2019-12-13T10:29:39Z")

</div>

Hi Lorenzo,  
Thank you for your answer, so can I just write something along the lines of RooDataSet(“data”, “data”, tree, Abs(variable))?
