I tried to fit the histograms in multi pads in one canvas with a gaus function. However, the last fit overwrites the previous ones when I tried to save this canvas. Please see my simple example in attachment.
test.C (488 Bytes)
see solution below:
[code]{
char varname[100],cutname[100];
int i=0;
Double_t p0,p1,p2;
TCanvas c1 = new TCanvas(“c1”,“Gas Cerenkov ADC”,800,600);
TH1F h2 = new TH1F(“h2”,"",100,-100,100);
c1->Divide(2, 2);
while (i<4)
{
c1->cd(i+1);
sprintf(cutname,"ADC %d, pedastal",i+1);
sprintf(cutname,"ADC %d, single ph.e. peak",i+1);
h2->SetTitle(cutname);
h2->FillRandom("gaus",6000);
h2->Fit("gaus","");
h2->DrawCopy();
c1->Update();
i++;
}
}
[/code]
Rene