I have a directory Processed_Data
with thousands of hists*****_blinded.root
files. Each hists*****_blinded.root
contains around 15 graphs and histograms in it. My goal is just to overlap 1 specific histogram sc*****
from each file to get the final histogram finalhists_blinded.root
which will represent all of those overlapped together.
I have tried the following macro:
void final()
{
TCanvas *time = new TCanvas("c1","overlap" ,600,1000);
time ->Divide(1,1);
time ->cd(1);
TH1F *h1 = new TH1F("h1","time" ,4096,0,4096);
ifstream in;
Float_t t;
Int_t nlines= 0;
in.open("Processed_Data", ios::in);
while (1) {
in >> t;
if (!in.good()) break;
h1->Fill(t);
nlines++;
}
in.close();
But I get the blank canvas at the end. The idea is to run each hists
file through the code and add each one by one.
As a result, I want to see all those sc*****
histograms overlapping so that the spikes in each of them will create a pattern in a finalhists_blinded.root
file.
Shouldn't be that complicated, try this:
It loops over all
Processed_Data/histsXXXXXi_blinded.root
files (given their names areProcessed_Data/hists0_blinded.root
,Processed_Data/hists1_blinded.root
,Processed_Data/hists2_blinded.root
, ...,Processed_Data/hists99998_blinded.root
,Processed_Data/hists99999_blinded.root
), opens each of them, grabs a 1Dsc
histogram, adds it to the canvas, closes the file and moves to the next file.