Hi,
I am trying to write a macro to obtain a histogram displaying the integrals of a large number of waveforms I have plotted using a function in the macro called “histWaveform”.
TH1F* histintegral = new TH1F("integral","integralspectrum; x value; y value", 100,-100,0);
TCanvas* canvas = new TCanvas("spectrum","spectrum",1000,800);
canvas->cd();
TLegend* leg = new TLegend(0.44,0.72,0.87,0.82);
leg-> SetTextSize(0.028);
leg-> SetFillColor(0);
histintegral-> Draw();
TH1F* waveIntegration (TH1F* histWaveform){
double xmin = 0;
double xmax = 4;
TAxis *axis = histWaveform->GetXaxis();
int bmin = axis->FindBin(xmin);
int bmax = axis->FindBin(xmax);
integral = (double) histWaveform->Integral(bmin,bmax);
//printf("Number of DatPoints %d\n",bmax-bmin );
printf(" %f\n", -integral);
//integral -> cd()
return integral;
}
Please do you have any suggestions?
Thanks!