hist->SetBinContent(5, 10);
for(int i=0; i<10; i++){ hist->SetBinContent(i, i*i); }In the above example, the bin contents are set to squares of the bin indices. The ROOT package library provides many functions and classes for manipulating and analyzing data using histograms. The TH1D class is specifically used for one-dimensional histograms with double precision bin contents. The SetBinContent function is a basic function provided by this class that is frequently used for setting bin contents of histograms.