Implemented histogram saving and loading. Also changed lots of ordering. Results unchanged.
This commit is contained in:
@@ -38,39 +38,9 @@ int main(int argc, char* argv[]) {
|
||||
string data_file = argv[3];
|
||||
|
||||
jungfrauFile *thisfile = new jungfrauFile();
|
||||
char savename[128];
|
||||
sprintf(savename,"%s/%s_%%6.6d.dat", data_loc.c_str(), data_file.c_str());
|
||||
thisfile->open((char*)savename, 0);
|
||||
|
||||
TH2F *gainmap_all = new TH2F("gainmap_all","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
||||
TH2F *adcmap_all = new TH2F("adcmap_all","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
||||
TH2F *gainmap_sel = new TH2F("gainmap_sel","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
||||
TH2F *adcmap_sel = new TH2F("adcmap_sel","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
||||
|
||||
TH1F *gain_avg = new TH1F("gain_avg","",100,-1,4);
|
||||
TH2F *gainmap_avg = new TH2F("gainmap_avg","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
||||
TH1F *adc_avg_g1 = new TH1F("adc_avg_g1","",100,0,17000);
|
||||
TH1F *adc_avg_g2 = new TH1F("adc_avg_g2","",100,0,17000);
|
||||
|
||||
TH2F *adcmap_avg_g1 [35];
|
||||
TH2F *adcmap_avg_g2 [35];
|
||||
TH2F *adcermap_avg_g1 [35];
|
||||
TH2F *adcermap_avg_g2 [35];
|
||||
|
||||
for(int i = 0; i < 35; i++) {
|
||||
ostringstream histogramNameStreamg1;
|
||||
histogramNameStreamg1 << "adcmap_avg_g1_" << i;
|
||||
adcmap_avg_g1[i] = new TH2F(histogramNameStreamg1.str().c_str(),"",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
||||
ostringstream histogramNameStreamg2;
|
||||
histogramNameStreamg2 << "adcmap_avg_g2_" << i;
|
||||
adcmap_avg_g2[i] = new TH2F(histogramNameStreamg2.str().c_str(),"",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
||||
ostringstream histogramNameStreamg3;
|
||||
histogramNameStreamg3 << "adcermap_avg_g1_" << i;
|
||||
adcermap_avg_g1[i] = new TH2F(histogramNameStreamg3.str().c_str(),"",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
||||
ostringstream histogramNameStreamg4;
|
||||
histogramNameStreamg4 << "adcermap_avg_g2_" << i;
|
||||
adcermap_avg_g2[i] = new TH2F(histogramNameStreamg4.str().c_str(),"",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
||||
}
|
||||
jungfrauPixelMask *pixelMaskObject = new jungfrauPixelMask();
|
||||
static int pixel_mask [NCH];
|
||||
|
||||
jungfrauPedestal *pedestalObject = new jungfrauPedestal();
|
||||
pedestalObject->pedestalSetNFrames(640);
|
||||
@@ -83,8 +53,15 @@ int main(int argc, char* argv[]) {
|
||||
TH2F* pedeRMSG1 = new TH2F("pedeRMSG1","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
||||
TH2F* pedeRMSG2 = new TH2F("pedeRMSG2","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
||||
|
||||
jungfrauPixelMask *pixelMaskObject = new jungfrauPixelMask();
|
||||
static int pixel_mask [NCH];
|
||||
char savename[128];
|
||||
|
||||
int createHistoFile = 0;
|
||||
|
||||
// open first file
|
||||
sprintf(savename,"%s/%s_%%6.6d.dat", data_loc.c_str(), data_file.c_str());
|
||||
thisfile->open((char*)savename, 0);
|
||||
|
||||
// calculate pixel mask
|
||||
pixelMaskObject->initialisePixelMask(pixel_mask);
|
||||
if (module_str == "032") {
|
||||
pixelMaskObject->maskChip(2,pixel_mask);
|
||||
@@ -96,51 +73,6 @@ int main(int argc, char* argv[]) {
|
||||
pixelMaskObject->maskSupercolumn(4,2, pixel_mask);
|
||||
}
|
||||
|
||||
static TH1I *adc_histos_g1 [NCH];
|
||||
static TH1I *adc_histos_g2 [NCH];
|
||||
static TH1I *gain_histos [NCH];
|
||||
|
||||
for(int i = 0; i < NCH; i++) {
|
||||
ostringstream histogramNameStreamg1;
|
||||
histogramNameStreamg1 << "adc_histos_g1_" << i;
|
||||
adc_histos_g1[i] = new TH1I(histogramNameStreamg1.str().c_str(),"",100,0,17000);
|
||||
ostringstream histogramNameStreamg2;
|
||||
histogramNameStreamg2 << "adc_histos_g2_" << i;
|
||||
adc_histos_g2[i] = new TH1I(histogramNameStreamg2.str().c_str(),"",100,0,17000);
|
||||
ostringstream histogramNameStream2;
|
||||
histogramNameStream2 << "gain_histos_" << i;
|
||||
gain_histos[i] = new TH1I(histogramNameStream2.str().c_str(),"",4,-0.5,3.5);
|
||||
}
|
||||
|
||||
double filter[35];
|
||||
if (module_str == "044") {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
filter[i] = 0.05+(i*0.05);
|
||||
}
|
||||
for (int i = 0; i < 9; i++) {
|
||||
filter[i+5] = 0.5+(i*0.25);
|
||||
}
|
||||
for (int i = 0; i < 17; i++) {
|
||||
filter[i+5+9] = 5.+(i*2.5);
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < 9; i++) {
|
||||
filter[i] = 0.05+(i*0.025);
|
||||
}
|
||||
for (int i = 0; i < 9; i++) {
|
||||
filter[i+9] = 0.5+(i*0.25);
|
||||
}
|
||||
for (int i = 0; i < 17; i++) {
|
||||
filter[i+9+9] = 5.+(i*2.5);
|
||||
}
|
||||
}
|
||||
|
||||
double pede_ene[1];
|
||||
pede_ene[0] = 0.01;
|
||||
|
||||
TCanvas *c1 = new TCanvas("c1","");
|
||||
|
||||
// calculate pixel mask
|
||||
for (int i = 0; i < 640; i++) {
|
||||
thisfile->readNextFrame();
|
||||
pixelMaskObject->maskIfGainNot(0, thisfile->getFrameDataHandle(), (int*)(&pixel_mask));
|
||||
@@ -257,214 +189,295 @@ int main(int argc, char* argv[]) {
|
||||
sprintf(savename,"plots/M%s/CurrentSource/pedeRMSG2.png", module_str.c_str());
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
|
||||
int frame_counter = 0;
|
||||
int j = 0;
|
||||
int nfiles = 0;
|
||||
if (module_str == "032" || module_str == "021" || module_str == "022") {
|
||||
nfiles = 2;
|
||||
} else if (module_str == "006" || module_str == "008" || module_str == "044") {
|
||||
nfiles = 3;
|
||||
}
|
||||
TH2F *adcmap_avg_g1 [35];
|
||||
TH2F *adcmap_avg_g2 [35];
|
||||
TH2F *adcermap_avg_g1 [35];
|
||||
TH2F *adcermap_avg_g2 [35];
|
||||
|
||||
for (int filei = 0; filei < nfiles; filei++) {
|
||||
TCanvas *c1 = new TCanvas("c1","");
|
||||
|
||||
sprintf(savename,"%s/%s_%%6.6d.dat", data_loc.c_str(), data_file.c_str());
|
||||
thisfile->open((char*)savename, filei);
|
||||
// creating the histograms
|
||||
if (createHistoFile) {
|
||||
|
||||
if (filei == 0) {
|
||||
for (int k = 0; k < (640*3); k++) {
|
||||
thisfile->readNextFrame();
|
||||
frame_counter++;
|
||||
}
|
||||
for(int i = 0; i < 35; i++) {
|
||||
ostringstream histogramNameStreamg1;
|
||||
histogramNameStreamg1 << "adcmap_avg_g1_" << i;
|
||||
adcmap_avg_g1[i] = new TH2F(histogramNameStreamg1.str().c_str(),"",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
||||
ostringstream histogramNameStreamg2;
|
||||
histogramNameStreamg2 << "adcmap_avg_g2_" << i;
|
||||
adcmap_avg_g2[i] = new TH2F(histogramNameStreamg2.str().c_str(),"",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
||||
ostringstream histogramNameStreamg3;
|
||||
histogramNameStreamg3 << "adcermap_avg_g1_" << i;
|
||||
adcermap_avg_g1[i] = new TH2F(histogramNameStreamg3.str().c_str(),"",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
||||
ostringstream histogramNameStreamg4;
|
||||
histogramNameStreamg4 << "adcermap_avg_g2_" << i;
|
||||
adcermap_avg_g2[i] = new TH2F(histogramNameStreamg4.str().c_str(),"",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
||||
}
|
||||
|
||||
while (thisfile->readNextFrame()) {
|
||||
frame_counter++;
|
||||
j++;
|
||||
TH2F *gainmap_all = new TH2F("gainmap_all","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
||||
TH2F *adcmap_all = new TH2F("adcmap_all","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
||||
TH2F *gainmap_sel = new TH2F("gainmap_sel","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
||||
TH2F *adcmap_sel = new TH2F("adcmap_sel","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
||||
|
||||
uint16_t* imagedptr = thisfile->getFrameDataHandle();
|
||||
for (int i = 0; i < NCH; i++) {
|
||||
TH1F *gain_avg = new TH1F("gain_avg","",100,-1,4);
|
||||
TH2F *gainmap_avg = new TH2F("gainmap_avg","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
||||
TH1F *adc_avg_g1 = new TH1F("adc_avg_g1","",100,0,17000);
|
||||
TH1F *adc_avg_g2 = new TH1F("adc_avg_g2","",100,0,17000);
|
||||
|
||||
if ((j-1) < 10 || (j > 8075 && j < 8085)) {
|
||||
if (pixel_mask[i] == 1) {
|
||||
uint16_t adc = imagedptr[i]&0x3fff;
|
||||
uint16_t gain = (imagedptr[i]&0xc000) >> 14;
|
||||
adcmap_all->Fill(i%NC,i/NC,adc);
|
||||
gainmap_all->Fill(i%NC,i/NC,gain);
|
||||
}
|
||||
}
|
||||
static TH1I *adc_histos_g1 [NCH];
|
||||
static TH1I *adc_histos_g2 [NCH];
|
||||
static TH1I *gain_histos [NCH];
|
||||
|
||||
if (((i/NC <= 255) && (i%64 == (j-1)%64)) ||
|
||||
((i/NC >= 256) &&((-1*(i-524287))%64 == (j-1)%64))) {
|
||||
for(int i = 0; i < NCH; i++) {
|
||||
ostringstream histogramNameStreamg1;
|
||||
histogramNameStreamg1 << "adc_histos_g1_" << i;
|
||||
adc_histos_g1[i] = new TH1I(histogramNameStreamg1.str().c_str(),"",100,0,17000);
|
||||
ostringstream histogramNameStreamg2;
|
||||
histogramNameStreamg2 << "adc_histos_g2_" << i;
|
||||
adc_histos_g2[i] = new TH1I(histogramNameStreamg2.str().c_str(),"",100,0,17000);
|
||||
ostringstream histogramNameStream2;
|
||||
histogramNameStream2 << "gain_histos_" << i;
|
||||
gain_histos[i] = new TH1I(histogramNameStream2.str().c_str(),"",4,-0.5,3.5);
|
||||
}
|
||||
|
||||
if (pixel_mask[i] == 1) {
|
||||
uint16_t adc = imagedptr[i]&0x3fff;
|
||||
uint16_t gain = (imagedptr[i]&0xc000) >> 14;
|
||||
int frame_counter = 0;
|
||||
int j = 0;
|
||||
int nfiles = 0;
|
||||
if (module_str == "032" || module_str == "021" || module_str == "022") {
|
||||
nfiles = 2;
|
||||
} else if (module_str == "006" || module_str == "008" || module_str == "044") {
|
||||
nfiles = 3;
|
||||
}
|
||||
|
||||
gain_histos[i]->Fill(gain);
|
||||
if (gain == 1) {
|
||||
adc_histos_g1[i]->Fill(adc);
|
||||
} else if (gain == 3) {
|
||||
adc_histos_g2[i]->Fill(adc);
|
||||
}
|
||||
for (int filei = 0; filei < nfiles; filei++) {
|
||||
|
||||
if ((j-1) < 10 || (j > 8075 && j < 8085)) {
|
||||
adcmap_sel->Fill(i%NC,i/NC,adc);
|
||||
gainmap_sel->Fill(i%NC,i/NC,gain);
|
||||
}
|
||||
sprintf(savename,"%s/%s_%%6.6d.dat", data_loc.c_str(), data_file.c_str());
|
||||
thisfile->open((char*)savename, filei);
|
||||
|
||||
}
|
||||
if (filei == 0) {
|
||||
for (int k = 0; k < (640*3); k++) {
|
||||
thisfile->readNextFrame();
|
||||
frame_counter++;
|
||||
}
|
||||
}
|
||||
if ((j-1) < 10 || (j > 8075 && j < 8085)) {
|
||||
mapcanvas->cd();
|
||||
adcmap_sel->GetXaxis()->SetTitle("Column");
|
||||
adcmap_sel->GetYaxis()->SetTitle("Row");
|
||||
adcmap_sel->GetYaxis()->SetTitleOffset(0.7);
|
||||
adcmap_sel->Draw("colz");
|
||||
sprintf(savename,"plots/M%s/CurrentSource/adcmap_%i_sel.png", module_str.c_str(), j-1);
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
adcmap_all->GetXaxis()->SetTitle("Column");
|
||||
adcmap_all->GetYaxis()->SetTitle("Row");
|
||||
adcmap_all->GetYaxis()->SetTitleOffset(0.7);
|
||||
adcmap_all->Draw("colz");
|
||||
sprintf(savename,"plots/M%s/CurrentSource/adcmap_%i_all.png", module_str.c_str(), j-1);
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
|
||||
gainmap_sel->GetXaxis()->SetTitle("Column");
|
||||
gainmap_sel->GetYaxis()->SetTitle("Row");
|
||||
gainmap_sel->GetYaxis()->SetTitleOffset(0.7);
|
||||
gainmap_sel->Draw("colz");
|
||||
sprintf(savename,"plots/M%s/CurrentSource/gainmap_%i_sel.png", module_str.c_str(), j-1);
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
gainmap_all->GetXaxis()->SetTitle("Column");
|
||||
gainmap_all->GetYaxis()->SetTitle("Row");
|
||||
gainmap_all->GetYaxis()->SetTitleOffset(0.7);
|
||||
gainmap_all->Draw("colz");
|
||||
sprintf(savename,"plots/M%s/CurrentSource/gainmap_%i_all.png", module_str.c_str(), j-1);
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
|
||||
adcmap_sel->Reset();
|
||||
adcmap_all->Reset();
|
||||
gainmap_sel->Reset();
|
||||
gainmap_all->Reset();
|
||||
}
|
||||
|
||||
// catch the last frame (bad ctrl-c exit)
|
||||
int last_frame = 0;
|
||||
if (module_str == "032" || module_str == "021" || module_str == "022") {
|
||||
last_frame = 19199;
|
||||
} else if (module_str == "006" || module_str == "008" || module_str == "044") {
|
||||
last_frame = 24319;
|
||||
}
|
||||
while (thisfile->readNextFrame()) {
|
||||
frame_counter++;
|
||||
j++;
|
||||
|
||||
if (j%640 == 0 || j == last_frame) {
|
||||
if (j == last_frame) {
|
||||
j = last_frame+1;
|
||||
}
|
||||
|
||||
uint16_t* imagedptr = thisfile->getFrameDataHandle();
|
||||
for (int i = 0; i < NCH; i++) {
|
||||
if (pixel_mask[i] == 1) {
|
||||
|
||||
gainmap_avg->Fill(i%NC,i/NC,gain_histos[i]->GetMean());
|
||||
adcmap_avg_g1[j/640-1]->Fill(i%NC,i/NC,adc_histos_g1[i]->GetMean());
|
||||
adcermap_avg_g1[j/640-1]->Fill(i%NC,i/NC,adc_histos_g1[i]->GetMeanError());
|
||||
adcmap_avg_g2[j/640-1]->Fill(i%NC,i/NC,adc_histos_g2[i]->GetMean());
|
||||
adcermap_avg_g2[j/640-1]->Fill(i%NC,i/NC,adc_histos_g2[i]->GetMeanError());
|
||||
|
||||
if (gain_histos[i]->GetEntries() > 0) {
|
||||
gain_avg->Fill(gain_histos[i]->GetMean());
|
||||
}
|
||||
if (adc_histos_g1[i]->GetEntries() > 0) {
|
||||
adc_avg_g1->Fill(adc_histos_g1[i]->GetMean());
|
||||
}
|
||||
if (adc_histos_g2[i]->GetEntries() > 0) {
|
||||
adc_avg_g2->Fill(adc_histos_g2[i]->GetMean());
|
||||
}
|
||||
|
||||
gain_histos[i]->Reset();
|
||||
adc_histos_g1[i]->Reset();
|
||||
adc_histos_g2[i]->Reset();
|
||||
if ((j-1) < 10 || (j > 8075 && j < 8085)) {
|
||||
if (pixel_mask[i] == 1) {
|
||||
uint16_t adc = imagedptr[i]&0x3fff;
|
||||
uint16_t gain = (imagedptr[i]&0xc000) >> 14;
|
||||
adcmap_all->Fill(i%NC,i/NC,adc);
|
||||
gainmap_all->Fill(i%NC,i/NC,gain);
|
||||
}
|
||||
}
|
||||
|
||||
if (((i/NC <= 255) && (i%64 == (j-1)%64)) ||
|
||||
((i/NC >= 256) &&((-1*(i-524287))%64 == (j-1)%64))) {
|
||||
|
||||
if (pixel_mask[i] == 1) {
|
||||
uint16_t adc = imagedptr[i]&0x3fff;
|
||||
uint16_t gain = (imagedptr[i]&0xc000) >> 14;
|
||||
|
||||
gain_histos[i]->Fill(gain);
|
||||
if (gain == 1) {
|
||||
adc_histos_g1[i]->Fill(adc);
|
||||
} else if (gain == 3) {
|
||||
adc_histos_g2[i]->Fill(adc);
|
||||
}
|
||||
|
||||
if ((j-1) < 10 || (j > 8075 && j < 8085)) {
|
||||
adcmap_sel->Fill(i%NC,i/NC,adc);
|
||||
gainmap_sel->Fill(i%NC,i/NC,gain);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
c1->cd();
|
||||
gain_avg->GetXaxis()->SetTitle("Average gain");
|
||||
gain_avg->GetXaxis()->SetTitleOffset(1.1);
|
||||
gain_avg->GetYaxis()->SetTitleOffset(1.5);
|
||||
gain_avg->Draw();
|
||||
sprintf(savename,"plots/M%s/CurrentSource/perStep/gain_avg_%i.png", module_str.c_str(), j/640);
|
||||
c1->SaveAs((const char *)(savename));
|
||||
mapcanvas->cd();
|
||||
gainmap_avg->GetXaxis()->SetTitle("Column");
|
||||
gainmap_avg->GetYaxis()->SetTitle("Row");
|
||||
gainmap_avg->GetYaxis()->SetTitleOffset(0.7);
|
||||
gainmap_avg->Draw("colz");
|
||||
sprintf(savename,"plots/M%s/CurrentSource/perStep/gainmap_avg_%i.png", module_str.c_str(), j/640);
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
if ((j-1) < 10 || (j > 8075 && j < 8085)) {
|
||||
mapcanvas->cd();
|
||||
adcmap_sel->GetXaxis()->SetTitle("Column");
|
||||
adcmap_sel->GetYaxis()->SetTitle("Row");
|
||||
adcmap_sel->GetYaxis()->SetTitleOffset(0.7);
|
||||
adcmap_sel->Draw("colz");
|
||||
sprintf(savename,"plots/M%s/CurrentSource/adcmap_%i_sel.png", module_str.c_str(), j-1);
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
adcmap_all->GetXaxis()->SetTitle("Column");
|
||||
adcmap_all->GetYaxis()->SetTitle("Row");
|
||||
adcmap_all->GetYaxis()->SetTitleOffset(0.7);
|
||||
adcmap_all->Draw("colz");
|
||||
sprintf(savename,"plots/M%s/CurrentSource/adcmap_%i_all.png", module_str.c_str(), j-1);
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
|
||||
gainmap_sel->GetXaxis()->SetTitle("Column");
|
||||
gainmap_sel->GetYaxis()->SetTitle("Row");
|
||||
gainmap_sel->GetYaxis()->SetTitleOffset(0.7);
|
||||
gainmap_sel->Draw("colz");
|
||||
sprintf(savename,"plots/M%s/CurrentSource/gainmap_%i_sel.png", module_str.c_str(), j-1);
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
gainmap_all->GetXaxis()->SetTitle("Column");
|
||||
gainmap_all->GetYaxis()->SetTitle("Row");
|
||||
gainmap_all->GetYaxis()->SetTitleOffset(0.7);
|
||||
gainmap_all->Draw("colz");
|
||||
sprintf(savename,"plots/M%s/CurrentSource/gainmap_%i_all.png", module_str.c_str(), j-1);
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
|
||||
adcmap_sel->Reset();
|
||||
adcmap_all->Reset();
|
||||
gainmap_sel->Reset();
|
||||
gainmap_all->Reset();
|
||||
}
|
||||
|
||||
c1->cd();
|
||||
adc_avg_g1->GetXaxis()->SetTitle("Average G1 ADC");
|
||||
adc_avg_g1->GetXaxis()->SetTitleOffset(1.1);
|
||||
adc_avg_g1->GetYaxis()->SetTitleOffset(1.5);
|
||||
adc_avg_g1->Draw();
|
||||
sprintf(savename,"plots/M%s/CurrentSource/perStep/adc_avg_g1_%i.png", module_str.c_str(), j/640);
|
||||
c1->SaveAs((const char *)(savename));
|
||||
mapcanvas->cd();
|
||||
adcmap_avg_g1[j/640-1]->GetXaxis()->SetTitle("Column");
|
||||
adcmap_avg_g1[j/640-1]->GetYaxis()->SetTitle("Row");
|
||||
adcmap_avg_g1[j/640-1]->GetYaxis()->SetTitleOffset(0.7);
|
||||
adcmap_avg_g1[j/640-1]->Draw("colz");
|
||||
mapcanvas->Update();
|
||||
sprintf(savename,"plots/M%s/CurrentSource/perStep/adcmap_avg_g1_%i.png", module_str.c_str(), j/640);
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
adcermap_avg_g1[j/640-1]->GetXaxis()->SetTitle("Column");
|
||||
adcermap_avg_g1[j/640-1]->GetYaxis()->SetTitle("Row");
|
||||
adcermap_avg_g1[j/640-1]->GetYaxis()->SetTitleOffset(0.7);
|
||||
adcermap_avg_g1[j/640-1]->Draw("colz");
|
||||
mapcanvas->Update();
|
||||
sprintf(savename,"plots/M%s/CurrentSource/perStep/adcermap_avg_g1_%i.png", module_str.c_str(), j/640);
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
// catch the last frame (bad ctrl-c exit)
|
||||
int last_frame = 0;
|
||||
if (module_str == "032" || module_str == "021" || module_str == "022") {
|
||||
last_frame = 19199;
|
||||
} else if (module_str == "006" || module_str == "008" || module_str == "044") {
|
||||
last_frame = 24319;
|
||||
}
|
||||
|
||||
c1->cd();
|
||||
adc_avg_g2->GetXaxis()->SetTitle("Average G2 ADC");
|
||||
adc_avg_g2->GetXaxis()->SetTitleOffset(1.1);
|
||||
adc_avg_g2->GetYaxis()->SetTitleOffset(1.5);
|
||||
adc_avg_g2->Draw();
|
||||
sprintf(savename,"plots/M%s/CurrentSource/perStep/adc_avg_g2_%i.png", module_str.c_str(), j/640);
|
||||
c1->SaveAs((const char *)(savename));
|
||||
mapcanvas->cd();
|
||||
adcmap_avg_g2[j/640-1]->GetXaxis()->SetTitle("Column");
|
||||
adcmap_avg_g2[j/640-1]->GetYaxis()->SetTitle("Row");
|
||||
adcmap_avg_g2[j/640-1]->GetYaxis()->SetTitleOffset(0.7);
|
||||
adcmap_avg_g2[j/640-1]->Draw("colz");
|
||||
sprintf(savename,"plots/M%s/CurrentSource/perStep/adcmap_avg_g2_%i.png", module_str.c_str(), j/640);
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
adcermap_avg_g2[j/640-1]->GetXaxis()->SetTitle("Column");
|
||||
adcermap_avg_g2[j/640-1]->GetYaxis()->SetTitle("Row");
|
||||
adcermap_avg_g2[j/640-1]->GetYaxis()->SetTitleOffset(0.7);
|
||||
adcermap_avg_g2[j/640-1]->Draw("colz");
|
||||
sprintf(savename,"plots/M%s/CurrentSource/perStep/adcermap_avg_g2_%i.png", module_str.c_str(), j/640);
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
if (j%640 == 0 || j == last_frame) {
|
||||
if (j == last_frame) {
|
||||
j = last_frame+1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < NCH; i++) {
|
||||
if (pixel_mask[i] == 1) {
|
||||
|
||||
gainmap_avg->Fill(i%NC,i/NC,gain_histos[i]->GetMean());
|
||||
adcmap_avg_g1[j/640-1]->Fill(i%NC,i/NC,adc_histos_g1[i]->GetMean());
|
||||
adcermap_avg_g1[j/640-1]->Fill(i%NC,i/NC,adc_histos_g1[i]->GetMeanError());
|
||||
adcmap_avg_g2[j/640-1]->Fill(i%NC,i/NC,adc_histos_g2[i]->GetMean());
|
||||
adcermap_avg_g2[j/640-1]->Fill(i%NC,i/NC,adc_histos_g2[i]->GetMeanError());
|
||||
|
||||
if (gain_histos[i]->GetEntries() > 0) {
|
||||
gain_avg->Fill(gain_histos[i]->GetMean());
|
||||
}
|
||||
if (adc_histos_g1[i]->GetEntries() > 0) {
|
||||
adc_avg_g1->Fill(adc_histos_g1[i]->GetMean());
|
||||
}
|
||||
if (adc_histos_g2[i]->GetEntries() > 0) {
|
||||
adc_avg_g2->Fill(adc_histos_g2[i]->GetMean());
|
||||
}
|
||||
|
||||
gain_avg->Reset();
|
||||
gainmap_avg->Reset();
|
||||
adc_avg_g1->Reset();
|
||||
adc_avg_g2->Reset();
|
||||
}
|
||||
} // end of while
|
||||
gain_histos[i]->Reset();
|
||||
adc_histos_g1[i]->Reset();
|
||||
adc_histos_g2[i]->Reset();
|
||||
}
|
||||
}
|
||||
c1->cd();
|
||||
gain_avg->GetXaxis()->SetTitle("Average gain");
|
||||
gain_avg->GetXaxis()->SetTitleOffset(1.1);
|
||||
gain_avg->GetYaxis()->SetTitleOffset(1.5);
|
||||
gain_avg->Draw();
|
||||
sprintf(savename,"plots/M%s/CurrentSource/perStep/gain_avg_%i.png", module_str.c_str(), j/640);
|
||||
c1->SaveAs((const char *)(savename));
|
||||
mapcanvas->cd();
|
||||
gainmap_avg->GetXaxis()->SetTitle("Column");
|
||||
gainmap_avg->GetYaxis()->SetTitle("Row");
|
||||
gainmap_avg->GetYaxis()->SetTitleOffset(0.7);
|
||||
gainmap_avg->Draw("colz");
|
||||
sprintf(savename,"plots/M%s/CurrentSource/perStep/gainmap_avg_%i.png", module_str.c_str(), j/640);
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
|
||||
thisfile->close();
|
||||
c1->cd();
|
||||
adc_avg_g1->GetXaxis()->SetTitle("Average G1 ADC");
|
||||
adc_avg_g1->GetXaxis()->SetTitleOffset(1.1);
|
||||
adc_avg_g1->GetYaxis()->SetTitleOffset(1.5);
|
||||
adc_avg_g1->Draw();
|
||||
sprintf(savename,"plots/M%s/CurrentSource/perStep/adc_avg_g1_%i.png", module_str.c_str(), j/640);
|
||||
c1->SaveAs((const char *)(savename));
|
||||
mapcanvas->cd();
|
||||
adcmap_avg_g1[j/640-1]->GetXaxis()->SetTitle("Column");
|
||||
adcmap_avg_g1[j/640-1]->GetYaxis()->SetTitle("Row");
|
||||
adcmap_avg_g1[j/640-1]->GetYaxis()->SetTitleOffset(0.7);
|
||||
adcmap_avg_g1[j/640-1]->Draw("colz");
|
||||
mapcanvas->Update();
|
||||
sprintf(savename,"plots/M%s/CurrentSource/perStep/adcmap_avg_g1_%i.png", module_str.c_str(), j/640);
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
adcermap_avg_g1[j/640-1]->GetXaxis()->SetTitle("Column");
|
||||
adcermap_avg_g1[j/640-1]->GetYaxis()->SetTitle("Row");
|
||||
adcermap_avg_g1[j/640-1]->GetYaxis()->SetTitleOffset(0.7);
|
||||
adcermap_avg_g1[j/640-1]->Draw("colz");
|
||||
mapcanvas->Update();
|
||||
sprintf(savename,"plots/M%s/CurrentSource/perStep/adcermap_avg_g1_%i.png", module_str.c_str(), j/640);
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
|
||||
} // end of files
|
||||
c1->cd();
|
||||
adc_avg_g2->GetXaxis()->SetTitle("Average G2 ADC");
|
||||
adc_avg_g2->GetXaxis()->SetTitleOffset(1.1);
|
||||
adc_avg_g2->GetYaxis()->SetTitleOffset(1.5);
|
||||
adc_avg_g2->Draw();
|
||||
sprintf(savename,"plots/M%s/CurrentSource/perStep/adc_avg_g2_%i.png", module_str.c_str(), j/640);
|
||||
c1->SaveAs((const char *)(savename));
|
||||
mapcanvas->cd();
|
||||
adcmap_avg_g2[j/640-1]->GetXaxis()->SetTitle("Column");
|
||||
adcmap_avg_g2[j/640-1]->GetYaxis()->SetTitle("Row");
|
||||
adcmap_avg_g2[j/640-1]->GetYaxis()->SetTitleOffset(0.7);
|
||||
adcmap_avg_g2[j/640-1]->Draw("colz");
|
||||
sprintf(savename,"plots/M%s/CurrentSource/perStep/adcmap_avg_g2_%i.png", module_str.c_str(), j/640);
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
adcermap_avg_g2[j/640-1]->GetXaxis()->SetTitle("Column");
|
||||
adcermap_avg_g2[j/640-1]->GetYaxis()->SetTitle("Row");
|
||||
adcermap_avg_g2[j/640-1]->GetYaxis()->SetTitleOffset(0.7);
|
||||
adcermap_avg_g2[j/640-1]->Draw("colz");
|
||||
sprintf(savename,"plots/M%s/CurrentSource/perStep/adcermap_avg_g2_%i.png", module_str.c_str(), j/640);
|
||||
mapcanvas->SaveAs((const char *)(savename));
|
||||
|
||||
for (int i = 0; i < NCH; i++) {
|
||||
delete gain_histos[i];
|
||||
delete adc_histos_g1[i];
|
||||
delete adc_histos_g2[i];
|
||||
}
|
||||
gain_avg->Reset();
|
||||
gainmap_avg->Reset();
|
||||
adc_avg_g1->Reset();
|
||||
adc_avg_g2->Reset();
|
||||
}
|
||||
} // end of while
|
||||
|
||||
thisfile->close();
|
||||
|
||||
} // end of files
|
||||
|
||||
for (int i = 0; i < NCH; i++) {
|
||||
delete gain_histos[i];
|
||||
delete adc_histos_g1[i];
|
||||
delete adc_histos_g2[i];
|
||||
}
|
||||
|
||||
cout << "frame_counter " << frame_counter << endl;
|
||||
cout << "frame_counter " << frame_counter << endl;
|
||||
|
||||
// save histograms
|
||||
sprintf(savename,"/mnt/pcmoench_jungfrau_data/jungfrau_ana_sophie/M%s_CalibAna/CS_histos_M%s.root", module_str.c_str(), module_str.c_str());
|
||||
TFile* saved_file = new TFile((const char *)(savename),"RECREATE");
|
||||
|
||||
for (int i = 0; i < 35; i++) {
|
||||
adcmap_avg_g1[i]->Write();
|
||||
adcmap_avg_g2[i]->Write();
|
||||
adcermap_avg_g1[i]->Write();
|
||||
adcermap_avg_g2[i]->Write();
|
||||
}
|
||||
saved_file->Close();
|
||||
} else {
|
||||
// load histos
|
||||
cout << "LOADING HISTOS" << endl;
|
||||
sprintf(savename,"/mnt/pcmoench_jungfrau_data/jungfrau_ana_sophie/M%s_CalibAna/CS_histos_M%s.root", module_str.c_str(), module_str.c_str());
|
||||
TFile* saved_file = new TFile((const char *)(savename),"READ");
|
||||
|
||||
for (int i = 0; i < 35; i++) {
|
||||
sprintf(savename,"adcmap_avg_g1_%d", i);
|
||||
adcmap_avg_g1[i] = (TH2F*)saved_file->Get((const char *)(savename));
|
||||
sprintf(savename,"adcmap_avg_g2_%d", i);
|
||||
adcmap_avg_g2[i] = (TH2F*)saved_file->Get((const char *)(savename));
|
||||
|
||||
sprintf(savename,"adcermap_avg_g1_%d", i);
|
||||
adcermap_avg_g1[i] = (TH2F*)saved_file->Get((const char *)(savename));
|
||||
sprintf(savename,"adcermap_avg_g2_%d", i);
|
||||
adcermap_avg_g2[i] = (TH2F*)saved_file->Get((const char *)(savename));
|
||||
}
|
||||
}
|
||||
|
||||
TH2F *g1map = new TH2F("g1map","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
||||
TH2F *g1ermap = new TH2F("g1ermap","",NC,-0.5,NC-0.5,NR,-0.5,NR-0.5);
|
||||
|
||||
@@ -506,6 +519,32 @@ int main(int argc, char* argv[]) {
|
||||
TH1F *g1overg2_isQuad = new TH1F("g1overg2_isQuad","",100,11,15);
|
||||
TH1F *g1overg2_isBulk = new TH1F("g1overg2_isBulk","",100,11,15);
|
||||
|
||||
double filter[35];
|
||||
if (module_str == "044") {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
filter[i] = 0.05+(i*0.05);
|
||||
}
|
||||
for (int i = 0; i < 9; i++) {
|
||||
filter[i+5] = 0.5+(i*0.25);
|
||||
}
|
||||
for (int i = 0; i < 17; i++) {
|
||||
filter[i+5+9] = 5.+(i*2.5);
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < 9; i++) {
|
||||
filter[i] = 0.05+(i*0.025);
|
||||
}
|
||||
for (int i = 0; i < 9; i++) {
|
||||
filter[i+9] = 0.5+(i*0.25);
|
||||
}
|
||||
for (int i = 0; i < 17; i++) {
|
||||
filter[i+9+9] = 5.+(i*2.5);
|
||||
}
|
||||
}
|
||||
|
||||
double pede_ene[1];
|
||||
pede_ene[0] = 0.01;
|
||||
|
||||
for (int i = 0; i < NCH; i++) {
|
||||
if (pixel_mask[i] == 1) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user