#include "TFile.h" #include "TH1.h" #include "TString.h" #include "TROOT.h" #include #include void WAVG(const char* filename, int cycle) { TFile *file1 = TFile::Open(TString::Format("%s_%i.root", filename, cycle), "READ"); if ((!file1) || file1->IsZombie()) { delete file1; return; } // just a precaution std::cout << "File " << file1->GetName() << " opened successfully." << std::endl; TH1F *havgflux_234U_front; file1->GetObject("hflux_234U_front", havgflux_234U_front); if (!havgflux_234U_front) { delete file1; return; } // just a precaution std::cout << "Histogram " << havgflux_234U_front->GetName() << " found." << std::endl; for (int i=0; iGetNbinsX(); i++) { if (std::isinf(havgflux_234U_front->GetBinContent(i+1))) std::cout << i+1 << std::endl; if (std::isinf(havgflux_234U_front->GetBinError(i+1))) std::cout << -(i+1) << std::endl; } havgflux_234U_front->Draw("histo"); #if 1 /* 0 or 1 */ havgflux_234U_front->SetDirectory(gROOT); // (gROOT) or (0) delete file1; #endif /* 0 or 1 */ }