Added size check to range finder functions and better plotting.
Results unchanged.
This commit is contained in:
505
BP_analysis.cpp
505
BP_analysis.cpp
@ -16,16 +16,22 @@
|
||||
|
||||
double highestPointBeforeSwitching(const vector<double> &lower_filter, const vector<double> &higher_filter) {
|
||||
|
||||
// find the highest value in lower_filter that is lower than all entries in higher_filter
|
||||
double highest_point_before_switching = *min_element(lower_filter.begin(),lower_filter.end())-1;
|
||||
double highest_point_before_switching;
|
||||
|
||||
double lowest_entry_in_higher_filter = *min_element(higher_filter.begin(),higher_filter.end());
|
||||
for(vector<double>::const_iterator it = lower_filter.begin(); it != lower_filter.end(); ++it) {
|
||||
if (*it < lowest_entry_in_higher_filter) {
|
||||
if (*it > highest_point_before_switching) {
|
||||
highest_point_before_switching = *it;
|
||||
if (higher_filter.size() > 0) {
|
||||
// find the highest value in lower_filter that is lower than all entries in higher_filter
|
||||
highest_point_before_switching = *min_element(lower_filter.begin(),lower_filter.end())-1;
|
||||
|
||||
double lowest_entry_in_higher_filter = *min_element(higher_filter.begin(),higher_filter.end());
|
||||
for(vector<double>::const_iterator it = lower_filter.begin(); it != lower_filter.end(); ++it) {
|
||||
if (*it < lowest_entry_in_higher_filter) {
|
||||
if (*it > highest_point_before_switching) {
|
||||
highest_point_before_switching = *it;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
highest_point_before_switching = *max_element(lower_filter.begin(),lower_filter.end());
|
||||
}
|
||||
|
||||
return highest_point_before_switching;
|
||||
@ -34,16 +40,22 @@ double highestPointBeforeSwitching(const vector<double> &lower_filter, const vec
|
||||
|
||||
double lowestPointAfterSwitching(const vector<double> &higher_filter, const vector<double> &lower_filter) {
|
||||
|
||||
// find the lowest value in higher_filter that is higher than all entries in lower_filter
|
||||
double lowest_point_after_switching = *max_element(higher_filter.begin(),higher_filter.end())+1;
|
||||
double lowest_point_after_switching;
|
||||
|
||||
double highest_entry_in_lower_filter = *max_element(lower_filter.begin(),lower_filter.end());
|
||||
for(vector<double>::const_iterator it = higher_filter.begin(); it != higher_filter.end(); ++it) {
|
||||
if (*it > highest_entry_in_lower_filter) {
|
||||
if (*it < lowest_point_after_switching) {
|
||||
lowest_point_after_switching = *it;
|
||||
if (lower_filter.size() > 0) {
|
||||
// find the lowest value in higher_filter that is higher than all entries in lower_filter
|
||||
lowest_point_after_switching = *max_element(higher_filter.begin(),higher_filter.end())+1;
|
||||
|
||||
double highest_entry_in_lower_filter = *max_element(lower_filter.begin(),lower_filter.end());
|
||||
for(vector<double>::const_iterator it = higher_filter.begin(); it != higher_filter.end(); ++it) {
|
||||
if (*it > highest_entry_in_lower_filter) {
|
||||
if (*it < lowest_point_after_switching) {
|
||||
lowest_point_after_switching = *it;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
lowest_point_after_switching = *min_element(higher_filter.begin(),higher_filter.end());
|
||||
}
|
||||
|
||||
return lowest_point_after_switching;
|
||||
@ -172,6 +184,24 @@ int main(int argc, char* argv[]) {
|
||||
TH2F* g1_const_map = new TH2F("g1_const_map","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
||||
TH2F* g1_conster_map = new TH2F("g1_conster_map","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
||||
|
||||
TH1F* g0overg1_hist = new TH1F("g0overg1_hist","",100,-34,-24);
|
||||
TH1F* g0overg1er_hist = 0;
|
||||
if (module_str == "006") {
|
||||
g0overg1er_hist = new TH1F("g0overg1er_hist","",100,0,0.01);
|
||||
} else {
|
||||
g0overg1er_hist = new TH1F("g0overg1er_hist","",100,0,0.001);
|
||||
}
|
||||
|
||||
TH1F* g0overg1_hist_isEdge = new TH1F("g0overg1_hist_isEdge","",100,-34,-24);
|
||||
TH1F* g0overg1_hist_isInnerEdge = new TH1F("g0overg1_hist_isInnerEdge","",100,-34,-24);
|
||||
TH1F* g0overg1_hist_isDouble = new TH1F("g0overg1_hist_isDouble","",100,-34,-24);
|
||||
TH1F* g0overg1_hist_isNextToDouble = new TH1F("g0overg1_hist_isNextToDouble","",100,-34,-24);
|
||||
TH1F* g0overg1_hist_isQuad = new TH1F("g0overg1_hist_isQuad","",100,-34,-24);
|
||||
TH1F* g0overg1_hist_isBulk = new TH1F("g0overg1_hist_isBulk","",100,-34,-24);
|
||||
|
||||
TH2F* g0overg1_map = new TH2F("g0overg1_map","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
||||
TH2F* g0overg1er_map = new TH2F("g0overg1er_map","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
||||
|
||||
if (createHistos == 1) {
|
||||
|
||||
for (int j = 0; j < 220; j++) {
|
||||
@ -354,34 +384,91 @@ int main(int argc, char* argv[]) {
|
||||
}
|
||||
}
|
||||
|
||||
if (r0_adc.size() > 1 && r1_adc.size() > 1) {
|
||||
TGraphErrors *grap0 = 0;
|
||||
TGraphErrors *grap1 = 0;
|
||||
|
||||
double g0max = highestPointBeforeSwitching(r0_filter,r1_filter);
|
||||
double g1min = lowestPointAfterSwitching(r1_filter,r0_filter);
|
||||
TF1 *g0_fit = 0;
|
||||
TF1 *g1_fit = 0;
|
||||
|
||||
int data_in_range_g0 = 0;
|
||||
for (size_t j = 0; j < r0_filter.size(); j++) {
|
||||
if (r0_filter[j] >= 0 && r0_filter[j] <= g0max) {
|
||||
data_in_range_g0++;
|
||||
double g0min = 0;
|
||||
double g0max = 0;
|
||||
double g1min = 0;
|
||||
double g1max = 0;
|
||||
|
||||
// define graphs
|
||||
if (r0_adc.size() > 1) {
|
||||
grap0 = new TGraphErrors(r0_adc.size(),&(r0_filter[0]),&(r0_adc[0]),&(r0_ferr[0]),&(r0_adcerr[0]));
|
||||
grap0->SetMarkerStyle(20);
|
||||
grap0->SetMarkerColor(kBlue);
|
||||
grap0->SetLineColor(kBlue);
|
||||
}
|
||||
|
||||
if (r1_adc.size() > 1) {
|
||||
grap1 = new TGraphErrors(r1_adc.size(),&(r1_filter[0]),&(r1_adc[0]),&(r1_ferr[0]),&(r1_adcerr[0]));
|
||||
grap1->SetMarkerStyle(20);
|
||||
grap1->SetMarkerColor(kGreen+2);
|
||||
grap1->SetLineColor(kGreen+2);
|
||||
}
|
||||
|
||||
// plot the datapoints
|
||||
if (r1_adc.size() > 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";
|
||||
}
|
||||
}
|
||||
int data_in_range_g1 = 0;
|
||||
for (size_t j = 0; j < r1_filter.size(); j++) {
|
||||
if (r1_filter[j] >= g1min && r1_filter[j] <= 7000) {
|
||||
data_in_range_g1++;
|
||||
|
||||
mapcanvas->SetLeftMargin(0.13);
|
||||
mapcanvas->SetRightMargin(0.05);
|
||||
|
||||
grap1->GetXaxis()->SetTitle("Signal generator voltage [mV]");
|
||||
grap1->GetYaxis()->SetTitle("ADC [ADU]");
|
||||
grap1->GetYaxis()->SetTitleOffset(0.9);
|
||||
grap1->SetMinimum(1000);
|
||||
grap1->SetMaximum(15000);
|
||||
grap1->GetXaxis()->SetLimits(0,7200);
|
||||
grap1->Draw("AP");
|
||||
if (r0_adc.size() > 1) {
|
||||
grap0->Draw("P");
|
||||
}
|
||||
mapcanvas->Update();
|
||||
sprintf(savename,"plots/M%s/BackplanePulsing/pixel_%s_%d_M%s.png", module_str.c_str(), pixel_type.c_str(), i, module_str.c_str());
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (data_in_range_g0 > 1 && data_in_range_g1 > 1) {
|
||||
// define fit ranges and fit
|
||||
if (r0_adc.size() > 1) {
|
||||
|
||||
TGraphErrors *grap0 = new TGraphErrors(r0_adc.size(),&(r0_filter[0]),&(r0_adc[0]),&(r0_ferr[0]),&(r0_adcerr[0]));
|
||||
TGraphErrors *grap1 = new TGraphErrors(r1_adc.size(),&(r1_filter[0]),&(r1_adc[0]),&(r1_ferr[0]),&(r1_adcerr[0]));
|
||||
g0min = *min_element(r0_filter.begin(),r0_filter.end());
|
||||
g0max = highestPointBeforeSwitching(r0_filter,r1_filter);
|
||||
|
||||
grap0->Fit("pol1","QRC","",0,g0max);
|
||||
TF1 *g0_fit = (TF1*) grap0->GetFunction("pol1");
|
||||
if (g0max > g0min) {
|
||||
|
||||
grap1->Fit("pol1","QRC","",g1min,7000);
|
||||
TF1 *g1_fit = (TF1*) grap1->GetFunction("pol1");
|
||||
grap0->Fit("pol1","QRC","",g0min,g0max);
|
||||
g0_fit = (TF1*) grap0->GetFunction("pol1");
|
||||
g0_fit->SetLineColor(kBlue);
|
||||
g0_fit->SetParName(0,"G0 const");
|
||||
g0_fit->SetParName(1,"G0 grad");
|
||||
|
||||
g0_grad_hist->Fill(g0_fit->GetParameter(1));
|
||||
g0_grader_hist->Fill(g0_fit->GetParError(1));
|
||||
@ -392,6 +479,132 @@ int main(int argc, char* argv[]) {
|
||||
g0_const_map->Fill(i%NC,i/NC,g0_fit->GetParameter(0));
|
||||
g0_conster_map->Fill(i%NC,i/NC,g0_fit->GetParError(0));
|
||||
|
||||
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);
|
||||
|
||||
grap0->GetXaxis()->SetTitle("Signal generator voltage [mV]");
|
||||
grap0->GetYaxis()->SetTitle("ADC [ADU]");
|
||||
grap0->GetYaxis()->SetTitleOffset(0.9);
|
||||
grap0->SetMinimum(1000);
|
||||
grap0->SetMaximum(15000);
|
||||
grap0->GetXaxis()->SetLimits(*min_element(r0_filter.begin(),r0_filter.end()),*max_element(r0_filter.begin(),r0_filter.end()));
|
||||
grap0->Draw("AP");
|
||||
g0_fit->Draw("same");
|
||||
mapcanvas->Update();
|
||||
TPaveStats *st0 = (TPaveStats*)grap0->FindObject("stats");
|
||||
st0->SetX1NDC(0.2);
|
||||
st0->SetX2NDC(0.54);
|
||||
st0->SetY1NDC(0.18);
|
||||
st0->SetY2NDC(0.37);
|
||||
st0->SetBorderSize(0);
|
||||
st0->SetTextColor(kBlue);
|
||||
sprintf(savename,"plots/M%s/BackplanePulsing/pixel_%s_%d_g0_M%s.png", module_str.c_str(), pixel_type.c_str(), i, module_str.c_str());
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
|
||||
vector<double> r0_adc_norm;
|
||||
for (size_t j = 0; j < r0_adc.size(); j++) {
|
||||
r0_adc_norm.push_back(r0_adc[j] - g0_fit->Eval(r0_filter[j]));
|
||||
}
|
||||
|
||||
TGraphErrors *grap0_norm = new TGraphErrors(r0_adc.size(),&(r0_filter[0]),&(r0_adc_norm[0]),&(r0_ferr[0]),&(r0_adcerr[0]));
|
||||
grap0_norm->SetMarkerColor(kBlue);
|
||||
grap0_norm->SetLineColor(kBlue);
|
||||
|
||||
TF1* flat_g0 = new TF1("flat_g0","0",g0min,g0max);
|
||||
flat_g0->SetLineColor(kBlue);
|
||||
|
||||
TF1* lin_g0_p1pc = new TF1("lin_g0_p1pc","[0]+[1]*x",g0min,g0max);
|
||||
lin_g0_p1pc->SetParameter(0,g0_fit->GetParameter(0)/100.);
|
||||
lin_g0_p1pc->SetParameter(1,g0_fit->GetParameter(1)/100.);
|
||||
lin_g0_p1pc->SetLineColor(kRed);
|
||||
|
||||
TF1* lin_g0_p05pc = new TF1("lin_g0_p05pc","[0]+[1]*x",g0min,g0max);
|
||||
lin_g0_p05pc->SetParameter(0,g0_fit->GetParameter(0)/200.);
|
||||
lin_g0_p05pc->SetParameter(1,g0_fit->GetParameter(1)/200.);
|
||||
lin_g0_p05pc->SetLineColor(kOrange+1);
|
||||
|
||||
TF1* lin_g0_p02pc = new TF1("lin_g0_p02pc","[0]+[1]*x",g0min,g0max);
|
||||
lin_g0_p02pc->SetParameter(0,g0_fit->GetParameter(0)/500.);
|
||||
lin_g0_p02pc->SetParameter(1,g0_fit->GetParameter(1)/500.);
|
||||
lin_g0_p02pc->SetLineColor(kOrange);
|
||||
|
||||
TF1* lin_g0_m1pc = new TF1("lin_g0_m1pc","[0]+[1]*x",g0min,g0max);
|
||||
lin_g0_m1pc->SetParameter(0,g0_fit->GetParameter(0)/-100.);
|
||||
lin_g0_m1pc->SetParameter(1,g0_fit->GetParameter(1)/-100.);
|
||||
lin_g0_m1pc->SetLineColor(kRed);
|
||||
|
||||
TF1* lin_g0_m05pc = new TF1("lin_g0_m05pc","[0]+[1]*x",g0min,g0max);
|
||||
lin_g0_m05pc->SetParameter(0,g0_fit->GetParameter(0)/-200.);
|
||||
lin_g0_m05pc->SetParameter(1,g0_fit->GetParameter(1)/-200.);
|
||||
lin_g0_m05pc->SetLineColor(kOrange+1);
|
||||
|
||||
TF1* lin_g0_m02pc = new TF1("lin_g0_m02pc","[0]+[1]*x",g0min,g0max);
|
||||
lin_g0_m02pc->SetParameter(0,g0_fit->GetParameter(0)/-500.);
|
||||
lin_g0_m02pc->SetParameter(1,g0_fit->GetParameter(1)/-500.);
|
||||
lin_g0_m02pc->SetLineColor(kOrange);
|
||||
|
||||
grap0_norm->GetXaxis()->SetRangeUser(*min_element(r0_filter.begin(),r0_filter.end()),*max_element(r0_filter.begin(),r0_filter.end()));
|
||||
grap0_norm->SetMinimum(1.5*lin_g0_m02pc->Eval(g0max));
|
||||
grap0_norm->SetMaximum(1.5*lin_g0_p02pc->Eval(g0max));
|
||||
grap0_norm->GetXaxis()->SetTitle("Signal generator voltage [mV]");
|
||||
grap0_norm->GetYaxis()->SetTitle("Normalised ADC [ADU]");
|
||||
grap0_norm->GetYaxis()->SetTitleOffset(0.9);
|
||||
grap0_norm->Draw("AP");
|
||||
flat_g0->Draw("same");
|
||||
lin_g0_p1pc->Draw("same");
|
||||
lin_g0_p05pc->Draw("same");
|
||||
lin_g0_p02pc->Draw("same");
|
||||
lin_g0_m1pc->Draw("same");
|
||||
lin_g0_m05pc->Draw("same");
|
||||
lin_g0_m02pc->Draw("same");
|
||||
grap0_norm->Draw("P");
|
||||
sprintf(savename,"plots/M%s/BackplanePulsing/pixel_%s_%d_g0norm_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 grap0_norm;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (r1_adc.size() > 1) {
|
||||
|
||||
g1min = lowestPointAfterSwitching(r1_filter,r0_filter);
|
||||
g1max = *max_element(r1_filter.begin(),r1_filter.end());
|
||||
|
||||
if (g1max > g1min) {
|
||||
|
||||
grap1->Fit("pol1","QRC","",g1min,g1max);
|
||||
g1_fit = (TF1*) grap1->GetFunction("pol1");
|
||||
g1_fit->SetLineColor(kGreen+2);
|
||||
g1_fit->SetParName(0,"G1 const");
|
||||
g1_fit->SetParName(1,"G1 grad");
|
||||
|
||||
g1_grad_hist->Fill(g1_fit->GetParameter(1));
|
||||
g1_grader_hist->Fill(g1_fit->GetParError(1));
|
||||
g1_grad_map->Fill(i%NC,i/NC,g1_fit->GetParameter(1));
|
||||
@ -427,135 +640,57 @@ int main(int argc, char* argv[]) {
|
||||
mapcanvas->SetLeftMargin(0.13);
|
||||
mapcanvas->SetRightMargin(0.05);
|
||||
|
||||
g0_fit->SetParName(0,"G0 const");
|
||||
g0_fit->SetParName(1,"G0 grad");
|
||||
g1_fit->SetParName(0,"G1 const");
|
||||
g1_fit->SetParName(1,"G1 grad");
|
||||
|
||||
grap0->SetMarkerStyle(20);
|
||||
grap0->SetMarkerColor(kBlue);
|
||||
grap0->GetXaxis()->SetTitle("Signal generator voltage [mV]");
|
||||
grap0->GetYaxis()->SetTitle("ADC [ADU]");
|
||||
grap0->GetYaxis()->SetTitleOffset(0.9);
|
||||
grap0->SetMinimum(1000);
|
||||
grap0->SetMaximum(15000);
|
||||
grap0->GetXaxis()->SetLimits(0,7200);
|
||||
grap0->Draw("AP");
|
||||
g0_fit->Draw("same");
|
||||
grap1->GetXaxis()->SetTitle("Signal generator voltage [mV]");
|
||||
grap1->GetYaxis()->SetTitle("ADC [ADU]");
|
||||
grap1->GetYaxis()->SetTitleOffset(0.9);
|
||||
grap1->SetMinimum(1000);
|
||||
grap1->SetMaximum(15000);
|
||||
grap1->GetXaxis()->SetLimits(*min_element(r1_filter.begin(),r1_filter.end()),*max_element(r1_filter.begin(),r1_filter.end()));
|
||||
grap1->Draw("AP");
|
||||
g1_fit->Draw("same");
|
||||
mapcanvas->Update();
|
||||
TPaveStats *st0 = (TPaveStats*)grap0->FindObject("stats");
|
||||
st0->SetX1NDC(0.2);
|
||||
st0->SetX2NDC(0.54);
|
||||
TPaveStats *st0 = (TPaveStats*)grap1->FindObject("stats");
|
||||
st0->SetX1NDC(0.6);
|
||||
st0->SetX2NDC(0.94);
|
||||
st0->SetY1NDC(0.18);
|
||||
st0->SetY2NDC(0.37);
|
||||
st0->SetBorderSize(0);
|
||||
st0->SetTextColor(kBlue);
|
||||
|
||||
grap1->SetMarkerStyle(20);
|
||||
grap1->SetMarkerColor(kGreen+2);
|
||||
grap1->Draw("P");
|
||||
g1_fit->Draw("same");
|
||||
mapcanvas->Update();
|
||||
TPaveStats *st1 = (TPaveStats*)grap1->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/BackplanePulsing/pixel_%s_%d_M%s.png", module_str.c_str(), pixel_type.c_str(), i, module_str.c_str());
|
||||
st0->SetTextColor(kGreen+2);
|
||||
sprintf(savename,"plots/M%s/BackplanePulsing/pixel_%s_%d_g1_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] - g0_fit->Eval(r0_filter[j]));
|
||||
}
|
||||
for (size_t j = 0; j < r1_adc.size(); j++) {
|
||||
r1_adc_norm.push_back(r1_adc[j] - g1_fit->Eval(r1_filter[j]));
|
||||
}
|
||||
TGraphErrors *grap0_norm = new TGraphErrors(r0_adc.size(),&(r0_filter[0]),&(r0_adc_norm[0]),&(r0_ferr[0]),&(r0_adcerr[0]));
|
||||
|
||||
TGraphErrors *grap1_norm = new TGraphErrors(r1_adc.size(),&(r1_filter[0]),&(r1_adc_norm[0]),&(r1_ferr[0]),&(r1_adcerr[0]));
|
||||
grap1_norm->SetMarkerColor(kGreen+2);
|
||||
grap1_norm->SetLineColor(kGreen+2);
|
||||
|
||||
TF1* flat_g0 = new TF1("flat_g0","0",0,g0max);
|
||||
TF1* flat_g1 = new TF1("flat_gi","0",g1min,7000);
|
||||
TF1* flat_g1 = new TF1("flat_gi","0",g1min,g1max);
|
||||
flat_g1->SetLineColor(kGreen+2);
|
||||
|
||||
TF1* lin_g0_p1pc = new TF1("lin_g0_p1pc","[0]+[1]*x",0,g0max);
|
||||
lin_g0_p1pc->SetParameter(0,g0_fit->GetParameter(0)/100.);
|
||||
lin_g0_p1pc->SetParameter(1,g0_fit->GetParameter(1)/100.);
|
||||
lin_g0_p1pc->SetLineColor(kRed);
|
||||
|
||||
TF1* lin_g0_p05pc = new TF1("lin_g0_p05pc","[0]+[1]*x",0,g0max);
|
||||
lin_g0_p05pc->SetParameter(0,g0_fit->GetParameter(0)/200.);
|
||||
lin_g0_p05pc->SetParameter(1,g0_fit->GetParameter(1)/200.);
|
||||
lin_g0_p05pc->SetLineColor(kOrange+1);
|
||||
|
||||
TF1* lin_g0_p02pc = new TF1("lin_g0_p02pc","[0]+[1]*x",0,g0max);
|
||||
lin_g0_p02pc->SetParameter(0,g0_fit->GetParameter(0)/500.);
|
||||
lin_g0_p02pc->SetParameter(1,g0_fit->GetParameter(1)/500.);
|
||||
lin_g0_p02pc->SetLineColor(kOrange);
|
||||
|
||||
TF1* lin_g0_m1pc = new TF1("lin_g0_m1pc","[0]+[1]*x",0,g0max);
|
||||
lin_g0_m1pc->SetParameter(0,g0_fit->GetParameter(0)/-100.);
|
||||
lin_g0_m1pc->SetParameter(1,g0_fit->GetParameter(1)/-100.);
|
||||
lin_g0_m1pc->SetLineColor(kRed);
|
||||
|
||||
TF1* lin_g0_m05pc = new TF1("lin_g0_m05pc","[0]+[1]*x",0,g0max);
|
||||
lin_g0_m05pc->SetParameter(0,g0_fit->GetParameter(0)/-200.);
|
||||
lin_g0_m05pc->SetParameter(1,g0_fit->GetParameter(1)/-200.);
|
||||
lin_g0_m05pc->SetLineColor(kOrange+1);
|
||||
|
||||
TF1* lin_g0_m02pc = new TF1("lin_g0_m02pc","[0]+[1]*x",0,g0max);
|
||||
lin_g0_m02pc->SetParameter(0,g0_fit->GetParameter(0)/-500.);
|
||||
lin_g0_m02pc->SetParameter(1,g0_fit->GetParameter(1)/-500.);
|
||||
lin_g0_m02pc->SetLineColor(kOrange);
|
||||
|
||||
grap0_norm->SetMarkerColor(kBlue);
|
||||
grap0_norm->SetLineColor(kBlue);
|
||||
flat_g0->SetLineColor(kBlue);
|
||||
grap0_norm->GetXaxis()->SetRangeUser(*min_element(r0_filter.begin(),r0_filter.end()),*max_element(r0_filter.begin(),r0_filter.end()));
|
||||
grap0_norm->SetMinimum(1.5*lin_g0_m02pc->Eval(g0max));
|
||||
grap0_norm->SetMaximum(1.5*lin_g0_p02pc->Eval(g0max));
|
||||
grap0_norm->GetXaxis()->SetTitle("Signal generator voltage [mV]");
|
||||
grap0_norm->GetYaxis()->SetTitle("Normalised ADC [ADU]");
|
||||
grap0_norm->GetYaxis()->SetTitleOffset(0.9);
|
||||
grap0_norm->Draw("AP");
|
||||
flat_g0->Draw("same");
|
||||
lin_g0_p1pc->Draw("same");
|
||||
lin_g0_p05pc->Draw("same");
|
||||
lin_g0_p02pc->Draw("same");
|
||||
lin_g0_m1pc->Draw("same");
|
||||
lin_g0_m05pc->Draw("same");
|
||||
lin_g0_m02pc->Draw("same");
|
||||
grap0_norm->Draw("P");
|
||||
sprintf(savename,"plots/M%s/BackplanePulsing/pixel_%s_%d_g0norm_M%s.png", module_str.c_str(), pixel_type.c_str(), i, module_str.c_str());
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
|
||||
TF1* lin_g1_p02pc = new TF1("lin_g1_p02pc","[0]+[1]*x",g1min,7000);
|
||||
TF1* lin_g1_p02pc = new TF1("lin_g1_p02pc","[0]+[1]*x",g1min,g1max);
|
||||
lin_g1_p02pc->SetParameter(0,g1_fit->GetParameter(0)/500.);
|
||||
lin_g1_p02pc->SetParameter(1,g1_fit->GetParameter(1)/500.);
|
||||
lin_g1_p02pc->SetLineColor(kOrange);
|
||||
|
||||
TF1* lin_g1_p01pc = new TF1("lin_g1_p01pc","[0]+[1]*x",g1min,7000);
|
||||
TF1* lin_g1_p01pc = new TF1("lin_g1_p01pc","[0]+[1]*x",g1min,g1max);
|
||||
lin_g1_p01pc->SetParameter(0,g1_fit->GetParameter(0)/1000.);
|
||||
lin_g1_p01pc->SetParameter(1,g1_fit->GetParameter(1)/1000.);
|
||||
lin_g1_p01pc->SetLineColor(kYellow);
|
||||
|
||||
TF1* lin_g1_m02pc = new TF1("lin_g1_m02pc","[0]+[1]*x",g1min,7000);
|
||||
TF1* lin_g1_m02pc = new TF1("lin_g1_m02pc","[0]+[1]*x",g1min,g1max);
|
||||
lin_g1_m02pc->SetParameter(0,g1_fit->GetParameter(0)/-500.);
|
||||
lin_g1_m02pc->SetParameter(1,g1_fit->GetParameter(1)/-500.);
|
||||
lin_g1_m02pc->SetLineColor(kOrange);
|
||||
|
||||
TF1* lin_g1_m01pc = new TF1("lin_g1_m01pc","[0]+[1]*x",g1min,7000);
|
||||
TF1* lin_g1_m01pc = new TF1("lin_g1_m01pc","[0]+[1]*x",g1min,g1max);
|
||||
lin_g1_m01pc->SetParameter(0,g1_fit->GetParameter(0)/-1000.);
|
||||
lin_g1_m01pc->SetParameter(1,g1_fit->GetParameter(1)/-1000.);
|
||||
lin_g1_m01pc->SetLineColor(kYellow);
|
||||
|
||||
grap1_norm->SetMarkerColor(kGreen+2);
|
||||
grap1_norm->SetLineColor(kGreen+2);
|
||||
flat_g1->SetLineColor(kGreen+2);
|
||||
grap1_norm->GetXaxis()->SetRangeUser(*min_element(r1_filter.begin(),r1_filter.end()),*max_element(r1_filter.begin(),r1_filter.end()));
|
||||
grap1_norm->SetMinimum(1.5*lin_g1_m02pc->Eval(g1min));
|
||||
grap1_norm->SetMaximum(1.5*lin_g1_p02pc->Eval(g1min));
|
||||
@ -574,28 +709,44 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
mapcanvas->SetLeftMargin(0.1);
|
||||
mapcanvas->SetRightMargin(0.13);
|
||||
delete grap0_norm;
|
||||
|
||||
delete grap1_norm;
|
||||
}
|
||||
|
||||
delete grap0;
|
||||
delete grap1;
|
||||
|
||||
} else {
|
||||
pixelmask_map->Fill(i%NC,i/NC,1);
|
||||
pixel_mask[i] = false;
|
||||
}
|
||||
|
||||
} else {
|
||||
pixelmask_map->Fill(i%NC,i/NC,1);
|
||||
pixel_mask[i] = false;
|
||||
}
|
||||
|
||||
} else {
|
||||
pixelmask_map->Fill(i%NC,i/NC,1);
|
||||
pixel_mask[i] = false;
|
||||
}
|
||||
|
||||
// get ratio measurements
|
||||
if (g0max > g0min && g1max > g1min) {
|
||||
|
||||
g0overg1_hist->Fill(g0_fit->GetParameter(1) / g1_fit->GetParameter(1));
|
||||
g0overg1er_hist->Fill(sqrt(pow(g0_fit->GetParError(1)/g0_fit->GetParameter(1),2) + pow(g1_fit->GetParError(1)/g1_fit->GetParameter(1),2)));
|
||||
|
||||
g0overg1_map->Fill(i%NC,i/NC,g0_fit->GetParameter(1) / g1_fit->GetParameter(1));
|
||||
g0overg1er_map->Fill(i%NC,i/NC,sqrt(pow(g0_fit->GetParError(1)/g0_fit->GetParameter(1),2) + pow(g1_fit->GetParError(1)/g1_fit->GetParameter(1),2)));
|
||||
|
||||
if (isEdge(i)) {
|
||||
g0overg1_hist_isEdge->Fill(g0_fit->GetParameter(1) / g1_fit->GetParameter(1));
|
||||
}
|
||||
if (isInnerEdge(i)) {
|
||||
g0overg1_hist_isInnerEdge->Fill(g0_fit->GetParameter(1) / g1_fit->GetParameter(1));
|
||||
}
|
||||
if (isDouble(i)) {
|
||||
g0overg1_hist_isDouble->Fill(g0_fit->GetParameter(1) / g1_fit->GetParameter(1));
|
||||
}
|
||||
if (isNextToDouble(i)) {
|
||||
g0overg1_hist_isNextToDouble->Fill(g0_fit->GetParameter(1) / g1_fit->GetParameter(1));
|
||||
}
|
||||
if (isQuad(i)) {
|
||||
g0overg1_hist_isQuad->Fill(g0_fit->GetParameter(1) / g1_fit->GetParameter(1));
|
||||
}
|
||||
if (isBulk(i)) {
|
||||
g0overg1_hist_isBulk->Fill(g0_fit->GetParameter(1) / g1_fit->GetParameter(1));
|
||||
}
|
||||
}
|
||||
|
||||
delete grap0;
|
||||
delete grap1;
|
||||
}
|
||||
}
|
||||
|
||||
TCanvas* c1 = new TCanvas("c1","");
|
||||
@ -740,60 +891,6 @@ int main(int argc, char* argv[]) {
|
||||
}
|
||||
sprintf(savename,"plots/M%s/BackplanePulsing/g1_conster_map_M%s.png", module_str.c_str(), module_str.c_str());
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
|
||||
TH1F* g0overg1_hist = new TH1F("g0overg1_hist","",100,-34,-24);
|
||||
TH1F* g0overg1er_hist = 0;
|
||||
if (module_str == "006") {
|
||||
g0overg1er_hist = new TH1F("g0overg1er_hist","",100,0,0.01);
|
||||
} else {
|
||||
g0overg1er_hist = new TH1F("g0overg1er_hist","",100,0,0.001);
|
||||
}
|
||||
|
||||
TH1F* g0overg1_hist_isEdge = new TH1F("g0overg1_hist_isEdge","",100,-34,-24);
|
||||
TH1F* g0overg1_hist_isInnerEdge = new TH1F("g0overg1_hist_isInnerEdge","",100,-34,-24);
|
||||
TH1F* g0overg1_hist_isDouble = new TH1F("g0overg1_hist_isDouble","",100,-34,-24);
|
||||
TH1F* g0overg1_hist_isNextToDouble = new TH1F("g0overg1_hist_isNextToDouble","",100,-34,-24);
|
||||
TH1F* g0overg1_hist_isQuad = new TH1F("g0overg1_hist_isQuad","",100,-34,-24);
|
||||
TH1F* g0overg1_hist_isBulk = new TH1F("g0overg1_hist_isBulk","",100,-34,-24);
|
||||
|
||||
TH2F* g0overg1_map = new TH2F("g0overg1_map","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
||||
TH2F* g0overg1er_map = new TH2F("g0overg1er_map","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
||||
|
||||
double this_g0 = 0;
|
||||
double this_g1 = 0;
|
||||
|
||||
for (int i = 0; i < NCH; i ++) {
|
||||
if (pixel_mask[i] == true) {
|
||||
|
||||
this_g0 = g0_grad_map->GetBinContent((i%NC)+1,(i/NC)+1);
|
||||
this_g1 = g1_grad_map->GetBinContent((i%NC)+1,(i/NC)+1);
|
||||
|
||||
g0overg1_hist->Fill(this_g0 / this_g1);
|
||||
g0overg1_map->Fill(i%NC,i/NC,this_g0 / this_g1);
|
||||
|
||||
g0overg1er_hist->Fill(sqrt(pow(g0_grader_map->GetBinContent((i%NC)+1,(i/NC)+1)/this_g0,2) + pow(g1_grader_map->GetBinContent((i%NC)+1,(i/NC)+1)/this_g1,2)));
|
||||
g0overg1er_map->Fill(i%NC,i/NC,sqrt(pow(g0_grader_map->GetBinContent((i%NC)+1,(i/NC)+1)/this_g0,2) + pow(g1_grader_map->GetBinContent((i%NC)+1,(i/NC)+1)/this_g1,2)));
|
||||
|
||||
if (isEdge(i)) {
|
||||
g0overg1_hist_isEdge->Fill(this_g0 / this_g1);
|
||||
}
|
||||
if (isInnerEdge(i)) {
|
||||
g0overg1_hist_isInnerEdge->Fill(this_g0 / this_g1);
|
||||
}
|
||||
if (isDouble(i)) {
|
||||
g0overg1_hist_isDouble->Fill(this_g0 / this_g1);
|
||||
}
|
||||
if (isNextToDouble(i)) {
|
||||
g0overg1_hist_isNextToDouble->Fill(this_g0 / this_g1);
|
||||
}
|
||||
if (isQuad(i)) {
|
||||
g0overg1_hist_isQuad->Fill(this_g0 / this_g1);
|
||||
}
|
||||
if (isBulk(i)) {
|
||||
g0overg1_hist_isBulk->Fill(this_g0 / this_g1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
c1->cd();
|
||||
|
||||
|
Reference in New Issue
Block a user