Hi All,
I have a little method that does this
[code] TFile* m_f = TFile::Open(“InFileName”);
TFile* outF = new TFile(“outFileName”, “RECREATE”);
TH1D* hist = (TH1D*)m_f->Get("histName");
hist->Write();
m_f->Close();
outF->Close();[/code]
Where the input file is a .root file merged from many .root files with identical structures containing histograms, using the hadd() method.
I can no longer do this due to disk spaces, how can I substitute the merged input file with a TChain, adding all of the files? For example:
[code] TChain* m_f = new TChain("");
m_f->Add(File1);
m_f->Add(File2);
TFile* outF = new TFile(“outFileName”, “RECREATE”);
TH1D* hist = (TH1D*)m_f->GetHistogram("histName");
hist->Write();
m_f->Close();
outF->Close();[/code]
I have tried this, however the GetHistogram() method from the TTree class, where TChain inherits from, cannot be used like in the first example, where Get() belongs to TDirectoryFile, where TFile inherits from.
Thanks in advance for the help,
Cheers
Jason