1 int Fe55_main (
const char * dir,
const char * outName =
"Fe_50V" );
21 const double CteX = 0.9999999;
22 const double CteY = 0.9999999;
48 static const double Ea;
49 static const double Eb;
63 static const double Ro;
64 static const double Na;
65 static const double Nd;
66 static const double Cpn;
67 static const double Vde;
97 const double Co::Ea= 5897.;
98 const double Co::Eb = 6490.;
117 const double Co::Nd=1.6e+3;
128 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
129 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 };
147 double G2DI (
double *
v,
double *par )
149 const double bin_w2 = 0.5;
153 if ( par[3] < 0.000001 ) { sigma = 1.e-6; }
154 else { sigma = par[3]; }
156 double Xmin = (x - bin_w2 - par[1])/sigma;
157 double Xmax = (x + bin_w2 - par[1])/sigma;
158 double Ymin = (y - bin_w2 - par[2])/sigma;
159 double Ymax = (y + bin_w2 - par[2])/sigma;
160 double fitval = par[0];
161 fitval *= TMath::Freq(Xmax) - TMath::Freq(Xmin);
162 fitval *= TMath::Freq(Ymax) - TMath::Freq(Ymin);
196 void Init(
int ix,
int jy );
197 int AddPix(
int ix,
int jy );
232 void GetRow(
double * p_row,
int yc);
235 Hits(
int nx,
int ny,
double ANoise,
double thresh);
254 printf(
" OneHit::Init %i %i \n", ix, jy);
294 if (aSumA>SumA) {
jymax=jy-1;}
312 double amp = *(
p_crow+ix);
324 maxHit((nx/Wpad+1)*(ny/Wtime+1)),
325 maxSeed(Wtime*nx/Wpad),
328 Acut(Noise*Threshold),
363 for (
int ii=lind; ii<rind; ii++) {
464 void Cluster(
int ix,
int jy,
const int pass=0 );
466 Ohit(
int max_X,
int min_X,
int max_Y,
int min_Y,
double ANoise,
467 int nx,
int ny,
double * buf,
468 TCanvas * pcF, TH2F * pf2D, TF2 * pfit );
474 Ohit::Ohit(
int max_X,
int min_X,
int max_Y,
int min_Y,
double ANoise,
475 int nx,
int ny,
double * buf,
476 TCanvas * pcF, TH2F * pf2D, TF2 * pfit ):
482 lowT(
Co::NTlow*Noise),
483 cntT(
Co::NTcnt*Noise),
495 Nfree(NXsrch*NYsrch-Npar2DI),
504 if ( pcF==0)
cF =
new TCanvas(
"Fit2D",
"Fit2D", 300,10,700,650);
507 for (
int i=0;
i<
NZ;
i++){
551 if (js < 0 || js >=
Jmax)
return;
558 const int center =
Ncore/2;
560 int ybuf =
jyb +
y - center;
561 if ( ybuf < Ymin || ybuf >=
Ymax) {
Flag = -1;
continue;}
563 int xbuf = ixb +
x - center;
564 if ( xbuf < Xmin || xbuf >=
Xmax) {
Flag = -1;
continue;}
565 int jb = ybuf*
nxb + xbuf;
570 if (
flagbuf[jb] >1 ) {pileup = 1;}
572 if ( (amp >
lowT) || pass ) {
578 ampC /=(TMath::Power(
CteX, xbuf)*TMath::Power(
CteY, ybuf));
586 if (pass) {
return; }
587 if ( pileup ) {
Flag = -200;
return;}
588 if (
Sum < 100.) {
Flag = -100;
return;}
600 double amp=
Amp[
x][
y];
601 if (amp <0.)
continue;
606 rms = sqrt(rmsx2+rmsy2);
614 if (
y == center )
continue;
622 for(
int x = 0;
x < preC;
x++) {
665 double amp =
Amp[
x-1][
y-1];
666 if (amp < 0.) amp=0.;
667 f2D->SetBinContent(
x,
y, amp);
668 double StErr =
Noise;
670 if ( amp > 3.*Noise ){
672 StErr = sqrt(StErr2);
674 f2D->SetBinError (
x,
y, StErr);
682 fit->SetParameter(0,
Sum);
686 fit->SetParameter(3,
rms);
765 if (
Flag < -500 )
return;
771 int jb = ybuf*
nxb + xbuf;
772 if ( (xbuf >=
Xmin && xbuf <
Xmax) &&
781 const double Fract = 0.04;
782 int maxbin = hist->GetMaximumBin();
783 *maxpos = hist->GetBinCenter(maxbin);
784 double maxval = hist->GetBinContent(maxbin);
786 cout <<
" maxbin=" << maxbin <<
" maxval=" <<maxval <<endl;
787 cout <<
" max/maxpos=" << *maxpos << endl;
790 while (bin>0 && hist->GetBinContent(bin) > Fract*maxval) bin--;
791 *Rmin = hist->GetBinCenter(bin);
792 cout <<
" Rmin=" << *Rmin <<
" A(Rmin)=" << hist->GetBinContent(bin) << endl;
794 int xlast = hist->GetXaxis()->GetLast();
796 while (bin<xlast && hist->GetBinContent(bin) > Fract*maxval) bin++;
798 *Rmax = hist->GetBinCenter(bin);
799 cout <<
" Rmax=" << *Rmax <<
" A(Rmax)=" << hist->GetBinContent(bin) << endl;
863 SimX (
string dir_name );
867 int OutSimF(
const char * fOutName );
909 cout<<
" Sim Param Sigma Diffusion: "<<
SiDi<<
'\n';
910 cout<<
" Sim Param Gain: "<<
Co::Gain<<
'\n';
911 cout<<
" Sim Param Ne Ka: "<<
Co::NeKa<<
'\n';
912 cout<<
" Sim Param Ne Kb: "<<
Co::NeKb<<
'\n';
913 cout<<
" Sim Cluster matrix bend: "<<
bend <<
'\n';
914 cout<<
" Sim Cluster matrix Nmatr: "<<
Nmatr <<
'\n';
915 cout<<
" Sim Vop: "<<
Vop <<
'\n';
916 cout<<
" Sim Vde: "<<
Vde <<
'\n';
919 cout<<
" Sim DelD: "<<
Co::DelD <<
'\n';
920 cout<<
" Sim Cpn: "<<
Co::Cpn<<
'\n';
921 cout<<
" Sim Vplus: "<<
Vplus <<
'\n';
922 cout<<
" Sim Vmins: "<<
Vmins <<
'\n';
923 cout<<
" Sim Tmax: "<<
Tmax <<
'\n';
924 cout<<
" Sim t_sat: "<<
t_sat <<
'\n';
926 hsiAmp =
new TH1D(
"siAmp",
"siAmp", 1000, 0., 1000.);
928 hsiAmx =
new TH1D(
"siAmx",
"siAmx", 1000, 0., 1000.);
930 hsiAle =
new TH1D(
"siAle",
"siAle", 1000, 0., 1.);
932 hsiXl =
new TH1D(
"siXl",
"siXl", 200, -0.5, 1.5);
934 hsiYl =
new TH1D(
"siYl",
"siYl", 200, -0.5, 1.5);
936 hsiZl =
new TH1D(
"siZl",
"siZl", 120, 0., 1.20);
938 hsiTl =
new TH1D(
"siTl",
"siTl", 120, 0., 1.20);
951 cout <<
"Sim starts with bias file:" << *FL.
FName_Iter << endl;
955 cout <<
"SimX File: " << *FL.
FName_Iter << endl;
960 if (
Read() )
continue;
961 if (
naxis != 2)
continue;
971 cout<<
" Sim Param Pixel Size: "<<
PixSz<<
'\n';
972 cout<<
" Sim Param SigmDiff: "<<SiDi*PixSz<<
'\n';
977 bufsi[
i] = 5700. + gRandom->Gaus(0.,5.137);
1001 TCanvas * SimP =
new TCanvas(
"SimP",
"SimP", 55, 15, 900, 800);
1002 SimP->SetBorderMode (0);
1007 SimP->SetFrameFillColor(0);
1011 SimP->SetFillStyle(4100);
1012 SimP->SetFillColor(0);
1016 Entry = (int)
hsiAmp->GetEntries();
1022 Entry = (int)
hsiAmx->GetEntries();
1028 Entry = (int)
hsiXl->GetEntries();
1034 Entry = (int)
hsiYl->GetEntries();
1040 Entry = (int)
hsiZl->GetEntries();
1046 Entry = (int)
hsiTl->GetEntries();
1052 Entry = (int)
hsiAle->GetEntries();
1059 SimP->Print(
"SimP.pdf");
1115 for (
int ray=0; ray<
Nray; ray++){
1118 double xs = (
double)XminSearch + Xrange*gRandom->Rndm();
1119 double ys = (
double)YminSearch + Yrange*gRandom->Rndm();
1123 double lxs = xs - ixs;
1124 double lys = ys - jys;
1131 double ab = gRandom->Rndm();
1139 lz = gRandom->Exp(tau);
1145 if (drti < 0.) {drti = 0.;}
1146 else {drti = sqrt (drti);}
1148 double sigma_z =
SiDi*drti;
1150 SiPzS2 = sigma_z*sqrt(2.);
1170 sigY = TMath::Erf(dyh)-TMath::Erf(dyl);
1180 sigX = TMath::Erf(dxh)-TMath::Erf(dxl);
1182 double signal = Amp*sigX*sigY;
1185 double ran_sig = signal *
Co::Fano;
1186 sim_sig = gRandom->PoissonD(ran_sig);
1189 if ( sim_sig < 0.0) sim_sig=0.;
1194 int jj = gy *
nx +
gx;
1195 int idx =
i * Nmatr +
k;
1197 bufsi[jj] +=sim_sig;
1209 sigY = TMath::Erf(dyh)-TMath::Erf(dyl);
1213 sigX = TMath::Erf(dyh)-TMath::Erf(dyl);
1215 double sigLF = (1.-sigX*sigY)*100.;
1234 strcpy (foutname, fOutName);
1237 fits_create_file(&fSimOut, foutname, &
status);
1256 fits_close_file(fSimOut, &
status);
1356 Fe55 (
string dir_name,
1357 const char * outName,
1358 const double * Noise,
1359 const vector<double> * b_avbuf,
1365 static double GGF (
double *
v,
double *par );
1366 static double Gauss (
double *
v,
double *par );
1367 void FitG(TH1D * hm,
double * Amp,
double * Shift,
double * Noise);
1407 for (
int u=0;
u<2;
u++){
1411 sprintf(tiname,
"FeFFT %i",
u);
1412 sprintf(PDFname,
"Fe55FFT_%i.pdf",
u);
1413 if (
u >
MaxP )
break;
1414 Tr[
u] =
new TCanvas( tiname, tiname, 200+4*
u, 10+2*
u, 800, 600);
1415 Tr[
u]->SetBorderMode (1);
1420 Tr[
u]->SetFrameFillColor(0);
1424 printf(
" Start draw Power Spectrum for Rows\n\n");
1432 printf(
" RowPSD points =%i RowFreq size=%i *** \n", Npsd, Nfrq);
1433 if ( Npsd <= 3 )
continue;
1435 if ( Nfrq < nn )
continue;
1437 std6->SetTitle(
"Rows");
1438 std6->GetYaxis()->SetTitle(
"PSD ");
1439 std6->GetXaxis()->SetTitle(
"k/N, 1/pixel");
1440 std6->SetMarkerColor(4);
1441 std6->SetMarkerStyle(21);
1443 cout <<
"i" <<
" - " <<
"Freq" <<
" - " <<
" RowPSD" << endl;
1444 for (
int i=0;
i<Npsd;
i++){
1456 printf(
" ColPSD points =%i ColFreq size=%i *** \n", Npsd, Nfrq);
1457 if ( Npsd <= 3 )
continue;
1459 if ( Nfrq < nn )
continue;
1461 std7->SetTitle(
"Columns");
1462 std7->GetYaxis()->SetTitle(
"PSD ");
1463 std7->GetXaxis()->SetTitle(
"k/N, 1/pixel");
1464 std7->SetMarkerColor(6);
1465 std7->SetMarkerStyle(21);
1470 Tr[
u]->Print(PDFname);
1475 TCanvas * Tb =
new TCanvas(
"subtract",
"subtract", 250, 20, 800, 600);
1476 Tb->SetBorderMode (1);
1481 Tb->SetFrameFillColor(0);
1484 int Entry = (int)
Row->
hbuf[0]->GetEntries();
1488 gStyle->SetOptFit(1);
1494 Entry = (int)
Row->
hbuf[1]->GetEntries();
1498 gStyle->SetOptFit(1);
1503 Entry = (int)
Row->
hbuf[2]->GetEntries();
1510 Entry = (int)
Row->
hbuf[3]->GetEntries();
1525 printf(
"******* BaLiC is invoked for HDU=%i channel=%i ******\n",
hdu,
ch_idx);
1529 double b_shift1 = 0;
1533 for (
int iy=Dev->
minY(); iy<Dev->
maxY(); iy++) {
1534 for (
int ix=Dev->
minX(); ix<Dev->
maxX(); ix++) {
1537 if (
bufzs[j] < NoiseCut ) {
1546 FitG(
hblc, &peak, &b_shift1, &b_rms);
1547 printf (
"GausAv=%f rms=%f \n", b_shift1, b_rms);
1552 printf(
" shift= %f act=%f \n", b_shift, act);
1554 for (
int iy=0; iy<
ny; iy++) {
1555 for (
int ix=0; ix<
nx; ix++) {
1558 if ( Dev->
IsOver(ix, iy) )
continue;
1567 printf(
"*********# BaLiS is invoked for HDU=%i ch_idx=%i #********\n",
hdu,
ch_idx);
1568 printf(
"*********# BaLiS: Dev->: Ominx=%i Omax=%i minX=%i maxX=%i NoverX=%i \n",
1571 double b_shift = 0.;
1576 for (
int iy=0; iy<
ny; iy++) {
1577 for (
int ix=0; ix<
nx; ix++) {
1578 long j = iy*nx + ix;
1584 for (
int iy=0; iy<
ny; iy++) {
1586 for (
int ix=Dev->
OmiX(); ix<Dev->
OmaX(); ix++) {
1587 long j = iy*
nx + ix;
1590 for (
int ix=0; ix<
nx; ix++) {
1591 long j = iy*nx + ix;
1603 printf (
" OS: GausAv=%f rms=%f \n", b_shift, b_rms);
1608 for (
int it=0;
it<4;
it++){
1613 double RowCut = 4.*b_rms;
1615 for (
int iy=0; iy<
ny; iy++) {
1619 for (
int ix=Dev->
minX(); ix<Dev->
maxX(); ix++) {
1622 if ( !
it || (
bufzs[j] < RowCut) ) {a_row +=
bufzs[
j]; n_row +=1.;}
1624 if (n_row > 0.5*
nx ) a_row /= n_row;
1627 for (
int ix=Dev->
minX(); ix<Dev->
maxX(); ix++) {
1636 FitG(
hs[ch_idx][4+2*
it], &peak, &b_shift, &b_rms);
1637 printf (
"Fit Noise Itr%d : Row: shift=%f rms=%f \n",
it, b_shift,b_rms);
1640 double ColCut = 4.*b_rms;
1642 for (
int ix=0; ix<
nx; ix++) {
1646 for (
int iy=Dev->
minY(); iy<Dev->
maxY(); iy++) {
1647 long j = iy*nx + ix;
1649 if ( !
it || (
bufzs[j] < ColCut) ) {a_col +=
bufzs[
j]; n_col +=1.;}
1651 if (n_col > 0.5*ny ) a_col /= n_col;
1654 for (
int iy=Dev->
minY(); iy<Dev->
maxY(); iy++) {
1655 long j = iy*nx + ix;
1663 FitG(
hs[ch_idx][3+2*
it], &peak, &b_shift, &b_rms);
1664 printf (
"Fit Noise Itr%d : Col: shift=%f rms=%f \n",
it, b_shift,b_rms);
1670 cout <<
" BaLiS noise for hdu="<<
hdu<<
" : " <<b_rms << endl;
1672 for (
int iy=0; iy<
ny; iy++) {
1673 for (
int ix=0; ix<
nx; ix++) {
1674 long j = iy*nx + ix;
1675 if ( Dev->
IsOver(ix, iy) )
continue;
1676 double amp =
bufzs[
j] - b_shift;
1699 printf(
"AIK in PlotBase\n");
1700 TCanvas * BaL[
MaxP]={0};
1706 sprintf(tiname,
"BaLiSu %i",
u);
1707 if (
u >
MaxP )
break;
1710 BaL[
u] =
new TCanvas( tiname, tiname, 100+5*
u, 100+5*
u, 900, 800);
1712 BaL[
u]->SetFrameFillColor(0);
1713 BaL[
u]->SetBorderMode (0);
1718 BaL[
u]->Divide(2,6);
1720 BaL[
u]->SetFillStyle(4100);
1721 BaL[
u]->SetFillColor(0);
1723 for (
int i = 0;
i<3;
i++){
1724 if (
hs[
u][
i] == 0)
continue;
1725 Entry = (int)
hs[
u][
i]->GetEntries();
1726 if ( Entry < 1 )
continue;
1732 Entry = (int)
hs[
u][13]->GetEntries();
1739 for (
int i = 3;
i<11;
i++){
1740 if (
hs[
u][
i] == 0)
continue;
1741 Entry = (int)
hs[
u][
i]->GetEntries();
1742 if ( Entry < 1 )
continue;
1749 sprintf(uname,
"BaLiSu_%i.pdf",
u);
1761 basic_string <char>::size_type indexL;
1762 indexL = listName.find (
".fits");
1763 listName = listName.replace ( indexL , 5 ,
"-xray.txt" );
1764 printf(
"Output list File: %s \n", listName.c_str());
1765 if (access(listName.c_str(), F_OK) != -1) {
1766 remove(listName.c_str());
1768 pFlist = fopen(listName.c_str(),
"a+t");
1770 printf(
"File %s can't be open \n", listName.c_str());
1774 fprintf(
pFlist,
"No x y x-fit y-fit y-fcorr sum-reg XIP \n");
1778 basic_string <char>::size_type indexF;
1779 indexF = regName.find (
".fits");
1780 regName = regName.replace ( indexF , 5 ,
".reg" );
1781 printf(
"Output reg File: %s \n", regName.c_str());
1782 if (access(regName.c_str(), F_OK) != -1) {
1783 remove(regName.c_str());
1785 pFreg = fopen(regName.c_str(),
"a+t");
1787 printf(
"File %s can't be open \n", regName.c_str());
1794 basic_string <char>::size_type indexC;
1795 indexC = catName.find (
".fits");
1796 catName = catName.replace ( indexF , 5 ,
"_catalog.xml" );
1797 printf(
"Output cat File: %s \n", catName.c_str());
1798 if (access(catName.c_str(), F_OK) != -1) {
1799 remove(catName.c_str());
1801 pFcat = fopen(catName.c_str(),
"a+t");
1803 printf(
"File %s can't be open \n", catName.c_str());
1807 fprintf(
pFcat,
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<VOTABLE version=\"1.1\">\n<RESOURCE>\n");
1809 fprintf(
pFcat,
"<DESCRIPTION># X-ray catalog\n</DESCRIPTION>\n");
1810 fprintf(
pFcat,
"<FIELD name=\"PhysicalX\" >\n<DESCRIPTION>Physical X</DESCRIPTION>\n</FIELD>\n");
1811 fprintf(
pFcat,
"<FIELD name=\"PhysicalY\" >\n<DESCRIPTION>Physical Y</DESCRIPTION>\n</FIELD>\n");
1812 fprintf(
pFcat,
"<FIELD name=\"ImageX\" >\n<DESCRIPTION>Image X</DESCRIPTION>\n</FIELD>\n");
1813 fprintf(
pFcat,
"<FIELD name=\"ImageY\" >\n<DESCRIPTION>Image y coordinates</DESCRIPTION>\n</FIELD>\n");
1814 fprintf(
pFcat,
"<FIELD name=\"Amp Sum\" >\n<DESCRIPTION>Amplitude Sum</DESCRIPTION>\n</FIELD>\n");
1815 fprintf(
pFcat,
"<FIELD name=\"ChannelNumber\" >\n<DESCRIPTION>CCD Segment</DESCRIPTION>\n</FIELD>\n");
1816 fprintf(
pFcat,
"<FIELD name=\"Amp0,0\" >\n<DESCRIPTION>Amplitude 0,0</DESCRIPTION>\n</FIELD>\n");
1817 fprintf(
pFcat,
"<FIELD name=\"Amp1,0\" >\n<DESCRIPTION>Amplitude 1,0</DESCRIPTION>\n</FIELD>\n");
1818 fprintf(
pFcat,
"<FIELD name=\"Amp2,0\" >\n<DESCRIPTION>Amplitude 2,0</DESCRIPTION>\n</FIELD>\n");
1819 fprintf(
pFcat,
"<FIELD name=\"Amp0,1\" >\n<DESCRIPTION>Amplitude 0,1</DESCRIPTION>\n</FIELD>\n");
1820 fprintf(
pFcat,
"<FIELD name=\"Amp1,1\" >\n<DESCRIPTION>Amplitude 1,1</DESCRIPTION>\n</FIELD>\n");
1821 fprintf(
pFcat,
"<FIELD name=\"Amp2,1\" >\n<DESCRIPTION>Amplitude 2,1</DESCRIPTION>\n</FIELD>\n");
1822 fprintf(
pFcat,
"<FIELD name=\"Amp0,2\" >\n<DESCRIPTION>Amplitude 0,2</DESCRIPTION>\n</FIELD>\n");
1823 fprintf(
pFcat,
"<FIELD name=\"Amp1,2\" >\n<DESCRIPTION>Amplitude 1,2</DESCRIPTION>\n</FIELD>\n");
1824 fprintf(
pFcat,
"<FIELD name=\"Amp2,2\" >\n<DESCRIPTION>Amplitude 2,2</DESCRIPTION>\n</FIELD>\n");
1831 const char * outName,
1832 const double * Noise,
1833 const vector<double> * b_avbuf,
1858 for (
int j=0;
j<
NZ;
j++) {
1871 sprintf(title,
"base line correction");
1872 hblc =
new TH1D( title, title, 800, -400., 400.);
1876 sprintf(title,
"hs %i 0",
u);
1877 sprintf(hname,
"Raw Data");
1878 hs[
u][0] =
new TH1D( title, hname, 2000, 0., 4000.);
1879 hs[
u][0]->GetXaxis()->SetNdivisions(505);
1880 hs[
u][0]->SetStats(1);
1882 sprintf(title,
"hs %i 1",
u);
1883 sprintf(hname,
"Pre+Overscan after overscan subtr");
1884 hs[
u][1] =
new TH1D( title, hname, 800, -400., 400.);
1885 hs[
u][1]->SetStats(1);
1887 sprintf(title,
"hs %i 2",
u);
1888 sprintf(hname,
"Active after overscan subtr");
1889 hs[
u][2] =
new TH1D( title, hname, 2000, -400., 1600.);
1890 hs[
u][2]->SetStats(1);
1892 for (
int it=0;
it<4;
it++){
1893 sprintf(title,
"hs %i %i",
u, 3+2*
it);
1894 sprintf(hname,
"Column %i",
it+1);
1895 hs[
u][3+2*
it] =
new TH1D( title, hname, 2000, -400., 1600.);
1896 hs[
u][3+2*
it]->GetXaxis()->SetNdivisions(505);
1897 hs[
u][3+2*
it]->SetStats(1);
1899 sprintf(title,
"hs %i %i",
u, 4+2*
it);
1900 sprintf(hname,
"Row %i ",
it+1);
1901 hs[
u][4+2*
it] =
new TH1D( title, hname, 2000, -400., 1600.);
1902 hs[
u][4+2*
it]->GetXaxis()->SetNdivisions(505);
1903 hs[
u][4+2*
it]->SetStats(1);
1907 sprintf(title,
"hs13 %i",
u);
1908 sprintf(hname,
"Active final");
1909 hs[
u][13] =
new TH1D( title, hname, 2000, -400., 1600.);
1910 hs[
u][13]->GetXaxis()->SetNdivisions(505);
1911 hs[
u][13]->SetStats(1);
1914 sprintf(title,
"hNp_%i",
u);
1915 sprintf(hname,
"Npix %i",
u);
1916 hNp[
u] =
new TH1F(title,hname,32,0.,32.);
1917 hNp[
u]->SetStats(1);
1918 sprintf(title,
"hNph_%i",
u);
1919 sprintf(hname,
"NpHT %i",
u);
1920 hNph[
u] =
new TH1F(title,hname,32,0.,32.);
1921 hNph[
u]->SetStats(1);
1922 sprintf(title,
"hOrm_%i",
u);
1923 sprintf(hname,
"Orm %i",
u);
1924 horm[
u] =
new TH1F(title,hname, 40,0.,2.);
1925 horm[
u]->SetStats(1);
1926 sprintf(title,
"hra_%i",
u);
1927 sprintf(hname,
"Ratio %i",
u);
1928 hra[
u] =
new TH1F(title,hname, 240,0.,1.05);
1930 hra[
u]->SetStats(0);
1931 sprintf(title,
"hspr_%i",
u);
1932 sprintf(hname,
"SPR %i",
u);
1933 hspr[
u] =
new TH1F(title,hname, 240,0.,1.2);
1935 hspr[
u]->SetStats(0);
1938 sprintf(title,
"Ch%i_cluster_%i",
u,
i);
1942 sprintf(hname,
"Ch%i all pixels",
u);
1945 sprintf(hname,
"Ch%i 1 pixel",
u);
1948 sprintf(hname,
"Ch%i 5-%i pixels",
u, Nham-1);
1951 sprintf(hname,
"Ch%i %i pixels",
u,
i);
1954 ham[
u][
i] =
new TH1D( title, hname, 750, 0., 1500.);
1955 ham[
u][
i]->GetXaxis()->SetNdivisions(505);
1956 ham[
u][
i]->SetStats(1);
1959 sprintf(title,
"Seq_hit_Ch%i_cluster_SumA",
u);
1960 sprintf(hname,
"Ch%i_SumA",
u);
1961 hitSumA[
u] =
new TH1D( title, hname, 150, 0., 1500.);
1962 hitSumA[
u]->GetXaxis()->SetNdivisions(505);
1966 sprintf(hname,
"pix_amp_%i",
u);
1967 hfe[
u] =
new TH1D(hname,hname,2000,-200.,9800.);
1968 hfe[
u]->SetStats(1);
1969 sprintf(hname,
"map_amp_%i",
u);
1970 hmap[
u] =
new TH1D(hname,hname,2000,-200.,9800.);
1971 hmap[
u]->SetStats(1);
1972 sprintf(hname,
"pileup_sum_%i",
u);
1973 hpile[
u] =
new TH1D(hname,hname,1000, 0., 10000.);
1975 sprintf(hname,
"clean_sum_%i",
u);
1976 hclean[
u] =
new TH1D(hname,hname,150, 0., 1500.);
1978 sprintf(hname,
"Y_profile_%i",
u);
1979 hYpro[
u] =
new TH1D(hname,hname,1600, 400., 1200.);
1981 sprintf(hname,
"X_profile_%i",
u);
1982 hXpro[
u] =
new TH1D(hname,hname,800, 0., 1600.);
1984 sprintf(hname,
"X_fit_%i",
u);
1985 hXtst[
u] =
new TH1D(hname,hname,200, 0.5, 2.5);
1987 sprintf(hname,
"YX_plot_%i",
u);
1988 hYX[
u] =
new TH2D(hname,hname,80, 600., 920., 100, 500, 1500.);
1989 hYX[
u]->SetStats(0);
1992 sprintf(title,
"X-loss %i",
u);
1993 sprintf(hname,
"X-loss %i",
u);
1994 hXstat[
u] =
new TH1D( title, hname, 10, 0., 10.);
1995 hXstat[
u]->GetXaxis()->SetNdivisions(505);
1998 sprintf(title,
"Serial Transfer %i",
u);
1999 sprintf(hname,
"Serial Transfer %i",
u);
2000 Xcte[
u] =
new TH2F( title, hname, 50, 0., 550., 400, 0., 2000.);
2001 Xcte[
u]->SetStats(0);
2002 sprintf(title,
"Parallel Transfer %i",
u);
2003 sprintf(hname,
"Parallel Transfer %i",
u);
2004 Ycte[
u] =
new TH2F( title, hname,101, 0., 2020., 400, 0., 2000.);
2005 Ycte[
u]->SetStats(0);
2006 sprintf(title,
"ClustQ %i",
u);
2007 sprintf(hname,
"ClustQ %i",
u);
2008 ClustQ[
u] =
new TH2F( title, hname, 50, 0., 550., 101, 0., 2020.);
2014 sprintf(xtitle,
" %i binx %i",
u,
i);
2015 sprintf(ytitle,
" %i biny %i",
u,
i);
2016 xcte[
u][
i] =
new TH1F( xtitle, xtitle, 400, 0., 2000.);
2017 ycte[
u][
i] =
new TH1F( ytitle, ytitle, 400, 0., 2000.);
2024 sprintf(title,
"AvHit %i",
u);
2030 sprintf(title,
"ClusterPix_%i_%i%i",
u,
x,
y);
2031 hpixA[
u][
x][
y] =
new TH1D(title,title,750,-50,700);
2032 hpixA[
u][
x][
y]->GetXaxis()->SetNdivisions(505);
2037 hXf[
u][0] =
new TH1D(
"chi2",
"chi2", 100, 0., 100.);
2038 hXf[
u][0]->SetStats(0);
2039 hXf[
u][6] =
new TH1D(
"chiR",
"chiR", 100, 0., 50.);
2040 hXf[
u][6]->SetStats(0);
2041 hXf[
u][1] =
new TH1D(
"SumF",
"SumF", 500, 0., 2000.);
2042 hXf[
u][1]->SetStats(1);
2043 hXf[
u][2] =
new TH1D(
"xfit",
"xfit", 200, 0.5, 2.5);
2044 hXf[
u][2]->SetStats(0);
2045 hXf[
u][3] =
new TH1D(
"yfit",
"yfit", 200, 0.5, 2.5);
2046 hXf[
u][3]->SetStats(0);
2047 hXf[
u][4] =
new TH1D(
"sigma",
"sigma", 200, 0., 20.0);
2048 hXf[
u][4]->SetStats(0);
2049 hXf[
u][5] =
new TH1D(
"SigErr",
"SigErr", 200, 0., 1.);
2050 hXf[
u][5]->SetStats(0);
2054 hSig =
new TH1D(
"sigma",
"sigma", 200, 0., 20.0);
2064 TCanvas * cF =
new TCanvas(
"Fit2D",
"Fit2D", 300,10,700,650);
2066 enum { Npar2DI = 4};
2072 const char *colr[8]={
"white",
"black",
"red",
"green",
"blue",
"cyan",
"magenta",
"yellow"};
2085 if (
hdu > MaxP )
break;
2086 if (
Read() )
continue;
2092 if (!ir)
Vval[
i].push_back( v );
2095 if (
naxis != 2)
continue;
2106 if (
doFFT && (!FFTinit) ) {
2107 Col =
new FFT(
"Fe55 Col",
2111 Row =
new FFT(
"Fe55 Row",
2126 if (
ch_idx != 0)
continue;
2157 typedef pair <double, Qhit> AmapPair;
2158 multimap <double, Qhit, greater<double> > Amap;
2159 multimap <double, Qhit, greater<double> >::iterator AIter;
2160 multimap <double, Qhit>::size_type Asize;
2163 printf(
" Start sequentional clustering: ch=%i \n", ch_idx );
2170 double * pb = &
bufzs[j0];
2178 printf(
" Done sequentional clustering: ch=%i Nhits=%i \n", ch_idx, SegHits[ch_idx]->NHits);
2180 SegHits[ch_idx]->Nrpix, SegHits[ch_idx]->maxHit, SegHits[ch_idx]->maxSeed);
2181 printf(
" Hits Dump: %f %f %f %f \n", SegHits[ch_idx]->Noise,
2182 SegHits[ch_idx]->Threshold, SegHits[ch_idx]->Acut, SegHits[ch_idx]->AcutL);
2183 printf(
" Hits Dump: %i %i %i \n", SegHits[ch_idx]->NSeeds, SegHits[ch_idx]->NHits,
2184 SegHits[ch_idx]->jy_c);
2188 fprintf(
pFreg,
"# tile %i\nimage; box %i %i %i %i 0 # color = %s text={%6.0f}\n", ch_idx+1, SegHits[ch_idx]->hit1[ih].ixcntr + 1, SegHits[ch_idx]->hit1[ih].jycntr + 1,
Hits::Wpad,
Hits::Wtime, colr[2], SegHits[ch_idx]->hit1[ih].SumA);
2197 if (amp < AminSrch )
continue;
2199 Amap.insert( AmapPair( amp, qhi ) );
2202 Asize = Amap.size();
2210 for ( AIter = Amap.begin(); AIter != Amap.end(); AIter++ ){
2211 int x = AIter->second.ixb;
2212 int y = AIter->second.jyb;
2218 printf(
" ** second pass \n");
2219 for ( AIter = Amap.begin(); AIter != Amap.end(); AIter++ ){
2220 double amp = AIter -> first;
2221 int x = AIter->second.ixb;
2222 int y = AIter->second.jyb;
2228 if (hit.
Flag < 0) { hit.
Clear();
continue;}
2230 if (!lHit)
continue;
2263 for (
int iy=0; iy<hit.
NYsrch; iy++){
2264 for (
int ix=0; ix<hit.
NXsrch; ix++){
2265 double ai=hit.
Amp[ix][iy]*gainC;
2273 for (
int iy=0; iy<hit.
NYsrch; iy++){
2274 for (
int ix=0; ix<hit.
NXsrch; ix++){
2275 double aj=hit.
Amp[ix][iy]*gainC;
2301 if ( hit.
chiR < 40. ) {
2304 if ( (hit.
Sumf > 500.) &&
2305 (hit.
Sumf < 1500.) ) {
2332 fprintf(
pFreg,
"# tile %i\nimage; box %i %i %i %i 0 # color = %s text={%6.0f}\n", ch_idx+1, hit.
ixb + 1, hit.
jyb + 1,
Ohit::NXsrch, Ohit::NYsrch, colr[3], hit.
Sum);
2335 double lY=(
double)hit.
yhit+1.0;
2336 int lRegion = (lX > 1) && (lY > 1) && (lX <
nx) && (lY <
ny);
2337 if ( (abs(
ltm1_1) > 0.001) && (abs(
ltm2_2) > 0.001) ) {
2340 if(ch_idx + 1 > 8){physX--; physY++;}
2341 fprintf(
pFcat,
"<TR><TD>%f</TD><TD>%f</TD><TD>%i</TD><TD>%i</TD><TD>%6.0f</TD><TD>%i</TD><TD>%6.0f</TD><TD>%6.0f</TD><TD>%6.0f</TD><TD>%6.0f</TD><TD>%6.0f</TD><TD>%6.0f</TD><TD>%6.0f</TD><TD>%6.0f</TD><TD>%6.0f</TD></TR>\n", physX, physY, hit.
ixb + 1, hit.
jyb + 1, hit.
Sum, ch_idx + 1, hit.
Amp[0][0], hit.
Amp[1][0], hit.
Amp[2][0], hit.
Amp[0][1], hit.
Amp[1][1], hit.
Amp[2][1], hit.
Amp[0][2], hit.
Amp[1][2], hit.
Amp[2][2]);
2347 printf(
" ** segment %i done \n", ch_idx);
2368 fprintf(
pFcat,
"</TABLEDATA>\n</DATA>\n</TABLE>\n</RESOURCE>\n</VOTABLE>");
2380 for (
int u=0;
u<2;
u++){
2403 static const double GNorm = 1./TMath::Sqrt(2.*TMath::Pi());
2410 double N2 = par[2]*par[2];
2411 double s1 = TMath::Sqrt(N2 + sa)*scale;
2412 double s2 = TMath::Sqrt(N2 + sb)*scale;
2413 double argG1 = (x - par[1])/s1;
2414 double argG2 = (x - par4)/s2;
2415 double fitval = par[0]*GNorm*TMath::Exp(-0.5*argG1*argG1)/s1 +
2416 par[3]*GNorm*TMath::Exp(-0.5*argG2*argG2)/s2;
2429 TCanvas * Zs[
MaxP]={0};
2432 sprintf(tiname,
"Spectra_%i",
ch_idx);
2435 Zs[
ch_idx] =
new TCanvas( tiname, tiname, 30, 10, 900, 800);
2436 Zs[
ch_idx]->SetBorderMode (0);
2441 Zs[
ch_idx]->SetFrameFillColor(0);
2445 Zs[
ch_idx]->SetFillStyle(4100);
2446 Zs[
ch_idx]->SetFillColor(0);
2451 gStyle->SetOptFit(1);
2505 sprintf(tiname,
"Spectra_%i.pdf",
ch_idx);
2506 Zs[
ch_idx]->Print(tiname);
2515 if (s1 < 0.000001) s1=0.000001;
2516 double GNorm = 1./(TMath::Sqrt(2.*TMath::Pi())*s1);
2517 double argG1 = (x - par[1])/s1;
2518 double fitval = par[0]*GNorm*TMath::Exp(-0.5*argG1*argG1);
2522 void Fe55::FitG (TH1D * hm,
double * Amp,
double * Shift,
double * Noise)
2529 cout <<
" maxpos=" << maxpos <<
" Rmin=" << Rmin <<
" Rmax" << Rmax <<endl;
2533 const char fitname[] =
"fitGauss";
2536 double maxval = hm->GetEntries();
2537 if (maxval < 1.)
return;
2538 printf(
"\n Fit of %s \n",hm->GetTitle());
2540 double par0 = maxval*0.75;
2541 double par2 = (Rmax - Rmin)/4.;
2542 fit->SetParameter(0, par0);
2543 fit->SetParameter(1, maxpos);
2544 fit->SetParameter(2, par2);
2545 cout <<
" par0=" << par0 << endl;
2546 cout <<
" par1=" << maxpos <<
" par2=" << par2 << endl;
2547 cout <<
"fitname=" << fitname << endl;
2548 int fitflag = hm->Fit(fitname,
"NS");
2549 cout <<
" FitFlag=" << fitflag << endl;
2550 *Amp = fit->GetParameter(0);
2551 *Shift = fit->GetParameter(1);
2552 *Noise = fit->GetParameter(2);
2560 string foName =
"AvHit_";
2563 printf(
" Output File: %s \n", foName.c_str());
2564 FILE * pFile = fopen (foName.c_str(),
"wt");
2565 if (pFile == 0) {
printf(
" File %s cann't be open \n", foName.c_str());
Flag=-1;
return;}
2566 fprintf (pFile,
"// %s input files from: %s \n", foName.c_str(),
dname.c_str());
2569 if (
u >
MaxP )
break;
2571 fprintf (pFile,
" \n *** channel: %i \n",
u);
2573 for (
int zind=0; zind<
NZ; zind++) {
2574 double Nev=
NKhit[
u][zind];
2575 fprintf (pFile,
" \n Zone: %i Nev=%f \n", zind, Nev);
2576 if (Nev < 100)
continue;
2580 double amp=
AvHit[
u][zind][
x][
y]/Nev;
2581 double am2=
A2Hit[
u][zind][
x][
y]/Nev;
2582 double rms = am2-amp*amp;
2583 if (rms <0.) rms=0.;
2586 fprintf (pFile,
" %f+/-%f ", amp, rms);
2655 string foName =
"fit4_";
2658 printf(
" Output File: %s \n", foName.c_str());
2659 FILE * pFile = fopen (foName.c_str(),
"wt");
2660 if (pFile == 0) {
printf(
" File %s cann't be open \n", foName.c_str());
Flag=-1;
return;}
2661 fprintf (pFile,
"// %s input files from: %s \n", foName.c_str(),
dname.c_str());
2664 TCanvas * Cs =
new TCanvas(
"Fe55",
"Fe55", 145, 5, 1000, 800);
2665 Cs->SetBorderMode (0);
2670 Cs->SetFrameFillColor(0);
2673 Cs->SetFillStyle(4100);
2674 Cs->SetFillColor(0);
2681 if ( maxpos > 0.000001) iGain =
Co::NeKa/maxpos;
2682 double par2 =
ANoise[
u]*iGain;
2683 cout <<
" maxpos=" << maxpos <<
" Rmin=" << Rmin <<
" Rmax" << Rmax << endl;
2684 cout <<
" gain estimate =" << iGain <<
" e-/adu" << endl;
2685 cout <<
" noise =" << par2 <<
" e-" << endl;
2688 Rmax = pKb + (Rmax - maxpos);
2689 cout <<
" new Rmax= " << Rmax << endl;
2691 fprintf (pFile,
"//Peak: maxpos= %f Rmin=%f Rmax=%f \n", maxpos, Rmin, Rmax);
2692 fprintf (pFile,
"// Channel %d estimates: gain= %f e-/adu; noise=%f e-; rms = %f adu \n",
2693 u, iGain, par2,
ANoise[u]);
2695 const char * fitname =
"fitGG";
2698 double maxval =
ham[
u][0]->GetEntries();
2699 if (maxval < 1.)
continue;
2700 double sw =
ham[
u][0]->GetSumOfWeights();
2701 double bw =
ham[
u][0]->GetBinWidth(1);
2702 printf(
"\n Fit of %s \n",
ham[u][0]->GetTitle());
2703 printf(
" ham%i[0]: Sum of weights = %f Entries = %f BinW = %f\n",
2705 double par0 = maxval*0.75*bw;
2706 double par3 = maxval*0.25*bw;
2707 fit->SetParameter(0, par0);
2708 fit->SetParameter(1, maxpos);
2709 fit->SetParameter(2, par2);
2710 fit->SetParameter(3, par3);
2711 cout <<
" par0=" << par0 << endl;
2712 cout <<
" par1=" << maxpos <<
" par2=" << par2 << endl;
2713 cout <<
" par3=" << par3 << endl;
2714 cout <<
"fitname=" << fitname << endl;
2723 int fitflag = -100.;
2725 fprintf (pFile,
"//flag N Ka N Kb Ka,adu er(Ka) noise,e Ca Ra/b \n");
2726 if (
ham[u][0]->GetEntries() > 1 ) {
2730 gPad->SetFillColor(0);
2731 gPad->SetBorderSize(2);
2732 ham[
u][0]->SetStats(0);
2733 ham[
u][0]->SetTitle(
"");
2734 ham[
u][0]->GetXaxis()->SetNdivisions(505);
2735 ham[
u][0]->GetXaxis()->CenterTitle();
2736 ham[
u][0]->GetXaxis()->SetTitle(
"Cluster Total Amplitude, a.d.u.");
2737 ham[
u][0]->GetXaxis()->SetLabelSize(0.05);
2738 ham[
u][0]->GetXaxis()->SetTitleSize(0.05);
2739 ham[
u][0]->GetYaxis()->SetNdivisions(505);
2740 ham[
u][0]->GetYaxis()->CenterTitle();
2741 ham[
u][0]->GetYaxis()->SetTitle(
"Number of clusters");
2742 ham[
u][0]->GetYaxis()->SetLabelSize(0.05);
2743 ham[
u][0]->GetYaxis()->SetTitleSize(0.05);
2744 ham[
u][0]->GetYaxis()->SetTitleOffset(1.3);
2747 gPad->SetBit(kMustCleanup);
2748 gPad->GetListOfPrimitives()->Add(
ham[u][0],
"");
2749 gPad->Modified(kTRUE);
2751 fitflag =
ham[
u][0]->Fit(fitname,
"LR");
2752 cout <<
" FitFlag=" << fitflag << endl;
2753 NKa = fit->GetParameter(0)/bw;
2754 EKa = fit->GetParameter(1);
2755 Noise = fit->GetParameter(2);
2756 NKb = fit->GetParameter(3)/bw;
2757 era = fit->GetParError(1);
2759 rab = NKa > 1 ? (
double)NKb/NKa : 0.;
2761 fprintf (pFile,
" { %i, %7.1f, %7.1f, %7.2f, %6.2f, %6.2f, %7.4f, %5.2f,",
2762 fitflag, NKa, NKb, EKa, era, Noise, ca, rab);
2765 fprintf (pFile,
" } // all clusters \n");
2769 Cs->Print(
"Fe55_all.pdf");
2773 printf(
"In PlotXlines\n");
2774 TCanvas * Cl[
MaxP]={0};
2775 TCanvas * Xbin[
MaxP]={0};
2776 TCanvas * Ybin[
MaxP]={0};
2777 TCanvas * CTEgr[
MaxP]={0};
2781 sprintf(tiname,
"Fe55_%i",
u);
2782 if (
u >
MaxP )
break;
2785 Cl[
u] =
new TCanvas( tiname, tiname, 50+5*
u, 50+5*
u, 1000, 800);
2786 Cl[
u]->SetBorderMode (0);
2791 Cl[
u]->SetFrameFillColor(0);
2794 Cl[
u]->SetFillStyle(4100);
2795 Cl[
u]->SetFillColor(0);
2801 if ( maxpos > 0.000001) iGain =
Co::NeKa/maxpos;
2802 double par2 =
ANoise[
u]*iGain;
2803 cout <<
" maxpos=" << maxpos <<
" Rmin=" << Rmin <<
" Rmax" << Rmax << endl;
2804 cout <<
" gain estimate =" << iGain <<
" e-/adu" << endl;
2805 cout <<
" noise =" << par2 <<
" e-" << endl;
2808 Rmax = pKb + (Rmax - maxpos);
2809 cout <<
" new Rmax= " << Rmax << endl;
2811 fprintf (pFile,
"//Peak: maxpos= %f Rmin=%f Rmax=%f \n", maxpos, Rmin, Rmax);
2812 fprintf (pFile,
"//Estimates: gain= %f noise=%f \n", iGain, par2);
2814 const char * fitname =
"fitGG";
2818 fprintf (pFile,
"// Channel %d Noise rms = %f, %f e- \n", u,
ANoise[u], par2);
2819 fprintf (pFile,
"//flag N Ka N Kb Ka,adu er(Ka) noise,e Ca Ra/b \n");
2823 for (
int i=0; i < 10; i++){
2824 double maxval =
ham[
u][
i]->GetEntries();
2825 if (maxval < 1.)
continue;
2826 double sw =
ham[
u][
i]->GetSumOfWeights();
2827 double bw =
ham[
u][
i]->GetBinWidth(1);
2828 printf(
"\n Fit of %s \n",
ham[u][i]->GetTitle());
2829 printf(
" ham%i[%i]: Sum of weights = %f Entries = %f BinW = %f\n",
2830 u, i, sw, maxval, bw);
2831 double par0 = maxval*0.75*bw;
2832 double par3 = maxval*0.25*bw;
2833 fit->SetParameter(0, par0);
2834 fit->SetParameter(1, maxpos);
2835 fit->SetParameter(2, par2);
2836 fit->SetParameter(3, par3);
2837 cout <<
" par0=" << par0 << endl;
2838 cout <<
" par1=" << maxpos <<
" par2=" << par2 << endl;
2839 cout <<
" par3=" << par3 << endl;
2840 cout <<
"fitname=" << fitname << endl;
2849 int fitflag = -100.;
2851 if (
ham[u][i]->GetEntries() > 1 ) {
2855 gPad->SetFillColor(0);
2856 gPad->SetBorderSize(2);
2857 ham[
u][
i]->SetStats(0);
2858 ham[
u][
i]->SetTitle(
"");
2859 ham[
u][
i]->GetXaxis()->SetNdivisions(505);
2860 ham[
u][
i]->GetXaxis()->CenterTitle();
2861 ham[
u][
i]->GetXaxis()->SetTitle(
"Cluster Total Amplitude, a.d.u.");
2862 ham[
u][
i]->GetXaxis()->SetLabelSize(0.05);
2863 ham[
u][
i]->GetXaxis()->SetTitleSize(0.05);
2864 ham[
u][
i]->GetYaxis()->SetNdivisions(505);
2865 ham[
u][
i]->GetYaxis()->CenterTitle();
2866 ham[
u][
i]->GetYaxis()->SetTitle(
"Number of clusters");
2867 ham[
u][
i]->GetYaxis()->SetLabelSize(0.05);
2868 ham[
u][
i]->GetYaxis()->SetTitleSize(0.05);
2869 ham[
u][
i]->GetYaxis()->SetTitleOffset(1.3);
2872 gPad->SetBit(kMustCleanup);
2873 gPad->GetListOfPrimitives()->Add(
ham[u][i],
"");
2874 gPad->Modified(kTRUE);
2876 fitflag =
ham[
u][
i]->Fit(fitname,
"LR");
2877 cout <<
" FitFlag=" << fitflag << endl;
2878 NKa = fit->GetParameter(0)/bw;
2879 EKa = fit->GetParameter(1);
2880 Noise = fit->GetParameter(2);
2881 if ( (i>1) & (i<10) ) Noise /= TMath::Sqrt((
double)i);
2882 NKb = fit->GetParameter(3)/bw;
2883 era = fit->GetParError(1);
2885 rab = NKa > 1 ? (
double)NKb/NKa : 0.;
2887 fprintf (pFile,
" { %i, %7.1f, %7.1f, %7.2f, %6.2f, %6.2f, %7.4f, %5.2f,",
2888 fitflag, NKa, NKb, EKa, era, Noise, ca, rab);
2891 if (i)
fprintf (pFile,
" } // %i pixel clusters \n", i);
2892 else fprintf (pFile,
" } // all clusters \n");
2895 if (
hNp[u]->GetEntries() > 1 ) {
2899 gPad->SetFillColor(0);
2900 gPad->SetBorderSize(2);
2902 hNp[
u]->SetStats(0);
2903 hNp[
u]->SetTitle(
"");
2907 hNp[
u]->GetXaxis()->SetNdivisions(505);
2908 hNp[
u]->GetXaxis()->CenterTitle();
2909 hNp[
u]->GetXaxis()->SetTitle(
"Number of fired pixels");
2910 hNp[
u]->GetXaxis()->SetLabelSize(0.05);
2911 hNp[
u]->GetXaxis()->SetTitleSize(0.06);
2912 hNp[
u]->GetYaxis()->SetNdivisions(505);
2913 hNp[
u]->GetYaxis()->CenterTitle();
2914 hNp[
u]->GetYaxis()->SetTitle(
"Number of clusters");
2915 hNp[
u]->GetYaxis()->SetLabelSize(0.05);
2916 hNp[
u]->GetYaxis()->SetTitleSize(0.06);
2917 hNp[
u]->GetYaxis()->SetTitleOffset(1.7);
2921 fprintf (pFile,
"\n Npix LT: entries=%f mean=%f rms=%f \n",
2922 hNp[u]->GetEntries(),
hNp[u]->GetMean(),
hNp[u]->GetRMS() );
2950 fprintf (pFile,
"\n Npix HT: entries=%f mean=%f rms=%f \n",
2951 hNph[u]->GetEntries(),
hNph[u]->GetMean(),
hNph[u]->GetRMS() );
2953 fprintf (pFile,
"\n Xstat: %f, %f, %f, %f, %f \n",
2954 hXstat[u]->GetBinContent(1),
hXstat[u]->GetBinContent(2),
2955 hXstat[u]->GetBinContent(3),
hXstat[u]->GetBinContent(4),
2956 hXstat[u]->GetBinContent(5));
2957 printf (
"\n Xstat: %f, %f, %f, %f, %f \n",
2958 hXstat[u]->GetBinContent(1),
hXstat[u]->GetBinContent(2),
2959 hXstat[u]->GetBinContent(3),
hXstat[u]->GetBinContent(4),
2960 hXstat[u]->GetBinContent(5) );
2970 sprintf(uname,
"Cl_Fe55_%i.pdf", u);
2971 Cl[
u]->Print(uname);
2975 sprintf(tiname,
"Xbin_%i", u);
2976 Xbin[
u] =
new TCanvas( tiname, tiname, 100+2*u, 75+2*u, 1000, 800);
2977 Xbin[
u]->SetBorderMode (0);
2982 Xbin[
u]->SetFrameFillColor(0);
2983 Xbin[
u]->Divide(8,4);
2985 Xbin[
u]->SetFillStyle(4100);
2986 Xbin[
u]->SetFillColor(0);
2988 cout <<
" maxpos=" << maxpos <<
" Rmin=" << Rmin <<
" Rmax" << Rmax << endl;
2996 double xptX[
Ncte]={0.};
2997 double xerX[
Ncte]={0.};
2998 double yptX[
Ncte]={0.};
2999 double yerX[
Ncte]={0.};
3001 for (
int i=0; i<(
Ncte-1); i++){
3002 double maxval =
xcte[
u][
i]->GetEntries();
3003 if (maxval < 1.)
continue;
3004 double sw =
xcte[
u][
i]->GetSumOfWeights();
3005 printf(
"\n Fit of %s \n",
xcte[u][i]->GetTitle());
3006 printf(
" xcte[%i]: Sum of weights = %f Entries = %f \n", i, sw, maxval);
3007 double par0 = maxval*0.75;
3008 double par3 = par0/10.;
3009 fit->SetParameter(0, par0);
3010 fit->SetParLimits(0,0.,par0*100.);
3011 fit->SetParameter(1, maxpos);
3012 fit->SetParLimits(1,0.,maxpos*10.);
3013 fit->SetParameter(2, par2);
3014 fit->SetParLimits(2,0.,par2*100.);
3015 fit->SetParameter(3, par3);
3017 cout <<
" par0=" << par0 << endl;
3018 cout <<
" par1=" << maxpos <<
" par2=" << par2 << endl;
3019 cout <<
" par3=" << par3 << endl;
3024 gPad->SetFillColor(0);
3025 gPad->SetBorderSize(2);
3027 int fitflag =
xcte[
u][
i]->Fit(
"fitGG",
"LIBr");
3028 cout <<
" FitFlag=" << fitflag << endl;
3029 double NKa = fit->GetParameter(0);
3030 double EKa = fit->GetParameter(1);
3031 double Noise = fit->GetParameter(2);
3032 double NKb = fit->GetParameter(3);
3034 double era = fit->GetParError(1);
3038 double rab = NKa > 1 ? (
double)NKb/NKa : 0.;
3039 fprintf (pFile,
" { %i, %7.1f, %7.1f, %7.2f, %6.2f, %6.2f, %5.2f, %5.2f,",
3040 fitflag, NKa, NKb, EKa, era, Noise, ca, rab);
3043 fprintf (pFile,
" } // Xbin# %i %i\n", u, i);
3044 double s2 =(EKa/era)*(EKa/era);
3045 if (fitflag == 0 ) {
3050 XY += (i*
NgrX+1)*log(EKa)*s2;
3051 xptX[NptX]=i*
NgrX+1;
3057 double detX = Sa*X2 - X*
X;
3061 if ( TMath::Abs(detX) > 0.000001) {
3062 aX = (Y*X2 - X*XY)/detX;
3063 bX = (Sa*XY - X*
Y)/detX;
3065 if (ebX > 0) {ebX = sqrt(ebX);}
3067 double Xcte_fit = exp(bX);
3068 double eCTEx = TMath::Abs(Xcte_fit)*ebX;
3069 double A0X = exp(aX)*
NgrX*(1.-Xcte_fit)/(1.-TMath::Power(Xcte_fit,
NgrX));
3070 fprintf (pFile,
" \n CTEX %12.8f +/- %12.8f \n", Xcte_fit, eCTEx );
3071 fprintf (pFile,
" \n NgrX=%i NptX=%i A0=%f \n",
NgrX, NptX, A0X );
3072 fprintf (pFile,
" \n CteXin=%f CteCorr=%f CteXnew=%f \n",
CteX, Xcte_fit,
CteX*Xcte_fit);
3075 sprintf(uname,
"Xbin_Fe55_%i.pdf", u);
3076 Xbin[
u]->Print(uname);
3080 sprintf(tiname,
"Ybin_%i", u);
3081 Ybin[
u] =
new TCanvas( tiname, tiname, 150+2*u, 100+2*u, 1000, 800);
3082 Ybin[
u]->SetBorderMode (0);
3087 Ybin[
u]->SetFrameFillColor(0);
3088 Ybin[
u]->Divide(8,4);
3090 Ybin[
u]->SetFillStyle(4100);
3091 Ybin[
u]->SetFillColor(0);
3093 cout <<
" maxpos=" << maxpos <<
" Rmin=" << Rmin <<
" Rmax" << Rmax << endl;
3101 double xptY[
Ncte]={0.};
3102 double xerY[
Ncte]={0.};
3103 double yptY[
Ncte]={0.};
3104 double yerY[
Ncte]={0.};
3106 for (
int i=0; i<(
Ncte-1); i++){
3107 double maxval =
ycte[
u][
i]->GetEntries();
3108 if (maxval < 1.)
continue;
3109 double sw =
ycte[
u][
i]->GetSumOfWeights();
3110 printf(
"\n Fit of %s \n",
ycte[u][i]->GetTitle());
3111 printf(
" ycte[%i]: Sum of weights = %f Entries = %f \n", i, sw, maxval);
3112 double par0 = maxval*0.75;
3113 double par3 = par0/10.;
3114 fit->SetParameter(0, par0);
3115 fit->SetParLimits(0, 0.,par0*100.);
3116 fit->SetParameter(1, maxpos);
3117 fit->SetParLimits(1, 0.,maxpos*10.);
3118 fit->SetParameter(2, par2);
3119 fit->SetParLimits(2, 0.,par2*100.);
3120 fit->SetParameter(3, par3);
3122 cout <<
" par0=" << par0 << endl;
3123 cout <<
" par1=" << maxpos <<
" par2=" << par2 << endl;
3124 cout <<
" par3=" << par3 << endl;
3129 gPad->SetFillColor(0);
3130 gPad->SetBorderSize(2);
3132 int fitflag =
ycte[
u][
i]->Fit(
"fitGG",
"LIBr");
3133 cout <<
" FitFlag=" << fitflag << endl;
3134 double NKa = fit->GetParameter(0);
3135 double EKa = fit->GetParameter(1);
3136 double Noise = fit->GetParameter(2);
3137 double NKb = fit->GetParameter(3);
3139 double era = fit->GetParError(1);
3143 double rab = NKa > 1 ? (
double)NKb/NKa : 0.;
3144 fprintf (pFile,
" { %i, %7.1f, %7.1f, %7.2f, %6.2f, %6.2f, %5.2f, %5.2f,",
3145 fitflag, NKa, NKb, EKa, era, Noise, ca, rab);
3148 fprintf (pFile,
" } // Xbin# %i \n", i);
3149 double s2 =(EKa/era)*(EKa/era);
3150 if (fitflag == 0 ) {
3155 XY += (i*
NgrY+1)*log(EKa)*s2;
3156 xptY[NptY]=i*
NgrY+1;
3162 double detY = Sa*X2 - X*
X;
3166 if ( TMath::Abs(detY) > 0.000001) {
3167 aY = (Y*X2 - X*XY)/detY;
3168 bY = (Sa*XY - X*
Y)/detY;
3170 if (ebY > 0.) {ebY =sqrt(ebY);}
3172 double Ycte_fit = exp(bY);
3173 double eCTEy = TMath::Abs(Ycte_fit)*ebY;
3174 double A0Y = exp(aY)*
NgrY*(1.-Ycte_fit)/(1.-TMath::Power(Ycte_fit,
NgrY));
3175 fprintf (pFile,
" \n CTEY %12.8f +/- %12.8f \n", Ycte_fit, eCTEy );
3176 fprintf (pFile,
" \n NgrY=%i NptY=%i A0y=%f \n",
NgrY, NptX, A0Y );
3177 fprintf (pFile,
" \n CteYin=%f CteCorr=%f CteYnew=%f \n",
CteY, Ycte_fit,
CteY*Ycte_fit);
3185 sprintf(tiname,
"CTE_%i", u);
3186 CTEgr[
u] =
new TCanvas( tiname, tiname, 110+2*u, 80+2*u, 1000, 800);
3187 CTEgr[
u]->SetBorderMode (0);
3192 CTEgr[
u]->SetFrameFillColor(0);
3193 CTEgr[
u]->Divide(2,2);
3195 CTEgr[
u]->SetFillStyle(4100);
3196 CTEgr[
u]->SetFillColor(0);
3197 gStyle->SetPalette(1);
3202 gPad->SetFillColor(0);
3203 gPad->SetBorderSize(2);
3204 Xcte[
u]->GetXaxis()->SetNdivisions(505);
3205 Xcte[
u]->GetXaxis()->CenterTitle();
3206 Xcte[
u]->GetXaxis()->SetTitle(
"Column number");
3207 Xcte[
u]->GetXaxis()->SetLabelSize(0.04);
3208 Xcte[
u]->GetXaxis()->SetTitleSize(0.04);
3209 Xcte[
u]->GetYaxis()->SetNdivisions(505);
3210 Xcte[
u]->GetYaxis()->CenterTitle();
3211 Xcte[
u]->GetYaxis()->SetTitle(
"X-ray signal, a.d.u.");
3212 Xcte[
u]->GetYaxis()->SetLabelSize(0.04);
3213 Xcte[
u]->GetYaxis()->SetTitleSize(0.04);
3214 Xcte[
u]->GetYaxis()->SetTitleOffset(1.4);
3215 Xcte[
u]->Draw(
"colz");
3218 gPad->SetFillColor(0);
3219 gPad->SetBorderSize(2);
3220 TGraph * Xgr =
new TGraphErrors(NptX, xptX, yptX, xerX, yerX);
3221 Xgr->SetTitle(
"serial transfer graph");
3222 Xgr->SetMarkerColor(4);
3223 Xgr->SetMarkerStyle(21);
3224 Xgr->GetXaxis()->SetNdivisions(505);
3225 Xgr->GetXaxis()->CenterTitle();
3226 Xgr->GetXaxis()->SetTitle(
"Column number");
3227 Xgr->GetXaxis()->SetLabelSize(0.04);
3228 Xgr->GetXaxis()->SetTitleSize(0.04);
3229 Xgr->GetYaxis()->SetNdivisions(505);
3230 Xgr->GetYaxis()->CenterTitle();
3231 Xgr->GetYaxis()->SetTitle(
"K_{#alpha} signal, a.d.u.");
3232 Xgr->GetYaxis()->SetLabelSize(0.04);
3233 Xgr->GetYaxis()->SetTitleSize(0.04);
3234 Xgr->GetYaxis()->SetTitleOffset(1.4);
3238 TF1 * fitX =
new TF1(
"fitX",
"exp([0]+[1]*x)", xmin,
XmaxSearch);
3239 fitX->SetParameter(0, aX);
3240 fitX->SetParameter(1, bX);
3241 fitX->SetLineWidth(2);
3247 gPad->SetFillColor(0);
3248 gPad->SetBorderSize(2);
3249 Ycte[
u]->GetXaxis()->SetNdivisions(505);
3250 Ycte[
u]->GetXaxis()->CenterTitle();
3251 Ycte[
u]->GetXaxis()->SetTitle(
"Row number");
3252 Ycte[
u]->GetXaxis()->SetLabelSize(0.04);
3253 Ycte[
u]->GetXaxis()->SetTitleSize(0.04);
3254 Ycte[
u]->GetYaxis()->SetNdivisions(505);
3255 Ycte[
u]->GetYaxis()->CenterTitle();
3256 Ycte[
u]->GetYaxis()->SetTitle(
"X-ray signal, a.d.u.");
3257 Ycte[
u]->GetYaxis()->SetLabelSize(0.04);
3258 Ycte[
u]->GetYaxis()->SetTitleSize(0.04);
3259 Ycte[
u]->GetYaxis()->SetTitleOffset(1.4);
3260 Ycte[
u]->Draw(
"colz");
3263 gPad->SetFillColor(0);
3264 gPad->SetBorderSize(2);
3265 TGraph * Ygr =
new TGraphErrors(NptY, xptY, yptY, xerY, yerY);
3266 Ygr->SetMarkerColor(4);
3267 Ygr->SetMarkerStyle(21);
3268 Ygr->SetTitle(
"parallel transfer graph");
3269 Ygr->GetXaxis()->SetNdivisions(505);
3270 Ygr->GetXaxis()->CenterTitle();
3271 Ygr->GetXaxis()->SetTitle(
"Row number");
3272 Ygr->GetXaxis()->SetLabelSize(0.04);
3273 Ygr->GetXaxis()->SetTitleSize(0.04);
3274 Ygr->GetYaxis()->SetNdivisions(505);
3275 Ygr->GetYaxis()->CenterTitle();
3276 Ygr->GetYaxis()->SetTitle(
"K_{#alpha} signal, a.d.u.");
3277 Ygr->GetYaxis()->SetLabelSize(0.04);
3278 Ygr->GetYaxis()->SetTitleSize(0.04);
3279 Ygr->GetYaxis()->SetTitleOffset(1.4);
3282 TF1 * fitY =
new TF1(
"fitY",
"exp([0]+[1]*x)", xmin,
YmaxSearch);
3283 fitY->SetParameter(0, aY);
3284 fitY->SetParameter(1, bY);
3285 fitY->SetLineWidth(2);
3316 int fitflag = -100.;
3321 TCanvas * Cx =
new TCanvas(
"Xfit",
"Xfit", 145, 5, 1000, 800);
3322 Cx->SetBorderMode (0);
3327 Cx->SetFrameFillColor(0);
3330 Cx->SetFillStyle(4100);
3331 Cx->SetFillColor(0);
3333 for (
int u=0;
u <16 ;
u++){
3335 if (
hXf[u][4]->GetEntries() > 1 ) {
3339 gPad->SetFillColor(0);
3340 gPad->SetBorderSize(0);
3341 hXf[
u][4]->SetStats(0);
3342 hXf[
u][4]->SetTitle(
"");
3347 hXf[
u][4]->GetXaxis()->SetTitle(
"#sigma, #mum");
3348 hXf[
u][4]->GetXaxis()->SetLabelSize(0.05);
3349 hXf[
u][4]->GetXaxis()->SetTitleSize(0.05);
3350 hXf[
u][4]->GetYaxis()->SetNdivisions(505);
3351 hXf[
u][4]->GetYaxis()->SetTitle(
"Number of clusters");
3352 hXf[
u][4]->GetYaxis()->SetLabelSize(0.05);
3353 hXf[
u][4]->GetYaxis()->SetTitleSize(0.05);
3354 hXf[
u][4]->GetYaxis()->SetTitleOffset(1.3);
3368 gPad->SetFillColor(0);
3369 gPad->SetBorderSize(0);
3376 hSig->GetXaxis()->SetTitle(
"#sigma, #mum");
3377 hSig->GetXaxis()->SetLabelSize(0.05);
3378 hSig->GetXaxis()->SetTitleSize(0.05);
3379 hSig->GetYaxis()->SetNdivisions(505);
3380 hSig->GetYaxis()->SetTitle(
"Number of clusters");
3381 hSig->GetYaxis()->SetLabelSize(0.05);
3382 hSig->GetYaxis()->SetTitleSize(0.05);
3383 hSig->GetYaxis()->SetTitleOffset(1.3);
3388 Cx->Print(
"Xfit_all.pdf");
3392 TCanvas * Cfit[
MaxP]={0};
3395 sprintf(tiname,
"Fit %i",
u);
3396 if (
u >
MaxP )
break;
3397 sprintf(tiname,
"Xfit_%i",
u);
3400 Cfit[
u] =
new TCanvas( tiname, tiname, 50+2*
u, 10+2*
u, 900, 800);
3401 Cfit[
u]->SetBorderMode (0);
3406 Cfit[
u]->SetFrameFillColor(0);
3407 Cfit[
u]->Divide(2,3);
3410 Cfit[
u]->SetFillStyle(4100);
3411 Cfit[
u]->SetFillColor(0);
3412 gStyle->SetOptFit();
3415 gPad->SetFillColor(0);
3416 gPad->SetBorderSize(2);
3437 if (
hXf[
u][6]->GetEntries() > 1 ) {
3439 hXf[
u][6]->SetStats(0);
3440 hXf[
u][6]->SetTitle(
"");
3444 hXf[
u][6]->GetXaxis()->SetNdivisions(505);
3445 hXf[
u][6]->GetXaxis()->SetTitle(
"#chi^{2}R");
3446 hXf[
u][6]->GetXaxis()->SetLabelSize(0.05);
3447 hXf[
u][6]->GetXaxis()->SetTitleSize(0.05);
3448 hXf[
u][6]->GetYaxis()->SetNdivisions(505);
3449 hXf[
u][6]->GetYaxis()->SetTitle(
"Number of clusters");
3450 hXf[
u][6]->GetYaxis()->SetLabelSize(0.05);
3451 hXf[
u][6]->GetYaxis()->SetTitleSize(0.05);
3452 hXf[
u][6]->GetYaxis()->SetTitleOffset(1.3);
3458 gPad->SetFillColor(0);
3459 gPad->SetBorderSize(2);
3460 if (
hXf[
u][1]->GetEntries() > 1 ) {
3462 hXf[
u][1]->SetStats(0);
3463 hXf[
u][1]->SetTitle(
"");
3467 hXf[
u][1]->GetXaxis()->SetNdivisions(505);
3468 hXf[
u][1]->GetXaxis()->SetTitle(
"Fitted cluster amplitude, a.d.u.");
3469 hXf[
u][1]->GetXaxis()->SetLabelSize(0.05);
3470 hXf[
u][1]->GetXaxis()->SetTitleSize(0.05);
3471 hXf[
u][1]->GetYaxis()->SetNdivisions(505);
3472 hXf[
u][1]->GetYaxis()->SetTitle(
"Number of clusters");
3473 hXf[
u][1]->GetYaxis()->SetLabelSize(0.05);
3474 hXf[
u][1]->GetYaxis()->SetTitleSize(0.05);
3475 hXf[
u][1]->GetYaxis()->SetTitleOffset(1.3);
3483 if ( maxpos > 0.000001) iGain =
Co::NeKa/maxpos;
3484 double par2 =
ANoise[
u]*iGain;
3485 cout <<
" maxpos=" << maxpos <<
" Rmin=" << Rmin <<
" Rmax" << Rmax << endl;
3486 cout <<
" gain estimate =" << iGain <<
" e-/adu" << endl;
3487 cout <<
" noise =" << par2 <<
" e-" << endl;
3490 Rmax = pKb + (Rmax - maxpos);
3491 cout <<
" new Rmax= " << Rmax << endl;
3496 const char * fitname =
"fitGG";
3503 double maxval =
hXf[
u][1]->GetEntries();
3504 if (maxval < 1.)
continue;
3505 double sw =
hXf[
u][1]->GetSumOfWeights();
3506 double bw =
hXf[
u][1]->GetBinWidth(1);
3507 printf(
"\n Fit of %s \n",
hXf[u][0]->GetTitle());
3508 printf(
" hXf%i[0]: Sum of weights = %f Entries = %f BinW = %f\n",
3510 double par0 = maxval*0.75*bw;
3511 double par3 = maxval*0.25*bw;
3512 fit->SetParameter(0, par0);
3513 fit->SetParameter(1, maxpos);
3514 fit->SetParameter(2, par2);
3515 fit->SetParameter(3, par3);
3516 cout <<
" par0=" << par0 << endl;
3517 cout <<
" par1=" << maxpos <<
" par2=" << par2 << endl;
3518 cout <<
" par3=" << par3 << endl;
3519 cout <<
"fitname=" << fitname << endl;
3521 fitflag =
hXf[
u][1]->Fit(fitname,
"LR");
3522 cout <<
" FitFlag=" << fitflag << endl;
3534 gPad->SetFillColor(0);
3535 gPad->SetBorderSize(2);
3536 if (
hXf[
u][2]->GetEntries() > 1 ) {
3538 hXf[
u][2]->SetStats(0);
3539 hXf[
u][2]->SetTitle(
"");
3543 hXf[
u][2]->GetXaxis()->SetTitle(
"X coordinate, sub pixel");
3544 hXf[
u][2]->GetXaxis()->SetLabelSize(0.05);
3545 hXf[
u][2]->GetXaxis()->SetTitleSize(0.05);
3546 hXf[
u][2]->GetYaxis()->SetNdivisions(505);
3547 hXf[
u][2]->GetYaxis()->SetTitle(
"Number of clusters");
3548 hXf[
u][2]->GetYaxis()->SetLabelSize(0.05);
3549 hXf[
u][2]->GetYaxis()->SetTitleSize(0.05);
3550 hXf[
u][2]->GetYaxis()->SetTitleOffset(1.3);
3556 gPad->SetFillColor(0);
3557 gPad->SetBorderSize(2);
3558 if (
hXf[
u][3]->GetEntries() > 1 ) {
3560 hXf[
u][3]->SetStats(0);
3561 hXf[
u][3]->SetTitle(
"");
3565 hXf[
u][3]->GetXaxis()->SetTitle(
"Y coordinate, sub pixel");
3566 hXf[
u][3]->GetXaxis()->SetLabelSize(0.05);
3567 hXf[
u][3]->GetXaxis()->SetTitleSize(0.05);
3568 hXf[
u][3]->GetYaxis()->SetNdivisions(505);
3569 hXf[
u][3]->GetYaxis()->SetTitle(
"Number of clusters");
3570 hXf[
u][3]->GetYaxis()->SetLabelSize(0.05);
3571 hXf[
u][3]->GetYaxis()->SetTitleSize(0.05);
3572 hXf[
u][3]->GetYaxis()->SetTitleOffset(1.3);
3578 gPad->SetFillColor(0);
3579 gPad->SetBorderSize(2);
3580 if (
hXf[
u][4]->GetEntries() > 1 ) {
3582 hXf[
u][4]->SetStats(0);
3583 hXf[
u][4]->SetTitle(
"");
3587 hXf[
u][4]->GetXaxis()->SetTitle(
"#sigma, #mum");
3588 hXf[
u][4]->GetXaxis()->SetLabelSize(0.05);
3589 hXf[
u][4]->GetXaxis()->SetTitleSize(0.05);
3590 hXf[
u][4]->GetYaxis()->SetNdivisions(505);
3591 hXf[
u][4]->GetYaxis()->SetTitle(
"Number of clusters");
3592 hXf[
u][4]->GetYaxis()->SetLabelSize(0.05);
3593 hXf[
u][4]->GetYaxis()->SetTitleSize(0.05);
3594 hXf[
u][4]->GetYaxis()->SetTitleOffset(1.3);
3600 if (
hXf[
u][5]->GetEntries() > 1 ) {
3602 hXf[
u][5]->SetStats(0);
3603 hXf[
u][5]->SetTitle(
"");
3607 hXf[
u][5]->GetXaxis()->SetTitle(
"#sigma error, #mum");
3608 hXf[
u][5]->GetXaxis()->SetLabelSize(0.05);
3609 hXf[
u][5]->GetXaxis()->SetTitleSize(0.05);
3610 hXf[
u][5]->GetYaxis()->SetNdivisions(505);
3611 hXf[
u][5]->GetYaxis()->SetTitle(
"Number of clusters");
3612 hXf[
u][5]->GetYaxis()->SetLabelSize(0.05);
3613 hXf[
u][5]->GetYaxis()->SetTitleSize(0.05);
3614 hXf[
u][5]->GetYaxis()->SetTitleOffset(1.3);
3630 TCanvas * CteXc =
new TCanvas(
"CteXc",
"CteXc", 150, 150, 800, 800);
3631 CteXc->SetBorderMode (0);
3636 CteXc->SetFrameFillColor(0);
3639 gStyle->SetPalette(1);
3640 CteXc->SetFillStyle(4100);
3641 CteXc->SetFillColor(0);
3644 if (
u >
MaxP )
break;
3648 gPad->SetFillColor(0);
3649 gPad->SetBorderSize(2);
3650 Xcte[
u]->Draw(
"colz");
3653 CteXc->Print(
"Fe55_CteXc.pdf");
3656 TCanvas * CteYc =
new TCanvas(
"CteYc",
"CteYc", 200, 200, 900, 900);
3657 CteYc->SetBorderMode (0);
3662 CteYc->SetFrameFillColor(0);
3665 gStyle->SetPalette(1);
3666 CteYc->SetFillStyle(4100);
3667 CteYc->SetFillColor(0);
3670 if (
u >
MaxP )
break;
3674 gPad->SetFillColor(0);
3675 gPad->SetBorderSize(2);
3676 Ycte[
u]->Draw(
"colz");
3680 CteYc->Print(
"Fe55_CteYc.pdf");
3683 TCanvas * CQ =
new TCanvas(
"CQ",
"CQ", 210, 210, 900, 900);
3684 CQ->SetBorderMode (0);
3689 CQ->SetFrameFillColor(0);
3692 gStyle->SetPalette(1);
3693 CQ->SetFillStyle(4100);
3694 CQ->SetFillColor(0);
3697 if (
u >
MaxP )
break;
3701 gPad->SetFillColor(0);
3702 gPad->SetBorderSize(2);
3707 CQ->Print(
"Fe55_Q.pdf");
3714 printf(
"In PlotProfiles\n");
3715 TCanvas * Prof[
MaxP]={0};
3721 sprintf(tiname,
"Profile_%i",
u);
3722 if (
u >
MaxP )
break;
3725 Prof[
u] =
new TCanvas( tiname, tiname, 150+5*
u, 150+5*
u, 1000, 800);
3726 Prof[
u]->SetBorderMode (0);
3731 Prof[
u]->SetFrameFillColor(0);
3734 Prof[
u]->SetFillStyle(4100);
3735 Prof[
u]->SetFillColor(0);
3739 Prof[
u]->cd(
y*Co::NXpix+
x+1);
3745 sprintf(tiname,
"Profile_%i.pdf",
u);
3746 Prof[
u]->Print(tiname);
3757 TCanvas * cHits =
new TCanvas(
"Hits",
"Hits", 400,20,800,750);
3758 cHits->SetBorderMode (0);
3763 cHits->SetFrameFillColor(0);
3764 cHits->Divide(1,
Nchan);
3766 cHits->SetFillStyle(4100);
3767 cHits->SetFillColor(0);
3770 if (
u >
MaxP )
break;
3772 if (
hitSumA[
u]->GetEntries() > 1 ) {
3778 cHits->Print(
"Hits.pdf");
3783 const char * outName )
3786 gDirectory->GetList()->Delete();
3793 string dir_name = dir;
3798 string bias_dir = dir_name;
3799 bias_dir +=
"/bias";
3823 Fe55 Fe( dir_name, outName, 0, 0, doFFt );
3825 if (Fe.
Flag != 0)
return -1;
3838 unsigned int VNpnt =
Vval[0].size();
3840 if ( !VNpnt )
return 0;
3842 const float left_margin = (float)0.01;
3843 const float right_margin = (float)0.001;
3844 const float top_margin = (float)0.00;
3845 const float bot_margin = (float)0.00;
3848 TCanvas * CT =
new TCanvas(
"CT",
"Bias", 100, 70, 900, 800);
3849 CT->SetBorderMode (0);
3850 CT->SetLeftMargin (left_margin);
3851 CT->SetRightMargin (right_margin);
3852 CT->SetTopMargin (top_margin);
3853 CT->SetBottomMargin(bot_margin);
3854 CT->SetFrameFillColor(0);
3858 gPad->SetFillStyle(4100);
3859 gPad->SetFillColor(0);
3863 VVpnt =
Vval[2].size();
3864 printf(
" Vector's Vpoints =%i *** \n", VVpnt);
3865 if ( !VVpnt )
continue;
3866 TGraph * pGe =
new TGraph( VNpnt, &
Vval[0][0], &
Vval[2][0]);
3867 pGe->SetTitle(
"exposure");
3868 pGe->GetXaxis()->SetTimeDisplay(1);
3869 pGe->GetXaxis()->SetLabelOffset((
float)0.02);
3870 pGe->GetXaxis()->SetTimeFormat(
"#splitline{%Y-%m-%d}{%H:%M}");
3871 pGe->SetMarkerColor (4);
3872 pGe->SetMarkerStyle (8);
3873 pGe->SetMarkerSize (1);
3874 pGe->SetLineColor (4);
3875 pGe->SetLineWidth (2);
3881 VVpnt =
Vval[3].size();
3882 printf(
" Vector's Vpoints =%i *** \n", VVpnt);
3883 if ( !VVpnt )
continue;
3884 TGraph * pGv =
new TGraph( VNpnt, &
Vval[0][0], &
Vval[3][0]);
3885 pGv->SetTitle(
"Bias");
3886 pGv->GetXaxis()->SetTimeDisplay(1);
3887 pGv->GetXaxis()->SetLabelOffset((
float)0.02);
3888 pGv->GetXaxis()->SetTimeFormat(
"#splitline{%Y-%m-%d}{%H:%M}");
3889 pGv->SetMarkerColor (4);
3890 pGv->SetMarkerStyle (8);
3891 pGv->SetMarkerSize (1);
3892 pGv->SetLineColor (4);
3893 pGv->SetLineWidth (2);
3899 VVpnt =
Vval[4].size();
3900 printf(
" Vector's Vpoints =%i *** \n", VVpnt);
3901 if ( !VVpnt )
continue;
3902 TGraph * pGa =
new TGraph( VNpnt, &
Vval[0][0], &
Vval[4][0]);
3903 pGa->SetTitle(
"Bias current, pA");
3904 pGa->GetXaxis()->SetTimeDisplay(1);
3905 pGa->GetXaxis()->SetLabelOffset((
float)0.02);
3906 pGa->GetXaxis()->SetTimeFormat(
"#splitline{%Y-%m-%d}{%H:%M}");
3907 pGa->SetMarkerColor (6);
3908 pGa->SetMarkerStyle (8);
3909 pGa->SetMarkerSize (1);
3910 pGa->SetLineColor (6);
3911 pGa->SetLineWidth (2);
3917 CT->Print(
"CT_main.pdf");
3920 TCanvas * C2 =
new TCanvas(
"C2",
"Temperature", 150, 100, 900, 800);
3921 C2->SetBorderMode (0);
3922 C2->SetLeftMargin (left_margin);
3923 C2->SetRightMargin (right_margin);
3924 C2->SetTopMargin (top_margin);
3925 C2->SetBottomMargin(bot_margin);
3926 C2->SetFrameFillColor(0);
3929 gPad->SetFillStyle(4100);
3930 gPad->SetFillColor(0);
3934 VVpnt =
Vval[5].size();
3935 printf(
" Vector's Vpoints =%i *** \n", VVpnt);
3936 if ( !VVpnt )
continue;
3937 TGraph * pGTA =
new TGraph( VNpnt, &
Vval[0][0], &
Vval[5][0]);
3938 pGTA->SetTitle(
"A");
3939 pGTA->GetXaxis()->SetTimeDisplay(1);
3940 pGTA->GetXaxis()->SetLabelOffset((
float)0.02);
3941 pGTA->GetXaxis()->SetTimeFormat(
"#splitline{%Y-%m-%d}{%H:%M}");
3942 pGTA->SetMarkerColor (4);
3943 pGTA->SetMarkerStyle (8);
3944 pGTA->SetMarkerSize (1);
3945 pGTA->SetLineColor (4);
3946 pGTA->SetLineWidth (2);
3952 VVpnt =
Vval[6].size();
3953 printf(
" Vector's Vpoints =%i *** \n", VVpnt);
3954 if ( !VVpnt )
continue;
3955 TGraph * pGTB =
new TGraph( VNpnt, &
Vval[0][0], &
Vval[6][0]);
3956 pGTB->SetTitle(
"B");
3957 pGTB->GetXaxis()->SetTimeDisplay(1);
3958 pGTB->GetXaxis()->SetLabelOffset((
float)0.02);
3959 pGTB->GetXaxis()->SetTimeFormat(
"#splitline{%Y-%m-%d}{%H:%M}");
3960 pGTB->SetMarkerColor (8);
3961 pGTB->SetMarkerStyle (8);
3962 pGTB->SetMarkerSize (1);
3963 pGTB->SetLineColor (8);
3964 pGTB->SetLineWidth (2);
3970 VVpnt =
Vval[7].size();
3971 printf(
" Vector's Vpoints =%i *** \n", VVpnt);
3972 if ( !VVpnt )
continue;
3973 TGraph * pGTC =
new TGraph( VNpnt, &
Vval[0][0], &
Vval[7][0]);
3974 pGTC->SetTitle(
"C");
3975 pGTC->GetXaxis()->SetTimeDisplay(1);
3976 pGTC->GetXaxis()->SetLabelOffset((
float)0.02);
3977 pGTC->GetXaxis()->SetTimeFormat(
"#splitline{%Y-%m-%d}{%H:%M}");
3978 pGTC->SetMarkerColor (4);
3979 pGTC->SetMarkerStyle (8);
3980 pGTC->SetMarkerSize (1);
3981 pGTC->SetLineColor (4);
3982 pGTC->SetLineWidth (2);
3988 VVpnt =
Vval[8].size();
3989 printf(
" Vector's Vpoints =%i *** \n", VVpnt);
3990 if ( !VVpnt )
continue;
3991 TGraph * pGTD =
new TGraph( VNpnt, &
Vval[0][0], &
Vval[8][0]);
3992 pGTD->SetTitle(
"D");
3993 pGTD->GetXaxis()->SetTimeDisplay(1);
3994 pGTD->GetXaxis()->SetLabelOffset((
float)0.02);
3995 pGTD->GetXaxis()->SetTimeFormat(
"#splitline{%Y-%m-%d}{%H:%M}");
3996 pGTD->SetMarkerColor (14);
3997 pGTD->SetMarkerStyle (8);
3998 pGTD->SetMarkerSize (1);
3999 pGTD->SetLineColor (14);
4000 pGTD->SetLineWidth (2);
4006 C2->Print(
"C2_main.pdf");