Added frame number check, and a check that the fit range exists.
Results improve.
This commit is contained in:
486
DB_analysis.cpp
486
DB_analysis.cpp
@ -230,7 +230,7 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
int nsteps = 0;
|
||||
if (module_str == "094" || module_str == "066") {
|
||||
nsteps = 80;
|
||||
nsteps = 79;
|
||||
} else {
|
||||
nsteps = 40;
|
||||
}
|
||||
@ -258,7 +258,32 @@ int main(int argc, char* argv[]) {
|
||||
avg_adcer_g1_map[j] = new TH2F(savename,"",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
||||
}
|
||||
|
||||
int nfiles = nsteps/10;
|
||||
int nfiles = ceil(nsteps/10.);
|
||||
|
||||
// total frame number check
|
||||
int totalFrames = 0;
|
||||
|
||||
for (int filei = 0; filei < nfiles; filei++) {
|
||||
|
||||
sprintf(savename,"%s/%s_%%6.6d.dat", data_loc.c_str(), data_file.c_str());
|
||||
thisfile->open((char*)savename, filei);
|
||||
|
||||
while(thisfile->readNextFrame()) {
|
||||
totalFrames++;
|
||||
}
|
||||
|
||||
thisfile->close();
|
||||
}
|
||||
|
||||
if (totalFrames == nsteps*1000) {
|
||||
cout << "expected number of frames " << totalFrames << endl;
|
||||
} else {
|
||||
cout << "unexpected number of frames " << totalFrames << endl;
|
||||
cout << "code expected nsteps*1000 = " << nsteps*1000 << " frames" << endl;
|
||||
cout << "exiting to make sure you notice" << endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int framecounter = 0;
|
||||
for (int filei = 0; filei < nfiles; filei++) {
|
||||
|
||||
@ -402,10 +427,11 @@ int main(int argc, char* argv[]) {
|
||||
vector<double> r1_filterer;
|
||||
|
||||
for (int j = 0; j < nsteps; j++) {
|
||||
|
||||
int current = 0;
|
||||
if (nsteps == 40) {
|
||||
current = (j+1)*2;
|
||||
} else if (nsteps == 80) {
|
||||
} else if (nsteps == 79) {
|
||||
current = j+2;
|
||||
}
|
||||
|
||||
@ -431,255 +457,235 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
if (r0_adc.size() > 1 && r1_adc.size() > 1) {
|
||||
|
||||
TGraphErrors *grap_g0 = new TGraphErrors(r0_adc.size(),&(r0_filter[0]),&(r0_adc[0]),&(r0_filterer[0]),&(r0_adcer[0]));
|
||||
TGraphErrors *grap_g1 = new TGraphErrors(r1_adc.size(),&(r1_filter[0]),&(r1_adc[0]),&(r1_filterer[0]),&(r1_adcer[0]));
|
||||
|
||||
double rangemin0 = 0;
|
||||
if (module_str == "028" || module_str == "021" || module_str == "022" || module_str == "008" || module_str == "044" || module_str == "066" || module_str == "094") {
|
||||
rangemin0 = 2;
|
||||
} else if (module_str == "006") {
|
||||
rangemin0 = 4;
|
||||
}
|
||||
|
||||
double rangemin0 = *min_element(r0_filter.begin(),r0_filter.end());
|
||||
double rangemax0 = highestPointBeforeSwitching(r0_filter,r1_filter);
|
||||
range0maxhist->Fill(rangemax0);
|
||||
range0maxmap->Fill(i%NC,i/NC,rangemax0);
|
||||
|
||||
TF1 *fit1 = new TF1("fit1","[0]+[1]*x",rangemin0,rangemax0);
|
||||
TF1 *fit2 = 0;
|
||||
TF1 *fit1_e = 0;
|
||||
TF1 *fit2_e = 0;
|
||||
|
||||
fit1->SetParameter(0, 100.);
|
||||
fit1->SetParameter(1, 1);
|
||||
fit1->SetParName(0,"G0 const");
|
||||
fit1->SetParName(1,"G0 grad");
|
||||
fit1->SetLineColor(kBlue);
|
||||
grap_g0->Fit(fit1,"QR","");
|
||||
|
||||
g0map->Fill(i%NC,i/NC,fit1->GetParameter(1));
|
||||
g0ermap->Fill(i%NC,i/NC,fit1->GetParError(1));
|
||||
|
||||
fit1_e = new TF1("fit1_e","[0]+[1]*x",0,40);
|
||||
fit1_e->SetParameters(fit1->GetParameter(0),fit1->GetParameter(1));
|
||||
fit1_e->SetLineColor(kBlue);
|
||||
fit1_e->SetLineStyle(2);
|
||||
|
||||
double rangemin1 = lowestPointAfterSwitching(r1_filter,r0_filter);
|
||||
range1minhist->Fill(rangemin1);
|
||||
range1minmap->Fill(i%NC,i/NC,rangemin1);
|
||||
double rangemax1 = *max_element(r1_filter.begin(),r1_filter.end());
|
||||
|
||||
double rangemax1 = 80;
|
||||
if (rangemax0 > rangemin0 && rangemax1 > rangemin1) {
|
||||
|
||||
fit2 = new TF1("fit2","[0]+[1]*x",rangemin1,rangemax1);
|
||||
TGraphErrors *grap_g0 = new TGraphErrors(r0_adc.size(),&(r0_filter[0]),&(r0_adc[0]),&(r0_filterer[0]),&(r0_adcer[0]));
|
||||
TGraphErrors *grap_g1 = new TGraphErrors(r1_adc.size(),&(r1_filter[0]),&(r1_adc[0]),&(r1_filterer[0]),&(r1_adcer[0]));
|
||||
|
||||
fit2->SetParameter(0, 1000.);
|
||||
fit2->SetParameter(1, -0.1);
|
||||
fit2->SetParName(0,"G1 const");
|
||||
fit2->SetParName(1,"G1 grad");
|
||||
fit2->SetLineColor(kGreen+2);
|
||||
grap_g1->Fit(fit2,"QR","");
|
||||
|
||||
g1map->Fill(i%NC,i/NC,fit2->GetParameter(1));
|
||||
g1ermap->Fill(i%NC,i/NC,fit2->GetParError(1));
|
||||
|
||||
fit2_e = new TF1("fit2_e","[0]+[1]*x",0,80);
|
||||
fit2_e->SetParameters(fit2->GetParameter(0),fit2->GetParameter(1));
|
||||
fit2_e->SetLineColor(kGreen+2);
|
||||
fit2_e->SetLineStyle(2);
|
||||
|
||||
g0overg1map->Fill(i%NC,i/NC,fit1->GetParameter(1)/fit2->GetParameter(1));
|
||||
g0overg1hist->Fill(fit1->GetParameter(1)/fit2->GetParameter(1));
|
||||
g0overg1ermap->Fill(i%NC,i/NC,abs(fit1->GetParameter(1)/fit2->GetParameter(1))*sqrt(pow((fit1->GetParError(1)/fit1->GetParameter(1)),2) + pow((fit2->GetParError(1)/fit2->GetParameter(1)),2)));
|
||||
g0overg1erhist->Fill(abs(fit1->GetParameter(1)/fit2->GetParameter(1))*sqrt(pow((fit1->GetParError(1)/fit1->GetParameter(1)),2) + pow((fit2->GetParError(1)/fit2->GetParameter(1)),2)));
|
||||
|
||||
if (isEdge(i)) {
|
||||
g0overg1hist_isEdge->Fill(fit1->GetParameter(1)/fit2->GetParameter(1));
|
||||
}
|
||||
if (isInnerEdge(i)) {
|
||||
g0overg1hist_isInnerEdge->Fill(fit1->GetParameter(1)/fit2->GetParameter(1));
|
||||
}
|
||||
if (isDouble(i)) {
|
||||
g0overg1hist_isDouble->Fill(fit1->GetParameter(1)/fit2->GetParameter(1));
|
||||
}
|
||||
if (isNextToDouble(i)) {
|
||||
g0overg1hist_isNextToDouble->Fill(fit1->GetParameter(1)/fit2->GetParameter(1));
|
||||
}
|
||||
if (isQuad(i)) {
|
||||
g0overg1hist_isQuad->Fill(fit1->GetParameter(1)/fit2->GetParameter(1));
|
||||
}
|
||||
if (isBulk(i)) {
|
||||
g0overg1hist_isBulk->Fill(fit1->GetParameter(1)/fit2->GetParameter(1));
|
||||
}
|
||||
|
||||
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";
|
||||
}
|
||||
|
||||
mapcanvas->SetLeftMargin(0.13);
|
||||
mapcanvas->SetRightMargin(0.05);
|
||||
|
||||
grap_g0->SetMarkerStyle(20);
|
||||
grap_g0->SetMarkerColor(kBlue);
|
||||
grap_g0->SetLineColor(kBlue);
|
||||
grap_g1->SetMarkerStyle(20);
|
||||
grap_g1->SetMarkerColor(kGreen+2);
|
||||
grap_g1->SetLineColor(kGreen+2);
|
||||
|
||||
grap_g1->GetXaxis()->SetTitle("Tube current [mA]");
|
||||
grap_g1->GetYaxis()->SetTitle("ADC [ADU]");
|
||||
grap_g1->GetYaxis()->SetTitleOffset(0.9);
|
||||
grap_g1->GetXaxis()->SetLimits(0,85);
|
||||
grap_g1->SetMinimum(0);
|
||||
grap_g1->SetMaximum(17000);
|
||||
grap_g1->Draw("AP");
|
||||
grap_g0->Draw("P");
|
||||
fit1->Draw("same");
|
||||
fit1_e->Draw("same");
|
||||
fit2->Draw("same");
|
||||
fit2_e->Draw("same");
|
||||
mapcanvas->Update();
|
||||
|
||||
TPaveStats *st0 = (TPaveStats*)grap_g0->FindObject("stats");
|
||||
st0->SetX1NDC(0.2);
|
||||
st0->SetX2NDC(0.54);
|
||||
st0->SetY1NDC(0.18);
|
||||
st0->SetY2NDC(0.37);
|
||||
st0->SetBorderSize(0);
|
||||
st0->SetTextColor(kBlue);
|
||||
|
||||
TPaveStats *st1 = (TPaveStats*)grap_g1->FindObject("stats");
|
||||
st1->SetX1NDC(0.6);
|
||||
st1->SetX2NDC(0.94);
|
||||
st1->SetY1NDC(0.18);
|
||||
st1->SetY2NDC(0.37);
|
||||
st1->SetBorderSize(0);
|
||||
st1->SetTextColor(kGreen+2);
|
||||
|
||||
sprintf(savename,"plots/M%s/DirectBeam/graps_%s_%d_M%s.png", module_str.c_str(), pixel_type.c_str(), i, module_str.c_str());
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
|
||||
// normalise
|
||||
vector<double> r0_adc_norm;
|
||||
vector<double> r1_adc_norm;
|
||||
for (size_t j = 0; j < r0_adc.size(); j++) {
|
||||
r0_adc_norm.push_back(r0_adc[j] - fit1->Eval(r0_filter[j]));
|
||||
}
|
||||
for (size_t j = 0; j < r1_adc.size(); j++) {
|
||||
r1_adc_norm.push_back(r1_adc[j] - fit2->Eval(r1_filter[j]));
|
||||
}
|
||||
TGraphErrors *grap0_norm = new TGraphErrors(r0_adc.size(),&(r0_filter[0]),&(r0_adc_norm[0]),&(r0_filterer[0]),&(r0_adcer[0]));
|
||||
TGraphErrors *grap1_norm = new TGraphErrors(r1_adc.size(),&(r1_filter[0]),&(r1_adc_norm[0]),&(r1_filterer[0]),&(r1_adcer[0]));
|
||||
|
||||
TF1* flat_g0 = new TF1("flat_g0","0",rangemin0, rangemax0);
|
||||
TF1* flat_g1 = new TF1("flat_g1","0",rangemin1, rangemax1);
|
||||
|
||||
TF1* lin_g0_p02pc = new TF1("lin_g0_p02pc","[0]+[1]*x",rangemin0,rangemax0);
|
||||
lin_g0_p02pc->SetParameter(0,fit1->GetParameter(0)/500.);
|
||||
lin_g0_p02pc->SetParameter(1,fit1->GetParameter(1)/500.);
|
||||
lin_g0_p02pc->SetLineColor(kOrange);
|
||||
|
||||
TF1* lin_g0_p05pc = new TF1("lin_g0_p05pc","[0]+[1]*x",rangemin0,rangemax0);
|
||||
lin_g0_p05pc->SetParameter(0,fit1->GetParameter(0)/200.);
|
||||
lin_g0_p05pc->SetParameter(1,fit1->GetParameter(1)/200.);
|
||||
lin_g0_p05pc->SetLineColor(kOrange+1);
|
||||
|
||||
TF1* lin_g0_m02pc = new TF1("lin_g0_m02pc","[0]+[1]*x",rangemin0,rangemax0);
|
||||
lin_g0_m02pc->SetParameter(0,fit1->GetParameter(0)/-500.);
|
||||
lin_g0_m02pc->SetParameter(1,fit1->GetParameter(1)/-500.);
|
||||
lin_g0_m02pc->SetLineColor(kOrange);
|
||||
|
||||
TF1* lin_g0_m05pc = new TF1("lin_g0_m05pc","[0]+[1]*x",rangemin0,rangemax0);
|
||||
lin_g0_m05pc->SetParameter(0,fit1->GetParameter(0)/-200.);
|
||||
lin_g0_m05pc->SetParameter(1,fit1->GetParameter(1)/-200.);
|
||||
lin_g0_m05pc->SetLineColor(kOrange+1);
|
||||
|
||||
TF1* lin_g1_p02pc = new TF1("lin_g1_p02pc","[0]+[1]*x",rangemin1,rangemax1);
|
||||
lin_g1_p02pc->SetParameter(0,fit2->GetParameter(0)/500.);
|
||||
lin_g1_p02pc->SetParameter(1,fit2->GetParameter(1)/500.);
|
||||
lin_g1_p02pc->SetLineColor(kOrange);
|
||||
|
||||
TF1* lin_g1_p05pc = new TF1("lin_g1_p05pc","[0]+[1]*x",rangemin1,rangemax1);
|
||||
lin_g1_p05pc->SetParameter(0,fit2->GetParameter(0)/200.);
|
||||
lin_g1_p05pc->SetParameter(1,fit2->GetParameter(1)/200.);
|
||||
lin_g1_p05pc->SetLineColor(kOrange+1);
|
||||
|
||||
TF1* lin_g1_m02pc = new TF1("lin_g1_m02pc","[0]+[1]*x",rangemin1,rangemax1);
|
||||
lin_g1_m02pc->SetParameter(0,fit2->GetParameter(0)/-500.);
|
||||
lin_g1_m02pc->SetParameter(1,fit2->GetParameter(1)/-500.);
|
||||
lin_g1_m02pc->SetLineColor(kOrange);
|
||||
|
||||
TF1* lin_g1_m05pc = new TF1("lin_g1_m05pc","[0]+[1]*x",rangemin1,rangemax1);
|
||||
lin_g1_m05pc->SetParameter(0,fit2->GetParameter(0)/-200.);
|
||||
lin_g1_m05pc->SetParameter(1,fit2->GetParameter(1)/-200.);
|
||||
lin_g1_m05pc->SetLineColor(kOrange+1);
|
||||
|
||||
grap0_norm->SetMarkerColor(kBlue);
|
||||
grap0_norm->SetLineColor(kBlue);
|
||||
flat_g0->SetLineColor(kBlue);
|
||||
grap0_norm->GetXaxis()->SetTitle("Tube current [mA]");
|
||||
grap0_norm->GetYaxis()->SetTitle("Normalised ADC [ADU]");
|
||||
grap0_norm->GetYaxis()->SetTitleOffset(0.9);
|
||||
grap0_norm->Draw("AP");
|
||||
flat_g0->Draw("same");
|
||||
lin_g0_p02pc->Draw("same");
|
||||
lin_g0_p05pc->Draw("same");
|
||||
lin_g0_m02pc->Draw("same");
|
||||
lin_g0_m05pc->Draw("same");
|
||||
sprintf(savename,"plots/M%s/DirectBeam/graps_%s_%d_g0norm_M%s.png", module_str.c_str(), pixel_type.c_str(), i, module_str.c_str());
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
grap0_norm->SetMinimum(-100);
|
||||
grap0_norm->SetMaximum(100);
|
||||
sprintf(savename,"plots/M%s/DirectBeam/graps_%s_%d_g0norm_zoom_M%s.png", module_str.c_str(), pixel_type.c_str(), i, module_str.c_str());
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
|
||||
grap1_norm->SetMarkerColor(kGreen+2);
|
||||
grap1_norm->SetLineColor(kGreen+2);
|
||||
flat_g1->SetLineColor(kGreen+2);
|
||||
grap1_norm->GetXaxis()->SetTitle("Tube current [mA]");
|
||||
grap1_norm->GetYaxis()->SetTitle("Normalised ADC [ADU]");
|
||||
grap1_norm->GetYaxis()->SetTitleOffset(0.9);
|
||||
grap1_norm->Draw("AP");
|
||||
flat_g1->Draw("same");
|
||||
lin_g1_p02pc->Draw("same");
|
||||
lin_g1_p05pc->Draw("same");
|
||||
lin_g1_m02pc->Draw("same");
|
||||
lin_g1_m05pc->Draw("same");
|
||||
sprintf(savename,"plots/M%s/DirectBeam/graps_%s_%d_g1norm_M%s.png", module_str.c_str(), pixel_type.c_str(), i, module_str.c_str());
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
grap1_norm->SetMinimum(-50);
|
||||
grap1_norm->SetMaximum(50);
|
||||
sprintf(savename,"plots/M%s/DirectBeam/graps_%s_%d_g1norm_zoom_M%s.png", module_str.c_str(), pixel_type.c_str(), i, module_str.c_str());
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
|
||||
mapcanvas->SetLeftMargin(0.1);
|
||||
mapcanvas->SetRightMargin(0.13);
|
||||
}
|
||||
TF1 *fit1 = new TF1("fit1","[0]+[1]*x",rangemin0,rangemax0);
|
||||
TF1 *fit2 = 0;
|
||||
|
||||
delete fit1;
|
||||
delete fit1_e;
|
||||
delete fit2;
|
||||
delete fit2_e;
|
||||
fit1->SetParameter(0, 100.);
|
||||
fit1->SetParameter(1, 1);
|
||||
fit1->SetParName(0,"G0 const");
|
||||
fit1->SetParName(1,"G0 grad");
|
||||
fit1->SetLineColor(kBlue);
|
||||
grap_g0->Fit(fit1,"QR","");
|
||||
|
||||
g0map->Fill(i%NC,i/NC,fit1->GetParameter(1));
|
||||
g0ermap->Fill(i%NC,i/NC,fit1->GetParError(1));
|
||||
|
||||
fit2 = new TF1("fit2","[0]+[1]*x",rangemin1,rangemax1);
|
||||
|
||||
fit2->SetParameter(0, 1000.);
|
||||
fit2->SetParameter(1, -0.1);
|
||||
fit2->SetParName(0,"G1 const");
|
||||
fit2->SetParName(1,"G1 grad");
|
||||
fit2->SetLineColor(kGreen+2);
|
||||
grap_g1->Fit(fit2,"QR","");
|
||||
|
||||
g1map->Fill(i%NC,i/NC,fit2->GetParameter(1));
|
||||
g1ermap->Fill(i%NC,i/NC,fit2->GetParError(1));
|
||||
|
||||
g0overg1map->Fill(i%NC,i/NC,fit1->GetParameter(1)/fit2->GetParameter(1));
|
||||
g0overg1hist->Fill(fit1->GetParameter(1)/fit2->GetParameter(1));
|
||||
g0overg1ermap->Fill(i%NC,i/NC,abs(fit1->GetParameter(1)/fit2->GetParameter(1))*sqrt(pow((fit1->GetParError(1)/fit1->GetParameter(1)),2) + pow((fit2->GetParError(1)/fit2->GetParameter(1)),2)));
|
||||
g0overg1erhist->Fill(abs(fit1->GetParameter(1)/fit2->GetParameter(1))*sqrt(pow((fit1->GetParError(1)/fit1->GetParameter(1)),2) + pow((fit2->GetParError(1)/fit2->GetParameter(1)),2)));
|
||||
|
||||
if (isEdge(i)) {
|
||||
g0overg1hist_isEdge->Fill(fit1->GetParameter(1)/fit2->GetParameter(1));
|
||||
}
|
||||
if (isInnerEdge(i)) {
|
||||
g0overg1hist_isInnerEdge->Fill(fit1->GetParameter(1)/fit2->GetParameter(1));
|
||||
}
|
||||
if (isDouble(i)) {
|
||||
g0overg1hist_isDouble->Fill(fit1->GetParameter(1)/fit2->GetParameter(1));
|
||||
}
|
||||
if (isNextToDouble(i)) {
|
||||
g0overg1hist_isNextToDouble->Fill(fit1->GetParameter(1)/fit2->GetParameter(1));
|
||||
}
|
||||
if (isQuad(i)) {
|
||||
g0overg1hist_isQuad->Fill(fit1->GetParameter(1)/fit2->GetParameter(1));
|
||||
}
|
||||
if (isBulk(i)) {
|
||||
g0overg1hist_isBulk->Fill(fit1->GetParameter(1)/fit2->GetParameter(1));
|
||||
}
|
||||
|
||||
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";
|
||||
}
|
||||
|
||||
mapcanvas->SetLeftMargin(0.13);
|
||||
mapcanvas->SetRightMargin(0.05);
|
||||
|
||||
grap_g0->SetMarkerStyle(20);
|
||||
grap_g0->SetMarkerColor(kBlue);
|
||||
grap_g0->SetLineColor(kBlue);
|
||||
grap_g1->SetMarkerStyle(20);
|
||||
grap_g1->SetMarkerColor(kGreen+2);
|
||||
grap_g1->SetLineColor(kGreen+2);
|
||||
|
||||
grap_g1->GetXaxis()->SetTitle("Tube current [mA]");
|
||||
grap_g1->GetYaxis()->SetTitle("ADC [ADU]");
|
||||
grap_g1->GetYaxis()->SetTitleOffset(0.9);
|
||||
grap_g1->GetXaxis()->SetLimits(0,85);
|
||||
grap_g1->SetMinimum(0);
|
||||
grap_g1->SetMaximum(17000);
|
||||
grap_g1->Draw("AP");
|
||||
grap_g0->Draw("P");
|
||||
fit1->Draw("same");
|
||||
fit2->Draw("same");
|
||||
mapcanvas->Update();
|
||||
|
||||
TPaveStats *st0 = (TPaveStats*)grap_g0->FindObject("stats");
|
||||
st0->SetX1NDC(0.2);
|
||||
st0->SetX2NDC(0.54);
|
||||
st0->SetY1NDC(0.18);
|
||||
st0->SetY2NDC(0.37);
|
||||
st0->SetBorderSize(0);
|
||||
st0->SetTextColor(kBlue);
|
||||
|
||||
TPaveStats *st1 = (TPaveStats*)grap_g1->FindObject("stats");
|
||||
st1->SetX1NDC(0.6);
|
||||
st1->SetX2NDC(0.94);
|
||||
st1->SetY1NDC(0.18);
|
||||
st1->SetY2NDC(0.37);
|
||||
st1->SetBorderSize(0);
|
||||
st1->SetTextColor(kGreen+2);
|
||||
|
||||
sprintf(savename,"plots/M%s/DirectBeam/graps_%s_%d_M%s.png", module_str.c_str(), pixel_type.c_str(), i, module_str.c_str());
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
|
||||
// normalise
|
||||
vector<double> r0_adc_norm;
|
||||
vector<double> r1_adc_norm;
|
||||
for (size_t j = 0; j < r0_adc.size(); j++) {
|
||||
r0_adc_norm.push_back(r0_adc[j] - fit1->Eval(r0_filter[j]));
|
||||
}
|
||||
for (size_t j = 0; j < r1_adc.size(); j++) {
|
||||
r1_adc_norm.push_back(r1_adc[j] - fit2->Eval(r1_filter[j]));
|
||||
}
|
||||
TGraphErrors *grap0_norm = new TGraphErrors(r0_adc.size(),&(r0_filter[0]),&(r0_adc_norm[0]),&(r0_filterer[0]),&(r0_adcer[0]));
|
||||
TGraphErrors *grap1_norm = new TGraphErrors(r1_adc.size(),&(r1_filter[0]),&(r1_adc_norm[0]),&(r1_filterer[0]),&(r1_adcer[0]));
|
||||
|
||||
TF1* flat_g0 = new TF1("flat_g0","0",rangemin0, rangemax0);
|
||||
TF1* flat_g1 = new TF1("flat_g1","0",rangemin1, rangemax1);
|
||||
|
||||
TF1* lin_g0_p02pc = new TF1("lin_g0_p02pc","[0]+[1]*x",rangemin0,rangemax0);
|
||||
lin_g0_p02pc->SetParameter(0,fit1->GetParameter(0)/500.);
|
||||
lin_g0_p02pc->SetParameter(1,fit1->GetParameter(1)/500.);
|
||||
lin_g0_p02pc->SetLineColor(kOrange);
|
||||
|
||||
TF1* lin_g0_p05pc = new TF1("lin_g0_p05pc","[0]+[1]*x",rangemin0,rangemax0);
|
||||
lin_g0_p05pc->SetParameter(0,fit1->GetParameter(0)/200.);
|
||||
lin_g0_p05pc->SetParameter(1,fit1->GetParameter(1)/200.);
|
||||
lin_g0_p05pc->SetLineColor(kOrange+1);
|
||||
|
||||
TF1* lin_g0_m02pc = new TF1("lin_g0_m02pc","[0]+[1]*x",rangemin0,rangemax0);
|
||||
lin_g0_m02pc->SetParameter(0,fit1->GetParameter(0)/-500.);
|
||||
lin_g0_m02pc->SetParameter(1,fit1->GetParameter(1)/-500.);
|
||||
lin_g0_m02pc->SetLineColor(kOrange);
|
||||
|
||||
TF1* lin_g0_m05pc = new TF1("lin_g0_m05pc","[0]+[1]*x",rangemin0,rangemax0);
|
||||
lin_g0_m05pc->SetParameter(0,fit1->GetParameter(0)/-200.);
|
||||
lin_g0_m05pc->SetParameter(1,fit1->GetParameter(1)/-200.);
|
||||
lin_g0_m05pc->SetLineColor(kOrange+1);
|
||||
|
||||
TF1* lin_g1_p02pc = new TF1("lin_g1_p02pc","[0]+[1]*x",rangemin1,rangemax1);
|
||||
lin_g1_p02pc->SetParameter(0,fit2->GetParameter(0)/500.);
|
||||
lin_g1_p02pc->SetParameter(1,fit2->GetParameter(1)/500.);
|
||||
lin_g1_p02pc->SetLineColor(kOrange);
|
||||
|
||||
TF1* lin_g1_p05pc = new TF1("lin_g1_p05pc","[0]+[1]*x",rangemin1,rangemax1);
|
||||
lin_g1_p05pc->SetParameter(0,fit2->GetParameter(0)/200.);
|
||||
lin_g1_p05pc->SetParameter(1,fit2->GetParameter(1)/200.);
|
||||
lin_g1_p05pc->SetLineColor(kOrange+1);
|
||||
|
||||
TF1* lin_g1_m02pc = new TF1("lin_g1_m02pc","[0]+[1]*x",rangemin1,rangemax1);
|
||||
lin_g1_m02pc->SetParameter(0,fit2->GetParameter(0)/-500.);
|
||||
lin_g1_m02pc->SetParameter(1,fit2->GetParameter(1)/-500.);
|
||||
lin_g1_m02pc->SetLineColor(kOrange);
|
||||
|
||||
TF1* lin_g1_m05pc = new TF1("lin_g1_m05pc","[0]+[1]*x",rangemin1,rangemax1);
|
||||
lin_g1_m05pc->SetParameter(0,fit2->GetParameter(0)/-200.);
|
||||
lin_g1_m05pc->SetParameter(1,fit2->GetParameter(1)/-200.);
|
||||
lin_g1_m05pc->SetLineColor(kOrange+1);
|
||||
|
||||
grap0_norm->SetMarkerColor(kBlue);
|
||||
grap0_norm->SetLineColor(kBlue);
|
||||
flat_g0->SetLineColor(kBlue);
|
||||
grap0_norm->GetXaxis()->SetTitle("Tube current [mA]");
|
||||
grap0_norm->GetYaxis()->SetTitle("Normalised ADC [ADU]");
|
||||
grap0_norm->GetYaxis()->SetTitleOffset(0.9);
|
||||
grap0_norm->Draw("AP");
|
||||
flat_g0->Draw("same");
|
||||
lin_g0_p02pc->Draw("same");
|
||||
lin_g0_p05pc->Draw("same");
|
||||
lin_g0_m02pc->Draw("same");
|
||||
lin_g0_m05pc->Draw("same");
|
||||
sprintf(savename,"plots/M%s/DirectBeam/graps_%s_%d_g0norm_M%s.png", module_str.c_str(), pixel_type.c_str(), i, module_str.c_str());
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
grap0_norm->SetMinimum(-100);
|
||||
grap0_norm->SetMaximum(100);
|
||||
sprintf(savename,"plots/M%s/DirectBeam/graps_%s_%d_g0norm_zoom_M%s.png", module_str.c_str(), pixel_type.c_str(), i, module_str.c_str());
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
|
||||
grap1_norm->SetMarkerColor(kGreen+2);
|
||||
grap1_norm->SetLineColor(kGreen+2);
|
||||
flat_g1->SetLineColor(kGreen+2);
|
||||
grap1_norm->GetXaxis()->SetTitle("Tube current [mA]");
|
||||
grap1_norm->GetYaxis()->SetTitle("Normalised ADC [ADU]");
|
||||
grap1_norm->GetYaxis()->SetTitleOffset(0.9);
|
||||
grap1_norm->Draw("AP");
|
||||
flat_g1->Draw("same");
|
||||
lin_g1_p02pc->Draw("same");
|
||||
lin_g1_p05pc->Draw("same");
|
||||
lin_g1_m02pc->Draw("same");
|
||||
lin_g1_m05pc->Draw("same");
|
||||
sprintf(savename,"plots/M%s/DirectBeam/graps_%s_%d_g1norm_M%s.png", module_str.c_str(), pixel_type.c_str(), i, module_str.c_str());
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
grap1_norm->SetMinimum(-50);
|
||||
grap1_norm->SetMaximum(50);
|
||||
sprintf(savename,"plots/M%s/DirectBeam/graps_%s_%d_g1norm_zoom_M%s.png", module_str.c_str(), pixel_type.c_str(), i, module_str.c_str());
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
|
||||
mapcanvas->SetLeftMargin(0.1);
|
||||
mapcanvas->SetRightMargin(0.13);
|
||||
}
|
||||
|
||||
delete fit1;
|
||||
delete fit2;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user