mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-26 00:00:02 +02:00
eiger mapping of top
This commit is contained in:
commit
6b38ad10d1
@ -132,6 +132,57 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Returns the value of the selected channel for the given dataset. Virtual function, can be overloaded.
|
||||||
|
\param data pointer to the dataset (including headers etc)
|
||||||
|
\param ix pixel number in the x direction
|
||||||
|
\param iy pixel number in the y direction
|
||||||
|
\param dr dynamic range
|
||||||
|
\returns data for the selected channel, with inversion if required
|
||||||
|
|
||||||
|
*/
|
||||||
|
virtual dataType getChannel(char *data, int ix, int iy=0, int dr=0) {
|
||||||
|
dataType m=0, d=0;
|
||||||
|
uint64_t t;
|
||||||
|
int numBytes,divFactor,newix,pixelval;
|
||||||
|
|
||||||
|
|
||||||
|
if (ix>=0 && ix<nx && iy>=0 && iy<ny && dataMap[iy][ix]>=0 && dataMap[iy][ix]<dataSize) {
|
||||||
|
m=dataMask[iy][ix];
|
||||||
|
|
||||||
|
numBytes = (nx * iy + ix);
|
||||||
|
divFactor=2;
|
||||||
|
if(dr == 4) divFactor = 16;
|
||||||
|
else if (dr == 8) divFactor = 8;
|
||||||
|
else if (dr == 16) divFactor = 4;
|
||||||
|
|
||||||
|
pixelval = numBytes % divFactor;
|
||||||
|
newix = ix - pixelval;
|
||||||
|
|
||||||
|
//cout <<"pixelval:"<<pixelval<<" newix:"<<newix<<endl;
|
||||||
|
//cout <<"64:"<< hex<<((uint64_t)(*((uint64_t*)(((char*)data)+(dataMap[iy][newix])))))<<endl;
|
||||||
|
t = (be64toh((uint64_t)(*((uint64_t*)(((char*)data)+(dataMap[iy][newix]))))));
|
||||||
|
//cout<<"t:"<<t<<endl;
|
||||||
|
|
||||||
|
}else
|
||||||
|
cprintf(RED,"outside limits\n");
|
||||||
|
|
||||||
|
if(dr == 4)
|
||||||
|
//uint8_t value = t >> (pixelval*4); cout <<"value:"<< value << endl;
|
||||||
|
return ((t >> (pixelval*4)) & 0xf)^m;
|
||||||
|
else if(dr == 8)
|
||||||
|
//uint8_t value = t >> (pixelval*8); cout <<"value:"<< value << endl;
|
||||||
|
return ((t >> (pixelval*8)) & 0xff)^m;
|
||||||
|
else if(dr == 16){
|
||||||
|
//uint16_t value = t >> (pixelval*16); cout <<"value:"<< value << endl;
|
||||||
|
return ((t >> (pixelval*16)) & 0xffff)^m;
|
||||||
|
}else{
|
||||||
|
//uint32_t value = t >> (pixelval*32); cout <<"value:"<< value << endl;
|
||||||
|
return ((t >> (pixelval*32)) & 0xffffffff)^m;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -144,6 +195,12 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** gets the packets number (last packet is labelled with 0 and is replaced with 40)
|
/** gets the packets number (last packet is labelled with 0 and is replaced with 40)
|
||||||
\param buff pointer to the memory
|
\param buff pointer to the memory
|
||||||
\returns packet number
|
\returns packet number
|
||||||
|
155
slsDetectorCalibration/jungfrau10ModuleData.h
Normal file
155
slsDetectorCalibration/jungfrau10ModuleData.h
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
#ifndef JUNGFRAU10MODULEDATA_H
|
||||||
|
#define JUNGFRAU10MODULEBDATA_H
|
||||||
|
#include "slsDetectorData.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class jungfrau10ModuleData : public slsDetectorData<uint16_t> {
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
int iframe;
|
||||||
|
int nadc;
|
||||||
|
int sc_width;
|
||||||
|
int sc_height;
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Implements the slsReceiverData structure for the moench02 prototype read out by a module i.e. using the slsReceiver
|
||||||
|
(160x160 pixels, 40 packets 1286 large etc.)
|
||||||
|
\param c crosstalk parameter for the output buffer
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
jungfrau10ModuleData(int ns=16384): slsDetectorData<uint16_t>(256*4, 256*2, 256*256*8*2, NULL, NULL, NULL) , iframe(0), nadc(32), sc_width(64), sc_height(256) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int row, col;
|
||||||
|
|
||||||
|
int isample;
|
||||||
|
int iadc;
|
||||||
|
int ix, iy;
|
||||||
|
|
||||||
|
int ichip;
|
||||||
|
|
||||||
|
// cout << sizeof(uint16_t) << endl;
|
||||||
|
|
||||||
|
for (iadc=0; iadc<nadc; iadc++) {
|
||||||
|
ichip=iadc/4;
|
||||||
|
|
||||||
|
for (int i=0; i<sc_width*sc_height; i++) {
|
||||||
|
|
||||||
|
if (ichip%2==0) {
|
||||||
|
row=sc_height+i/sc_width;
|
||||||
|
col=(ichip/2)*256+iadc%4*sc_width+(i%sc_width);
|
||||||
|
} else {
|
||||||
|
row=sc_height-1-i/sc_width;
|
||||||
|
col=((ichip/2)*256+iadc%4*sc_width)+sc_width-(i%sc_width)-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* if (iadc<nadc/2) { */
|
||||||
|
/* row=sc_height+i/sc_width; */
|
||||||
|
/* col=iadc*sc_width+(i%sc_width); */
|
||||||
|
/* } else { */
|
||||||
|
/* row=sc_height-1-i/sc_width; */
|
||||||
|
/* col=(nx-1)-((iadc-16)*sc_width)-(i%sc_width); */
|
||||||
|
/* } */
|
||||||
|
if (row<0 || row>=ny || col<0 || col>=nx) {
|
||||||
|
cout << "Wrong row, column " << row << " " << col << " " << iadc << " " << i << endl;
|
||||||
|
} else
|
||||||
|
dataMap[row][col]=(nadc*i+iadc)*2;
|
||||||
|
if (dataMap[row][col]<0 || dataMap[row][col]>=dataSize)
|
||||||
|
cout << "Error: pointer " << dataMap[row][col] << " out of range " << row << " " << col <<" " << iadc << " " << i << endl;
|
||||||
|
else {
|
||||||
|
xmap[nadc*i+iadc]=col;
|
||||||
|
ymap[nadc*i+iadc]=row;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Returns the frame number for the given dataset. Purely virtual func.
|
||||||
|
\param buff pointer to the dataset
|
||||||
|
\returns frame number
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
int getFrameNumber(char *buff){(void)buff; return iframe;};
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Returns the packet number for the given dataset. purely virtual func
|
||||||
|
\param buff pointer to the dataset
|
||||||
|
\returns packet number number
|
||||||
|
|
||||||
|
|
||||||
|
virtual int getPacketNumber(char *buff)=0;
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Loops over a memory slot until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). purely virtual func
|
||||||
|
\param data pointer to the memory to be analyzed
|
||||||
|
\param ndata reference to the amount of data found for the frame, in case the frame is incomplete at the end of the memory slot
|
||||||
|
\param dsize size of the memory slot to be analyzed
|
||||||
|
\returns pointer to the beginning of the last good frame (might be incomplete if ndata smaller than dataSize), or NULL if no frame is found
|
||||||
|
|
||||||
|
*/
|
||||||
|
char *findNextFrame(char *data, int &ndata, int dsize){ndata=dsize; setDataSize(dsize); return data;};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
Loops over a file stream until a complete frame is found (i.e. all packets 0 to nPackets, same frame number). Can be overloaded for different kind of detectors!
|
||||||
|
\param filebin input file stream (binary)
|
||||||
|
\returns pointer to the begin of the last good frame, NULL if no frame is found or last frame is incomplete
|
||||||
|
|
||||||
|
*/
|
||||||
|
char *readNextFrame(ifstream &filebin){
|
||||||
|
// int afifo_length=0;
|
||||||
|
uint16_t *afifo_cont;
|
||||||
|
int ib=0;
|
||||||
|
if (filebin.is_open()) {
|
||||||
|
afifo_cont=new uint16_t[dataSize/2];
|
||||||
|
while (filebin.read(((char*)afifo_cont)+ib,2)) {
|
||||||
|
ib+=2;
|
||||||
|
if (ib==dataSize) break;
|
||||||
|
}
|
||||||
|
if (ib>0) {
|
||||||
|
iframe++;
|
||||||
|
// cout << ib << "-" << endl;
|
||||||
|
return (char*)afifo_cont;
|
||||||
|
} else {
|
||||||
|
delete [] afifo_cont;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -36,9 +36,6 @@ class moench02CtbData : public slsDetectorData<uint16_t> {
|
|||||||
int iadc;
|
int iadc;
|
||||||
int ix, iy;
|
int ix, iy;
|
||||||
|
|
||||||
xmap=new int[nx*ny];
|
|
||||||
ymap=new int[nx*ny];
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -47,30 +44,13 @@ class moench02CtbData : public slsDetectorData<uint16_t> {
|
|||||||
col=adc_nr[iadc]+(i%sc_width);
|
col=adc_nr[iadc]+(i%sc_width);
|
||||||
row=i/sc_width;
|
row=i/sc_width;
|
||||||
dataMap[row][col]=(32*i+iadc)*2;
|
dataMap[row][col]=(32*i+iadc)*2;
|
||||||
if (dataMap[row][col]<0 || dataMap[row][col]>=2*160*160)
|
if (dataMap[row][col]<0 || dataMap[row][col]>=dataSize) {
|
||||||
cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl;
|
cout << "Error: pointer " << dataMap[row][col] << " out of range "<< endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
for (int i=0; i<nx*ny; i++) {
|
|
||||||
isample=i/32;
|
|
||||||
iadc=i%nadc;
|
|
||||||
ix=isample%sc_width;
|
|
||||||
iy=isample/sc_width;
|
|
||||||
if (iadc<(nadc/2)) {
|
|
||||||
xmap[i]=adc_nr[iadc]+ix;
|
|
||||||
ymap[i]=ny/2-1-iy;
|
|
||||||
} else {
|
|
||||||
xmap[i]=adc_nr[iadc]+ix;
|
|
||||||
ymap[i]=ny/2+iy;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
iframe=0;
|
iframe=0;
|
||||||
// cout << "data struct created" << endl;
|
// cout << "data struct created" << endl;
|
||||||
|
@ -9,7 +9,6 @@ class moench03CtbData : public slsDetectorData<uint16_t> {
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
int iframe;
|
int iframe;
|
||||||
int *xmap, *ymap;
|
|
||||||
int nadc;
|
int nadc;
|
||||||
int sc_width;
|
int sc_width;
|
||||||
int sc_height;
|
int sc_height;
|
||||||
@ -39,8 +38,6 @@ class moench03CtbData : public slsDetectorData<uint16_t> {
|
|||||||
int iadc;
|
int iadc;
|
||||||
int ix, iy;
|
int ix, iy;
|
||||||
|
|
||||||
xmap=new int[nx*ny];
|
|
||||||
ymap=new int[nx*ny];
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -83,8 +80,6 @@ class moench03CtbData : public slsDetectorData<uint16_t> {
|
|||||||
// cout << "data struct created" << endl;
|
// cout << "data struct created" << endl;
|
||||||
};
|
};
|
||||||
|
|
||||||
void getPixel(int ip, int &x, int &y) {if (ip>=0 && ip<nx*ny) {x=xmap[ip]; y=ymap[ip];}};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
@ -139,7 +134,7 @@ class moench03CtbData : public slsDetectorData<uint16_t> {
|
|||||||
}
|
}
|
||||||
if (ib>0) {
|
if (ib>0) {
|
||||||
iframe++;
|
iframe++;
|
||||||
cout << ib << "-" << endl;
|
// cout << ib << "-" << endl;
|
||||||
return (char*)afifo_cont;
|
return (char*)afifo_cont;
|
||||||
} else {
|
} else {
|
||||||
delete [] afifo_cont;
|
delete [] afifo_cont;
|
||||||
|
@ -27,7 +27,7 @@ using namespace std;
|
|||||||
#define NR 400
|
#define NR 400
|
||||||
|
|
||||||
|
|
||||||
#define MY_DEBUG 1
|
//#define MY_DEBUG 1
|
||||||
|
|
||||||
#ifdef MY_DEBUG
|
#ifdef MY_DEBUG
|
||||||
#include <TCanvas.h>
|
#include <TCanvas.h>
|
||||||
@ -47,7 +47,7 @@ TH2F *readImage(ifstream &filebin, TH2F *h2=NULL, TH2F *hped=NULL) {
|
|||||||
h2=new TH2F("h2","",400,0,400,400,0,400);
|
h2=new TH2F("h2","",400,0,400,400,0,400);
|
||||||
h2->SetStats(kFALSE);
|
h2->SetStats(kFALSE);
|
||||||
}
|
}
|
||||||
cout << "." << endl;
|
// cout << "." << endl;
|
||||||
for (int ix=0; ix<400; ix++) {
|
for (int ix=0; ix<400; ix++) {
|
||||||
for (int iy=0; iy<400; iy++) {
|
for (int iy=0; iy<400; iy++) {
|
||||||
// cout << decoder->getDataSize() << " " << decoder->getValue(buff,ix,iy)<< endl;
|
// cout << decoder->getDataSize() << " " << decoder->getValue(buff,ix,iy)<< endl;
|
||||||
@ -77,7 +77,7 @@ TH2F *readImage(char *fname, int iframe=0, TH2F *hped=NULL) {
|
|||||||
if (hh==NULL) break;
|
if (hh==NULL) break;
|
||||||
hh=readImage(filebin, h2, hped );
|
hh=readImage(filebin, h2, hped );
|
||||||
if (hh)
|
if (hh)
|
||||||
cout << "="<< endl;
|
;// cout << "="<< endl;
|
||||||
else {
|
else {
|
||||||
delete h2;
|
delete h2;
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -114,7 +114,7 @@ TH2F *calcPedestal(char *fformat, int runmin, int runmax){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete [] buff;
|
delete [] buff;
|
||||||
cout << "="<< endl;
|
//cout << "="<< endl;
|
||||||
ii++;
|
ii++;
|
||||||
}
|
}
|
||||||
if (filebin.is_open())
|
if (filebin.is_open())
|
||||||
@ -146,8 +146,6 @@ Loops over data file to find single photons, fills the tree (and writes it to fi
|
|||||||
\param nbins number of bins for spectrum hists
|
\param nbins number of bins for spectrum hists
|
||||||
\param hmin histo minimum for spectrum hists
|
\param hmin histo minimum for spectrum hists
|
||||||
\param hmax histo maximum for spectrum hists
|
\param hmax histo maximum for spectrum hists
|
||||||
\param sign sign of the spectrum to find hits
|
|
||||||
\param hc readout correlation coefficient with previous pixel
|
|
||||||
\param xmin minimum x coordinate
|
\param xmin minimum x coordinate
|
||||||
\param xmax maximum x coordinate
|
\param xmax maximum x coordinate
|
||||||
\param ymin minimum y coordinate
|
\param ymin minimum y coordinate
|
||||||
@ -156,7 +154,9 @@ Loops over data file to find single photons, fills the tree (and writes it to fi
|
|||||||
\returns pointer to histo stack with cluster spectra
|
\returns pointer to histo stack with cluster spectra
|
||||||
*/
|
*/
|
||||||
|
|
||||||
THStack *moench03ReadData(char *fformat, char *tit, int runmin, int runmax, int nbins=1500, int hmin=-500, int hmax=1000, int sign=1, double hc=0, int xmin=1, int xmax=NC-1, int ymin=1, int ymax=NR-1, int cmsub=0, int hitfinder=1) {
|
THStack *moench03ReadData(char *fformat, char *tit, int runmin, int runmax, int nbins=1500, int hmin=-500, int hmax=1000, int xmin=1, int xmax=NC-1, int ymin=1, int ymax=NR-1, int cmsub=0, int hitfinder=1) {
|
||||||
|
double hc=0;
|
||||||
|
int sign=1;
|
||||||
|
|
||||||
moench03CtbData *decoder=new moench03CtbData();
|
moench03CtbData *decoder=new moench03CtbData();
|
||||||
cout << "decoder allocated " << endl;
|
cout << "decoder allocated " << endl;
|
||||||
@ -173,7 +173,7 @@ THStack *moench03ReadData(char *fformat, char *tit, int runmin, int runmax, int
|
|||||||
int iev=0;
|
int iev=0;
|
||||||
int nph=0;
|
int nph=0;
|
||||||
|
|
||||||
singlePhotonDetector<uint16_t> *filter=new singlePhotonDetector<uint16_t>(decoder, 3, 5, sign, cmSub, 10, 100);
|
singlePhotonDetector<uint16_t> *filter=new singlePhotonDetector<uint16_t>(decoder, 3, 5, sign, cmSub, 100, 10);
|
||||||
cout << "filter allocated " << endl;
|
cout << "filter allocated " << endl;
|
||||||
|
|
||||||
char *buff;
|
char *buff;
|
||||||
@ -270,11 +270,8 @@ THStack *moench03ReadData(char *fformat, char *tit, int runmin, int runmax, int
|
|||||||
nph=0;
|
nph=0;
|
||||||
while ((buff=decoder->readNextFrame(filebin))) {
|
while ((buff=decoder->readNextFrame(filebin))) {
|
||||||
|
|
||||||
|
|
||||||
if (hitfinder) {
|
|
||||||
filter->newFrame();
|
filter->newFrame();
|
||||||
|
|
||||||
//calculate pedestals and common modes
|
|
||||||
if (cmsub) {
|
if (cmsub) {
|
||||||
// cout << "cm" << endl;
|
// cout << "cm" << endl;
|
||||||
for (ix=xmin-1; ix<xmax+1; ix++)
|
for (ix=xmin-1; ix<xmax+1; ix++)
|
||||||
@ -282,7 +279,10 @@ THStack *moench03ReadData(char *fformat, char *tit, int runmin, int runmax, int
|
|||||||
thisEvent=filter->getEventType(buff, ix, iy,0);
|
thisEvent=filter->getEventType(buff, ix, iy,0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
// if (hitfinder) {
|
||||||
|
|
||||||
|
// //calculate pedestals and common modes
|
||||||
|
// }
|
||||||
|
|
||||||
// cout << "new frame " << endl;
|
// cout << "new frame " << endl;
|
||||||
|
|
||||||
@ -290,16 +290,14 @@ THStack *moench03ReadData(char *fformat, char *tit, int runmin, int runmax, int
|
|||||||
for (iy=ymin-1; iy<ymax+1; iy++) {
|
for (iy=ymin-1; iy<ymax+1; iy++) {
|
||||||
// cout << ix << " " << iy << endl;
|
// cout << ix << " " << iy << endl;
|
||||||
thisEvent=filter->getEventType(buff, ix, iy, cmsub);
|
thisEvent=filter->getEventType(buff, ix, iy, cmsub);
|
||||||
|
|
||||||
#ifdef MY_DEBUG
|
|
||||||
if (hitfinder) {
|
|
||||||
// if (iev%10==0)
|
|
||||||
he->SetBinContent(ix+1-xmin, iy+1-ymin, (int)thisEvent);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// if (nf>10) {
|
// if (nf>10) {
|
||||||
h1->Fill(filter->getClusterTotal(1), iy+NR*ix);
|
h1->Fill(filter->getClusterTotal(1), iy+NR*ix);
|
||||||
|
|
||||||
|
#ifdef MY_DEBUG
|
||||||
|
// if (iev%10==0)
|
||||||
|
he->SetBinContent(ix+1-xmin, iy+1-ymin, (int)thisEvent);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (hitfinder) {
|
if (hitfinder) {
|
||||||
|
|
||||||
if (thisEvent==PHOTON_MAX ) {
|
if (thisEvent==PHOTON_MAX ) {
|
||||||
@ -315,7 +313,10 @@ THStack *moench03ReadData(char *fformat, char *tit, int runmin, int runmax, int
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
} // else {
|
||||||
|
// filter->addToPedestal(decoder->getValue(buff,ix,iy, cmsub));
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
// }
|
// }
|
||||||
@ -323,7 +324,7 @@ THStack *moench03ReadData(char *fformat, char *tit, int runmin, int runmax, int
|
|||||||
//////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef MY_DEBUG
|
#ifdef MY_DEBUG
|
||||||
cout << iev << " " << h1->GetEntries() << " " << h2->GetEntries() << endl;
|
// cout << iev << " " << h1->GetEntries() << " " << h2->GetEntries() << endl;
|
||||||
// if (iev%10==0) {
|
// if (iev%10==0) {
|
||||||
// myC->Modified();
|
// myC->Modified();
|
||||||
// myC->Update();
|
// myC->Update();
|
||||||
@ -338,10 +339,10 @@ THStack *moench03ReadData(char *fformat, char *tit, int runmin, int runmax, int
|
|||||||
#endif
|
#endif
|
||||||
nf++;
|
nf++;
|
||||||
|
|
||||||
cout << "=" ;
|
// cout << "=" ;
|
||||||
delete [] buff;
|
delete [] buff;
|
||||||
}
|
}
|
||||||
cout << nph << endl;
|
// cout << nph << endl;
|
||||||
if (filebin.is_open())
|
if (filebin.is_open())
|
||||||
filebin.close();
|
filebin.close();
|
||||||
else
|
else
|
||||||
|
@ -12,31 +12,31 @@ void readMoench03Data(char *tit, int sign=1){
|
|||||||
TFile *fout;
|
TFile *fout;
|
||||||
THStack *hs;
|
THStack *hs;
|
||||||
|
|
||||||
sprintf(fname,"/scratch/roberto/photons.root");
|
sprintf(fname,"/mnt/moenchnas/big_moench_xbox_20150223/Mo.root");
|
||||||
fout=new TFile(fname,"RECREATE");
|
fout=new TFile(fname,"RECREATE");
|
||||||
|
|
||||||
sprintf(fname,"/scratch/roberto/run_%%d.raw");
|
sprintf(fname,"/mnt/moenchnas/big_moench_xbox_20150223/Mo_f0_%%d.raw");
|
||||||
|
|
||||||
hs=moench03ReadData(fname,"photons",136,1135,1500,-500,2500,1,0.,1,399,1,399, 0,1);
|
hs=moench03ReadData(fname,"Mo",25133,25187,1500,-500,2500,1,399,1,399, 0,1);
|
||||||
// cout << "returned" << endl;
|
cout << "returned" << endl;
|
||||||
// hs->SetName(tit);
|
hs->SetName(tit);
|
||||||
// hs->SetTitle(tit);
|
hs->SetTitle(tit);
|
||||||
// cout << "name/title set" << endl;
|
cout << "name/title set" << endl;
|
||||||
|
|
||||||
|
|
||||||
// if (hs->GetHists()) {
|
if (hs->GetHists()) {
|
||||||
// for (int i=0; i<3; i++) {
|
for (int i=0; i<3; i++) {
|
||||||
// if (hs->GetHists()->At(i)) {
|
if (hs->GetHists()->At(i)) {
|
||||||
// cout << i << " " ;
|
cout << i << " " ;
|
||||||
// (TH2F*)(hs->GetHists()->At(i))->Write();
|
(TH2F*)(hs->GetHists()->At(i))->Write();
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// cout << " histos written " << endl;
|
cout << " histos written " << endl;
|
||||||
// } else
|
} else
|
||||||
// cout << "no hists in stack " << endl;
|
cout << "no hists in stack " << endl;
|
||||||
|
|
||||||
|
|
||||||
// fout->Close();
|
fout->Close();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,7 +18,8 @@ class slsDetectorData {
|
|||||||
int **dataMap; /**< Array of size nx*ny storing the pointers to the data in the dataset (as offset)*/
|
int **dataMap; /**< Array of size nx*ny storing the pointers to the data in the dataset (as offset)*/
|
||||||
dataType **dataMask; /**< Array of size nx*ny storing the polarity of the data in the dataset (should be 0 if no inversion is required, 0xffffffff is inversion is required) */
|
dataType **dataMask; /**< Array of size nx*ny storing the polarity of the data in the dataset (should be 0 if no inversion is required, 0xffffffff is inversion is required) */
|
||||||
int **dataROIMask; /**< Array of size nx*ny 1 if channel is good (or in the ROI), 0 if bad channel (or out of ROI) */
|
int **dataROIMask; /**< Array of size nx*ny 1 if channel is good (or in the ROI), 0 if bad channel (or out of ROI) */
|
||||||
|
int *xmap;
|
||||||
|
int *ymap;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -39,6 +40,8 @@ class slsDetectorData {
|
|||||||
slsDetectorData(int npx, int npy, int dsize, int **dMap=NULL, dataType **dMask=NULL, int **dROI=NULL): nx(npx), ny(npy), dataSize(dsize) {
|
slsDetectorData(int npx, int npy, int dsize, int **dMap=NULL, dataType **dMask=NULL, int **dROI=NULL): nx(npx), ny(npy), dataSize(dsize) {
|
||||||
|
|
||||||
|
|
||||||
|
xmap=new int[nx*ny];
|
||||||
|
ymap=new int[nx*ny];
|
||||||
|
|
||||||
dataMask=new dataType*[ny];
|
dataMask=new dataType*[ny];
|
||||||
for(int i = 0; i < ny; i++) {
|
for(int i = 0; i < ny; i++) {
|
||||||
@ -56,6 +59,8 @@ class slsDetectorData {
|
|||||||
dataROIMask[i][j]=1;
|
dataROIMask[i][j]=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
setDataMap(dMap);
|
setDataMap(dMap);
|
||||||
setDataMask(dMask);
|
setDataMask(dMask);
|
||||||
setDataROIMask(dROI);
|
setDataROIMask(dROI);
|
||||||
@ -71,9 +76,11 @@ class slsDetectorData {
|
|||||||
delete [] dataMap;
|
delete [] dataMap;
|
||||||
delete [] dataMask;
|
delete [] dataMask;
|
||||||
delete [] dataROIMask;
|
delete [] dataROIMask;
|
||||||
|
delete [] xmap;
|
||||||
|
delete [] ymap;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void getPixel(int ip, int &x, int &y) {x=ip; y=0;};
|
virtual void getPixel(int ip, int &x, int &y) {x=xmap[ip]; y=ymap[ip];};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -85,7 +92,7 @@ class slsDetectorData {
|
|||||||
|
|
||||||
|
|
||||||
void setDataMap(int **dMap=NULL) {
|
void setDataMap(int **dMap=NULL) {
|
||||||
|
int ip;
|
||||||
|
|
||||||
if (dMap==NULL) {
|
if (dMap==NULL) {
|
||||||
for (int iy=0; iy<ny; iy++)
|
for (int iy=0; iy<ny; iy++)
|
||||||
@ -98,6 +105,9 @@ class slsDetectorData {
|
|||||||
for (int ix=0; ix<nx; ix++) {
|
for (int ix=0; ix<nx; ix++) {
|
||||||
dataMap[iy][ix]=dMap[iy][ix];
|
dataMap[iy][ix]=dMap[iy][ix];
|
||||||
// cout << ix << " " << iy << endl;
|
// cout << ix << " " << iy << endl;
|
||||||
|
ip=dataMap[ix][iy]/sizeof(dataType);
|
||||||
|
xmap[ip]=ix;
|
||||||
|
ymap[ip]=iy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -190,7 +200,7 @@ class slsDetectorData {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
virtual dataType getChannel(char *data, int ix, int iy=0) {
|
virtual dataType getChannel(char *data, int ix, int iy=0, int dr=0) {
|
||||||
dataType m=0, d=0;
|
dataType m=0, d=0;
|
||||||
if (ix>=0 && ix<nx && iy>=0 && iy<ny && dataMap[iy][ix]>=0 && dataMap[iy][ix]<dataSize) {
|
if (ix>=0 && ix<nx && iy>=0 && iy<ny && dataMap[iy][ix]>=0 && dataMap[iy][ix]<dataSize) {
|
||||||
m=dataMask[iy][ix];
|
m=dataMask[iy][ix];
|
||||||
@ -202,6 +212,7 @@ class slsDetectorData {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
Returns the value of the selected channel for the given dataset. Virtual function, can be overloaded.
|
Returns the value of the selected channel for the given dataset. Virtual function, can be overloaded.
|
||||||
\param data pointer to the dataset (including headers etc)
|
\param data pointer to the dataset (including headers etc)
|
||||||
\param ix pixel number in the x direction
|
\param ix pixel number in the x direction
|
||||||
@ -253,6 +264,8 @@ class slsDetectorData {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
|
=======
|
||||||
|
>>>>>>> b3dac953736499019603c2201df6e7eb45cc890c
|
||||||
Returns the value of the selected channel for the given dataset as double.
|
Returns the value of the selected channel for the given dataset as double.
|
||||||
\param data pointer to the dataset (including headers etc)
|
\param data pointer to the dataset (including headers etc)
|
||||||
\param ix pixel number in the x direction
|
\param ix pixel number in the x direction
|
||||||
|
Loading…
x
Reference in New Issue
Block a user