3 void writeFile(
const char* inRootFile)
5 TFile inRoot(inRootFile);
7 cout <<
"Cannot open " << inRootFile << endl;
10 TIterator* iterator = inRoot.GetListOfKeys()->MakeIterator();
13 TString outText = inRootFile;
14 outText.Replace(0,outText.Last(
'/')+1,
"");
16 ofstream os(outText.Data());
21 while( (key=dynamic_cast<TKey*>(iterator->Next())) != 0){
22 cout << key->GetName() << endl;
23 TH1* h = (TH1*)inRoot.Get(key->GetName());
24 if(h->GetDimension()!=1)
continue;
28 int nBin = h->GetNbinsX();
29 os <<
"name: " << h->GetName() << endl
30 <<
"title: " << h->GetTitle() << endl
31 <<
"bins: " << h->GetNbinsX() << endl
32 <<
"min: " << h->GetXaxis()->GetBinLowEdge(1)
33 <<
", max: " << h->GetXaxis()->GetBinUpEdge(h->GetNbinsX()) << endl;
35 for(
int i=1; i<=nBin; i++){
36 os <<
"bin: " << i <<
" value: " << (float)h->GetBinContent(i)
37 <<
" error: " << (float)h->GetBinError(i) << endl;
44 void readFile(
const char* textFile)