Mostly old changes for HG0HG1HG2 calibration

This commit is contained in:
2023-05-31 14:07:06 +02:00
parent e6026875ff
commit 74ee17a0da
3 changed files with 431 additions and 73 deletions

View File

@ -43,7 +43,7 @@ int main(int argc, char* argv[]) {
}
*/ //uncomment for SR
if (argc != 4) {
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;
@ -52,18 +52,31 @@ int main(int argc, char* argv[]) {
} //uncomment for VH 210906
string module_str = argv[1];
string str2 ("HG0G1G2");
if (module_str.find(str2) == string::npos) isHGX=true;
if (isHGX) { cout << " HG0->HG1->HG2 sequence - dynamicHG0" <<endl;}
else
{cout << " G0->G1->G2 sequence - dynamicG0" <<endl;}
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
@ -93,7 +106,7 @@ if (module_str.find(str2) == string::npos) isHGX=true;
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/BackplanePulsing", module_str.c_str());
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
@ -134,8 +147,10 @@ if (module_str.find(str2) == string::npos) isHGX=true;
module_str == "253" ||
module_str == "253_fullspeed" ||
module_str == "307" ||
module_str == "307_fullspeed") {
g0_grad_hist = new TH1F("g0_grad_hist","",100,3,10);
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,5,10);
}
@ -157,8 +172,10 @@ if (module_str.find(str2) == string::npos) isHGX=true;
module_str == "253" ||
module_str == "253_fullspeed" ||
module_str == "307" ||
module_str == "307_fullspeed") {
g1_grad_hist = new TH1F("g1_grad_hist","",100,-0.3,-0.1);
module_str == "307_fullspeed" ||
module_str == "272_halfspeedtest" ||
module_str == "272_fullspeedtest") {
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);
}
@ -459,7 +476,7 @@ if (module_str.find(str2) == string::npos) isHGX=true;
grap_g0->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());
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));
}
@ -530,7 +547,7 @@ if (module_str.find(str2) == string::npos) isHGX=true;
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());
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;
@ -597,7 +614,7 @@ if (module_str.find(str2) == string::npos) isHGX=true;
lin_g0_m05pc->Draw("same");
lin_g0_m02pc->Draw("same");
norm_g0->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());
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;
@ -671,7 +688,7 @@ if (module_str.find(str2) == string::npos) isHGX=true;
st0->SetY2NDC(0.37);
st0->SetBorderSize(0);
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());
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;
@ -719,7 +736,7 @@ if (module_str.find(str2) == string::npos) isHGX=true;
lin_g1_m02pc->Draw("same");
lin_g1_m01pc->Draw("same");
norm_g1->Draw("P");
sprintf(savename,"plots/M%s/BackplanePulsing/pixel_%s_%d_g1norm_M%s.png", module_str.c_str(), pixel_type.c_str(), i, module_str.c_str());
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;
@ -772,42 +789,42 @@ if (module_str.find(str2) == string::npos) isHGX=true;
g0_grad_hist->GetXaxis()->SetTitle("G0 gradient");
g0_grad_hist->Draw();
sprintf(savename,"plots/M%s/BackplanePulsing/g0_grad_hist_M%s.png", module_str.c_str(), module_str.c_str());
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/BackplanePulsing/g0_grader_hist_M%s.png", module_str.c_str(), module_str.c_str());
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/BackplanePulsing/g1_grad_hist_M%s.png", module_str.c_str(), module_str.c_str());
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/BackplanePulsing/g1_grader_hist_M%s.png", module_str.c_str(), module_str.c_str());
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/BackplanePulsing/g0_const_hist_M%s.png", module_str.c_str(), module_str.c_str());
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/BackplanePulsing/g0_conster_hist_M%s.png", module_str.c_str(), module_str.c_str());
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/BackplanePulsing/g1_const_hist_M%s.png", module_str.c_str(), module_str.c_str());
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/BackplanePulsing/g1_conster_hist_M%s.png", module_str.c_str(), module_str.c_str());
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();
@ -839,15 +856,17 @@ if (module_str.find(str2) == string::npos) isHGX=true;
module_str == "253" ||
module_str == "253_fullspeed" ||
module_str == "307" ||
module_str == "307_fullspeed") {
g0_grad_map->GetZaxis()->SetRangeUser(5,10);
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(5,10);
}
if (isHGX) g0_grad_map->GetZaxis()->SetRangeUser(10,15);
sprintf(savename,"plots/M%s/BackplanePulsing/g0_grad_map_M%s.png", module_str.c_str(), module_str.c_str());
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");
@ -858,7 +877,7 @@ if (module_str.find(str2) == string::npos) isHGX=true;
pave->AddText("#sigma_{G0}");
pave->Draw();
g0_grader_map->GetZaxis()->SetRangeUser(0.0,0.001);
sprintf(savename,"plots/M%s/BackplanePulsing/g0_grader_map_M%s.png", module_str.c_str(), module_str.c_str());
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");
@ -887,14 +906,16 @@ if (module_str.find(str2) == string::npos) isHGX=true;
module_str == "253" ||
module_str == "253_fullspeed" ||
module_str == "307" ||
module_str == "307_fullspeed") {
g1_grad_map->GetZaxis()->SetRangeUser(-0.3,-0.2);
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.25,-0.2);
}
if (isHGX) g1_grad_map->GetZaxis()->SetRangeUser(-0.2,-0.1);
sprintf(savename,"plots/M%s/BackplanePulsing/g1_grad_map_M%s.png", module_str.c_str(), module_str.c_str());
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");
@ -909,7 +930,7 @@ if (module_str.find(str2) == string::npos) isHGX=true;
} else {
g1_grader_map->GetZaxis()->SetRangeUser(0.0,0.0002);
}
sprintf(savename,"plots/M%s/BackplanePulsing/g1_grader_map_M%s.png", module_str.c_str(), module_str.c_str());
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");
@ -917,7 +938,7 @@ if (module_str.find(str2) == string::npos) isHGX=true;
g0_const_map->GetYaxis()->SetTitleOffset(0.7);
g0_const_map->Draw("colz");
g0_const_map->GetZaxis()->SetRangeUser(1500,3500);
sprintf(savename,"plots/M%s/BackplanePulsing/g0_const_map_M%s.png", module_str.c_str(), module_str.c_str());
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");
@ -925,7 +946,7 @@ if (module_str.find(str2) == string::npos) isHGX=true;
g0_conster_map->GetYaxis()->SetTitleOffset(0.7);
g0_conster_map->Draw("colz");
g0_conster_map->GetZaxis()->SetRangeUser(0.0,0.5);
sprintf(savename,"plots/M%s/BackplanePulsing/g0_conster_map_M%s.png", module_str.c_str(), module_str.c_str());
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");
@ -937,7 +958,7 @@ if (module_str.find(str2) == string::npos) isHGX=true;
} else {
g1_const_map->GetZaxis()->SetRangeUser(13000,15000);
}
sprintf(savename,"plots/M%s/BackplanePulsing/g1_const_map_M%s.png", module_str.c_str(), module_str.c_str());
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");
@ -949,14 +970,14 @@ if (module_str.find(str2) == string::npos) isHGX=true;
} else {
g1_conster_map->GetZaxis()->SetRangeUser(0.0,1.);
}
sprintf(savename,"plots/M%s/BackplanePulsing/g1_conster_map_M%s.png", module_str.c_str(), module_str.c_str());
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/BackplanePulsing/g0overg1_hist_M%s.png", module_str.c_str(), module_str.c_str());
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");
@ -976,12 +997,12 @@ if (module_str.find(str2) == string::npos) isHGX=true;
pave2->Draw();
}
g0overg1_hist->SetStats(kFALSE);
sprintf(savename,"plots/M%s/BackplanePulsing/g0overg1_histfit_M%s.png", module_str.c_str(), module_str.c_str());
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/BackplanePulsing/g0overg1er_hist_M%s.png", module_str.c_str(), module_str.c_str());
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);
@ -1021,7 +1042,7 @@ if (module_str.find(str2) == string::npos) isHGX=true;
g0overg1_hist_isNextToDouble->Draw("same");
g0overg1_hist_isBulk->Draw("same");
leg->Draw("same");
sprintf(savename,"plots/M%s/BackplanePulsing/g0overg1_hist_perType_M%s.png", module_str.c_str(), module_str.c_str());
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();
@ -1036,13 +1057,13 @@ if (module_str.find(str2) == string::npos) isHGX=true;
if (isHGX) {
g0overg1_map->GetZaxis()->SetRangeUser(-110,-70);
}
else
{
g0overg1_map->GetZaxis()->SetRangeUser(-31,-27);
}
else {
//g0overg1_map->GetZaxis()->SetRangeUser(-31,-27);
g0overg1_map->GetZaxis()->SetRangeUser(-32,-28);
}
sprintf(savename,"plots/M%s/BackplanePulsing/g0overg1_map_M%s.png", module_str.c_str(), module_str.c_str());
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");
@ -1057,17 +1078,26 @@ if (module_str.find(str2) == string::npos) isHGX=true;
} else {
g0overg1er_map->GetZaxis()->SetRangeUser(0,0.001);
}
sprintf(savename,"plots/M%s/BackplanePulsing/g0overg1er_map_M%s.png", module_str.c_str(), module_str.c_str());
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/BackplanePulsing/no_g0g1_calib_map_M%s.png", module_str.c_str(), module_str.c_str());
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));
sprintf(savename,"data/M%s/BP_ratio_M%s.root", module_str.c_str(), module_str.c_str());
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();

View File

@ -56,6 +56,12 @@ int main(int argc, char* argv[]) {
string module_str = argv[1];
string gain_str = argv[2];
bool isJF11=false;
if (gain_str == "HG0JF11") {
gain_str = "HG0";
isJF11=true;
}
string data_loc = argv[3];
string pede_file = argv[4];
string data_file = argv[5];
@ -138,7 +144,7 @@ int main(int argc, char* argv[]) {
}
for (int i = 0; i < 1000; i++) {
thisfile->readNextFrame();
pixelMaskObject->maskIfGainNot(1, thisfile->getFrameDataHandle(), pixel_mask);
pixelMaskObject->maskIfGainNot(1, thisfile->getFrameDataHandle(), pixel_mask); // change to Not(2 to fix FW error during JF11 FW develop. needed for modules 243-379
}
for (int i = 0; i < 999; i++) {
thisfile->readNextFrame();
@ -254,14 +260,18 @@ int main(int argc, char* argv[]) {
sprintf(savename,"plots/M%s/CuFluo/%s/pedeRMSG0_%s_M%s.png", module_str.c_str(), gain_str.c_str(), gain_str.c_str(), module_str.c_str());
mapcanvas->SaveAs((const char *)(savename));
TH2I* adc2d_1 = new TH2I("adc2d_1","",1200,-200-0.5,1000-0.5,65536,(65536*0-0.5),(65536*1-0.5));
TH2I* adc2d_2 = new TH2I("adc2d_2","",1200,-200-0.5,1000-0.5,65536,(65536*1-0.5),(65536*2-0.5));
TH2I* adc2d_3 = new TH2I("adc2d_3","",1200,-200-0.5,1000-0.5,65536,(65536*2-0.5),(65536*3-0.5));
TH2I* adc2d_4 = new TH2I("adc2d_4","",1200,-200-0.5,1000-0.5,65536,(65536*3-0.5),(65536*4-0.5));
TH2I* adc2d_5 = new TH2I("adc2d_5","",1200,-200-0.5,1000-0.5,65536,(65536*4-0.5),(65536*5-0.5));
TH2I* adc2d_6 = new TH2I("adc2d_6","",1200,-200-0.5,1000-0.5,65536,(65536*5-0.5),(65536*6-0.5));
TH2I* adc2d_7 = new TH2I("adc2d_7","",1200,-200-0.5,1000-0.5,65536,(65536*6-0.5),(65536*7-0.5));
TH2I* adc2d_8 = new TH2I("adc2d_8","",1200,-200-0.5,1000-0.5,65536,(65536*7-0.5),(65536*8-0.5));
int adc2d_nbin= 1200;
if (isJF11) adc2d_nbin= 1600;
TH2I* adc2d_1 = new TH2I("adc2d_1","",adc2d_nbin,-200-0.5,adc2d_nbin-200-0.5,65536,(65536*0-0.5),(65536*1-0.5));
TH2I* adc2d_2 = new TH2I("adc2d_2","",adc2d_nbin,-200-0.5,adc2d_nbin-200-0.5,65536,(65536*1-0.5),(65536*2-0.5));
TH2I* adc2d_3 = new TH2I("adc2d_3","",adc2d_nbin,-200-0.5,adc2d_nbin-200-0.5,65536,(65536*2-0.5),(65536*3-0.5));
TH2I* adc2d_4 = new TH2I("adc2d_4","",adc2d_nbin,-200-0.5,adc2d_nbin-200-0.5,65536,(65536*3-0.5),(65536*4-0.5));
TH2I* adc2d_5 = new TH2I("adc2d_5","",adc2d_nbin,-200-0.5,adc2d_nbin-200-0.5,65536,(65536*4-0.5),(65536*5-0.5));
TH2I* adc2d_6 = new TH2I("adc2d_6","",adc2d_nbin,-200-0.5,adc2d_nbin-200-0.5,65536,(65536*5-0.5),(65536*6-0.5));
TH2I* adc2d_7 = new TH2I("adc2d_7","",adc2d_nbin,-200-0.5,adc2d_nbin-200-0.5,65536,(65536*6-0.5),(65536*7-0.5));
TH2I* adc2d_8 = new TH2I("adc2d_8","",adc2d_nbin,-200-0.5,adc2d_nbin-200-0.5,65536,(65536*7-0.5),(65536*8-0.5));
TH1D* adcpc_spec = new TH1D("adcpc_spec","",300,0,3000);
@ -373,8 +383,16 @@ int main(int argc, char* argv[]) {
int low_ADU_peak = 0;
int high_ADU_peak = 0;
if (gain_str == "HG0") {
low_ADU_peak = 700;
high_ADU_peak = 900;
if (isJF11) {
low_ADU_peak = 850;
high_ADU_peak = 1350;
}
} else if (gain_str == "G0") {
low_ADU_peak = 250;
high_ADU_peak = 400;
@ -424,10 +442,19 @@ int main(int argc, char* argv[]) {
if (gain_str == "HG0") {
low_bin_peak = 701;
high_bin_peak = 1200;
} else if (gain_str == "G0") {
if (isJF11) {
low_bin_peak = 801;
high_bin_peak = 1451;
}
} else if (gain_str == "G0") {
low_bin_peak = 301;
high_bin_peak = 651;
}
for (int j=1; j<9; j++) {
cout << "slice " << j << endl;

View File

@ -20,12 +20,18 @@ struct GainMaps
static double g1VALs[NCH];
static double g2VALs[NCH];
static double hg0VALs[NCH];
static double hg1VALs[NCH];
static double hg2VALs[NCH];
};
double GainMaps::g0VALs[NCH]; // definition, complete type
double GainMaps::g1VALs[NCH];
double GainMaps::g2VALs[NCH];
double GainMaps::hg0VALs[NCH];
double GainMaps::hg1VALs[NCH];
double GainMaps::hg2VALs[NCH];
int main(int argc, char* argv[]) {
jungfrauStyle();
@ -33,11 +39,14 @@ int main(int argc, char* argv[]) {
if (argc != 2) {
cout << "Correct usage:" << endl;
cout << "arg 1: specify module number" << endl;
cout << " " << endl;
exit(1);
}
string module_str = argv[1];
bool hasHGX = false;
//char savename[128];
char savename[256]; // VH 210902
@ -105,6 +114,23 @@ int main(int argc, char* argv[]) {
DB_ratioer_map = (TH2F*)DB_file->Get("g0overg1er_map");
}
// Backplane pulsing dataset for HG0hg1hg2
sprintf(savename,"data/M%s/BP_ratio_M%s_HG0G1G2.root", module_str.c_str(), module_str.c_str());
TFile* DB_HGX_file = new TFile((char*)savename,"READ");
TH2F* DB_HGX_ratio_map = 0;
TH2F* DB_HGX_ratioer_map = 0;
if (DB_HGX_file->IsZombie()) {
cout << "didn't find BP file" << endl; }
else {
cout << "loading G0/G1 from BP" << endl;
DB_HGX_ratio_map = (TH2F*)DB_HGX_file->Get("g0overg1_map");
DB_HGX_ratioer_map = (TH2F*)DB_HGX_file->Get("g0overg1er_map");
}
// Current source dataset
sprintf(savename,"data/M%s/CS_ratio_M%s.root", module_str.c_str(), module_str.c_str());
TFile* CS_file = new TFile((char*)savename,"READ");
@ -112,11 +138,30 @@ int main(int argc, char* argv[]) {
TH2F* CS_ratioer_map = 0;
if (CS_file->IsZombie()) {
cout << "didn't find CS file" << endl;
hasHGX=false;
} else {
hasHGX=true;
CS_ratio_map = (TH2F*)CS_file->Get("g1overg2map");
CS_ratioer_map = (TH2F*)CS_file->Get("g1overg2ermap");
}
// Current source dataset for HG0hg1hg2
sprintf(savename,"data/M%s/CS_ratio_M%s_HG0G1G2.root", module_str.c_str(), module_str.c_str());
TFile* CS_HGX_file = new TFile((char*)savename,"READ");
TH2F* CS_HGX_ratio_map = 0;
TH2F* CS_HGX_ratioer_map = 0;
if (CS_HGX_file->IsZombie()) {
hasHGX=false;
cout << "didn't find CS file" << endl;
} else {
if (hasHGX) hasHGX=true;
CS_HGX_ratio_map = (TH2F*)CS_HGX_file->Get("g1overg2map");
CS_HGX_ratioer_map = (TH2F*)CS_HGX_file->Get("g1overg2ermap");
}
if (hasHGX) cout << "HG0HG1HG2 data present" <<endl;
// Now write binary maps
// units of ADU/keV
// one output file per module with four maps in
@ -125,6 +170,8 @@ int main(int argc, char* argv[]) {
// start out with all calibration constants zero
for (int i = 0; i < NCH; i++) {
mapsObject->hg0VALs[i] = 0.;
mapsObject->hg1VALs[i] = 0.;
mapsObject->hg2VALs[i] = 0.;
mapsObject->g0VALs[i] = 0.;
mapsObject->g1VALs[i] = 0.;
mapsObject->g2VALs[i] = 0.;
@ -134,41 +181,60 @@ int main(int argc, char* argv[]) {
TH1F* g0histall = new TH1F("g0histall","",100,20,60);
TH1F* g1histall = new TH1F("g1histall","",100,-3,0);
TH1F* g2histall = new TH1F("g2histall","",100,-0.2,0);
TH1F* hg1histall = new TH1F("hg1histall","",100,-3,0);
TH1F* hg2histall = new TH1F("hg2histall","",100,-0.2,0);
TH1F* hg0ferhistall = new TH1F("hg0ferhistall","",100,0,0.005);
TH1F* g0ferhistall = new TH1F("g0ferhistall","",100,0,0.005);
TH1F* g1ferhistall = new TH1F("g1ferhistall","",100,0,0.01);
TH1F* g2ferhistall = new TH1F("g2ferhistall","",100,0,0.05);
TH1F* hg1ferhistall = new TH1F("hg1ferhistall","",100,0,0.01);
TH1F* hg2ferhistall = new TH1F("hg2ferhistall","",100,0,0.05);
TH1F* hg0histcut = new TH1F("hg0histcut","",160,80,160);
TH1F* g0histcut = new TH1F("g0histcut","",100,20,60);
TH1F* g1histcut = new TH1F("g1histcut","",100,-3,0);
TH1F* g2histcut = new TH1F("g2histcut","",100,-0.2,0);
TH1F* hg1histcut = new TH1F("hg1histcut","",100,-3,0);
TH1F* hg2histcut = new TH1F("hg2histcut","",100,-0.2,0);
TH2F* hg0mapall = new TH2F("hg0mapall","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
TH2F* g0mapall = new TH2F("g0mapall","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
TH2F* g1mapall = new TH2F("g1mapall","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
TH2F* g2mapall = new TH2F("g2mapall","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
TH2F* hg1mapall = new TH2F("hg1mapall","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
TH2F* hg2mapall = new TH2F("hg2mapall","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
TH2F* hg0fermapall = new TH2F("hg0fermapall","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
TH2F* g0fermapall = new TH2F("g0fermapall","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
TH2F* g1fermapall = new TH2F("g1fermapall","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
TH2F* g2fermapall = new TH2F("g2fermapall","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
TH2F* hg1fermapall = new TH2F("hg1fermapall","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
TH2F* hg2fermapall = new TH2F("hg2fermapall","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
TH2F* hg0mapcut = new TH2F("hg0mapcut","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
TH2F* g0mapcut = new TH2F("g0mapcut","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
TH2F* g1mapcut = new TH2F("g1mapcut","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
TH2F* g2mapcut = new TH2F("g2mapcut","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
TH2F* hg1mapcut = new TH2F("hg1mapcut","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
TH2F* hg2mapcut = new TH2F("hg2mapcut","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
TH2F* defaultvalmap_hg0 = new TH2F("defaultvalmap_hg0","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
TH2F* defaultvalmap_g0 = new TH2F("defaultvalmap_g0","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
TH2F* defaultvalmap_g1 = new TH2F("defaultvalmap_g1","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
TH2F* defaultvalmap_g2 = new TH2F("defaultvalmap_g2","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
TH2F* defaultvalmap_hg1 = new TH2F("defaultvalmap_hg1","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
TH2F* defaultvalmap_hg2 = new TH2F("defaultvalmap_hg2","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
TH2F* missingvalmap_hg0 = new TH2F("missingvalmap_hg0","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
TH2F* missingvalmap_g0 = new TH2F("missingvalmap_g0","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
TH2F* missingvalmap_g1 = new TH2F("missingvalmap_g1","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
TH2F* missingvalmap_g2 = new TH2F("missingvalmap_g2","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
TH2F* missingvalmap_hg1 = new TH2F("missingvalmap_hg1","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
TH2F* missingvalmap_hg2 = new TH2F("missingvalmap_hg2","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
sprintf(savename,"data/M%s/gainMaps_M%s_%s.bin", module_str.c_str(), module_str.c_str(), date);
fstream outfile;
@ -179,6 +245,11 @@ int main(int argc, char* argv[]) {
// load existing values into maps
// if the map doesn't exist, put the global default value
if (FL_HG0_gain_map) {
mapsObject->hg0VALs[i] = FL_HG0_gain_map->GetBinContent((i%NC)+1,(i/NC)+1);
if (FL_HG0_gain_map->GetBinContent((i%NC)+1,(i/NC)+1) == 0) {
@ -213,6 +284,18 @@ int main(int argc, char* argv[]) {
missingvalmap_g1->Fill(i%NC,i/NC,1);
}
if (DB_HGX_ratio_map) {
if (DB_HGX_ratio_map->GetBinContent((i%NC)+1,(i/NC)+1) != 0) {
mapsObject->hg1VALs[i] = mapsObject->hg0VALs[i] / DB_HGX_ratio_map->GetBinContent((i%NC)+1,(i/NC)+1);
} else {
missingvalmap_hg1->Fill(i%NC,i/NC,1);
}
} else {
mapsObject->hg1VALs[i] = -1.41;
defaultvalmap_hg1->Fill(i%NC,i/NC,1);
missingvalmap_hg1->Fill(i%NC,i/NC,1);
}
if (CS_ratio_map) {
if (CS_ratio_map->GetBinContent((i%NC)+1,(i/NC)+1) != 0) {
mapsObject->g2VALs[i] = mapsObject->g1VALs[i] / CS_ratio_map->GetBinContent((i%NC)+1,(i/NC)+1);
@ -224,19 +307,35 @@ int main(int argc, char* argv[]) {
defaultvalmap_g2->Fill(i%NC,i/NC,1);
missingvalmap_g2->Fill(i%NC,i/NC,1);
}
if (CS_HGX_ratio_map) {
if (CS_HGX_ratio_map->GetBinContent((i%NC)+1,(i/NC)+1) != 0) {
mapsObject->hg2VALs[i] = mapsObject->hg1VALs[i] / CS_HGX_ratio_map->GetBinContent((i%NC)+1,(i/NC)+1);
} else {
missingvalmap_hg2->Fill(i%NC,i/NC,1);
}
} else {
mapsObject->hg2VALs[i] = -0.11;
defaultvalmap_hg2->Fill(i%NC,i/NC,1);
missingvalmap_hg2->Fill(i%NC,i/NC,1);
}
hg1histall->Fill(mapsObject->hg1VALs[i]);
hg2histall->Fill(mapsObject->hg2VALs[i]);
hg0histall->Fill(mapsObject->hg0VALs[i]);
g0histall->Fill(mapsObject->g0VALs[i]);
g1histall->Fill(mapsObject->g1VALs[i]);
g2histall->Fill(mapsObject->g2VALs[i]);
hg0mapall->SetBinContent((i%NC)+1,(i/NC)+1,mapsObject->hg0VALs[i]);
hg1mapall->SetBinContent((i%NC)+1,(i/NC)+1,mapsObject->hg1VALs[i]);
hg2mapall->SetBinContent((i%NC)+1,(i/NC)+1,mapsObject->hg2VALs[i]);
g0mapall->SetBinContent((i%NC)+1,(i/NC)+1,mapsObject->g0VALs[i]);
g1mapall->SetBinContent((i%NC)+1,(i/NC)+1,mapsObject->g1VALs[i]);
g2mapall->SetBinContent((i%NC)+1,(i/NC)+1,mapsObject->g2VALs[i]);
// uncertainties
if (FL_HG0_gain_map) {
@ -269,7 +368,7 @@ int main(int argc, char* argv[]) {
}
}
// if (FL_HG0_gain_map && DB_HGX_ratio_map) { not generating the error distributions for HGOG1G2 at the moment.
}
@ -278,6 +377,9 @@ int main(int argc, char* argv[]) {
defaultHG0 = hg0histall->GetBinCenter(hg0histall->GetMaximumBin());
}
float defaultG0 = 0;
if (FL_G0_gain_map) {
defaultG0 = g0histall->GetBinCenter(g0histall->GetMaximumBin());
@ -288,45 +390,80 @@ int main(int argc, char* argv[]) {
defaultG1 = g1histall->GetBinCenter(g1histall->GetMaximumBin());
}
float defaultG2 = 0;
if (CS_ratio_map) {
defaultG2 = g2histall->GetBinCenter(g2histall->GetMaximumBin());
}
cout << setprecision(4) << fixed << "default values for module " << module_str << " " << defaultHG0 << " " << defaultG0 << " " << defaultG1 << " " << defaultG2 << endl;
float defaultHG2 = 0;
if (CS_HGX_ratio_map) {
defaultHG2 = hg2histall->GetBinCenter(hg2histall->GetMaximumBin());
}
float defaultHG1 = 0;
if (DB_HGX_ratio_map) {
defaultHG1 = hg1histall->GetBinCenter(hg1histall->GetMaximumBin());
}
cout << setprecision(4) << fixed << "default/average values for module " << module_str << " " << defaultG0 << " " << defaultG1 << " " << defaultG2 <<" " << defaultHG0 << " " << defaultHG1 << " "<< defaultHG2 << " "<< endl;
for (int i = 0; i < NCH; i++) {
// crazy and missing value check: replace with module default
// think of a way to get the limits better
if (mapsObject->hg0VALs[i] < 80 || mapsObject->hg0VALs[i] > 160 || isnan(mapsObject->hg0VALs[i])) {
if (mapsObject->hg0VALs[i] < 80 || mapsObject->hg0VALs[i] > 200 || isnan(mapsObject->hg0VALs[i])) {
mapsObject->hg0VALs[i] = defaultHG0;
defaultvalmap_hg0->Fill(i%NC,i/NC,1);
}
if (mapsObject->g0VALs[i] < 30 || mapsObject->g0VALs[i] > 48 || isnan(mapsObject->g0VALs[i])) {
if (mapsObject->hg1VALs[i] < -2.5 || mapsObject->hg1VALs[i] > -0.4 || isnan(mapsObject->hg1VALs[i])) {
mapsObject->hg1VALs[i] = defaultHG1;
defaultvalmap_hg1->Fill(i%NC,i/NC,1);
}
if (mapsObject->hg2VALs[i] < -0.3 || mapsObject->hg2VALs[i] > -0.015 || isnan(mapsObject->hg2VALs[i])) {
mapsObject->hg2VALs[i] = defaultHG2;
defaultvalmap_hg2->Fill(i%NC,i/NC,1);
}
if (mapsObject->g0VALs[i] < 30 || mapsObject->g0VALs[i] > 56 || isnan(mapsObject->g0VALs[i])) {
mapsObject->g0VALs[i] = defaultG0;
defaultvalmap_g0->Fill(i%NC,i/NC,1);
}
if (mapsObject->g1VALs[i] < -2.0 || mapsObject->g1VALs[i] > -0.5 || isnan(mapsObject->g1VALs[i])) {
if (mapsObject->g1VALs[i] < -2.5 || mapsObject->g1VALs[i] > -0.4 || isnan(mapsObject->g1VALs[i])) {
mapsObject->g1VALs[i] = defaultG1;
defaultvalmap_g1->Fill(i%NC,i/NC,1);
}
if (mapsObject->g2VALs[i] < -0.2 || mapsObject->g2VALs[i] > -0.02 || isnan(mapsObject->g2VALs[i])) {
if (mapsObject->g2VALs[i] < -0.3 || mapsObject->g2VALs[i] > -0.015 || isnan(mapsObject->g2VALs[i])) {
mapsObject->g2VALs[i] = defaultG2;
defaultvalmap_g2->Fill(i%NC,i/NC,1);
}
hg0histcut->Fill(mapsObject->hg0VALs[i]);
hg1histcut->Fill(mapsObject->hg1VALs[i]);
hg2histcut->Fill(mapsObject->hg2VALs[i]);
g0histcut->Fill(mapsObject->g0VALs[i]);
g1histcut->Fill(mapsObject->g1VALs[i]);
g2histcut->Fill(mapsObject->g2VALs[i]);
hg0mapcut->SetBinContent((i%NC)+1,(i/NC)+1,mapsObject->hg0VALs[i]);
hg1mapcut->SetBinContent((i%NC)+1,(i/NC)+1,mapsObject->hg1VALs[i]);
hg2mapcut->SetBinContent((i%NC)+1,(i/NC)+1,mapsObject->hg2VALs[i]);
g0mapcut->SetBinContent((i%NC)+1,(i/NC)+1,mapsObject->g0VALs[i]);
g1mapcut->SetBinContent((i%NC)+1,(i/NC)+1,mapsObject->g1VALs[i]);
g2mapcut->SetBinContent((i%NC)+1,(i/NC)+1,mapsObject->g2VALs[i]);
@ -337,6 +474,9 @@ int main(int argc, char* argv[]) {
outfile.write((char*)mapsObject->g1VALs, sizeof(mapsObject->g1VALs));
outfile.write((char*)mapsObject->g2VALs, sizeof(mapsObject->g2VALs));
outfile.write((char*)mapsObject->hg0VALs, sizeof(mapsObject->hg0VALs));
outfile.write((char*)mapsObject->hg1VALs, sizeof(mapsObject->hg1VALs));
outfile.write((char*)mapsObject->hg2VALs, sizeof(mapsObject->hg2VALs));
outfile.close();
TCanvas *mapcanvas = new TCanvas("mapcanvas","",150,10,800,400);
@ -351,7 +491,7 @@ int main(int argc, char* argv[]) {
pave->SetTextSize(0.06);
pave->SetTextAlign(32);
cout << setprecision(4) << fixed << "mean values for module " << module_str << " " << hg0histcut->GetMean() << " " << g0histcut->GetMean() << " " << g1histcut->GetMean() << " " << g2histcut->GetMean() << endl;
cout << setprecision(4) << fixed << "mean values for module " << module_str << " " << g0histcut->GetMean() << " " << g1histcut->GetMean() << " " << g2histcut->GetMean() << " " << hg0histcut->GetMean()<<" " << hg1histcut->GetMean()<<" " << hg2histcut->GetMean() <<endl;
hg0mapall->GetXaxis()->SetTitle("Column");
hg0mapall->GetYaxis()->SetTitle("Row");
@ -359,7 +499,7 @@ int main(int argc, char* argv[]) {
hg0mapall->Draw("colz");
pave->AddText("HG0 [ADU/keV]");
pave->Draw();
hg0mapall->GetZaxis()->SetRangeUser(90,110);
hg0mapall->GetZaxis()->SetRangeUser(90,150);
sprintf(savename,"plots/M%s/Calib_%s/hgain0_all_M%s.png", module_str.c_str(), date, module_str.c_str());
mapcanvas->SaveAs((const char *)(savename));
@ -397,10 +537,26 @@ int main(int argc, char* argv[]) {
pave->Clear();
pave->AddText("G1 [ADU/keV]");
pave->Draw();
g1mapall->GetZaxis()->SetRangeUser(-1.56,-1.36);
//g1mapall->GetZaxis()->SetRangeUser(-1.56,-1.36);
g1mapall->GetZaxis()->SetRangeUser(-1.56,-1.16); // VH 2022-04-26
sprintf(savename,"plots/M%s/Calib_%s/gain1_all_M%s.png", module_str.c_str(), date, module_str.c_str());
mapcanvas->SaveAs((const char *)(savename));
hg1mapall->GetXaxis()->SetTitle("Column");
hg1mapall->GetYaxis()->SetTitle("Row");
hg1mapall->GetYaxis()->SetTitleOffset(0.7);
hg1mapall->Draw("colz");
pave->Clear();
pave->AddText("HG1 [ADU/keV]");
pave->Draw();
hg1mapall->GetZaxis()->SetRangeUser(-1.66,-1.26);
sprintf(savename,"plots/M%s/Calib_%s/hgain1_all_M%s.png", module_str.c_str(), date, module_str.c_str());
mapcanvas->SaveAs((const char *)(savename));
g1fermapall->GetXaxis()->SetTitle("Column");
g1fermapall->GetYaxis()->SetTitle("Row");
g1fermapall->GetYaxis()->SetTitleOffset(0.7);
@ -416,10 +572,24 @@ int main(int argc, char* argv[]) {
pave->Clear();
pave->AddText("G2 [ADU/keV]");
pave->Draw();
g2mapall->GetZaxis()->SetRangeUser(-0.122,-0.108);
//g2mapall->GetZaxis()->SetRangeUser(-0.122,-0.108);
g2mapall->GetZaxis()->SetRangeUser(-0.122,-0.088); // VH 2022-04-26
sprintf(savename,"plots/M%s/Calib_%s/gain2_all_M%s.png", module_str.c_str(), date, module_str.c_str());
mapcanvas->SaveAs((const char *)(savename));
hg2mapall->GetXaxis()->SetTitle("Column");
hg2mapall->GetYaxis()->SetTitle("Row");
hg2mapall->GetYaxis()->SetTitleOffset(0.7);
hg2mapall->Draw("colz");
pave->Clear();
pave->AddText("HG2 [ADU/keV]");
pave->Draw();
hg2mapall->GetZaxis()->SetRangeUser(-0.14,-0.10);
sprintf(savename,"plots/M%s/Calib_%s/hgain2_all_M%s.png", module_str.c_str(), date, module_str.c_str());
mapcanvas->SaveAs((const char *)(savename));
g2fermapall->GetXaxis()->SetTitle("Column");
g2fermapall->GetYaxis()->SetTitle("Row");
g2fermapall->GetYaxis()->SetTitleOffset(0.7);
@ -457,10 +627,26 @@ int main(int argc, char* argv[]) {
pave->Clear();
pave->AddText("G1 [ADU/keV]");
pave->Draw();
g1mapcut->GetZaxis()->SetRangeUser(-1.56,-1.36);
//g1mapcut->GetZaxis()->SetRangeUser(-1.56,-1.36);
g1mapcut->GetZaxis()->SetRangeUser(-1.56,-1.16); // VH 2022-04-26
sprintf(savename,"plots/M%s/Calib_%s/gain1_cut_M%s.png", module_str.c_str(), date, module_str.c_str());
mapcanvas->SaveAs((const char *)(savename));
hg1mapcut->GetXaxis()->SetTitle("Column");
hg1mapcut->GetYaxis()->SetTitle("Row");
hg1mapcut->GetYaxis()->SetTitleOffset(0.7);
hg1mapcut->Draw("colz");
pave->Clear();
pave->AddText("HG1 [ADU/keV]");
pave->Draw();
hg1mapcut->GetZaxis()->SetRangeUser(-1.56,-1.36);
sprintf(savename,"plots/M%s/Calib_%s/hgain1_cut_M%s.png", module_str.c_str(), date, module_str.c_str());
mapcanvas->SaveAs((const char *)(savename));
g2mapcut->GetXaxis()->SetTitle("Column");
g2mapcut->GetYaxis()->SetTitle("Row");
g2mapcut->GetYaxis()->SetTitleOffset(0.7);
@ -468,10 +654,25 @@ int main(int argc, char* argv[]) {
pave->Clear();
pave->AddText("G2 [ADU/keV]");
pave->Draw();
g2mapcut->GetZaxis()->SetRangeUser(-0.122,-0.108);
//g2mapcut->GetZaxis()->SetRangeUser(-0.122,-0.108);
g2mapcut->GetZaxis()->SetRangeUser(-0.122,-0.088); // VH 2022-04-26
sprintf(savename,"plots/M%s/Calib_%s/gain2_cut_M%s.png", module_str.c_str(), date, module_str.c_str());
mapcanvas->SaveAs((const char *)(savename));
hg2mapcut->GetXaxis()->SetTitle("Column");
hg2mapcut->GetYaxis()->SetTitle("Row");
hg2mapcut->GetYaxis()->SetTitleOffset(0.7);
hg2mapcut->Draw("colz");
pave->Clear();
pave->AddText("HG2 [ADU/keV]");
pave->Draw();
hg2mapcut->GetZaxis()->SetRangeUser(-0.122,-0.108);
sprintf(savename,"plots/M%s/Calib_%s/hgain2_cut_M%s.png", module_str.c_str(), date, module_str.c_str());
mapcanvas->SaveAs((const char *)(savename));
defaultvalmap_hg0->GetXaxis()->SetTitle("Column");
defaultvalmap_hg0->GetYaxis()->SetTitle("Row");
defaultvalmap_hg0->GetYaxis()->SetTitleOffset(0.7);
@ -508,6 +709,20 @@ int main(int argc, char* argv[]) {
sprintf(savename,"plots/M%s/Calib_%s/defaultvalmap_g1_M%s.png", module_str.c_str(), date, module_str.c_str());
mapcanvas->SaveAs((const char *)(savename));
defaultvalmap_hg1->GetXaxis()->SetTitle("Column");
defaultvalmap_hg1->GetYaxis()->SetTitle("Row");
defaultvalmap_hg1->GetYaxis()->SetTitleOffset(0.7);
defaultvalmap_hg1->Draw("colz");
pave->Clear();
sprintf(savename,"%d pixels default", int(defaultvalmap_hg1->GetEntries()));
pave->AddText(savename);
pave->Draw();
defaultvalmap_hg1->GetZaxis()->SetRangeUser(0,1);
sprintf(savename,"plots/M%s/Calib_%s/defaultvalmap_hg1_M%s.png", module_str.c_str(), date, module_str.c_str());
mapcanvas->SaveAs((const char *)(savename));
defaultvalmap_g2->GetXaxis()->SetTitle("Column");
defaultvalmap_g2->GetYaxis()->SetTitle("Row");
defaultvalmap_g2->GetYaxis()->SetTitleOffset(0.7);
@ -520,6 +735,22 @@ int main(int argc, char* argv[]) {
sprintf(savename,"plots/M%s/Calib_%s/defaultvalmap_g2_M%s.png", module_str.c_str(), date, module_str.c_str());
mapcanvas->SaveAs((const char *)(savename));
defaultvalmap_hg2->GetXaxis()->SetTitle("Column");
defaultvalmap_hg2->GetYaxis()->SetTitle("Row");
defaultvalmap_hg2->GetYaxis()->SetTitleOffset(0.7);
defaultvalmap_hg2->Draw("colz");
pave->Clear();
sprintf(savename,"%d pixels default", int(defaultvalmap_hg2->GetEntries()));
pave->AddText(savename);
pave->Draw();
defaultvalmap_hg2->GetZaxis()->SetRangeUser(0,1);
sprintf(savename,"plots/M%s/Calib_%s/defaultvalmap_hg2_M%s.png", module_str.c_str(), date, module_str.c_str());
mapcanvas->SaveAs((const char *)(savename));
missingvalmap_hg0->GetXaxis()->SetTitle("Column");
missingvalmap_hg0->GetYaxis()->SetTitle("Row");
missingvalmap_hg0->GetYaxis()->SetTitleOffset(0.7);
@ -568,6 +799,32 @@ int main(int argc, char* argv[]) {
sprintf(savename,"plots/M%s/Calib_%s/missingvalmap_g2_M%s.png", module_str.c_str(), date, module_str.c_str());
mapcanvas->SaveAs((const char *)(savename));
missingvalmap_hg1->GetXaxis()->SetTitle("Column");
missingvalmap_hg1->GetYaxis()->SetTitle("Row");
missingvalmap_hg1->GetYaxis()->SetTitleOffset(0.7);
missingvalmap_hg1->Draw("colz");
pave->Clear();
sprintf(savename,"%d pixels missing", int(missingvalmap_hg1->GetEntries()));
pave->AddText(savename);
pave->Draw();
missingvalmap_hg1->GetZaxis()->SetRangeUser(0,1);
sprintf(savename,"plots/M%s/Calib_%s/missingvalmap_hg1_M%s.png", module_str.c_str(), date, module_str.c_str());
mapcanvas->SaveAs((const char *)(savename));
missingvalmap_hg2->GetXaxis()->SetTitle("Column");
missingvalmap_hg2->GetYaxis()->SetTitle("Row");
missingvalmap_hg2->GetYaxis()->SetTitleOffset(0.7);
missingvalmap_hg2->Draw("colz");
pave->Clear();
sprintf(savename,"%d pixels missing", int(missingvalmap_hg2->GetEntries()));
pave->AddText(savename);
pave->Draw();
missingvalmap_hg2->GetZaxis()->SetRangeUser(0,1);
sprintf(savename,"plots/M%s/Calib_%s/missingvalmap_hg2_M%s.png", module_str.c_str(), date, module_str.c_str());
mapcanvas->SaveAs((const char *)(savename));
TCanvas* c1 = new TCanvas("c1","");
hg0histcut->SetLineColor(kRed);
@ -632,6 +889,28 @@ int main(int argc, char* argv[]) {
c1->SaveAs((const char *)(savename));
c1->SetLogy(0);
hg1histall->GetXaxis()->SetTitle("Gain HG1 [ADU / keV]");
hg1histall->Draw();
sprintf(savename,"plots/M%s/Calib_%s/hg1hist_all_M%s.png", module_str.c_str(), date, module_str.c_str());
c1->SaveAs((const char *)(savename));
hg1histcut->GetXaxis()->SetTitle("Gain HG1 [ADU / keV]");
hg1histcut->Draw();
sprintf(savename,"plots/M%s/Calib_%s/hg1hist_cut_M%s.png", module_str.c_str(), date, module_str.c_str());
c1->SaveAs((const char *)(savename));
hg1histcut->Draw();
hg1histall->Draw("same");
sprintf(savename,"plots/M%s/Calib_%s/hg1hist_M%s.png", module_str.c_str(), date, module_str.c_str());
c1->SaveAs((const char *)(savename));
c1->SetLogy();
sprintf(savename,"plots/M%s/Calib_%s/hg1hist_log_M%s.png", module_str.c_str(), date, module_str.c_str());
c1->SaveAs((const char *)(savename));
c1->SetLogy(0);
g2histall->GetXaxis()->SetTitle("Gain G2 [ADU / keV]");
g2histall->Draw();
sprintf(savename,"plots/M%s/Calib_%s/g2hist_all_M%s.png", module_str.c_str(), date, module_str.c_str());
@ -651,6 +930,28 @@ int main(int argc, char* argv[]) {
c1->SaveAs((const char *)(savename));
c1->SetLogy(0);
hg2histall->GetXaxis()->SetTitle("Gain HG2 [ADU / keV]");
hg2histall->Draw();
sprintf(savename,"plots/M%s/Calib_%s/hg2hist_all_M%s.png", module_str.c_str(), date, module_str.c_str());
c1->SaveAs((const char *)(savename));
hg2histcut->GetXaxis()->SetTitle("Gain HG2 [ADU / keV]");
hg2histcut->Draw();
sprintf(savename,"plots/M%s/Calib_%s/hg2hist_cut_M%s.png", module_str.c_str(), date, module_str.c_str());
c1->SaveAs((const char *)(savename));
hg2histcut->Draw();
hg2histall->Draw("same");
sprintf(savename,"plots/M%s/Calib_%s/hg2hist_M%s.png", module_str.c_str(), date, module_str.c_str());
c1->SaveAs((const char *)(savename));
c1->SetLogy();
sprintf(savename,"plots/M%s/Calib_%s/hg2hist_log_M%s.png", module_str.c_str(), date, module_str.c_str());
c1->SaveAs((const char *)(savename));
c1->SetLogy(0);
g0ferhistall->GetXaxis()->SetTitle("Gain G0 frac uncert");
g0ferhistall->Draw();
sprintf(savename,"plots/M%s/Calib_%s/g0ferhist_M%s.png", module_str.c_str(), date, module_str.c_str());