I could not see the specific points.
Anyway, here is the complete code:
void StatNewEPScatteringSample01()
{
static Int_t nof = 500; // number of functions to be generated
auto can = new TCanvas("c1", "c1", 800,800); // setting the canvas
//gStyle->SetOptStat("nerf");
//gStyle->SetOptStat();
gStyle->SetOptStat(0);
can->Draw();
auto avf = new TH1F("avf", "Average of Functions", 100, 0.0025, 1.0);
avf->Draw();
//=== generating the functions ===//
TF1 *fpf[nof], *ppf[nof];
TString fna;
for (Int_t i=0; i<nof; i++)
{
fna = "f"; fna += i;
fpf[i] = new TF1("fna","(((2.0*[0]*[0]*[1]*[1]*[2]*[2]*[3]*[3])/(x*x*sin([4]*[5]/360.0)*sin([4]*[5]/360.0)*sin([4]*[5]/360.0)*sin([4]*[5]/360.0)+2.0*[3]*[3]*x*sin([4]*[5]/360.0)*sin([4]*[5]/360.0)+(x*sin([4]*[5]/360.0)*sin([4]*[5]/360.0)*sqrt(x*x*sin([4]*[5]/360.0)*sin([4]*[5]/360.0)*sin([4]*[5]/360.0)*sin([4]*[5]/360.0)+4.0*[3]*[3]*x*sin([4]*[5]/360.0)*sin([4]*[5]/360.0)))))*((2.0*[3]*[3])/(2.0*[3]*[3]+x*sin([4]*[5]/360.0)*sin([4]*[5]/360.0)+sqrt(x*x*sin([4]*[5]/360.0)*sin([4]*[5]/360.0)*sin([4]*[5]/360.0)*sin([4]*[5]/360.0)+4.0*[3]*[3]*x*sin([4]*[5]/360.0)*sin([4]*[5]/360.0))))*((4.0*[3]*[3])/(4.0*[3]*[3]+x))*((0.71)/(0.71+x))*((0.71)/(0.71+x))*((0.71)/(0.71+x))*((0.71)/(0.71+x))*((8.0*[3]*[3]*[3]*[3]*cos([4]*[5]/360.0)*cos([4]*[5]/360.0)+2.0*[3]*[3]*x*[6]*[6]*cos([4]*[5]/360.0)*cos([4]*[5]/360.0)+4.0*[3]*[3]*x*[6]*[6]*sin([4]*[5]/360.0)*sin([4]*[5]/360.0)+x*x*[6]*[6]*sin([4]*[5]/360.0)*sin([4]*[5]/360.0))/(8.0*[3]*[3]*[3]*[3])))", 0.0025, 1.0);
fpf[i]->SetParameter(0,1.0);
fpf[i]->SetParameter(1,1.0);
fpf[i]->SetParameter(2,1.0/137.0);
fpf[i]->SetParameter(3,gRandom->Gaus(0.938272081,0.000000023));
fpf[i]->SetParameter(4,10.0);
fpf[i]->SetParameter(5,TMath::Pi());
fpf[i]->SetParameter(6,2.793);
}
for (Int_t i=0; i<nof; i++)
{
fna = "f"; fna += i;
ppf[i] = new TF1("fna","((2.0*[0]*[0]*[1]*[1]*[2]*[2]*[3]*[3])/(x*x*sin([4]*[5]/360.0)*sin([4]*[5]/360.0)*sin([4]*[5]/360.0)*sin([4]*[5]/360.0)+2.0*[3]*[3]*x*sin([4]*[5]/360.0)*sin([4]*[5]/360.0)+(x*sin([4]*[5]/360.0)*sin([4]*[5]/360.0)*sqrt(x*x*sin([4]*[5]/360.0)*sin([4]*[5]/360.0)*sin([4]*[5]/360.0)*sin([4]*[5]/360.0)+4.0*[3]*[3]*x*sin([4]*[5]/360.0)*sin([4]*[5]/360.0)))))*((2.0*[3]*[3])/(2.0*[3]*[3]+x*sin([4]*[5]/360.0)*sin([4]*[5]/360.0)+sqrt(x*x*sin([4]*[5]/360.0)*sin([4]*[5]/360.0)*sin([4]*[5]/360.0)*sin([4]*[5]/360.0)+4.0*[3]*[3]*x*sin([4]*[5]/360.0)*sin([4]*[5]/360.0))))*((2.0*[3]*[3]*cos([4]*[5]/360.0)*cos([4]*[5]/360.0)+x*sin([4]*[5]/360.0)*sin([4]*[5]/360.0))/(2.0*[3]*[3]))", 0.0025, 1.0);
ppf[i]->SetParameter(0,1.0);
ppf[i]->SetParameter(1,1.0);
ppf[i]->SetParameter(2,1.0/137.0);
ppf[i]->SetParameter(3,gRandom->Gaus(0.938272081,0.000000023));
ppf[i]->SetParameter(4,10.0);
ppf[i]->SetParameter(5,TMath::Pi());
ppf[i]->SetParameter(6,2.793);
}
//=== getting the average ===//
Int_t nop=100;
Double_t xpt, ypt, del = 0.9975/nop;
TGraph *av1 = new TGraph();
for (Int_t j=0; j < nop; j++)
{
xpt = del*j + 0.0025*del;
av1->SetPoint(j, xpt, 0.0);
}
for (Int_t i=0; i<nof; i++)
{
for (Int_t j=0; j < nop; j++)
{
av1->GetPoint(j, xpt, ypt);
av1->SetPoint(j, xpt, ypt + fpf[i]->Eval(xpt)/(Double_t)nof);
}
}
TGraph *av2 = new TGraph();
for (Int_t j=0; j < nop; j++)
{
xpt = del*j + 0.0025*del;
av2->SetPoint(j, xpt, 0.0);
}
for (Int_t i=0; i<nof; i++)
{
for (Int_t j=0; j < nop; j++)
{
av2->GetPoint(j, xpt, ypt);
av2->SetPoint(j, xpt, ypt + ppf[i]->Eval(xpt)/(Double_t)nof);
}
}
TGraph *av4 = new TGraph();
int j = 0;
for (Int_t i=0; i<nof; i++)
{
av2->GetPoint(i, xpt, ypt);
if (xpt == 0.4 || xpt == 0.5 || xpt == 0.6 || xpt == 0.75 ) {
av4->GetPoint(i, xpt, ypt);
av4->SetPoint(j, xpt, ypt + ppf[i]->Eval(xpt)/(Double_t)nof);
j++;
}
}
//=== pLotting the average on canvas ===//
gPad->SetLogy(1);
av1->SetMarkerStyle(7);
av1->SetMarkerColor(kBlue);
av1->SetMarkerSize(1);
av2->SetMarkerStyle(6);
av2->SetMarkerColor(kRed);
av2->SetMarkerSize(1);
av4->SetMarkerStyle(3);
av4->SetMarkerColor(kMagenta);
av4->SetMarkerSize(1);
TMultiGraph *mgp = new TMultiGraph();
mgp->SetMinimum(1.e-4);
mgp->SetMaximum(1.e0);
mgp->Add(av1,"PL");
mgp->Add(av2,"PL");
mgp->Add(av4,"PL");
mgp->Draw("a");
avf->SetMaximum(1.e0);
can->Modified();
can->Update();
}
please help me about this.