Skip to Content.
Sympa Menu

star-mudet-l - [Star-mudet-l] Useful tip on histogram merging

star-mudet-l AT lists.bnl.gov

Subject: STAR Muon Telescope Detector development

List archive

Chronological Thread  
  • From: Rongrong Ma <marr AT rcf.rhic.bnl.gov>
  • To: STAR Muon Telescope Detector development <star-mudet-l AT lists.bnl.gov>
  • Subject: [Star-mudet-l] Useful tip on histogram merging
  • Date: Tue, 12 Jul 2022 10:39:41 -0400

Dear All

I saw the following discussion on MatterMost about how to efficiently merge a large number of root files, which might be useful. 

Best
Rongrong

Hi, I am trying to merge my root files (histogram) on rcf grid but its taking too much of time to merge (initially it use to take 10 mins only now its running for 3 hrs). Please let me know if there is some way I can do it more effectively or this problem is there for most of users. thanks.
jeromel profile image
Jerome Lauret
How do you merge?
  • Using hadd? If so, this is notoriously slow especially if you have many files and histogram (memory management is not really done).
  • we have a merger macro at $STAR/StRoot/macros/analysis/MergeHistogramFile.C you could try (not sure if it still works but you can try)
void MergeComplexHistogramFile( const Char_t *TargetName=0, const Char_t *inputFilesPattern=0)
Hope this helps.
ajentsch profile image
Alexander Jentsch
hadd also has an argument "-n", which allows you to specify the maximum number of files to add at any given time (meaning, only a certain number is open at the same time). I find this helps to speed up merging immensely since you aren't bogging down the memory so much.
So try doing -n 50, and see if it helps (opens 50 files, adds them, then moves onto the next 50, etc.). It really does make a huge difference.
"hadd -n 50 target_file.root input_file_*.root" Edited



  • [Star-mudet-l] Useful tip on histogram merging, Rongrong Ma, 07/12/2022

Archive powered by MHonArc 2.6.24.

Top of Page