# Applying cut on histogram

**URL:** <https://root-forum.cern.ch/t/applying-cut-on-histogram/28404>\
**Category:** ROOT\
**Created:** [March 22, 2018, 3:17pm UTC](https://root-forum.cern.ch/t/applying-cut-on-histogram/28404 "2018-03-22T15:17:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![m\_cern313](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/m_cern313/32/18688_2.png) [@m\_cern313](https://root-forum.cern.ch/u/m_cern313)\
**Post date:** [March 22, 2018, 3:17pm UTC](https://root-forum.cern.ch/t/applying-cut-on-histogram/28404/1 "2018-03-22T15:17:44Z")

</div>

Dear Friends,

I want to apply cut on the attached histogram around 400 GeV. Could you please guide me how can I do that?

Cheers

![1](https://root-forum.cern.ch/uploads/default/original/2X/f/fff76179a2b0f7685680b2d5dbd1a547fb88c882.png)

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [March 22, 2018, 3:33pm UTC](https://root-forum.cern.ch/t/applying-cut-on-histogram/28404/2 "2018-03-22T15:33:00Z")

</div>

> [@m\_cern313](#):
>
> I want to apply cut on the attached histogram around 400

What do you mean by “apply cut around 400” ? you want to bins content above 400 to be 0 ?

---

<div class="post-metadata">

**Author:** ![m\_cern313](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/m_cern313/32/18688_2.png) [@m\_cern313](https://root-forum.cern.ch/u/m_cern313)\
**Post date:** [March 22, 2018, 4:02pm UTC](https://root-forum.cern.ch/t/applying-cut-on-histogram/28404/3 "2018-03-22T16:02:49Z")

</div>

yes. I want to apply on 400 GeV as the rest (half right side) is not important.

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [March 22, 2018, 5:01pm UTC](https://root-forum.cern.ch/t/applying-cut-on-histogram/28404/4 "2018-03-22T17:01:00Z")

</div>

You can just zoom the X axis to cut the paper part of it.

> [@How to set ranges on axis?](https://root-forum.cern.ch/t/how-to-set-ranges-on-axis/28254):
>
> The viewing range for a histogram axis can be set from bin ifirst to ilast using the method TAxis::SetRange(ifirst, ilast). Example (hpxpy is a 2D histogram): { TFile f("hsimple.root"); hpxpy-\>Draw("colz"); hpxpy-\>GetYaxis()-\>SetRange(22,23); hpxpy-\>GetXaxis()-\>SetRange(18,19); } Sometimes it is more convenient to set this range using “User’s Coordinates” (axis values) rather than bin numbers. To do that one should use TAxis::SetRangeUser(ufirst, ulast). This method computes the cl…

---

<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:** [April 5, 2018, 5:01pm UTC](https://root-forum.cern.ch/t/applying-cut-on-histogram/28404/5 "2018-04-05T17:01:05Z")

</div>

Closed on April 5, 2018, 5:01pm UTC

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