For 2
// ...
tmin = hgraph->GetXaxis()->GetBinLowEdge(BinMin);
tmax = hgraph->GetXaxis()->GetBinUpEdge(BinMax);
tpeakmin = hgraph->GetXaxis()->GetBinLowEdge(BinPeakMin);
tpeakmax = hgraph->GetXaxis()->GetBinUpEdge(BinPeakMax);
double TotArea= hgraph->Integral(BinMin,BinMax);
double BkgAreaSx= hgraph->Integral(BinMin, BinPeakMin - 1);
double BkgAreaDx= hgraph->Integral(BinPeakMax + 1, BinMax);
// ...