# Reweighting multiple histograms quickly

**URL:** <https://root-forum.cern.ch/t/reweighting-multiple-histograms-quickly/51166>\
**Category:** Newbie\
**Created:** [August 12, 2022, 12:26am UTC](https://root-forum.cern.ch/t/reweighting-multiple-histograms-quickly/51166 "2022-08-12T00:26:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![abunka](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/d6d6ee/32.png) [@abunka](https://root-forum.cern.ch/u/abunka)\
**Post date:** [August 12, 2022, 12:26am UTC](https://root-forum.cern.ch/t/reweighting-multiple-histograms-quickly/51166/1 "2022-08-12T00:26:46Z")

</div>

Hello ROOTers  
What would be the fastest way to reweight all the histograms in a file? I’m guessing a nested for loop to go over each histogram and then each bin?  
The reweighting value is the same for each bin/hist. How do I loop over each histogram without having to call each distinct name? There are about 200 histograms in the file.

Thanks!

---

<div class="post-metadata">

**Author:** ![yus](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/y/9fc348/32.png) [@yus](https://root-forum.cern.ch/u/yus)\
**Post date:** [August 12, 2022, 8:57pm UTC](https://root-forum.cern.ch/t/reweighting-multiple-histograms-quickly/51166/2 "2022-08-12T20:57:25Z")

</div>

Hi,

> [@abunka](#):
>
> How do I loop over each histogram without having to call each distinct name?

this might help: [ROOT: tutorials/io/loopdir.C File Reference](https://root.cern/doc/master/loopdir_8C.html)
