void dumpHistoToTxt() { TFile *f=new TFile("SPEC_TotalFotoesA.root"); // opens the root file //TH1F *tr=(TH1F*)f->Get("SPEC_TotalFotoes1"); TH1F *tr; f->GetObject("energy", tr); float energy,count, value_normalized; double integral = 1.0/(tr->Integral()); double integ = tr->Integral(); ofstream myfile; myfile.open ("TotalFotoes_espMinA1.txt"); //myfile.open ("values1.txt"); value_normalized myfile << "energy count \n"; for (int idx=0; idxGetNbinsX();++idx) { energy = tr->GetBinCenter(idx); count = (tr->GetBinContent(idx)); //value_normalized = count * (integral); // value_normalized = count/integ; cout << energy << " " << count << endl; //print to the screen myfile << energy << " " << count << "\n"; //write to file // cout << energy << " " << value_normalized <