I am trying to set Y-axis range limit as my histogram is not fully shown in the canvas. Here is my code. Please let me know how to set the y axis range correctly. Thank you.
{
TFile *f = new TFile("data.root", "RECREATE");
ifstream input;
input.open("nrhf-data.txt");
TH1D* h = new TH1D("Flux_hist", "#nu_{mu} : Energy vs. Flux; Energy (GeV); Flux", 5, 0, 6);
unsigned int i;
float x; // energy
float y; // flux
while( !input.eof() )
{
input >> x >> y;
cout << x << ", " << y << endl;
i = h->FindBin(x);
h->SetBinContent(i, y);
}
h->GetYaxis->SetRange(0,0.0000412);
h->Write();
f->Close();
}