1110 lines
42 KiB
C++
1110 lines
42 KiB
C++
// to analyse the backplane pulsing data per module
|
|
// changes by VH 210906: to eliminate hardcoded absolute paths, uses location of the analysis root files as additional input argument (accordingly changed in filename_creator.sh)
|
|
|
|
#include "sls_detector_calibration/jungfrauCommonHeader.h"
|
|
#include "sls_detector_calibration/jungfrauCommonFunctions.h"
|
|
|
|
#include "sls_detector_calibration/jungfrauFile.C"
|
|
#include "sls_detector_calibration/jungfrauPedestal.C"
|
|
|
|
#include "TGraphErrors.h"
|
|
#include "TF1.h"
|
|
#include "TPaveStats.h"
|
|
#include "TFile.h"
|
|
#include "TLegend.h"
|
|
#include "TPaveText.h"
|
|
|
|
#include <sys/stat.h>
|
|
|
|
double checkRangeMaxForAmplifierPlateau(double range_max) {
|
|
|
|
// check that the range maximum is no more than 6.4 V
|
|
// to avoid non-linearity coming from amplifier plateau
|
|
if (range_max > 6400) {
|
|
return 6400;
|
|
} else {
|
|
return range_max;
|
|
}
|
|
|
|
}
|
|
bool isHGX=false;
|
|
int main(int argc, char* argv[]) {
|
|
|
|
jungfrauStyle();
|
|
gROOT->SetBatch(1);
|
|
gStyle->SetOptFit(11);
|
|
|
|
/*
|
|
if (argc != 3) {
|
|
cout << "Correct usage:" << endl;
|
|
cout << "arg 1: specify module number" << endl;
|
|
cout << "arg 2: specify data location" << endl;
|
|
exit(1);
|
|
}
|
|
*/ //uncomment for SR
|
|
|
|
if (argc != 4) {
|
|
cout << "Correct usage:" << endl;
|
|
cout << "arg 1: specify module number" << endl;
|
|
cout << "arg 2: specify data location (folder + data file prefix)" << endl;
|
|
cout << "arg 3: specify location of analysis root files" << endl;
|
|
exit(1);
|
|
} //uncomment for VH 210906
|
|
|
|
string module_str = argv[1];
|
|
|
|
string str2 =("HG0G1G2");
|
|
string str3 =("HGOG1G2"); //filename creator had this bug
|
|
|
|
string data_loc = argv[2];
|
|
string anadata_loc = argv[3]; //uncomment for VH 210906
|
|
string plotfolder_str;
|
|
|
|
|
|
if (data_loc.find(str2) != string::npos) isHGX=true;
|
|
if (data_loc.find(str3) != string::npos) isHGX=true;
|
|
|
|
|
|
// cout << data_loc.find(str2)<<" " << string::npos << " " << str2 << " " << data_loc <<endl;
|
|
|
|
|
|
if (isHGX) {
|
|
cout << " HG0->HG1->HG2 sequence - dynamicHG0" <<endl;
|
|
plotfolder_str="BackplanePulsing_HG0G1G2";
|
|
}
|
|
else {
|
|
cout << " G0->G1->G2 sequence - dynamicG0" <<endl;
|
|
plotfolder_str="BackplanePulsing";
|
|
}
|
|
|
|
|
|
int createHistos = 1; // set to 0 to do a fit-only run
|
|
int createPerStepHistos = 0; //debug
|
|
|
|
jungfrauFile *thisfile = new jungfrauFile();
|
|
|
|
jungfrauPedestal *pedestalObjectG0 = new jungfrauPedestal();
|
|
pedestalObjectG0->pedestalSetNFrames(100); // using 100 frames, rolling window
|
|
jungfrauPedestal *pedestalObjectG1 = new jungfrauPedestal();
|
|
pedestalObjectG1->pedestalSetNFrames(100); // using 100 frames, rolling window
|
|
|
|
TH2F* avg_adcG0_map [220];
|
|
TH2F* avg_adcG0er_map [220];
|
|
TH2F* avg_adcG1_map [220];
|
|
TH2F* avg_adcG1er_map [220];
|
|
|
|
//char savename[128]; //uncomment for SR
|
|
//char filename[128]; //uncomment for SR
|
|
char savename[256]; //uncomment for VH 210902
|
|
char filename[256]; //uncomment for VH 210902
|
|
|
|
// create necessary directories with permissions drwxrwxr-x
|
|
// data/Mxxx
|
|
sprintf(savename,"data/M%s", module_str.c_str());
|
|
mkdir(savename, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
|
|
// plots/Mxxx
|
|
sprintf(savename,"plots/M%s", module_str.c_str());
|
|
mkdir(savename, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
|
|
// plots/Mxxx/BackplanePulsing
|
|
sprintf(savename,"plots/M%s/%s", module_str.c_str(), plotfolder_str.c_str());
|
|
mkdir(savename, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
|
|
// /mnt/pcmoench_jungfrau_data/jungfrau_ana_sophie/Mxxx_CalibAna
|
|
//sprintf(savename,"/mnt/sls_det_storage/jungfrau_data1/jungfrau_ana_sophie/M%s_CalibAna", module_str.c_str()); //uncomment for SR
|
|
sprintf(savename,"%s", anadata_loc.c_str()); //uncomment for VH 210906
|
|
mkdir(savename, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
|
|
|
|
double xs[220];
|
|
for (int i = 0; i < 100; i++) {
|
|
xs[i] = (i+1)*10.;
|
|
}
|
|
for (int i = 0; i < 120; i++) {
|
|
xs[i+100] = 1000+((i+1)*50);
|
|
}
|
|
|
|
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);
|
|
|
|
TCanvas* c1 = new TCanvas("c1","");
|
|
|
|
mapcanvas->cd();
|
|
|
|
TH1F* g0_grad_hist = 0;
|
|
if (module_str == "351" ||
|
|
module_str == "351_fullspeed" ||
|
|
module_str == "352" ||
|
|
module_str == "352_fullspeed" ||
|
|
module_str == "261" ||
|
|
module_str == "261_fullspeed" ||
|
|
module_str == "310" ||
|
|
module_str == "310_fullspeed" ||
|
|
module_str == "312" ||
|
|
module_str == "312_fullspeed" ||
|
|
module_str == "264" ||
|
|
module_str == "264_fullspeed" ||
|
|
module_str == "253" ||
|
|
module_str == "253_fullspeed" ||
|
|
module_str == "307" ||
|
|
module_str == "307_fullspeed" ||
|
|
module_str == "272_halfspeedtest" ||
|
|
module_str == "272_fullspeedtest") {
|
|
g0_grad_hist = new TH1F("g0_grad_hist","",100,3,8);
|
|
} else {
|
|
g0_grad_hist = new TH1F("g0_grad_hist","",100,25,35);
|
|
}
|
|
TH1F* g0_grader_hist = new TH1F("g0_grader_hist","",100,0,0.02);
|
|
|
|
TH1F* g1_grad_hist = 0;
|
|
if (module_str == "351" ||
|
|
module_str == "351_fullspeed" ||
|
|
module_str == "352" ||
|
|
module_str == "352_fullspeed" ||
|
|
module_str == "261" ||
|
|
module_str == "261_fullspeed" ||
|
|
module_str == "310" ||
|
|
module_str == "310_fullspeed" ||
|
|
module_str == "312" ||
|
|
module_str == "312_fullspeed" ||
|
|
module_str == "264" ||
|
|
module_str == "264_fullspeed" ||
|
|
module_str == "253" ||
|
|
module_str == "253_fullspeed" ||
|
|
module_str == "307" ||
|
|
module_str == "307_fullspeed" ||
|
|
module_str == "272_halfspeedtest" ||
|
|
module_str == "272_fullspeedtest" ||
|
|
module_str == "371") {
|
|
g1_grad_hist = new TH1F("g1_grad_hist","",100,-0.25,-0.1);
|
|
} else {
|
|
g1_grad_hist = new TH1F("g1_grad_hist","",100,-0.3,-0.15);
|
|
}
|
|
TH1F* g1_grader_hist = 0;
|
|
if (module_str == "006") {
|
|
g1_grader_hist = new TH1F("g1_grader_hist","",100,0,0.001);
|
|
} else {
|
|
g1_grader_hist = new TH1F("g1_grader_hist","",100,0,0.0001);
|
|
}
|
|
|
|
TH2F* no_g0g1_calib_map = new TH2F("no_g0g1_calib_map","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
|
|
|
TH2F* g0_grad_map = new TH2F("g0_grad_map","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
|
TH2F* g0_grader_map = new TH2F("g0_grader_map","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
|
|
|
TH2F* g1_grad_map = new TH2F("g1_grad_map","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
|
TH2F* g1_grader_map = new TH2F("g1_grader_map","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
|
|
|
TH1F* g0_const_hist = new TH1F("g0_const_hist","",100,500,4000);
|
|
TH1F* g0_conster_hist = new TH1F("g0_conster_hist","",100,0.6,1.2);
|
|
|
|
TH1F* g1_const_hist = new TH1F("g1_const_hist","",100,11000,16000);
|
|
TH1F* g1_conster_hist = 0;
|
|
if (module_str == "006") {
|
|
g1_conster_hist = new TH1F("g1_conster_hist","",100,0,10);
|
|
} else {
|
|
g1_conster_hist = new TH1F("g1_conster_hist","",100,0,1);
|
|
}
|
|
|
|
TH2F* g0_const_map = new TH2F("g0_const_map","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
|
TH2F* g0_conster_map = new TH2F("g0_conster_map","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
|
|
|
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,-190,-150);
|
|
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,-190,-150);
|
|
TH1F* g0overg1_hist_isInnerEdge = new TH1F("g0overg1_hist_isInnerEdge","",100,-190,-150);
|
|
TH1F* g0overg1_hist_isDouble = new TH1F("g0overg1_hist_isDouble","",100,-190,-150);
|
|
TH1F* g0overg1_hist_isNextToDouble = new TH1F("g0overg1_hist_isNextToDouble","",100,-190,-150);
|
|
TH1F* g0overg1_hist_isQuad = new TH1F("g0overg1_hist_isQuad","",100,-190,-150);
|
|
TH1F* g0overg1_hist_isBulk = new TH1F("g0overg1_hist_isBulk","",100,-190,-150);
|
|
|
|
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++) {
|
|
sprintf(savename,"avg_adcG0_map_%d", j);
|
|
avg_adcG0_map[j] = new TH2F(savename,"",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
|
sprintf(savename,"avg_adcG0er_map_%d", j);
|
|
avg_adcG0er_map[j] = new TH2F(savename,"",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
|
|
|
sprintf(savename,"avg_adcG1_map_%d", j);
|
|
avg_adcG1_map[j] = new TH2F(savename,"",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
|
sprintf(savename,"avg_adcG1er_map_%d", j);
|
|
avg_adcG1er_map[j] = new TH2F(savename,"",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
|
}
|
|
|
|
// data file
|
|
sprintf(filename,"%s_%%6.6d.dat", data_loc.c_str());
|
|
|
|
// total frame number check
|
|
int totalFrames = 0;
|
|
|
|
for (int filei = 0; filei < 3; filei++) {
|
|
|
|
thisfile->open((char*)filename, filei);
|
|
|
|
while(thisfile->readNextFrame()) {
|
|
totalFrames++;
|
|
}
|
|
|
|
thisfile->close();
|
|
}
|
|
|
|
if (totalFrames == 21999 || totalFrames == 22000) {
|
|
cout << "expected number of frames " << totalFrames << endl;
|
|
} else {
|
|
cout << "unexpected number of frames " << totalFrames << endl;
|
|
cout << "code expected 21999/22000 frames" << endl;
|
|
cout << "exiting to make sure you notice" << endl;
|
|
exit(1);
|
|
}
|
|
|
|
int framecounter = 0;
|
|
|
|
for (int filei = 0; filei < 3; filei++) {
|
|
|
|
thisfile->open((char*)filename, filei);
|
|
|
|
while(thisfile->readNextFrame()) {
|
|
|
|
pedestalObjectG0->addG0FrameToPedestalCalculation(thisfile->getFrameDataHandle());
|
|
pedestalObjectG1->addG1FrameToPedestalCalculation(thisfile->getFrameDataHandle());
|
|
|
|
if (((framecounter+1)%100 == 0) || ((totalFrames == 21999) && (framecounter == 21998))) {
|
|
if ((totalFrames == 21999) && (framecounter == 21998)) {
|
|
framecounter++;
|
|
}
|
|
|
|
for (int i = 0; i < NCH; i++) {
|
|
|
|
avg_adcG0_map[framecounter/100]->SetBinContent((i%NC)+1,(i/NC)+1,pedestalObjectG0->pedestalOfChannel(i));
|
|
avg_adcG0er_map[framecounter/100]->SetBinContent((i%NC)+1,(i/NC)+1,pedestalObjectG0->semOfChannel(i));
|
|
|
|
avg_adcG1_map[framecounter/100]->SetBinContent((i%NC)+1,(i/NC)+1,pedestalObjectG1->pedestalOfChannel(i));
|
|
avg_adcG1er_map[framecounter/100]->SetBinContent((i%NC)+1,(i/NC)+1,pedestalObjectG1->semOfChannel(i));
|
|
|
|
}
|
|
|
|
pedestalObjectG0->pedestalClear();
|
|
pedestalObjectG1->pedestalClear();
|
|
|
|
if (createPerStepHistos == 1) {
|
|
avg_adcG0_map[framecounter/100]->GetXaxis()->SetTitle("Column");
|
|
avg_adcG0_map[framecounter/100]->GetYaxis()->SetTitle("Row");
|
|
avg_adcG0_map[framecounter/100]->GetYaxis()->SetTitleOffset(0.7);
|
|
avg_adcG0_map[framecounter/100]->GetZaxis()->SetRangeUser(0,17000);
|
|
avg_adcG0_map[framecounter/100]->Draw("colz");
|
|
sprintf(savename,"plots/M%s/BackplanePulsing/perStep/adc_g0_map_%d_M%s.png", module_str.c_str(), framecounter/100, module_str.c_str());
|
|
mapcanvas->SaveAs((const char *)(savename));
|
|
|
|
avg_adcG0er_map[framecounter/100]->GetXaxis()->SetTitle("Column");
|
|
avg_adcG0er_map[framecounter/100]->GetYaxis()->SetTitle("Row");
|
|
avg_adcG0er_map[framecounter/100]->GetYaxis()->SetTitleOffset(0.7);
|
|
avg_adcG0er_map[framecounter/100]->GetZaxis()->SetRangeUser(0,5);
|
|
avg_adcG0er_map[framecounter/100]->Draw("colz");
|
|
sprintf(savename,"plots/M%s/BackplanePulsing/perStep/adcer_g0_map_%d_M%s.png", module_str.c_str(), framecounter/100, module_str.c_str());
|
|
mapcanvas->SaveAs((const char *)(savename));
|
|
|
|
avg_adcG1_map[framecounter/100]->GetXaxis()->SetTitle("Column");
|
|
avg_adcG1_map[framecounter/100]->GetYaxis()->SetTitle("Row");
|
|
avg_adcG1_map[framecounter/100]->GetYaxis()->SetTitleOffset(0.7);
|
|
avg_adcG1_map[framecounter/100]->GetZaxis()->SetRangeUser(0,17000);
|
|
avg_adcG1_map[framecounter/100]->Draw("colz");
|
|
sprintf(savename,"plots/M%s/BackplanePulsing/perStep/adc_g1_map_%d_M%s.png", module_str.c_str(), framecounter/100, module_str.c_str());
|
|
mapcanvas->SaveAs((const char *)(savename));
|
|
|
|
avg_adcG1er_map[framecounter/100]->GetXaxis()->SetTitle("Column");
|
|
avg_adcG1er_map[framecounter/100]->GetYaxis()->SetTitle("Row");
|
|
avg_adcG1er_map[framecounter/100]->GetYaxis()->SetTitleOffset(0.7);
|
|
avg_adcG1er_map[framecounter/100]->GetZaxis()->SetRangeUser(0,20);
|
|
avg_adcG1er_map[framecounter/100]->Draw("colz");
|
|
sprintf(savename,"plots/M%s/BackplanePulsing/perStep/adcer_g1_map_%d_M%s.png", module_str.c_str(), framecounter/100, module_str.c_str());
|
|
mapcanvas->SaveAs((const char *)(savename));
|
|
}
|
|
|
|
}
|
|
|
|
framecounter++;
|
|
}
|
|
thisfile->close();
|
|
} // end of files
|
|
|
|
// save histograms
|
|
//sprintf(savename,"/mnt/sls_det_storage/jungfrau_data1/jungfrau_ana_sophie/M%s_CalibAna/BP_histos_M%s.root", module_str.c_str(), module_str.c_str()); //uncomment for SR
|
|
sprintf(savename,"%s/BP_histos_M%s.root", anadata_loc.c_str(), module_str.c_str()); //uncomment for VH 210906
|
|
TFile* saved_file = new TFile((const char *)(savename),"RECREATE");
|
|
|
|
for (int i = 0; i < 220; i++) {
|
|
avg_adcG0_map[i]->Write();
|
|
avg_adcG1_map[i]->Write();
|
|
avg_adcG0er_map[i]->Write();
|
|
avg_adcG1er_map[i]->Write();
|
|
}
|
|
saved_file->Close();
|
|
|
|
} else {
|
|
// load histos
|
|
cout << "LOADING HISTOS" << endl;
|
|
//sprintf(savename,"/mnt/sls_det_storage/jungfrau_data1/jungfrau_ana_sophie/M%s_CalibAna/BP_histos_M%s.root", module_str.c_str(), module_str.c_str()); //uncomment for SR
|
|
sprintf(savename,"%s/BP_histos_M%s.root", anadata_loc.c_str(), module_str.c_str()); //uncomment for VH 210906
|
|
TFile* saved_file = new TFile((const char *)(savename),"READ");
|
|
|
|
for (int i = 0; i < 220; i++) {
|
|
sprintf(savename,"avg_adcG0_map_%d", i);
|
|
avg_adcG0_map[i] = (TH2F*)saved_file->Get((const char *)(savename));
|
|
sprintf(savename,"avg_adcG1_map_%d", i);
|
|
avg_adcG1_map[i] = (TH2F*)saved_file->Get((const char *)(savename));
|
|
|
|
sprintf(savename,"avg_adcG0er_map_%d", i);
|
|
avg_adcG0er_map[i] = (TH2F*)saved_file->Get((const char *)(savename));
|
|
sprintf(savename,"avg_adcG1er_map_%d", i);
|
|
avg_adcG1er_map[i] = (TH2F*)saved_file->Get((const char *)(savename));
|
|
}
|
|
}
|
|
|
|
mapcanvas->SetLeftMargin(0.13);
|
|
mapcanvas->SetRightMargin(0.05);
|
|
|
|
for (int i = 0; i < NCH; i++) {
|
|
|
|
vector<double> r0_adc;
|
|
vector<double> r0_filter;
|
|
|
|
vector<double> r0_adcerr;
|
|
vector<double> r0_ferr;
|
|
|
|
vector<double> r1_adc;
|
|
vector<double> r1_filter;
|
|
vector<double> r1_adcerr;
|
|
vector<double> r1_ferr;
|
|
|
|
for (int j = 0; j < 220; j++) {
|
|
|
|
double this_g0avg = avg_adcG0_map[j]->GetBinContent((i%NC)+1,(i/NC)+1);
|
|
double this_g1avg = avg_adcG1_map[j]->GetBinContent((i%NC)+1,(i/NC)+1);
|
|
double this_g0avger = avg_adcG0er_map[j]->GetBinContent((i%NC)+1,(i/NC)+1);
|
|
double this_g1avger = avg_adcG1er_map[j]->GetBinContent((i%NC)+1,(i/NC)+1);
|
|
|
|
if (this_g0avg != 0) {
|
|
r0_filter.push_back(xs[j]);
|
|
r0_ferr.push_back(0.);
|
|
r0_adc.push_back(this_g0avg);
|
|
r0_adcerr.push_back(this_g0avger);
|
|
}
|
|
if (this_g1avg != 0) {
|
|
r1_filter.push_back(xs[j]);
|
|
r1_ferr.push_back(0.);
|
|
r1_adc.push_back(this_g1avg);
|
|
r1_adcerr.push_back(this_g1avger);
|
|
}
|
|
}
|
|
|
|
TGraphErrors *grap_g0 = 0;
|
|
TGraphErrors *grap_g1 = 0;
|
|
|
|
TF1 *fit_g0 = 0;
|
|
TF1 *fit_g1 = 0;
|
|
|
|
double rangemin_g0 = 0;
|
|
double rangemax_g0 = 0;
|
|
double rangemin_g1 = 0;
|
|
double rangemax_g1 = 0;
|
|
|
|
// define graphs
|
|
if (r0_adc.size() > 1) {
|
|
grap_g0 = new TGraphErrors(r0_adc.size(),&(r0_filter[0]),&(r0_adc[0]),&(r0_ferr[0]),&(r0_adcerr[0]));
|
|
grap_g0->SetMarkerStyle(20);
|
|
grap_g0->SetMarkerColor(kBlue);
|
|
grap_g0->SetLineColor(kBlue);
|
|
}
|
|
|
|
if (r1_adc.size() > 1) {
|
|
grap_g1 = new TGraphErrors(r1_adc.size(),&(r1_filter[0]),&(r1_adc[0]),&(r1_ferr[0]),&(r1_adcerr[0]));
|
|
grap_g1->SetMarkerStyle(20);
|
|
grap_g1->SetMarkerColor(kGreen+2);
|
|
grap_g1->SetLineColor(kGreen+2);
|
|
}
|
|
|
|
//debug
|
|
// cout << i <<" r0size= "<< r0_adc.size()<< " r1size= "<< r1_adc.size()<< endl;
|
|
// 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
|
|
//|| (i >= (325*1024+902) && i < (325*1024+902)+10) // addon VH "high" G1 in Module 352
|
|
//|| (i >= (331*1024+902) && i < (331*1024+902)+10) // addon VH "low" G1 in Module 352
|
|
) {
|
|
|
|
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";
|
|
}
|
|
|
|
grap_g1->GetXaxis()->SetTitle("Signal generator voltage [mV]");
|
|
grap_g1->GetYaxis()->SetTitle("ADC [ADU]");
|
|
grap_g1->GetYaxis()->SetTitleOffset(0.9);
|
|
grap_g1->SetMinimum(1000);
|
|
grap_g1->SetMaximum(15000);
|
|
grap_g1->GetXaxis()->SetLimits(0,7200);
|
|
grap_g1->Draw("AP");
|
|
if (r0_adc.size() > 1) {
|
|
grap_g0->Draw("P");
|
|
}
|
|
mapcanvas->Update();
|
|
sprintf(savename,"plots/M%s/%s/pixel_%s_%d_M%s.png", module_str.c_str(), plotfolder_str.c_str(),pixel_type.c_str(), i,module_str.c_str());
|
|
mapcanvas->SaveAs((const char *)(savename));
|
|
|
|
}
|
|
}
|
|
|
|
// define fit ranges and fit
|
|
if (r0_adc.size() > 1) {
|
|
|
|
rangemin_g0 = *min_element(r0_filter.begin(),r0_filter.end());
|
|
rangemax_g0 = highestPointBeforeSwitching(r0_filter,r1_filter);
|
|
|
|
if (rangemax_g0 > rangemin_g0) {
|
|
|
|
grap_g0->Fit("pol1","QRC","",rangemin_g0,rangemax_g0);
|
|
fit_g0 = (TF1*) grap_g0->GetFunction("pol1");
|
|
if (fit_g0) {
|
|
fit_g0->SetLineColor(kBlue);
|
|
fit_g0->SetParName(0,"G0 const");
|
|
fit_g0->SetParName(1,"G0 grad");
|
|
|
|
g0_grad_hist->Fill(fit_g0->GetParameter(1));
|
|
g0_grader_hist->Fill(fit_g0->GetParError(1));
|
|
g0_grad_map->Fill(i%NC,i/NC,fit_g0->GetParameter(1));
|
|
g0_grader_map->Fill(i%NC,i/NC,fit_g0->GetParError(1));
|
|
g0_const_hist->Fill(fit_g0->GetParameter(0));
|
|
g0_conster_hist->Fill(fit_g0->GetParError(0));
|
|
g0_const_map->Fill(i%NC,i/NC,fit_g0->GetParameter(0));
|
|
g0_conster_map->Fill(i%NC,i/NC,fit_g0->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
|
|
//|| (i >= (325*1024+902) && i < (325*1024+902)+10) // addon VH "high" G1 in Module 352
|
|
//|| (i >= (331*1024+902) && i < (331*1024+902)+10) // addon VH "low" G1 in Module 352
|
|
) {
|
|
|
|
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";
|
|
}
|
|
|
|
grap_g0->GetXaxis()->SetTitle("Signal generator voltage [mV]");
|
|
grap_g0->GetYaxis()->SetTitle("ADC [ADU]");
|
|
grap_g0->GetYaxis()->SetTitleOffset(0.9);
|
|
grap_g0->SetMinimum(1000);
|
|
grap_g0->SetMaximum(15000);
|
|
grap_g0->GetXaxis()->SetLimits(*min_element(r0_filter.begin(),r0_filter.end()),*max_element(r0_filter.begin(),r0_filter.end()));
|
|
grap_g0->Draw("AP");
|
|
fit_g0->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);
|
|
sprintf(savename,"plots/M%s/%s/pixel_%s_%d_g0_M%s.png", module_str.c_str(),plotfolder_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] - fit_g0->Eval(r0_filter[j]));
|
|
}
|
|
|
|
TGraphErrors *norm_g0 = new TGraphErrors(r0_adc.size(),&(r0_filter[0]),&(r0_adc_norm[0]),&(r0_ferr[0]),&(r0_adcerr[0]));
|
|
norm_g0->SetMarkerColor(kBlue);
|
|
norm_g0->SetLineColor(kBlue);
|
|
|
|
TF1* flat_g0 = new TF1("flat_g0","0",rangemin_g0,rangemax_g0);
|
|
flat_g0->SetLineColor(kBlue);
|
|
|
|
TF1* lin_g0_p1pc = new TF1("lin_g0_p1pc","[0]+[1]*x",rangemin_g0,rangemax_g0);
|
|
lin_g0_p1pc->SetParameter(0,fit_g0->GetParameter(0)/100.);
|
|
lin_g0_p1pc->SetParameter(1,fit_g0->GetParameter(1)/100.);
|
|
lin_g0_p1pc->SetLineColor(kRed);
|
|
|
|
TF1* lin_g0_p05pc = new TF1("lin_g0_p05pc","[0]+[1]*x",rangemin_g0,rangemax_g0);
|
|
lin_g0_p05pc->SetParameter(0,fit_g0->GetParameter(0)/200.);
|
|
lin_g0_p05pc->SetParameter(1,fit_g0->GetParameter(1)/200.);
|
|
lin_g0_p05pc->SetLineColor(kOrange+1);
|
|
|
|
TF1* lin_g0_p02pc = new TF1("lin_g0_p02pc","[0]+[1]*x",rangemin_g0,rangemax_g0);
|
|
lin_g0_p02pc->SetParameter(0,fit_g0->GetParameter(0)/500.);
|
|
lin_g0_p02pc->SetParameter(1,fit_g0->GetParameter(1)/500.);
|
|
lin_g0_p02pc->SetLineColor(kOrange);
|
|
|
|
TF1* lin_g0_m1pc = new TF1("lin_g0_m1pc","[0]+[1]*x",rangemin_g0,rangemax_g0);
|
|
lin_g0_m1pc->SetParameter(0,fit_g0->GetParameter(0)/-100.);
|
|
lin_g0_m1pc->SetParameter(1,fit_g0->GetParameter(1)/-100.);
|
|
lin_g0_m1pc->SetLineColor(kRed);
|
|
|
|
TF1* lin_g0_m05pc = new TF1("lin_g0_m05pc","[0]+[1]*x",rangemin_g0,rangemax_g0);
|
|
lin_g0_m05pc->SetParameter(0,fit_g0->GetParameter(0)/-200.);
|
|
lin_g0_m05pc->SetParameter(1,fit_g0->GetParameter(1)/-200.);
|
|
lin_g0_m05pc->SetLineColor(kOrange+1);
|
|
|
|
TF1* lin_g0_m02pc = new TF1("lin_g0_m02pc","[0]+[1]*x",rangemin_g0,rangemax_g0);
|
|
lin_g0_m02pc->SetParameter(0,fit_g0->GetParameter(0)/-500.);
|
|
lin_g0_m02pc->SetParameter(1,fit_g0->GetParameter(1)/-500.);
|
|
lin_g0_m02pc->SetLineColor(kOrange);
|
|
|
|
norm_g0->GetXaxis()->SetRangeUser(*min_element(r0_filter.begin(),r0_filter.end()),*max_element(r0_filter.begin(),r0_filter.end()));
|
|
|
|
norm_g0->SetMinimum(1.5*lin_g0_m02pc->Eval(rangemax_g0));
|
|
norm_g0->SetMaximum(1.5*lin_g0_p02pc->Eval(rangemax_g0));
|
|
|
|
if (isHGX) {
|
|
norm_g0->SetMinimum(3*lin_g0_m02pc->Eval(rangemax_g0));
|
|
norm_g0->SetMaximum(3*lin_g0_p02pc->Eval(rangemax_g0));
|
|
}
|
|
|
|
norm_g0->GetXaxis()->SetTitle("Signal generator voltage [mV]");
|
|
norm_g0->GetYaxis()->SetTitle("Normalised ADC [ADU]");
|
|
norm_g0->GetYaxis()->SetTitleOffset(0.9);
|
|
norm_g0->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");
|
|
norm_g0->Draw("P");
|
|
sprintf(savename,"plots/M%s/%s/pixel_%s_%d_g0norm_M%s.png", module_str.c_str(), plotfolder_str.c_str(),pixel_type.c_str(), i, module_str.c_str());
|
|
mapcanvas->SaveAs((const char *)(savename));
|
|
|
|
delete norm_g0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (r1_adc.size() > 1) {
|
|
|
|
rangemin_g1 = lowestPointAfterSwitching(r1_filter,r0_filter);
|
|
rangemax_g1 = *max_element(r1_filter.begin(),r1_filter.end());
|
|
rangemax_g1 = checkRangeMaxForAmplifierPlateau(rangemax_g1);
|
|
|
|
if (rangemax_g1 > rangemin_g1) {
|
|
|
|
grap_g1->Fit("pol1","QRC","",rangemin_g1,rangemax_g1);
|
|
fit_g1 = (TF1*) grap_g1->GetFunction("pol1");
|
|
if (fit_g1) {
|
|
fit_g1->SetLineColor(kGreen+2);
|
|
fit_g1->SetParName(0,"G1 const");
|
|
fit_g1->SetParName(1,"G1 grad");
|
|
|
|
g1_grad_hist->Fill(fit_g1->GetParameter(1));
|
|
g1_grader_hist->Fill(fit_g1->GetParError(1));
|
|
g1_grad_map->Fill(i%NC,i/NC,fit_g1->GetParameter(1));
|
|
g1_grader_map->Fill(i%NC,i/NC,fit_g1->GetParError(1));
|
|
g1_const_hist->Fill(fit_g1->GetParameter(0));
|
|
g1_conster_hist->Fill(fit_g1->GetParError(0));
|
|
g1_const_map->Fill(i%NC,i/NC,fit_g1->GetParameter(0));
|
|
g1_conster_map->Fill(i%NC,i/NC,fit_g1->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
|
|
//|| (i >= (325*1024+902) && i < (325*1024+902)+10) // addon VH "high" G1 in Module 352
|
|
//|| (i >= (331*1024+902) && i < (331*1024+902)+10) // addon VH "low" G1 in Module 352
|
|
) {
|
|
|
|
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";
|
|
}
|
|
|
|
grap_g1->GetXaxis()->SetTitle("Signal generator voltage [mV]");
|
|
grap_g1->GetYaxis()->SetTitle("ADC [ADU]");
|
|
grap_g1->GetYaxis()->SetTitleOffset(0.9);
|
|
grap_g1->SetMinimum(1000);
|
|
grap_g1->SetMaximum(15000);
|
|
grap_g1->GetXaxis()->SetLimits(*min_element(r1_filter.begin(),r1_filter.end()),*max_element(r1_filter.begin(),r1_filter.end()));
|
|
grap_g1->Draw("AP");
|
|
fit_g1->Draw("same");
|
|
mapcanvas->Update();
|
|
TPaveStats *st0 = (TPaveStats*)grap_g1->FindObject("stats");
|
|
st0->SetX1NDC(0.6);
|
|
st0->SetX2NDC(0.94);
|
|
st0->SetY1NDC(0.18);
|
|
st0->SetY2NDC(0.37);
|
|
st0->SetBorderSize(0);
|
|
st0->SetTextColor(kGreen+2);
|
|
sprintf(savename,"plots/M%s/%s/pixel_%s_%d_g1_M%s.png", module_str.c_str(), plotfolder_str.c_str(), pixel_type.c_str(), i, module_str.c_str());
|
|
mapcanvas->SaveAs((const char *)(savename));
|
|
|
|
vector<double> r1_adc_norm;
|
|
for (size_t j = 0; j < r1_adc.size(); j++) {
|
|
r1_adc_norm.push_back(r1_adc[j] - fit_g1->Eval(r1_filter[j]));
|
|
}
|
|
|
|
TGraphErrors *norm_g1 = new TGraphErrors(r1_adc.size(),&(r1_filter[0]),&(r1_adc_norm[0]),&(r1_ferr[0]),&(r1_adcerr[0]));
|
|
norm_g1->SetMarkerColor(kGreen+2);
|
|
norm_g1->SetLineColor(kGreen+2);
|
|
|
|
TF1* flat_g1 = new TF1("flat_gi","0",rangemin_g1,rangemax_g1);
|
|
flat_g1->SetLineColor(kGreen+2);
|
|
|
|
TF1* lin_g1_p02pc = new TF1("lin_g1_p02pc","[0]+[1]*x",rangemin_g1,rangemax_g1);
|
|
lin_g1_p02pc->SetParameter(0,fit_g1->GetParameter(0)/500.);
|
|
lin_g1_p02pc->SetParameter(1,fit_g1->GetParameter(1)/500.);
|
|
lin_g1_p02pc->SetLineColor(kOrange);
|
|
|
|
TF1* lin_g1_p01pc = new TF1("lin_g1_p01pc","[0]+[1]*x",rangemin_g1,rangemax_g1);
|
|
lin_g1_p01pc->SetParameter(0,fit_g1->GetParameter(0)/1000.);
|
|
lin_g1_p01pc->SetParameter(1,fit_g1->GetParameter(1)/1000.);
|
|
lin_g1_p01pc->SetLineColor(kYellow);
|
|
|
|
TF1* lin_g1_m02pc = new TF1("lin_g1_m02pc","[0]+[1]*x",rangemin_g1,rangemax_g1);
|
|
lin_g1_m02pc->SetParameter(0,fit_g1->GetParameter(0)/-500.);
|
|
lin_g1_m02pc->SetParameter(1,fit_g1->GetParameter(1)/-500.);
|
|
lin_g1_m02pc->SetLineColor(kOrange);
|
|
|
|
TF1* lin_g1_m01pc = new TF1("lin_g1_m01pc","[0]+[1]*x",rangemin_g1,rangemax_g1);
|
|
lin_g1_m01pc->SetParameter(0,fit_g1->GetParameter(0)/-1000.);
|
|
lin_g1_m01pc->SetParameter(1,fit_g1->GetParameter(1)/-1000.);
|
|
lin_g1_m01pc->SetLineColor(kYellow);
|
|
|
|
norm_g1->GetXaxis()->SetRangeUser(*min_element(r1_filter.begin(),r1_filter.end()),*max_element(r1_filter.begin(),r1_filter.end()));
|
|
norm_g1->SetMinimum(1.5*lin_g1_m02pc->Eval(rangemin_g1));
|
|
norm_g1->SetMaximum(1.5*lin_g1_p02pc->Eval(rangemin_g1));
|
|
norm_g1->GetXaxis()->SetTitle("Signal generator voltage [mV]");
|
|
norm_g1->GetYaxis()->SetTitle("Normalised ADC [ADU]");
|
|
norm_g1->GetYaxis()->SetTitleOffset(0.9);
|
|
norm_g1->Draw("AP");
|
|
flat_g1->Draw("same");
|
|
lin_g1_p02pc->Draw("same");
|
|
lin_g1_p01pc->Draw("same");
|
|
lin_g1_m02pc->Draw("same");
|
|
lin_g1_m01pc->Draw("same");
|
|
norm_g1->Draw("P");
|
|
sprintf(savename,"plots/M%s/%s/pixel_%s_%d_g1norm_M%s.png", module_str.c_str(),plotfolder_str.c_str(), pixel_type.c_str(), i, module_str.c_str());
|
|
mapcanvas->SaveAs((const char *)(savename));
|
|
|
|
delete norm_g1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// get ratio measurements
|
|
if (fit_g0 && fit_g1) {
|
|
|
|
double this_g0overg1 = fit_g0->GetParameter(1)/fit_g1->GetParameter(1);
|
|
double this_g0overg1er = sqrt(pow(fit_g0->GetParError(1)/fit_g0->GetParameter(1),2) + pow(fit_g1->GetParError(1)/fit_g1->GetParameter(1),2));
|
|
|
|
g0overg1_map->Fill(i%NC,i/NC,this_g0overg1);
|
|
g0overg1_hist->Fill(this_g0overg1);
|
|
g0overg1er_map->Fill(i%NC,i/NC,this_g0overg1er);
|
|
g0overg1er_hist->Fill(this_g0overg1er);
|
|
|
|
if (isEdge(i)) {
|
|
g0overg1_hist_isEdge->Fill(this_g0overg1);
|
|
}
|
|
if (isInnerEdge(i)) {
|
|
g0overg1_hist_isInnerEdge->Fill(this_g0overg1);
|
|
}
|
|
if (isDouble(i)) {
|
|
g0overg1_hist_isDouble->Fill(this_g0overg1);
|
|
}
|
|
if (isNextToDouble(i)) {
|
|
g0overg1_hist_isNextToDouble->Fill(this_g0overg1);
|
|
}
|
|
if (isQuad(i)) {
|
|
g0overg1_hist_isQuad->Fill(this_g0overg1);
|
|
}
|
|
if (isBulk(i)) {
|
|
g0overg1_hist_isBulk->Fill(this_g0overg1);
|
|
}
|
|
} else {
|
|
no_g0g1_calib_map->Fill(i%NC,i/NC,1);
|
|
}
|
|
|
|
delete grap_g0;
|
|
delete grap_g1;
|
|
}
|
|
|
|
mapcanvas->SetLeftMargin(0.1);
|
|
mapcanvas->SetRightMargin(0.13);
|
|
|
|
c1->cd();
|
|
|
|
g0_grad_hist->GetXaxis()->SetTitle("G0 gradient");
|
|
g0_grad_hist->Draw();
|
|
sprintf(savename,"plots/M%s/%s/g0_grad_hist_M%s.png", module_str.c_str(), plotfolder_str.c_str(), module_str.c_str());
|
|
c1->SaveAs((const char *)(savename));
|
|
|
|
g0_grader_hist->GetXaxis()->SetTitle("#sigma_{G0 gradient}");
|
|
g0_grader_hist->Draw();
|
|
sprintf(savename,"plots/M%s/%s/g0_grader_hist_M%s.png", module_str.c_str(), plotfolder_str.c_str(), module_str.c_str());
|
|
c1->SaveAs((const char *)(savename));
|
|
|
|
g1_grad_hist->GetXaxis()->SetTitle("G1 gradient");
|
|
g1_grad_hist->Draw();
|
|
sprintf(savename,"plots/M%s/%s/g1_grad_hist_M%s.png", module_str.c_str(), plotfolder_str.c_str(), module_str.c_str());
|
|
c1->SaveAs((const char *)(savename));
|
|
|
|
g1_grader_hist->GetXaxis()->SetTitle("#sigma_{G1 gradient}");
|
|
g1_grader_hist->Draw();
|
|
sprintf(savename,"plots/M%s/%s/g1_grader_hist_M%s.png", module_str.c_str(), plotfolder_str.c_str(), module_str.c_str());
|
|
c1->SaveAs((const char *)(savename));
|
|
|
|
g0_const_hist->GetXaxis()->SetTitle("G0 intercept");
|
|
g0_const_hist->Draw();
|
|
sprintf(savename,"plots/M%s/%s/g0_const_hist_M%s.png", module_str.c_str(), plotfolder_str.c_str(),module_str.c_str());
|
|
c1->SaveAs((const char *)(savename));
|
|
|
|
g0_conster_hist->GetXaxis()->SetTitle("#sigma_{G0 intercept}");
|
|
g0_conster_hist->Draw();
|
|
sprintf(savename,"plots/M%s/%s/g0_conster_hist_M%s.png", module_str.c_str(), plotfolder_str.c_str(),module_str.c_str());
|
|
c1->SaveAs((const char *)(savename));
|
|
|
|
g1_const_hist->GetXaxis()->SetTitle("G1 intercept");
|
|
g1_const_hist->Draw();
|
|
sprintf(savename,"plots/M%s/%s/g1_const_hist_M%s.png", module_str.c_str(), plotfolder_str.c_str(),module_str.c_str());
|
|
c1->SaveAs((const char *)(savename));
|
|
|
|
g1_conster_hist->GetXaxis()->SetTitle("#sigma_{G1 intercept}");
|
|
g1_conster_hist->Draw();
|
|
sprintf(savename,"plots/M%s/%s/g1_conster_hist_M%s.png", module_str.c_str(), plotfolder_str.c_str(),module_str.c_str());
|
|
c1->SaveAs((const char *)(savename));
|
|
|
|
mapcanvas->cd();
|
|
|
|
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);
|
|
|
|
g0_grad_map->GetXaxis()->SetTitle("Column");
|
|
g0_grad_map->GetYaxis()->SetTitle("Row");
|
|
g0_grad_map->GetYaxis()->SetTitleOffset(0.7);
|
|
g0_grad_map->Draw("colz");
|
|
pave->AddText("G0 [ADU/mV]");
|
|
pave->Draw();
|
|
if (module_str == "351" ||
|
|
module_str == "351_fullspeed" ||
|
|
module_str == "352" ||
|
|
module_str == "352_fullspeed" ||
|
|
module_str == "261" ||
|
|
module_str == "261_fullspeed" ||
|
|
module_str == "310" ||
|
|
module_str == "310_fullspeed" ||
|
|
module_str == "312" ||
|
|
module_str == "312_fullspeed" ||
|
|
module_str == "264" ||
|
|
module_str == "264_fullspeed" ||
|
|
module_str == "253" ||
|
|
module_str == "253_fullspeed" ||
|
|
module_str == "307" ||
|
|
module_str == "307_fullspeed" ||
|
|
module_str == "272_halfspeedtest" ||
|
|
module_str == "272_fullspeedtest") {
|
|
g0_grad_map->GetZaxis()->SetRangeUser(3,4);
|
|
} else {
|
|
g0_grad_map->GetZaxis()->SetRangeUser(8,13);
|
|
}
|
|
if (isHGX) g0_grad_map->GetZaxis()->SetRangeUser(25,35);
|
|
|
|
|
|
sprintf(savename,"plots/M%s/%s/g0_grad_map_M%s.png", module_str.c_str(), plotfolder_str.c_str(),module_str.c_str());
|
|
mapcanvas->SaveAs((const char *)(savename));
|
|
|
|
g0_grader_map->GetXaxis()->SetTitle("Column");
|
|
g0_grader_map->GetYaxis()->SetTitle("Row");
|
|
g0_grader_map->GetYaxis()->SetTitleOffset(0.7);
|
|
g0_grader_map->Draw("colz");
|
|
pave->Clear();
|
|
pave->AddText("#sigma_{G0}");
|
|
pave->Draw();
|
|
g0_grader_map->GetZaxis()->SetRangeUser(0.0,0.01);
|
|
sprintf(savename,"plots/M%s/%s/g0_grader_map_M%s.png", module_str.c_str(), plotfolder_str.c_str(),module_str.c_str());
|
|
mapcanvas->SaveAs((const char *)(savename));
|
|
|
|
g1_grad_map->GetXaxis()->SetTitle("Column");
|
|
g1_grad_map->GetYaxis()->SetTitle("Row");
|
|
g1_grad_map->GetYaxis()->SetTitleOffset(0.7);
|
|
g1_grad_map->Draw("colz");
|
|
pave->Clear();
|
|
pave->AddText("G1 [ADU/mV]");
|
|
pave->Draw();
|
|
if (module_str == "006") {
|
|
g1_grad_map->GetZaxis()->SetRangeUser(-0.3,-0.1);
|
|
} else if (module_str == "021" || module_str == "022" || module_str == "044") {
|
|
g1_grad_map->GetZaxis()->SetRangeUser(-0.3,-0.23);
|
|
} else if (module_str == "351" ||
|
|
module_str == "351_fullspeed" ||
|
|
module_str == "352" ||
|
|
module_str == "352_fullspeed" ||
|
|
module_str == "261" ||
|
|
module_str == "261_fullspeed" ||
|
|
module_str == "310" ||
|
|
module_str == "310_fullspeed" ||
|
|
module_str == "312" ||
|
|
module_str == "312_fullspeed" ||
|
|
module_str == "264" ||
|
|
module_str == "264_fullspeed" ||
|
|
module_str == "253" ||
|
|
module_str == "253_fullspeed" ||
|
|
module_str == "307" ||
|
|
module_str == "307_fullspeed" ||
|
|
module_str == "272_halfspeedtest" ||
|
|
module_str == "272_fullspeedtest") {
|
|
g1_grad_map->GetZaxis()->SetRangeUser(-0.15,-0.1);
|
|
} else {
|
|
g1_grad_map->GetZaxis()->SetRangeUser(-0.19,-0.14);
|
|
}
|
|
|
|
if (isHGX) g1_grad_map->GetZaxis()->SetRangeUser(-0.2,-0.1);
|
|
sprintf(savename,"plots/M%s/%s/g1_grad_map_M%s.png", module_str.c_str(), plotfolder_str.c_str(),module_str.c_str());
|
|
mapcanvas->SaveAs((const char *)(savename));
|
|
|
|
g1_grader_map->GetXaxis()->SetTitle("Column");
|
|
g1_grader_map->GetYaxis()->SetTitle("Row");
|
|
g1_grader_map->GetYaxis()->SetTitleOffset(0.7);
|
|
g1_grader_map->Draw("colz");
|
|
pave->Clear();
|
|
pave->AddText("#sigma_{G1}");
|
|
pave->Draw();
|
|
if (module_str == "006") {
|
|
g1_grader_map->GetZaxis()->SetRangeUser(0.0,0.002);
|
|
} else {
|
|
g1_grader_map->GetZaxis()->SetRangeUser(0.0,0.0002);
|
|
}
|
|
sprintf(savename,"plots/M%s/%s/g1_grader_map_M%s.png", module_str.c_str(), plotfolder_str.c_str(),module_str.c_str());
|
|
mapcanvas->SaveAs((const char *)(savename));
|
|
|
|
g0_const_map->GetXaxis()->SetTitle("Column");
|
|
g0_const_map->GetYaxis()->SetTitle("Row");
|
|
g0_const_map->GetYaxis()->SetTitleOffset(0.7);
|
|
g0_const_map->Draw("colz");
|
|
g0_const_map->GetZaxis()->SetRangeUser(500,4000);
|
|
sprintf(savename,"plots/M%s/%s/g0_const_map_M%s.png", module_str.c_str(), plotfolder_str.c_str(),module_str.c_str());
|
|
mapcanvas->SaveAs((const char *)(savename));
|
|
|
|
g0_conster_map->GetXaxis()->SetTitle("Column");
|
|
g0_conster_map->GetYaxis()->SetTitle("Row");
|
|
g0_conster_map->GetYaxis()->SetTitleOffset(0.7);
|
|
g0_conster_map->Draw("colz");
|
|
g0_conster_map->GetZaxis()->SetRangeUser(0.6,1.2);
|
|
sprintf(savename,"plots/M%s/%s/g0_conster_map_M%s.png", module_str.c_str(), plotfolder_str.c_str(),module_str.c_str());
|
|
mapcanvas->SaveAs((const char *)(savename));
|
|
|
|
g1_const_map->GetXaxis()->SetTitle("Column");
|
|
g1_const_map->GetYaxis()->SetTitle("Row");
|
|
g1_const_map->GetYaxis()->SetTitleOffset(0.7);
|
|
g1_const_map->Draw("colz");
|
|
if (module_str == "006") {
|
|
g1_const_map->GetZaxis()->SetRangeUser(10000,15000);
|
|
} else {
|
|
g1_const_map->GetZaxis()->SetRangeUser(13000,16000);
|
|
}
|
|
sprintf(savename,"plots/M%s/%s/g1_const_map_M%s.png", module_str.c_str(), plotfolder_str.c_str(),module_str.c_str());
|
|
mapcanvas->SaveAs((const char *)(savename));
|
|
|
|
g1_conster_map->GetXaxis()->SetTitle("Column");
|
|
g1_conster_map->GetYaxis()->SetTitle("Row");
|
|
g1_conster_map->GetYaxis()->SetTitleOffset(0.7);
|
|
g1_conster_map->Draw("colz");
|
|
if (module_str == "006") {
|
|
g1_conster_map->GetZaxis()->SetRangeUser(0.0,10.);
|
|
} else {
|
|
g1_conster_map->GetZaxis()->SetRangeUser(0.0,1.);
|
|
}
|
|
sprintf(savename,"plots/M%s/%s/g1_conster_map_M%s.png", module_str.c_str(), plotfolder_str.c_str(),module_str.c_str());
|
|
mapcanvas->SaveAs((const char *)(savename));
|
|
|
|
c1->cd();
|
|
|
|
g0overg1_hist->GetXaxis()->SetTitle("G0 / G1");
|
|
g0overg1_hist->Draw();
|
|
sprintf(savename,"plots/M%s/%s/g0overg1_hist_M%s.png", module_str.c_str(), plotfolder_str.c_str(),module_str.c_str());
|
|
c1->SaveAs((const char *)(savename));
|
|
|
|
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);
|
|
g0overg1_hist->Fit("gaus");
|
|
g0overg1_hist->Draw();
|
|
c1->Update();
|
|
TF1* g0overg1hist_gaus = g0overg1_hist->GetFunction("gaus");
|
|
if (g0overg1hist_gaus) {
|
|
sprintf(savename,"Mean %0.4f #pm %0.4f", g0overg1hist_gaus->GetParameter(1), g0overg1hist_gaus->GetParError(1));
|
|
pave2->AddText((const char *)(savename));
|
|
sprintf(savename,"Sigma %0.4f #pm %0.4f", g0overg1hist_gaus->GetParameter(2), g0overg1hist_gaus->GetParError(2));
|
|
pave2->AddText((const char *)(savename));
|
|
pave2->Draw();
|
|
}
|
|
g0overg1_hist->SetStats(kFALSE);
|
|
sprintf(savename,"plots/M%s/%s/g0overg1_histfit_M%s.png", module_str.c_str(), plotfolder_str.c_str(),module_str.c_str());
|
|
c1->SaveAs((const char *)(savename));
|
|
|
|
g0overg1er_hist->GetXaxis()->SetTitle("#sigma_{G0 / G1}");
|
|
g0overg1er_hist->Draw();
|
|
sprintf(savename,"plots/M%s/%s/g0overg1er_hist_M%s.png", module_str.c_str(), plotfolder_str.c_str(),module_str.c_str());
|
|
c1->SaveAs((const char *)(savename));
|
|
|
|
g0overg1_hist_isEdge->SetLineColor(kBlue);
|
|
g0overg1_hist_isInnerEdge->SetLineColor(kCyan);
|
|
g0overg1_hist_isDouble->SetLineColor(kGreen+2);
|
|
g0overg1_hist_isNextToDouble->SetLineColor(kRed);
|
|
g0overg1_hist_isQuad->SetLineColor(kOrange);
|
|
|
|
g0overg1_hist_isEdge->Scale(1./g0overg1_hist_isEdge->GetEntries());
|
|
g0overg1_hist_isInnerEdge->Scale(1./g0overg1_hist_isInnerEdge->GetEntries());
|
|
g0overg1_hist_isDouble->Scale(1./g0overg1_hist_isDouble->GetEntries());
|
|
g0overg1_hist_isNextToDouble->Scale(1./g0overg1_hist_isNextToDouble->GetEntries());
|
|
g0overg1_hist_isQuad->Scale(1./g0overg1_hist_isQuad->GetEntries());
|
|
g0overg1_hist_isBulk->Scale(1./g0overg1_hist_isBulk->GetEntries());
|
|
|
|
TLegend *leg = new TLegend(0.62,0.6,0.93,0.93);
|
|
leg->AddEntry(g0overg1_hist_isBulk, "Normal", "l");
|
|
leg->AddEntry(g0overg1_hist_isDouble, "Double", "l");
|
|
leg->AddEntry(g0overg1_hist_isNextToDouble, "Next to D", "l");
|
|
leg->AddEntry(g0overg1_hist_isEdge, "Edge", "l");
|
|
leg->AddEntry(g0overg1_hist_isInnerEdge, "Inner E", "l");
|
|
|
|
if (module_str == "006") {
|
|
g0overg1_hist_isEdge->GetXaxis()->SetTitle("G0 / G1");
|
|
g0overg1_hist_isEdge->GetYaxis()->SetTitle("Normalised");
|
|
g0overg1_hist_isEdge->GetYaxis()->SetTitleOffset(1.3);
|
|
g0overg1_hist_isEdge->Draw();
|
|
g0overg1_hist_isDouble->Draw("same");
|
|
} else {
|
|
g0overg1_hist_isDouble->GetXaxis()->SetTitle("G0 / G1");
|
|
g0overg1_hist_isDouble->GetYaxis()->SetTitle("Normalised");
|
|
g0overg1_hist_isDouble->GetYaxis()->SetTitleOffset(1.3);
|
|
g0overg1_hist_isDouble->Draw();
|
|
g0overg1_hist_isEdge->Draw("same");
|
|
}
|
|
g0overg1_hist_isInnerEdge->Draw("same");
|
|
g0overg1_hist_isNextToDouble->Draw("same");
|
|
g0overg1_hist_isBulk->Draw("same");
|
|
leg->Draw("same");
|
|
sprintf(savename,"plots/M%s/%s/g0overg1_hist_perType_M%s.png", module_str.c_str(), plotfolder_str.c_str(),module_str.c_str());
|
|
c1->SaveAs((const char *)(savename));
|
|
|
|
mapcanvas->cd();
|
|
|
|
g0overg1_map->GetXaxis()->SetTitle("Column");
|
|
g0overg1_map->GetYaxis()->SetTitle("Row");
|
|
g0overg1_map->GetYaxis()->SetTitleOffset(0.7);
|
|
g0overg1_map->Draw("colz");
|
|
pave->Clear();
|
|
pave->AddText("G0/G1");
|
|
pave->Draw();
|
|
|
|
if (isHGX) {
|
|
g0overg1_map->GetZaxis()->SetRangeUser(-190,-150);
|
|
}
|
|
else {
|
|
//g0overg1_map->GetZaxis()->SetRangeUser(-31,-27);
|
|
g0overg1_map->GetZaxis()->SetRangeUser(-58,-53);
|
|
}
|
|
|
|
sprintf(savename,"plots/M%s/%s/g0overg1_map_M%s.png", module_str.c_str(), plotfolder_str.c_str(),module_str.c_str());
|
|
mapcanvas->SaveAs((const char *)(savename));
|
|
|
|
g0overg1er_map->GetXaxis()->SetTitle("Column");
|
|
g0overg1er_map->GetYaxis()->SetTitle("Row");
|
|
g0overg1er_map->GetYaxis()->SetTitleOffset(0.7);
|
|
g0overg1er_map->Draw("colz");
|
|
pave->Clear();
|
|
pave->AddText("#sigma_{G0/G1}");
|
|
pave->Draw();
|
|
if (module_str == "006") {
|
|
g0overg1er_map->GetZaxis()->SetRangeUser(0,0.01);
|
|
} else {
|
|
g0overg1er_map->GetZaxis()->SetRangeUser(0,0.001);
|
|
}
|
|
sprintf(savename,"plots/M%s/%s/g0overg1er_map_M%s.png", module_str.c_str(), plotfolder_str.c_str(),module_str.c_str());
|
|
mapcanvas->SaveAs((const char *)(savename));
|
|
|
|
no_g0g1_calib_map->GetXaxis()->SetTitle("Column");
|
|
no_g0g1_calib_map->GetYaxis()->SetTitle("Row");
|
|
no_g0g1_calib_map->GetYaxis()->SetTitleOffset(0.7);
|
|
no_g0g1_calib_map->Draw("colz");
|
|
sprintf(savename,"plots/M%s/%s/no_g0g1_calib_map_M%s.png", module_str.c_str(), plotfolder_str.c_str(),module_str.c_str());
|
|
mapcanvas->SaveAs((const char *)(savename));
|
|
|
|
|
|
if (isHGX) {
|
|
sprintf(savename,"data/M%s/BP_ratio_M%s_HG0G1G2.root", module_str.c_str(), module_str.c_str());
|
|
}
|
|
else
|
|
{
|
|
sprintf(savename,"data/M%s/BP_ratio_M%s.root", module_str.c_str(), module_str.c_str());
|
|
}
|
|
|
|
|
|
TFile* saved_file2 = new TFile((const char *)(savename),"RECREATE");
|
|
g0overg1_map->Write();
|
|
g0overg1er_map->Write();
|
|
g0_grad_map->Write();
|
|
g1_grad_map->Write();
|
|
saved_file2->Close();
|
|
|
|
}
|