Hi,
I want to find the derivative of a histogram with respect to each point on the histogram. The following is my macro and unfortunately it doesnt works :
{
auto h1 = new TH1D(“h1”,“h1”,101.0,39.5,140.5);
auto h2 = new TH1D(“h2”,“h2”,101.0,39.5,140.5);
double amu=0;
for(long int i=0;i<100000;i++)
{
amu=gRandom->Gaus(87.52,12.);
h1->Fill( amu );
}
TF1 *myfun = h1->GetFunction(“myfun”);
for(long int i=0;i<100000;i++)
{
h2->Fill(myfun->Derivative(h1->GetBinCenter(i)));
}
auto c1 = new TCanvas(“c1”,“Without constraint”,800,600);
c1->Divide(2,1);
c1->cd(1);
h1->Draw();
c1->cd(2);
h2->Draw(“”);
}