Message: Re: ROOT histograms: cycle number and hadd. Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: ROOT histograms: cycle number and hadd. 

Forum: Analysis
Re: Question ROOT histograms: cycle number and hadd. (Steve Quillin)
Date: 23 Aug, 2016
From: Ivana Hrivnacova <Ivana Hrivnacova>


Geant4 analysis do not support writing more versions of the same object in a file.

If you want to have all histograms generated per run in one file you can read them from the files per run and write them in the single output

 void merge() {
   TFile f1("run1.root");
   TFile f2("run2.root");
   TFile f3("run_all.root", "RECREATE");
   TH1D* h1 = (TH1D*)f1.Get("1");;
   h1 = (TH1D*)f2.Get("1");

The output from this macro will be
 root [0] .x merge.C 
 TFile**		run_all.root	
  TFile*		run_all.root	
   KEY: TH1D	1;2	Edep in absorber
   KEY: TH1D	1;1	Edep in absorber

The function hadd() will sum (merge) the histograms generated from each run into a single histogram.

Best regards,

 Add Message Add Message
to: "Re: ROOT histograms: cycle number and hadd."

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews

[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]