Regarding the dy/dx of the histogram

Dear Experts:
I now have a TH1 histogram with the x-axis noted as T and the y-axis noted as N. Now perform a t=a+bT transformation on x, which transforms the x-axis to t, and then perform an E=2t*t transformation, which transposes the x-axis to E. For example, a bin of the original histogram is (T0, T1), corresponding to N. and after t-transformation the bin becomes (t0, t1), and after E-transformation the bin becomes (E0, E1). Now, if I want to find dN/dE, should I use N/(E1-E0), or N/[(E1-E0)(T1-T0)], or should I use another method?
Thanks in advance.

Hi @QinLi,

Thank you for your question and welcome to the ROOT Forum.

It would be great if you can post a small snippet that could help us identify what you’re trying to achieve more clearly.

Cheers,
Dev

Hi @devajith ,
Thank you very much for your reply.
The following is my sample code. On the last line of the code, I want to calculate dN/dE. May I ask if this calculation is correct?

Instead of a photo can you post the code, so we can copy/paste and try it ?

The following is my code:

{
    TH1D* h1 = new TH1D("gauss_hist", "Gaussian Distribution;X;Counts", 4096, 0, 4096);
    for (int i = 0; i < 10000; ++i) {
        h1->Fill(gRandom->Gaus(2048, 300));
    }
    h1->Draw();

    double Tstart   = 1500;
    double Tend     = 2500;
    double BinWidth = h1->GetBinWidth(Tstart);
    Double_t T[3000], Tlow[3000], Tup[3000], N[3000], dT[3000], dN[3000] = {0};
    int nn = 0;
    for(double i = Tstart; i <= Tend; i += BinWidth){
        T[nn]    = h1->GetBinCenter(h1->FindBin(i));
        Tlow[nn] = h1->GetBinLowEdge(h1->FindBin(i));
        Tup[nn]  = Tlow[nn] + BinWidth;
        dT[nn]   = h1->GetBinWidth(h1->FindBin(i));
        N[nn]    = h1->GetBinContent(h1->FindBin(i));
        nn++;
    }
    double E[2000], dE[2000], Elow[2000], Eup[2000] = {0.0};
    double t, dt, tlow, tup = 0.0;
    double c = 2600;
    double tac = 0.2;
    for(int i = 0; i < nn; i++){
        t       = (c - T[i]) * tac;
        tlow    = (c - Tlow[i]) * tac;
        tup     = (c - Tup[i]) * tac;
        dt      = tlow -tup;
        E[i]    = 2 * t * t;
        Elow[i] = 2 * tlow * tlow;
        Eup[i]  = 2 * tup *tup;
        dE[i]   = Eup[i] - Elow[i];
        N[i]    = N[i] / dE[i]; // dN/dE?
    }
}

I am not sure to fully understand your problem.

N is your Y-axis, T your X-Axis. The value of dT you compte seems between the low edge of the bin and the upper edge of the bin but for these two values of T, N is the same. Therefore dN will be also nul. I might be wrong but, seems to me, dN sounds more like a difference between the N value of a bin i and the bin i+1 … But as I said I am not sure to fully understand what you are trying to do.