# DrawDerivative multiplicable with a factor?

Hi,

I have a TGraphError fed with doubles and this will be fitted via TF1. Out of this fit I need the derivative for a certain value which I obtain by fit->Derivative(). Now for the very certain derivative of the one certain value I have to multiply the result with a separate factor, like some_number=(fit->Derivative)*factor.
Next I wanna’ plot the derivative in general via fit->DrawDerivative(). Up to here it all works fine except that the derivative is plotted without the factor I have to multiply to the deriviation of the one certain fit value.

I’m not sure if you can get my point, so briefly: I would like to make use of DrawDerivative but I need to multiply a factor somehow to that derivation.

Any ideas how to do that ? Thank you very much in advance!

Hi,

You’ll need a bit of code:

``````TGraph *gr = new TGraph(fit,"d"); // That's the "Derivative" part of "DrawDerivative"
for (int i = 0, n = gr->GetN(); i < n; ++i)
gr->GetY()[i] *= factor;
gr->Draw("al"); // That's the "Draw" part of "DrawDerivative"
``````

Good?

Axel.

Hi,

yes, that works fine! Thank you very much!

Kind regards, -B