564 lines
25 KiB
C++
564 lines
25 KiB
C++
// file to fit fluo spectrum per pixel with Kalpha and Kalpha plus Kbeta
|
|
// and compare the differences
|
|
|
|
#include "../sls_detector_calibration/jungfrauCommonHeader.h"
|
|
#include "../sls_detector_calibration/jungfrauCommonFunctions.h"
|
|
|
|
#include "../sls_detector_calibration/jungfrauFile.C"
|
|
#include "../sls_detector_calibration/jungfrauPixelMask.C"
|
|
#include "../sls_detector_calibration/jungfrauPedestal.C"
|
|
|
|
#include "../sls_detector_calibration/energyCalibration.h"
|
|
#include "../sls_detector_calibration/energyCalibration.cpp"
|
|
|
|
#include "TGraph.h"
|
|
#include "TGraphErrors.h"
|
|
#include "TF1.h"
|
|
#include "TFile.h"
|
|
#include "TPaveStats.h"
|
|
#include "TLegend.h"
|
|
#include "TPaveText.h"
|
|
|
|
int main(int argc, char* argv[]) {
|
|
jungfrauStyle();
|
|
gStyle->SetOptFit(11);
|
|
|
|
if (argc != 3) {
|
|
cout << "Correct usage:" << endl;
|
|
cout << "arg 1: specify module number" << endl;
|
|
cout << "arg 2: specify HG0 or G0" << endl;
|
|
cout << " " << endl;
|
|
exit(1);
|
|
}
|
|
|
|
string module_str = argv[1];
|
|
string gain_str = argv[2];
|
|
|
|
char histoname[128];
|
|
char savename[128];
|
|
TCanvas* c1 = new TCanvas("c1","");
|
|
|
|
sprintf(savename,"/mnt/pcmoench_jungfrau_data/jungfrau_ana_sophie/M%s_CalibAna/CuFluo_%s_comb.root", module_str.c_str(), gain_str.c_str());
|
|
TFile* comb_file = new TFile((const char *)(savename),"READ");
|
|
|
|
jungfrauPixelMask *pixelMaskObject = new jungfrauPixelMask();
|
|
bool pixel_mask [NCH];
|
|
pixelMaskObject->initialisePixelMask(pixel_mask);
|
|
|
|
int low_ADU_peak = 0;
|
|
int high_ADU_peak = 0;
|
|
if (gain_str == "HG0") {
|
|
low_ADU_peak = 700;
|
|
high_ADU_peak = 900;
|
|
} else if (gain_str == "G0") {
|
|
low_ADU_peak = 250;
|
|
high_ADU_peak = 400;
|
|
}
|
|
|
|
TH1F* peak_Ka_fit_pos = new TH1F("peak_Ka_fit_pos","",100,low_ADU_peak,high_ADU_peak);
|
|
TH1F* peak_Ka_fit_poserr = new TH1F("peak_Ka_fit_poserr","",100,0,2);
|
|
TH2F* peak_Ka_fit_pos_2d = new TH2F("peak_Ka_fit_pos_2d","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
|
TH2F* peak_Ka_fit_poserr_2d = new TH2F("peak_Ka_fit_poserr_2d","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
|
|
|
TH1F* peak_KaKb_fit_pos = new TH1F("peak_KaKb_fit_pos","",100,low_ADU_peak,high_ADU_peak);
|
|
TH1F* peak_KaKb_fit_poserr = new TH1F("peak_KaKb_fit_poserr","",100,0,2);
|
|
TH2F* peak_KaKb_fit_pos_2d = new TH2F("peak_KaKb_fit_pos_2d","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
|
TH2F* peak_KaKb_fit_poserr_2d = new TH2F("peak_KaKb_fit_poserr_2d","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
|
|
|
TH1F* noise_fit_pos = new TH1F("noise_fit_pos","",100,-30,30);
|
|
TH1F* noise_fit_poserr = new TH1F("noise_fit_poserr","",100,0,0.1);
|
|
TH2F* noise_fit_pos_2d = new TH2F("noise_fit_pos_2d","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
|
TH2F* noise_fit_poserr_2d = new TH2F("noise_fit_poserr_2d","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
|
|
|
TH1F* gain_Ka_fit = new TH1F("gain_Ka_fit","",100,low_ADU_peak,high_ADU_peak);
|
|
TH1F* gain_Ka_fiterr = new TH1F("gain_Ka_fiterr","",100,0,2);
|
|
TH2F* gain_Ka_fit_2d = new TH2F("gain_Ka_fit_2d","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
|
TH2F* gain_Ka_fiterr_2d = new TH2F("gain_Ka_fiterr_2d","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
|
|
|
TH1F* gain_KaKb_fit = new TH1F("gain_KaKb_fit","",100,low_ADU_peak,high_ADU_peak);
|
|
TH1F* gain_KaKb_fiterr = new TH1F("gain_KaKb_fiterr","",100,0,2);
|
|
TH2F* gain_KaKb_fit_2d = new TH2F("gain_KaKb_fit_2d","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
|
TH2F* gain_KaKb_fiterr_2d = new TH2F("gain_KaKb_fiterr_2d","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
|
|
|
TH1F* gain_diff_fit = new TH1F("gain_diff_fit","",100,-10,10);
|
|
TH2F* gain_diff_fit_2d = new TH2F("gain_diff_fit_2d","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
|
|
|
int low_bin_noise = 101;
|
|
int high_bin_noise = 301;
|
|
int low_bin_peak = 0;
|
|
int high_bin_peak = 0;
|
|
if (gain_str == "HG0") {
|
|
low_bin_peak = 701;
|
|
high_bin_peak = 1200;
|
|
} else if (gain_str == "G0") {
|
|
low_bin_peak = 301;
|
|
high_bin_peak = 651;
|
|
}
|
|
|
|
for (int j=1; j<9; j++) {
|
|
cout << "slice " << j << endl;
|
|
sprintf(histoname,"adc2d_%i",j);
|
|
TH2I* adc2d_j = (TH2I*)(comb_file->Get((const char *)(histoname)));
|
|
cout << adc2d_j->GetEntries() << endl;
|
|
adc2d_j->Draw("colz");
|
|
c1->Update();
|
|
|
|
for (int i=(65536*(j-1)); i<(65536*(j)); i++) {
|
|
if (i%10000==0){cout << "another 10k" << endl;}
|
|
|
|
TH1D* proj = adc2d_j->ProjectionX("bin1",i-(65536*(j-1))+1,i-(65536*(j-1))+1);
|
|
|
|
if (proj->Integral(low_bin_noise,high_bin_noise)!=0 && proj->Integral(low_bin_peak,high_bin_peak)!=0) {
|
|
|
|
// noise
|
|
TH1D *proj_noise = dynamic_cast<TH1D*>(proj->Rebin(4,"proj_noise"));
|
|
proj_noise->SetStats(kTRUE);
|
|
proj_noise->GetXaxis()->SetRangeUser(proj->GetBinLowEdge(low_bin_noise),proj->GetBinLowEdge(high_bin_noise+1));
|
|
proj_noise->Fit("gaus","Q");
|
|
TF1 *fit = proj_noise->GetFunction("gaus");
|
|
|
|
noise_fit_pos->Fill(fit->GetParameter(1));
|
|
noise_fit_pos_2d->Fill(i%NC,i/NC,fit->GetParameter(1));
|
|
noise_fit_poserr->Fill(fit->GetParError(1));
|
|
noise_fit_poserr_2d->Fill(i%NC,i/NC,fit->GetParError(1));
|
|
|
|
// peak
|
|
TH1D *proj_peak = dynamic_cast<TH1D*>(proj->Rebin(4,"proj_peak"));
|
|
proj_peak->SetStats(kTRUE);
|
|
proj_peak->GetXaxis()->SetRangeUser(proj->GetBinLowEdge(low_bin_peak),proj->GetBinLowEdge(high_bin_peak+1));
|
|
|
|
// Ka
|
|
Double_t mypar_Ka[6];
|
|
mypar_Ka[0] = 0.0;
|
|
mypar_Ka[1] = 0.0;
|
|
mypar_Ka[2] = proj_peak->GetBinCenter(proj_peak->GetMaximumBin());
|
|
mypar_Ka[3] = 19.;
|
|
mypar_Ka[4] = proj_peak->GetBinContent(proj_peak->GetMaximumBin());
|
|
mypar_Ka[5] = 0.18;
|
|
|
|
Double_t emypar_Ka[6];
|
|
energyCalibration *thiscalibration_Ka = new energyCalibration();
|
|
int sign_Ka = 1;
|
|
thiscalibration_Ka->setScanSign(sign_Ka);
|
|
thiscalibration_Ka->setStartParametersKb(mypar_Ka);
|
|
thiscalibration_Ka->fixParameter(0,0.); // no background
|
|
thiscalibration_Ka->fixParameter(1,0.);
|
|
TF1* fittedfun_Ka = thiscalibration_Ka->fitSpectrum(proj_peak,mypar_Ka,emypar_Ka);
|
|
|
|
peak_Ka_fit_pos->Fill(mypar_Ka[2]);
|
|
peak_Ka_fit_poserr->Fill(emypar_Ka[2]);
|
|
peak_Ka_fit_pos_2d->Fill(i%NC,i/NC,mypar_Ka[2]);
|
|
peak_Ka_fit_poserr_2d->Fill(i%NC,i/NC,emypar_Ka[2]);
|
|
|
|
if ((i >= 58000 && i < 58000+10) || // bulk
|
|
(i >= 10 && i < 10+10) || // edge
|
|
(i >= 1024+10 && i < 1024+10+10) || // inner edge
|
|
(i >= (256*1024)+10 && i < (256*1024)+10+10) || // double
|
|
(i >= (257*1024)+10 && i < (257*1024)+10+10) || // next to double
|
|
(i == (255*1024)+255) // quad
|
|
) {
|
|
|
|
string pixel_type = "x";
|
|
if (i >= 58000 && i < 58000+10) {
|
|
pixel_type = "b";
|
|
} else if (i >= 10 && i < 10+10) {
|
|
pixel_type = "e";
|
|
} else if (i >= 1024+10 && i < 1024+10+10) {
|
|
pixel_type = "ie";
|
|
} else if (i >= (256*1024)+10 && i < (256*1024)+10+10) {
|
|
pixel_type = "d";
|
|
} else if (i >= (257*1024)+10 && i < (257*1024)+10+10) {
|
|
pixel_type = "ntd";
|
|
} else if (i == (255*1024)+255) {
|
|
pixel_type = "q";
|
|
}
|
|
|
|
proj_noise->Draw();
|
|
c1->Update();
|
|
proj_noise->GetXaxis()->SetTitle("Pedestal corrected ADC [ADU]");
|
|
proj_noise->GetXaxis()->SetRangeUser(-100,150);
|
|
fit->SetParNames("N_{#gamma}", "Peak pos", "Noise RMS");
|
|
TPaveStats *st0 = (TPaveStats*)proj_noise->FindObject("stats");
|
|
st0->SetX1NDC(0.53);
|
|
st0->SetX2NDC(0.94);
|
|
st0->SetY1NDC(0.75);
|
|
st0->SetY2NDC(0.94);
|
|
st0->SetBorderSize(0);
|
|
st0->SetTextSize(0.04);
|
|
sprintf(savename,"plots/M%s/CuFluo_Ka_KaKb_Comp/%s/noise_%s_%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), pixel_type.c_str(), i, gain_str.c_str(), module_str.c_str());
|
|
c1->SaveAs((const char *)(savename));
|
|
|
|
TF1 *mygaus_Ka = new TF1("mygaus_Ka","gaus",proj->GetBinLowEdge(low_bin_peak),proj->GetBinLowEdge(high_bin_peak+1));
|
|
mygaus_Ka->SetParameters(mypar_Ka[4],mypar_Ka[2],mypar_Ka[3]);
|
|
mygaus_Ka->SetLineColor(kBlue);
|
|
|
|
TF1 *mypedestal_Ka = new TF1("mypedestal_Ka","[0]-[1]*[2]*x",proj->GetBinLowEdge(low_bin_peak),proj->GetBinLowEdge(high_bin_peak+1));
|
|
mypedestal_Ka->SetParameters(mypar_Ka[0],mypar_Ka[1],sign_Ka);
|
|
mypedestal_Ka->SetLineColor(kViolet-5);
|
|
|
|
TF1 *myerfc_Ka = new TF1("myerfc_Ka","[0]/2.*(TMath::Erfc(([1]*(x-[2])/[3])/(TMath::Sqrt(2.))))",proj->GetBinLowEdge(low_bin_peak),proj->GetBinLowEdge(high_bin_peak+1));
|
|
myerfc_Ka->SetParameters(mypar_Ka[4]*mypar_Ka[5], sign_Ka, mypar_Ka[2], mypar_Ka[3]);
|
|
myerfc_Ka->SetLineColor(kOrange);
|
|
|
|
proj_peak->Draw();
|
|
fittedfun_Ka->Draw("same");
|
|
myerfc_Ka->Draw("same");
|
|
mygaus_Ka->Draw("same");
|
|
mypedestal_Ka->Draw("same");
|
|
proj_peak->SetMinimum(-10);
|
|
|
|
c1->Update();
|
|
proj_peak->GetXaxis()->SetTitle("Pedestal corrected ADC [ADU]");
|
|
fittedfun_Ka->SetParNames("Bkg height", "Bkg grad", "K_{#alpha} pos", "Noise RMS", "K_{#alpha} height", "CS");
|
|
TPaveStats *st = (TPaveStats*)proj_peak->FindObject("stats");
|
|
st->SetX1NDC(0.22);
|
|
st->SetX2NDC(0.62);
|
|
st->SetY1NDC(0.7);
|
|
st->SetY2NDC(0.94);
|
|
st->SetBorderSize(0);
|
|
st->SetTextSize(0.04);
|
|
sprintf(savename,"plots/M%s/CuFluo_Ka_KaKb_Comp/%s/peak_Ka_%s_%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), pixel_type.c_str(), i, gain_str.c_str(), module_str.c_str());
|
|
c1->SaveAs((const char *)(savename));
|
|
}
|
|
|
|
gain_Ka_fit->Fill(mypar_Ka[2] - fit->GetParameter(1));
|
|
gain_Ka_fiterr->Fill(sqrt(pow(emypar_Ka[2],2) + pow(fit->GetParError(1),2)));
|
|
gain_Ka_fit_2d->Fill(i%NC,i/NC,mypar_Ka[2] - fit->GetParameter(1));
|
|
gain_Ka_fiterr_2d->Fill(i%NC,i/NC,sqrt(pow(emypar_Ka[2],2) + pow(fit->GetParError(1),2)));
|
|
|
|
// KaKb
|
|
Double_t mypar_KaKb[8];
|
|
mypar_KaKb[0] = 0.0;
|
|
mypar_KaKb[1] = 0.0;
|
|
mypar_KaKb[2] = proj_peak->GetBinCenter(proj_peak->GetMaximumBin());
|
|
if (gain_str == "G0") {
|
|
mypar_KaKb[3] = 16.;
|
|
} else if (gain_str == "HG0") {
|
|
mypar_KaKb[3] = 29.;
|
|
}
|
|
mypar_KaKb[4] = proj_peak->GetBinContent(proj_peak->GetMaximumBin());
|
|
if (gain_str == "G0") {
|
|
mypar_KaKb[5] = 0.17;
|
|
} else if (gain_str == "HG0") {
|
|
mypar_KaKb[5] = 0.14;
|
|
}
|
|
mypar_KaKb[6] = 1.12;
|
|
if (gain_str == "G0") {
|
|
mypar_KaKb[7] = 0.12;
|
|
} else if (gain_str == "HG0") {
|
|
mypar_KaKb[7] = 0.14;
|
|
}
|
|
|
|
Double_t emypar_KaKb[8];
|
|
energyCalibration *thiscalibration_KaKb = new energyCalibration();
|
|
int sign_KaKb = 1;
|
|
thiscalibration_KaKb->setScanSign(sign_KaKb);
|
|
thiscalibration_KaKb->setStartParametersKb(mypar_KaKb);
|
|
thiscalibration_KaKb->fixParameter(0,0.); // no background
|
|
thiscalibration_KaKb->fixParameter(1,0.);
|
|
TF1* fittedfun_KaKb = thiscalibration_KaKb->fitSpectrumKb(proj_peak,mypar_KaKb,emypar_KaKb);
|
|
|
|
peak_KaKb_fit_pos->Fill(mypar_KaKb[2]);
|
|
peak_KaKb_fit_poserr->Fill(emypar_KaKb[2]);
|
|
peak_KaKb_fit_pos_2d->Fill(i%NC,i/NC,mypar_KaKb[2]);
|
|
peak_KaKb_fit_poserr_2d->Fill(i%NC,i/NC,emypar_KaKb[2]);
|
|
|
|
if ((i >= 58000 && i < 58000+10) || // bulk
|
|
(i >= 10 && i < 10+10) || // edge
|
|
(i >= 1024+10 && i < 1024+10+10) || // inner edge
|
|
(i >= (256*1024)+10 && i < (256*1024)+10+10) || // double
|
|
(i >= (257*1024)+10 && i < (257*1024)+10+10) || // next to double
|
|
(i == (255*1024)+255) // quad
|
|
) {
|
|
|
|
string pixel_type = "x";
|
|
if (i >= 58000 && i < 58000+10) {
|
|
pixel_type = "b";
|
|
} else if (i >= 10 && i < 10+10) {
|
|
pixel_type = "e";
|
|
} else if (i >= 1024+10 && i < 1024+10+10) {
|
|
pixel_type = "ie";
|
|
} else if (i >= (256*1024)+10 && i < (256*1024)+10+10) {
|
|
pixel_type = "d";
|
|
} else if (i >= (257*1024)+10 && i < (257*1024)+10+10) {
|
|
pixel_type = "ntd";
|
|
} else if (i == (255*1024)+255) {
|
|
pixel_type = "q";
|
|
}
|
|
|
|
TF1 *mygaus_KaKb = new TF1("mygaus_KaKb","gaus",proj->GetBinLowEdge(low_bin_peak),proj->GetBinLowEdge(high_bin_peak+1));
|
|
mygaus_KaKb->SetParameters(mypar_KaKb[4],mypar_KaKb[2],mypar_KaKb[3]);
|
|
mygaus_KaKb->SetLineColor(kBlue);
|
|
|
|
TF1 *mygausb_KaKb = new TF1("mygausb_KaKb","gaus",proj->GetBinLowEdge(low_bin_peak),proj->GetBinLowEdge(high_bin_peak+1));
|
|
mygausb_KaKb->SetParameters(mypar_KaKb[4]*mypar_KaKb[7],mypar_KaKb[6]*mypar_KaKb[2],mypar_KaKb[3]);
|
|
mygausb_KaKb->SetLineColor(kGreen+2);
|
|
|
|
TF1 *myerfc_KaKb = new TF1("myerfc_KaKb","[0]/2.*(TMath::Erfc(([1]*(x-[2])/[3])/(TMath::Sqrt(2.))))",proj->GetBinLowEdge(low_bin_peak),proj->GetBinLowEdge(high_bin_peak+1));
|
|
myerfc_KaKb->SetParameters(mypar_KaKb[4]*mypar_KaKb[5], sign_KaKb, mypar_KaKb[2], mypar_KaKb[3]);
|
|
myerfc_KaKb->SetLineColor(kOrange);
|
|
|
|
TF1 *myerfcb_KaKb = new TF1("myerfcb_KaKb","[0]/2.*(TMath::Erfc(([1]*(x-[2])/[3])/(TMath::Sqrt(2.))))",proj->GetBinLowEdge(low_bin_peak),proj->GetBinLowEdge(high_bin_peak+1));
|
|
myerfcb_KaKb->SetParameters(mypar_KaKb[4]*mypar_KaKb[7]*mypar_KaKb[5], sign_KaKb, mypar_KaKb[6]*mypar_KaKb[2], mypar_KaKb[3]);
|
|
myerfcb_KaKb->SetLineColor(kOrange+7);
|
|
|
|
TF1 *mypedestal_KaKb = new TF1("mypedestal_KaKb","[0]-[1]*[2]*x",proj->GetBinLowEdge(low_bin_peak),proj->GetBinLowEdge(high_bin_peak+1));
|
|
mypedestal_KaKb->SetParameters(mypar_KaKb[0],mypar_KaKb[1],sign_KaKb);
|
|
mypedestal_KaKb->SetLineColor(kViolet-5);
|
|
|
|
proj_peak->Draw();
|
|
fittedfun_KaKb->Draw("same");
|
|
mygaus_KaKb->Draw("same");
|
|
mygausb_KaKb->Draw("same");
|
|
myerfc_KaKb->Draw("same");
|
|
myerfcb_KaKb->Draw("same");
|
|
mypedestal_KaKb->Draw("same");
|
|
proj->SetMinimum(-10);
|
|
c1->Update();
|
|
proj_peak->GetXaxis()->SetTitle("Pedestal corrected ADC [ADU]");
|
|
fittedfun_KaKb->SetParNames("Bkg height", "Bkg grad", "K_{#alpha} pos", "Noise RMS", "K_{#alpha} height", "CS", "K_{#beta}/K_{#alpha} pos", "K_{#beta} frac");
|
|
TPaveStats *st = (TPaveStats*)proj_peak->FindObject("stats");
|
|
st->SetX1NDC(0.22);
|
|
st->SetX2NDC(0.62);
|
|
st->SetY1NDC(0.7);
|
|
st->SetY2NDC(0.94);
|
|
st->SetBorderSize(0);
|
|
st->SetTextSize(0.04);
|
|
sprintf(savename,"plots/M%s/CuFluo_Ka_KaKb_Comp/%s/peak_KaKb_%s_%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), pixel_type.c_str(), i, gain_str.c_str(), module_str.c_str());
|
|
c1->SaveAs((const char *)(savename));
|
|
}
|
|
|
|
gain_KaKb_fit->Fill(mypar_KaKb[2] - fit->GetParameter(1));
|
|
gain_KaKb_fiterr->Fill(sqrt(pow(emypar_KaKb[2],2) + pow(fit->GetParError(1),2)));
|
|
gain_KaKb_fit_2d->Fill(i%NC,i/NC,mypar_KaKb[2] - fit->GetParameter(1));
|
|
gain_KaKb_fiterr_2d->Fill(i%NC,i/NC,sqrt(pow(emypar_KaKb[2],2) + pow(fit->GetParError(1),2)));
|
|
|
|
gain_diff_fit->Fill(mypar_KaKb[2] - mypar_Ka[2]);
|
|
gain_diff_fit_2d->Fill(i%NC,i/NC,mypar_KaKb[2] - mypar_Ka[2]);
|
|
|
|
delete thiscalibration_Ka;
|
|
delete thiscalibration_KaKb;
|
|
delete proj_noise;
|
|
delete proj_peak;
|
|
delete proj;
|
|
|
|
} else {
|
|
pixel_mask[i] = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
sprintf(savename,"plots/M%s/CuFluo_Ka_KaKb_Comp/%s/pixelmask_afterfit_%s_M%s.png", module_str.c_str(), gain_str.c_str(), gain_str.c_str(), module_str.c_str());
|
|
pixelMaskObject->plotPixelMask(pixel_mask,savename);
|
|
|
|
TCanvas *mapcanvas = new TCanvas("mapcanvas","",150,10,800,400);
|
|
mapcanvas->SetLeftMargin(0.1);
|
|
mapcanvas->SetRightMargin(0.13);
|
|
mapcanvas->SetTopMargin(0.08);
|
|
mapcanvas->SetBottomMargin(0.15);
|
|
|
|
TPaveText *pave = new TPaveText(0.86,0.95,0.91,0.98,"blNDC");
|
|
pave->SetBorderSize(0);
|
|
pave->SetFillStyle(0);
|
|
pave->SetTextSize(0.06);
|
|
pave->SetTextAlign(32);
|
|
|
|
peak_Ka_fit_pos_2d->GetXaxis()->SetTitle("Column");
|
|
peak_Ka_fit_pos_2d->GetYaxis()->SetTitle("Row");
|
|
peak_Ka_fit_pos_2d->GetYaxis()->SetTitleOffset(0.7);
|
|
peak_Ka_fit_pos_2d->Draw("colz");
|
|
peak_Ka_fit_pos_2d->GetZaxis()->SetRangeUser(low_ADU_peak,high_ADU_peak);
|
|
sprintf(savename,"plots/M%s/CuFluo_Ka_KaKb_Comp/%s/peak_Ka_fit_pos_2d_%s_M%s.png",module_str.c_str(), gain_str.c_str(), gain_str.c_str(), module_str.c_str());
|
|
mapcanvas->SaveAs((const char *)(savename));
|
|
|
|
peak_Ka_fit_poserr_2d->GetXaxis()->SetTitle("Column");
|
|
peak_Ka_fit_poserr_2d->GetYaxis()->SetTitle("Row");
|
|
peak_Ka_fit_poserr_2d->GetYaxis()->SetTitleOffset(0.7);
|
|
peak_Ka_fit_poserr_2d->Draw("colz");
|
|
peak_Ka_fit_poserr_2d->GetZaxis()->SetRangeUser(0,2);
|
|
sprintf(savename,"plots/M%s/CuFluo_Ka_KaKb_Comp/%s/peak_Ka_fit_poserr_2d_%s_M%s.png",module_str.c_str(), gain_str.c_str(), gain_str.c_str(), module_str.c_str());
|
|
mapcanvas->SaveAs((const char *)(savename));
|
|
|
|
peak_KaKb_fit_pos_2d->GetXaxis()->SetTitle("Column");
|
|
peak_KaKb_fit_pos_2d->GetYaxis()->SetTitle("Row");
|
|
peak_KaKb_fit_pos_2d->GetYaxis()->SetTitleOffset(0.7);
|
|
peak_KaKb_fit_pos_2d->Draw("colz");
|
|
peak_KaKb_fit_pos_2d->GetZaxis()->SetRangeUser(low_ADU_peak,high_ADU_peak);
|
|
sprintf(savename,"plots/M%s/CuFluo_Ka_KaKb_Comp/%s/peak_KaKb_fit_pos_2d_%s_M%s.png",module_str.c_str(), gain_str.c_str(), gain_str.c_str(), module_str.c_str());
|
|
mapcanvas->SaveAs((const char *)(savename));
|
|
|
|
peak_KaKb_fit_poserr_2d->GetXaxis()->SetTitle("Column");
|
|
peak_KaKb_fit_poserr_2d->GetYaxis()->SetTitle("Row");
|
|
peak_KaKb_fit_poserr_2d->GetYaxis()->SetTitleOffset(0.7);
|
|
peak_KaKb_fit_poserr_2d->Draw("colz");
|
|
peak_KaKb_fit_poserr_2d->GetZaxis()->SetRangeUser(0,2);
|
|
sprintf(savename,"plots/M%s/CuFluo_Ka_KaKb_Comp/%s/peak_KaKb_fit_poserr_2d_%s_M%s.png",module_str.c_str(), gain_str.c_str(), gain_str.c_str(), module_str.c_str());
|
|
mapcanvas->SaveAs((const char *)(savename));
|
|
|
|
noise_fit_pos_2d->GetXaxis()->SetTitle("Column");
|
|
noise_fit_pos_2d->GetYaxis()->SetTitle("Row");
|
|
noise_fit_pos_2d->GetYaxis()->SetTitleOffset(0.7);
|
|
noise_fit_pos_2d->Draw("colz");
|
|
noise_fit_pos_2d->GetZaxis()->SetRangeUser(-30,30);
|
|
sprintf(savename,"plots/M%s/CuFluo_Ka_KaKb_Comp/%s/noise_fit_pos_2d_%s_M%s.png",module_str.c_str(), gain_str.c_str(), gain_str.c_str(), module_str.c_str());
|
|
mapcanvas->SaveAs((const char *)(savename));
|
|
|
|
noise_fit_poserr_2d->GetXaxis()->SetTitle("Column");
|
|
noise_fit_poserr_2d->GetYaxis()->SetTitle("Row");
|
|
noise_fit_poserr_2d->GetYaxis()->SetTitleOffset(0.7);
|
|
noise_fit_poserr_2d->Draw("colz");
|
|
if (gain_str == "HG0") {
|
|
noise_fit_poserr_2d->GetZaxis()->SetRangeUser(0,0.1);
|
|
} else if (gain_str == "G0") {
|
|
noise_fit_poserr_2d->GetZaxis()->SetRangeUser(0,0.05);
|
|
}
|
|
sprintf(savename,"plots/M%s/CuFluo_Ka_KaKb_Comp/%s/noise_fit_poserr_2d_%s_M%s.png",module_str.c_str(), gain_str.c_str(), gain_str.c_str(), module_str.c_str());
|
|
mapcanvas->SaveAs((const char *)(savename));
|
|
|
|
gain_Ka_fit_2d->GetXaxis()->SetTitle("Column");
|
|
gain_Ka_fit_2d->GetYaxis()->SetTitle("Row");
|
|
gain_Ka_fit_2d->GetYaxis()->SetTitleOffset(0.7);
|
|
gain_Ka_fit_2d->Draw("colz");
|
|
sprintf(savename,"%s [ADU/8 keV]", gain_str.c_str());
|
|
pave->AddText((const char *)(savename));
|
|
pave->Draw();
|
|
gain_Ka_fit_2d->GetZaxis()->SetRangeUser(low_ADU_peak,high_ADU_peak);
|
|
sprintf(savename,"plots/M%s/CuFluo_Ka_KaKb_Comp/%s/gain_Ka_fit_2d_%s_M%s.png",module_str.c_str(), gain_str.c_str(), gain_str.c_str(), module_str.c_str());
|
|
mapcanvas->SaveAs((const char *)(savename));
|
|
|
|
gain_Ka_fiterr_2d->GetXaxis()->SetTitle("Column");
|
|
gain_Ka_fiterr_2d->GetYaxis()->SetTitle("Row");
|
|
gain_Ka_fiterr_2d->GetYaxis()->SetTitleOffset(0.7);
|
|
gain_Ka_fiterr_2d->Draw("colz");
|
|
gain_Ka_fiterr_2d->GetZaxis()->SetRangeUser(0,2);
|
|
sprintf(savename,"plots/M%s/CuFluo_Ka_KaKb_Comp/%s/gain_Ka_fiterr_2d_%s_M%s.png",module_str.c_str(), gain_str.c_str(), gain_str.c_str(), module_str.c_str());
|
|
mapcanvas->SaveAs((const char *)(savename));
|
|
|
|
gain_KaKb_fit_2d->GetXaxis()->SetTitle("Column");
|
|
gain_KaKb_fit_2d->GetYaxis()->SetTitle("Row");
|
|
gain_KaKb_fit_2d->GetYaxis()->SetTitleOffset(0.7);
|
|
gain_KaKb_fit_2d->Draw("colz");
|
|
sprintf(savename,"%s [ADU/8 keV]", gain_str.c_str());
|
|
pave->Clear();
|
|
pave->AddText((const char *)(savename));
|
|
pave->Draw();
|
|
gain_KaKb_fit_2d->GetZaxis()->SetRangeUser(low_ADU_peak,high_ADU_peak);
|
|
sprintf(savename,"plots/M%s/CuFluo_Ka_KaKb_Comp/%s/gain_KaKb_fit_2d_%s_M%s.png",module_str.c_str(), gain_str.c_str(), gain_str.c_str(), module_str.c_str());
|
|
mapcanvas->SaveAs((const char *)(savename));
|
|
|
|
gain_KaKb_fiterr_2d->GetXaxis()->SetTitle("Column");
|
|
gain_KaKb_fiterr_2d->GetYaxis()->SetTitle("Row");
|
|
gain_KaKb_fiterr_2d->GetYaxis()->SetTitleOffset(0.7);
|
|
gain_KaKb_fiterr_2d->Draw("colz");
|
|
gain_KaKb_fiterr_2d->GetZaxis()->SetRangeUser(0,2);
|
|
sprintf(savename,"plots/M%s/CuFluo_Ka_KaKb_Comp/%s/gain_KaKb_fiterr_2d_%s_M%s.png",module_str.c_str(), gain_str.c_str(), gain_str.c_str(), module_str.c_str());
|
|
mapcanvas->SaveAs((const char *)(savename));
|
|
|
|
gain_diff_fit_2d->GetXaxis()->SetTitle("Column");
|
|
gain_diff_fit_2d->GetYaxis()->SetTitle("Row");
|
|
gain_diff_fit_2d->GetYaxis()->SetTitleOffset(0.7);
|
|
gain_diff_fit_2d->Draw("colz");
|
|
sprintf(savename,"%s diff [ADU]", gain_str.c_str());
|
|
pave->Clear();
|
|
pave->AddText((const char *)(savename));
|
|
pave->Draw();
|
|
gain_diff_fit_2d->GetZaxis()->SetRangeUser(-10,10);
|
|
sprintf(savename,"plots/M%s/CuFluo_Ka_KaKb_Comp/%s/gain_diff_fit_2d_%s_M%s.png",module_str.c_str(), gain_str.c_str(), gain_str.c_str(), module_str.c_str());
|
|
mapcanvas->SaveAs((const char *)(savename));
|
|
|
|
c1->cd();
|
|
|
|
peak_Ka_fit_pos->GetXaxis()->SetTitle("Peak position [ADU]");
|
|
peak_Ka_fit_pos->Draw();
|
|
sprintf(savename,"plots/M%s/CuFluo_Ka_KaKb_Comp/%s/peak_Ka_fit_pos_%s_M%s.png",module_str.c_str(), gain_str.c_str(), gain_str.c_str(), module_str.c_str());
|
|
c1->SaveAs((const char *)(savename));
|
|
|
|
peak_Ka_fit_poserr->GetXaxis()->SetTitle("Peak position uncert [ADU]");
|
|
peak_Ka_fit_poserr->Draw();
|
|
sprintf(savename,"plots/M%s/CuFluo_Ka_KaKb_Comp/%s/peak_Ka_fit_poserr_%s_M%s.png",module_str.c_str(), gain_str.c_str(), gain_str.c_str(), module_str.c_str());
|
|
c1->SaveAs((const char *)(savename));
|
|
|
|
peak_KaKb_fit_pos->GetXaxis()->SetTitle("Peak position [ADU]");
|
|
peak_KaKb_fit_pos->Draw();
|
|
sprintf(savename,"plots/M%s/CuFluo_Ka_KaKb_Comp/%s/peak_KaKb_fit_pos_%s_M%s.png",module_str.c_str(), gain_str.c_str(), gain_str.c_str(), module_str.c_str());
|
|
c1->SaveAs((const char *)(savename));
|
|
|
|
peak_KaKb_fit_poserr->GetXaxis()->SetTitle("Peak position uncert [ADU]");
|
|
peak_KaKb_fit_poserr->Draw();
|
|
sprintf(savename,"plots/M%s/CuFluo_Ka_KaKb_Comp/%s/peak_KaKb_fit_poserr_%s_M%s.png",module_str.c_str(), gain_str.c_str(), gain_str.c_str(), module_str.c_str());
|
|
c1->SaveAs((const char *)(savename));
|
|
|
|
noise_fit_pos->GetXaxis()->SetTitle("Noise position [ADU]");
|
|
noise_fit_pos->Draw();
|
|
sprintf(savename,"plots/M%s/CuFluo_Ka_KaKb_Comp/%s/noise_fit_pos_%s_M%s.png",module_str.c_str(), gain_str.c_str(), gain_str.c_str(), module_str.c_str());
|
|
c1->SaveAs((const char *)(savename));
|
|
|
|
noise_fit_poserr->GetXaxis()->SetTitle("Noise position uncert [ADU]");
|
|
noise_fit_poserr->Draw();
|
|
sprintf(savename,"plots/M%s/CuFluo_Ka_KaKb_Comp/%s/noise_fit_poserr_%s_M%s.png",module_str.c_str(), gain_str.c_str(), gain_str.c_str(), module_str.c_str());
|
|
c1->SaveAs((const char *)(savename));
|
|
|
|
sprintf(savename,"Gain %s [ADU / 8 keV]", gain_str.c_str());
|
|
gain_Ka_fit->GetXaxis()->SetTitle((const char *)(savename));
|
|
gain_Ka_fit->Draw();
|
|
sprintf(savename,"plots/M%s/CuFluo_Ka_KaKb_Comp/%s/gain_Ka_fit_%s_M%s.png",module_str.c_str(), gain_str.c_str(), gain_str.c_str(), module_str.c_str());
|
|
c1->SaveAs((const char *)(savename));
|
|
|
|
gain_Ka_fit->GetXaxis()->SetRangeUser(low_ADU_peak+30, high_ADU_peak);
|
|
gain_Ka_fit->Fit("gaus");
|
|
gain_Ka_fit->Draw();
|
|
c1->Update();
|
|
TPaveText *pave2 = new TPaveText(0.6,0.8,0.94,0.94,"blNDC");
|
|
pave2->SetBorderSize(0);
|
|
pave2->SetFillStyle(0);
|
|
pave2->SetTextSize(0.04);
|
|
pave2->SetTextAlign(32);
|
|
TF1* gain_Ka_fit_gaus = gain_Ka_fit->GetFunction("gaus");
|
|
sprintf(savename,"Mean %0.2f #pm %0.2f", gain_Ka_fit_gaus->GetParameter(1), gain_Ka_fit_gaus->GetParError(1));
|
|
pave2->AddText((const char *)(savename));
|
|
sprintf(savename,"Sigma %0.2f #pm %0.2f", gain_Ka_fit_gaus->GetParameter(2), gain_Ka_fit_gaus->GetParError(2));
|
|
pave2->AddText((const char *)(savename));
|
|
pave2->Draw();
|
|
gain_Ka_fit->SetStats(kFALSE);
|
|
sprintf(savename,"plots/M%s/CuFluo_Ka_KaKb_Comp/%s/gain_Ka_fit_fit_%s_M%s.png",module_str.c_str(), gain_str.c_str(), gain_str.c_str(), module_str.c_str());
|
|
c1->SaveAs((const char *)(savename));
|
|
|
|
gain_Ka_fiterr->GetXaxis()->SetTitle("Gain uncert [ADU / 8 keV]");
|
|
gain_Ka_fiterr->Draw();
|
|
sprintf(savename,"plots/M%s/CuFluo_Ka_KaKb_Comp/%s/gain_Ka_fiterr_%s_M%s.png",module_str.c_str(), gain_str.c_str(), gain_str.c_str(), module_str.c_str());
|
|
c1->SaveAs((const char *)(savename));
|
|
|
|
sprintf(savename,"Gain %s [ADU / 8 keV]", gain_str.c_str());
|
|
gain_KaKb_fit->GetXaxis()->SetTitle((const char *)(savename));
|
|
gain_KaKb_fit->Draw();
|
|
sprintf(savename,"plots/M%s/CuFluo_Ka_KaKb_Comp/%s/gain_KaKb_fit_%s_M%s.png",module_str.c_str(), gain_str.c_str(), gain_str.c_str(), module_str.c_str());
|
|
c1->SaveAs((const char *)(savename));
|
|
|
|
gain_KaKb_fit->GetXaxis()->SetRangeUser(low_ADU_peak+30, high_ADU_peak);
|
|
gain_KaKb_fit->Fit("gaus");
|
|
gain_KaKb_fit->Draw();
|
|
c1->Update();
|
|
pave2->Clear();
|
|
TF1* gain_KaKb_fit_gaus = gain_KaKb_fit->GetFunction("gaus");
|
|
sprintf(savename,"Mean %0.2f #pm %0.2f", gain_KaKb_fit_gaus->GetParameter(1), gain_KaKb_fit_gaus->GetParError(1));
|
|
pave2->AddText((const char *)(savename));
|
|
sprintf(savename,"Sigma %0.2f #pm %0.2f", gain_KaKb_fit_gaus->GetParameter(2), gain_KaKb_fit_gaus->GetParError(2));
|
|
pave2->AddText((const char *)(savename));
|
|
pave2->Draw();
|
|
gain_KaKb_fit->SetStats(kFALSE);
|
|
sprintf(savename,"plots/M%s/CuFluo_Ka_KaKb_Comp/%s/gain_KaKb_fit_fit_%s_M%s.png",module_str.c_str(), gain_str.c_str(), gain_str.c_str(), module_str.c_str());
|
|
c1->SaveAs((const char *)(savename));
|
|
|
|
gain_KaKb_fiterr->GetXaxis()->SetTitle("Gain uncert [ADU / 8 keV]");
|
|
gain_KaKb_fiterr->Draw();
|
|
sprintf(savename,"plots/M%s/CuFluo_Ka_KaKb_Comp/%s/gain_KaKb_fiterr_%s_M%s.png",module_str.c_str(), gain_str.c_str(), gain_str.c_str(), module_str.c_str());
|
|
c1->SaveAs((const char *)(savename));
|
|
|
|
sprintf(savename,"%s K_{#alpha} diff [ADU]", gain_str.c_str());
|
|
gain_diff_fit->GetXaxis()->SetTitle((const char *)(savename));
|
|
gain_diff_fit->Draw();
|
|
sprintf(savename,"plots/M%s/CuFluo_Ka_KaKb_Comp/%s/gain_diff_fit_%s_M%s.png",module_str.c_str(), gain_str.c_str(), gain_str.c_str(), module_str.c_str());
|
|
c1->SaveAs((const char *)(savename));
|
|
|
|
}
|