Rev 47 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 47 | Rev 51 | ||
---|---|---|---|
Line 48... | Line 48... | ||
48 | 48 | ||
49 | TCanvas* canvas9 = new TCanvas("canvas9","canvas9", 500,500); |
49 | TCanvas* canvas9 = new TCanvas("canvas9","canvas9", 500,500); |
50 | canvas9->cd(); |
50 | canvas9->cd(); |
51 | char hname[128]; |
51 | char hname[128]; |
52 | int channel = map[chX][chY]; |
52 | int channel = map[chX][chY]; |
53 | sprintf(hname, " |
53 | sprintf(hname, "hnhitsy%d", channel); |
54 | TH1F* h_laser = (TH1F*)rootfile->Get(hname); |
54 | TH1F* h_laser = (TH1F*)rootfile->Get(hname); |
55 | h_laser->Draw(); |
55 | h_laser->Draw(); |
56 | h_laser->SetStats(1); |
56 | h_laser->SetStats(1); |
57 | 57 | ||
58 | TF1 |
58 | //TF1* err = new TF1("err","[0]+[1]*TMath::Erf((x-[2])/[3])",parameter1,parameter2); |
- | 59 | TF1* err = new TF1("err","[0]+[1]*TMath::Erf((x-[2])/[3])",h_laser->GetBinCenter(3), h_laser->GetBinCenter(h_laser->GetMaximumBin())); |
|
59 | err->SetParameter(0, |
60 | err->SetParameter(0, h_laser->GetMinimum()); |
60 | err->SetParameter(1, h_laser->GetMaximum()); |
61 | err->SetParameter(1, h_laser->GetMaximum() - h_laser->GetMinimum()); |
61 | err->SetParameter(2, h_laser->GetBinCenter(h_laser->GetMaximumBin())); |
62 | err->SetParameter(2, h_laser->GetBinCenter(h_laser->GetMaximumBin())); |
62 | err->SetParameter(3, 0. |
63 | err->SetParameter(3, 0.025); |
63 | h_laser->Fit(err,"qr"); |
64 | h_laser->Fit(err,"qr"); |
64 | h_laser->Fit(err,"lr"); |
65 | h_laser->Fit(err,"lr"); |
65 | double sigma = err->GetParameter(3); |
66 | double sigma = err->GetParameter(3); |
66 | printf("sigma = %2.0f um, FWHM = %2.0f um\n", sigma*1000, 2.35*sigma*1000); |
67 | printf("sigma = %2.0f um, FWHM = %2.0f um\n", sigma*1000, 2.35*sigma*1000); |
67 | 68 |