mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 12:57:13 +02:00
cluster finder for phoenix data (i.e. old raw data format)
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
CBFLIBDIR= /afs/psi.ch/project/sls_det_software/CBFlib-0.9.5/
|
CBFLIBDIR= /afs/psi.ch/project/sls_det_software/CBFlib-0.9.5/
|
||||||
#ZMQLIB=../slsReceiverSoftware/include
|
#ZMQLIB=../slsReceiverSoftware/include
|
||||||
LIBRARYCBF=$(CBFLIBDIR)/lib/*.o
|
LIBRARYCBF=$(CBFLIBDIR)/lib/*.o
|
||||||
INCDIR=-IslsDetectorCalibration -I. -IetaVEL -I../slsReceiverSoftware/include -I$(CBFLIBDIR)/include/
|
INCDIR=-I.. -I. -I../interpolations -I../interpolations/etaVEL -I../../slsReceiverSoftware/include -I$(CBFLIBDIR)/include/ ../tiffIO.cpp -I../dataStructures
|
||||||
#LIBHDF5=
|
#LIBHDF5=
|
||||||
LDFLAG= -L/usr/lib64/ -lpthread -lm -lstdc++ -L. -pthread -lrt -L$(CBFLIBDIR)/lib/ -ltiff -lhdf5
|
LDFLAG= -L/usr/lib64/ -lpthread -lm -lstdc++ -L. -pthread -lrt -L$(CBFLIBDIR)/lib/ -ltiff -lhdf5
|
||||||
#-L$(ZMQLIB) -lzmq
|
#-L$(ZMQLIB) -lzmq
|
||||||
@ -17,14 +17,8 @@ all: moenchClusterFinderPhoenix
|
|||||||
|
|
||||||
|
|
||||||
moenchClusterFinderPhoenix: $(MAIN) $(INCS) clean
|
moenchClusterFinderPhoenix: $(MAIN) $(INCS) clean
|
||||||
g++ -o moenchClusterFinderPhoenix $(MAIN) $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) tiffIO.cpp -DSAVE_ALL
|
g++ -o moenchClusterFinderPhoenix $(MAIN) $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF)
|
||||||
|
|
||||||
moenchMakeEtaPhoenix: moench03MakeEtaPhoenix.cpp $(INCS) clean
|
|
||||||
g++ -o moenchMakeEta moench03MakeEta.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) tiffIO.cpp -DSAVE_ALL
|
|
||||||
|
|
||||||
moenchInterpolationPhoenix: moench03InterpolationPhoenix.cpp $(INCS) clean
|
|
||||||
g++ -o moenchInterpolation moench03Interpolation.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) tiffIO.cpp -DSAVE_ALL
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f moenchClusterFinderPhoenix moenchMakeEtaPhoenix moenchInterpolationPhoenix
|
rm -f moenchClusterFinderPhoenix
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ int main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
int p=10000;
|
int p=10000;
|
||||||
int fifosize=1000;
|
int fifosize=1000;
|
||||||
int nthreads=20;
|
int nthreads=1;
|
||||||
int nsubpix=25;
|
int nsubpix=25;
|
||||||
int etabins=nsubpix*10;
|
int etabins=nsubpix*10;
|
||||||
double etamin=-1, etamax=2;
|
double etamin=-1, etamax=2;
|
||||||
@ -48,7 +48,7 @@ int main(int argc, char *argv[]) {
|
|||||||
cout << "decoder" << endl;
|
cout << "decoder" << endl;
|
||||||
//moench03T1ReceiverData *decoder=new moench03T1ReceiverData();
|
//moench03T1ReceiverData *decoder=new moench03T1ReceiverData();
|
||||||
//moench03T1ZmqData *decoder=new moench03T1ZmqData();
|
//moench03T1ZmqData *decoder=new moench03T1ZmqData();
|
||||||
singlePhotonDetector *filter=new singlePhotonDetector(decoder,csize, nsigma, 1, 0, nped, 200);
|
singlePhotonDetector *filter=new singlePhotonDetector(decoder,csize, nsigma, 1, 0, nped, 100);
|
||||||
// char tit[10000];
|
// char tit[10000];
|
||||||
cout << "filter" << endl;
|
cout << "filter" << endl;
|
||||||
|
|
||||||
@ -117,21 +117,21 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
// mt->setFrameMode(eFrame); //need to find a way to switch between flat and frames!
|
// mt->setFrameMode(eFrame); //need to find a way to switch between flat and frames!
|
||||||
// mt->prepareInterpolation(ok);
|
// mt->prepareInterpolation(ok);
|
||||||
mt->setFrameMode(eFrame);
|
mt->setFrameMode(eFrame);
|
||||||
mt->StartThreads();
|
mt->StartThreads();
|
||||||
mt->popFree(buff);
|
mt->popFree(buff);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int ifr=0;
|
int ifr=0;
|
||||||
// //loop on files
|
// //loop on files
|
||||||
// mt->setFrameMode(eFrame);
|
// mt->setFrameMode(eFrame);
|
||||||
//mt->setFrameMode(eFlat);
|
//mt->setFrameMode(eFlat);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (int irun=runmin; irun<runmax; irun++) {
|
for (int irun=runmin; irun<runmax; irun++) {
|
||||||
sprintf(fn,fformat,irun);
|
sprintf(fn,fformat,irun);
|
||||||
sprintf(fname,"%s/%s.raw",indir,fn);
|
sprintf(fname,"%s/%s.raw",indir,fn);
|
||||||
@ -155,8 +155,8 @@ int main(int argc, char *argv[]) {
|
|||||||
// //while read frame
|
// //while read frame
|
||||||
ff=-1;
|
ff=-1;
|
||||||
while (decoder->readNextFrame(filebin, ff, np,buff)) {
|
while (decoder->readNextFrame(filebin, ff, np,buff)) {
|
||||||
// cout << "*"<<ifr++<<"*"<<ff<< endl;
|
//cout << "*"<<ifr++<<"*"<<ff<< endl;
|
||||||
// cout << ff << " " << np << endl;
|
//cout << ff << " " << np << endl;
|
||||||
// //push
|
// //push
|
||||||
mt->pushData(buff);
|
mt->pushData(buff);
|
||||||
// // //pop
|
// // //pop
|
||||||
@ -164,7 +164,7 @@ int main(int argc, char *argv[]) {
|
|||||||
// // // cout << " " << (void*)buff;
|
// // // cout << " " << (void*)buff;
|
||||||
mt->popFree(buff);
|
mt->popFree(buff);
|
||||||
|
|
||||||
ff=-1;
|
ff=-1;
|
||||||
}
|
}
|
||||||
// cout << "--" << endl;
|
// cout << "--" << endl;
|
||||||
filebin.close();
|
filebin.close();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "single_photon_hit.h"
|
#include "../single_photon_hit.h"
|
||||||
//#include "etaVEL/etaInterpolationPosXY.h"
|
//#include "etaVEL/etaInterpolationPosXY.h"
|
||||||
|
|
||||||
TH2F *readClusters(char *fname, int nx, int ny, TH2F *h2=NULL) {
|
TH2F *readClusters(char *fname, int nx, int ny, TH2F *h2=NULL) {
|
||||||
@ -11,83 +11,126 @@ TH2F *readClusters(char *fname, int nx, int ny, TH2F *h2=NULL) {
|
|||||||
int x1,y1;
|
int x1,y1;
|
||||||
if (h2==NULL)
|
if (h2==NULL)
|
||||||
h2=new TH2F("h2",fname,nx, -0.5, nx-0.5, ny, -0.5, ny-0.5);
|
h2=new TH2F("h2",fname,nx, -0.5, nx-0.5, ny, -0.5, ny-0.5);
|
||||||
h2mult=new TH2F("h2mult",fname,nx, -0.5, nx-0.5, ny, -0.5, ny-0.5);
|
//h2mult=new TH2F("h2mult",fname,nx, -0.5, nx-0.5, ny, -0.5, ny-0.5);
|
||||||
TH2F *hint=new TH2F("hint",fname,nx*ns, -0.5, nx-0.5, ny*ns, -0.5, ny-0.5);
|
// TH2F *hint=new TH2F("hint",fname,nx*ns, -0.5, nx-0.5, ny*ns, -0.5, ny-0.5);
|
||||||
TH2F *hff=new TH2F("hff","hff",ns, -0.5, 0.5, ns, -0.5, +0.5);
|
TH1F *hf=new TH1F("hf","hf",1000,0,30000);
|
||||||
TH1F *hsp=new TH1F("hsp",fname,500,0,2000);
|
//TH2F *hff=new TH2F("hff","hff",ns, -0.5, 0.5, ns, -0.5, +0.5);
|
||||||
|
TH1F *hsp=new TH1F("hsp",fname,500,0,2000);
|
||||||
|
TH1F *hsp1=new TH1F("hsp1",fname,500,0,2000);
|
||||||
|
TH1F *hsp2=new TH1F("hsp2",fname,500,0,2000);
|
||||||
|
TH1F *hsp3=new TH1F("hsp3",fname,500,0,2000);
|
||||||
|
hsp1->SetLineColor(2);
|
||||||
|
hsp2->SetLineColor(3);
|
||||||
|
hsp3->SetLineColor(4);
|
||||||
TCanvas *c=new TCanvas();
|
TCanvas *c=new TCanvas();
|
||||||
c->SetLogz(kTRUE);
|
c->SetLogz(kTRUE);
|
||||||
h2->Draw("colz");
|
h2->Draw("colz");
|
||||||
TCanvas *c1=new TCanvas();
|
TCanvas *c1=new TCanvas();
|
||||||
hsp->Draw();
|
hsp->Draw();
|
||||||
|
hsp1->Draw("same");
|
||||||
|
hsp2->Draw("same");
|
||||||
|
hsp3->Draw("same");
|
||||||
TCanvas *c2=new TCanvas();
|
TCanvas *c2=new TCanvas();
|
||||||
hint->Draw("colz");
|
hf->Draw();
|
||||||
c2->SetLogz(kTRUE);
|
// hint->Draw("colz");
|
||||||
|
//c2->SetLogz(kTRUE);
|
||||||
single_photon_hit cl(3,3);
|
single_photon_hit cl(3,3);
|
||||||
double tot;
|
double tot;
|
||||||
int w;
|
int w;
|
||||||
double phw=340, phs=62;
|
double phw=340, phs=62;
|
||||||
|
int f0=-1;
|
||||||
|
double tl, bl, tr, br, qt;
|
||||||
while (cl.read(f)) {
|
while (cl.read(f)) {
|
||||||
//cl.get_pixel(x1, y1);
|
//cl.get_pixel(x1, y1);
|
||||||
//cout << cl.iframe << " " << cl.x << " " << cl.y << endl;
|
//cout << cl.iframe << " " << cl.x << " " << cl.y << endl;
|
||||||
//if (cl.x>80 && cl.x<280 && cl.y>80 && cl.y<300) {
|
//if (cl.x>80 && cl.x<280 && cl.y>80 && cl.y<300) {
|
||||||
tot=0;
|
tot=0; /*
|
||||||
left=0;
|
left=0;
|
||||||
right=0;
|
right=0;
|
||||||
top=0;
|
top=0;
|
||||||
bottom=0;
|
bottom=0;*/
|
||||||
|
tl=0; tr=0; bl=0; br=0;
|
||||||
for (int ix=-1; ix<2; ix++)
|
for (int ix=-1; ix<2; ix++)
|
||||||
for (int iy=-1; iy<2; iy++){
|
for (int iy=-1; iy<2; iy++){
|
||||||
tot+=cl.get_data(ix,iy);
|
tot+=cl.get_data(ix,iy);
|
||||||
if (ix<0) left+=cl.get_data(ix,iy);
|
if (ix<=0 && iy<=0) bl+=cl.get_data(ix,iy);
|
||||||
if (ix>0) right+=cl.get_data(ix,iy);
|
if (ix<=0 && iy>=0) tl+=cl.get_data(ix,iy);
|
||||||
if (iy<0) bottom+=cl.get_data(ix,iy);
|
if (ix>=0 && iy<=0) br+=cl.get_data(ix,iy);
|
||||||
if (iy>0) top+=cl.get_data(ix,iy);
|
if (ix>=0 && iy>=0) tr+=cl.get_data(ix,iy);
|
||||||
|
|
||||||
|
//if (ix<0) left+=cl.get_data(ix,iy);
|
||||||
|
// if (ix>0) right+=cl.get_data(ix,iy);
|
||||||
|
// if (iy<0) bottom+=cl.get_data(ix,iy);
|
||||||
|
// if (iy>0) top+=cl.get_data(ix,iy);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qt=bl;
|
||||||
|
if (br>qt) qt=br;
|
||||||
|
if (tl>qt) qt=tl;
|
||||||
|
if (tr>qt) qt=tr;
|
||||||
|
/*
|
||||||
px=(-left+right)/tot;
|
px=(-left+right)/tot;
|
||||||
py=(-bottom+top)/tot;
|
py=(-bottom+top)/tot;*/
|
||||||
//max at 340
|
//max at 340
|
||||||
if (tot>200) {
|
//if (tot>200) {
|
||||||
w=(tot+3.5*phs)/phw;
|
w=1;
|
||||||
} else
|
if (f0<0)
|
||||||
w=0;
|
f0=cl.iframe;
|
||||||
if (w) {
|
hf->Fill(cl.iframe-f0);
|
||||||
hsp->Fill(tot);
|
//(tot+3.5*phs)/phw;
|
||||||
if (w==1) {
|
//} else
|
||||||
h2->Fill(cl.x,cl.y,w);
|
//w=0;
|
||||||
hint->Fill(px+cl.x,py+cl.y,w);
|
// if (w) {
|
||||||
if (cl.y<350)
|
// if (qt/tot>0.8 && qt/tot<1.2){
|
||||||
hff->Fill(px,py,w);
|
if (cl.y<350) {
|
||||||
}
|
if (cl.y<100 || cl.y>300) {
|
||||||
|
hsp->Fill(qt);
|
||||||
|
hsp2->Fill(cl.get_data(0,0));
|
||||||
|
} else {
|
||||||
|
hsp1->Fill(qt);
|
||||||
|
hsp3->Fill(cl.get_data(0,0));
|
||||||
|
}
|
||||||
|
//if (cl.x>160 && cl.x<260 && cl.y>30 && cl.y<80 && tot>0)
|
||||||
|
//if (w==1) {
|
||||||
|
h2->Fill(cl.x,cl.y,w);
|
||||||
|
}
|
||||||
|
//}
|
||||||
|
// hint->Fill(px+cl.x,py+cl.y,w);
|
||||||
|
// if (cl.y<350)
|
||||||
|
// hff->Fill(px,py,w);
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
h2mult->Fill(cl.x,cl.y,w);
|
//h2mult->Fill(cl.x,cl.y,w);
|
||||||
|
|
||||||
//}
|
//}
|
||||||
iph+=w;
|
iph+=w;
|
||||||
if (iph%100000==0) {
|
if (iph%100000==0) {
|
||||||
// c->Modified();
|
c->Modified();
|
||||||
// c->Update();
|
c->Update();
|
||||||
c1->Modified();;
|
c1->Modified();;
|
||||||
c1->Update();
|
c1->Update();
|
||||||
// c2->Modified();;
|
c2->Modified();;
|
||||||
// c2->Update();
|
c2->Update();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// if (iph>0.5E7) break;
|
//}
|
||||||
|
// if (iph>0.5E7) break;
|
||||||
|
|
||||||
}
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
hff->Scale(hff->GetNbinsX()*hff->GetNbinsY()/hff->Integral());
|
// hff->Scale(hff->GetNbinsX()*hff->GetNbinsY()/hff->Integral());
|
||||||
TH2F *hint2=(TH2F*)hint->Clone("hint2");
|
// TH2F *hint2=(TH2F*)hint->Clone("hint2");
|
||||||
double ff;
|
// double ff;
|
||||||
for (int ibx=0; ibx<hint->GetNbinsX(); ibx++) {
|
// for (int ibx=0; ibx<hint->GetNbinsX(); ibx++) {
|
||||||
for (int iby=0; iby<hint->GetNbinsY(); iby++) {
|
// for (int iby=0; iby<hint->GetNbinsY(); iby++) {
|
||||||
ff=hff->GetBinContent(ibx%ns+1, iby%ns+1);
|
// ff=hff->GetBinContent(ibx%ns+1, iby%ns+1);
|
||||||
// cout << ibx << " " << iby << " " << ibx%ns << " " << iby%ns << " " << ff << endl;
|
// // cout << ibx << " " << iby << " " << ibx%ns << " " << iby%ns << " " << ff << endl;
|
||||||
if (ff>0)
|
// if (ff>0)
|
||||||
hint2->SetBinContent(ibx+1, iby+1,hint->GetBinContent(ibx+1,iby+1)/ff);
|
// hint2->SetBinContent(ibx+1, iby+1,hint->GetBinContent(ibx+1,iby+1)/ff);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user