New: jungfrau02CommonMode.h. Some extra documentation for Jungfrau.

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorCalibration@40 113b152e-814d-439b-b186-022a431db7b5
This commit is contained in:
jungmann_j 2014-02-06 15:38:26 +00:00
parent 6b7d0d8c55
commit b90287e724
5 changed files with 34 additions and 38 deletions

View File

@ -22,7 +22,7 @@ class chiptestBoardData : public slsDetectorData<uint16_t> {
\param dROI Array of size nx*ny. The elements are 1s if the channel is good or in the ROI, 0 is bad or out of the ROI. NULL (default) means all 1s. \param dROI Array of size nx*ny. The elements are 1s if the channel is good or in the ROI, 0 is bad or out of the ROI. NULL (default) means all 1s.
*/ */
chiptestBoardData(int npx, int npy, int nadc, int offset, int **dMap=NULL, uint16_t **dMask=NULL, int **dROI=NULL): slsDetectorData<uint16_t>(npx, npy, nadc*(npx*npy)+offset, dMap, dMask, dROI), nAdc(nadc), offSize(offset), iframe(0) {}; chiptestBoardData(int npx, int npy, int nadc, int offset, int **dMap=NULL, uint16_t **dMask=NULL, int **dROI=NULL): slsDetectorData<uint16_t>(npx, npy, nadc*(npx*npy)+offset, dMap, dMask, dROI), nAdc(nadc), offSize(offset), iframe(0) {}; // should be? nadc*(npx*npy+offset)
@ -56,8 +56,8 @@ class chiptestBoardData : public slsDetectorData<uint16_t> {
virtual char *readNextFrame(ifstream &filebin) { virtual char *readNextFrame(ifstream &filebin) {
int afifo_length=0; //int afifo_length; int afifo_length=0;
uint16_t *afifo_cont;//2343 values for uint16_t *afifo_cont;
if (filebin.is_open()) { if (filebin.is_open()) {
if (filebin.read((char*)&afifo_length,sizeof(uint32_t))) { if (filebin.read((char*)&afifo_length,sizeof(uint32_t))) {

View File

@ -13,7 +13,7 @@ class jungfrau02Data : public chiptestBoardData {
/** /**
Implements the chiptestBoardData structure for the jungfrau02 prototype Implements the chiptestBoardData structure for the jungfrau02 prototype
(48x48 pixels, ADC2 for analog output, eventually 2 more for digital bits , offset configurable etc.) (48x48 pixels, ADC2 for analog output, 2 more ADCs used for readout of digital bits, pixel offset configurable.)
\param c crosstalk parameter for the output buffer \param c crosstalk parameter for the output buffer
*/ */
@ -61,7 +61,7 @@ class jungfrau02Data : public chiptestBoardData {
/** /**
Returns the value of the selected channel for the given dataset. Since the ADC is only 14bit wide, if the gain bits are read out they are returned in bit 14-15 Returns the value of the selected channel for the given dataset. Since the ADC is only 14bit wide, only bit 0-13 are occupied. If the gain bits are read out, they are returned in bit 14-15.
\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
\param iy pixel number in the y direction \param iy pixel number in the y direction

View File

@ -16,6 +16,7 @@
#include <fstream> #include <fstream>
#include "jungfrau02Data.h" #include "jungfrau02Data.h"
#include "moenchCommonMode.h" #include "moenchCommonMode.h"
#include "jungfrau02CommonMode.h"
#include "singlePhotonDetector.h" #include "singlePhotonDetector.h"
//#include "MovingStat.h" //#include "MovingStat.h"
@ -33,7 +34,7 @@ using namespace std;
/** /**
Loops over data file to find single photons, fills the tree (and writes it to file, althoug the root file should be opened before) and creates 1x1, 2x2, 3x3 cluster histograms with ADCu on the x axis, channel number (160*x+y) on the y axis. Loops over data file to find single photons, fills the tree (and writes it to file, although the root file should be opened before) and creates 1x1, 2x2, 3x3 cluster histograms with ADCu on the x axis, channel number (48*x+y) on the y axis.
\param fformat file name format \param fformat file name format
\param tit title of the tree etc. \param tit title of the tree etc.
@ -48,8 +49,8 @@ Loops over data file to find single photons, fills the tree (and writes it to fi
\param xmax maximum x coordinate \param xmax maximum x coordinate
\param ymin minimum y coordinate \param ymin minimum y coordinate
\param ymax maximum y coordinate \param ymax maximum y coordinate
\param cmsub enable commonmode subtraction \param cmsub enable commonmode subtraction -> Currently, CM subtraction is not implemented for Jungfrau!
\param hitfinder if 0, performs pedestal subtraction, not hit finding \param hitfinder if 0: performs pedestal subtraction, not hit finding; if 1: performs both pedestal subtraction and hit finding
\returns pointer to histo stack with cluster spectra \returns pointer to histo stack with cluster spectra
*/ */
@ -57,7 +58,7 @@ Loops over data file to find single photons, fills the tree (and writes it to fi
THStack *jungfrauReadData(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 *jungfrauReadData(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) {
jungfrau02Data *decoder=new jungfrau02Data(1,0,0); jungfrau02Data *decoder=new jungfrau02Data(1,0,0);
moenchCommonMode *cmSub=NULL; jungfrau02CommonMode *cmSub=NULL;//moenchCommonMode *cmSub=NULL; //
// if (cmsub) // if (cmsub)
// cmSub=new moenchCommonMode(); // cmSub=new moenchCommonMode();
@ -78,8 +79,8 @@ THStack *jungfrauReadData(char *fformat, char *tit, int runmin, int runmax, int
TH2F *h2; TH2F *h2;
TH2F *h3; TH2F *h3;
TH2F *hetaX; TH2F *hetaX; // not needed for JF?
TH2F *hetaY; TH2F *hetaY; // not needed for JF?
THStack *hs=new THStack("hs",fformat); THStack *hs=new THStack("hs",fformat);
@ -91,12 +92,12 @@ THStack *jungfrauReadData(char *fformat, char *tit, int runmin, int runmax, int
if (hitfinder) { if (hitfinder) {
h2=new TH2F("h2",tit,nbins,hmin-0.5,hmax-0.5,NC*NR,-0.5,NC*NR-0.5); h2=new TH2F("h2",tit,nbins,hmin-0.5,hmax-0.5,NC*NR,-0.5,NC*NR-0.5);
h3=new TH2F("h3",tit,nbins,hmin-0.5,hmax-0.5,NC*NR,-0.5,NC*NR-0.5); h3=new TH2F("h3",tit,nbins,hmin-0.5,hmax-0.5,NC*NR,-0.5,NC*NR-0.5);
hetaX=new TH2F("hetaX",tit,nbins,-1,2,NC*NR,-0.5,NC*NR-0.5); hetaX=new TH2F("hetaX",tit,nbins,-1,2,NC*NR,-0.5,NC*NR-0.5); // not needed for JF?
hetaY=new TH2F("hetaY",tit,nbins,-1,2,NC*NR,-0.5,NC*NR-0.5); hetaY=new TH2F("hetaY",tit,nbins,-1,2,NC*NR,-0.5,NC*NR-0.5); // not needed for JF?
hs->Add(h2); hs->Add(h2);
hs->Add(h3); hs->Add(h3);
hs->Add(hetaX); hs->Add(hetaX); // not needed for JF?
hs->Add(hetaY); hs->Add(hetaY); // not needed for JF?
} }
@ -142,7 +143,7 @@ THStack *jungfrauReadData(char *fformat, char *tit, int runmin, int runmax, int
filter->newDataSet(); filter->newDataSet();
for (int irun=runmin; irun<runmax; irun++) { for (int irun=runmin; irun<=runmax; irun++){ //{for (int irun=runmin; irun<runmax; irun++) {
sprintf(fname,fformat,irun); sprintf(fname,fformat,irun);
cout << "file name " << fname << endl; cout << "file name " << fname << endl;
filebin.open((const char *)(fname), ios::in | ios::binary); filebin.open((const char *)(fname), ios::in | ios::binary);
@ -222,14 +223,14 @@ THStack *jungfrauReadData(char *fformat, char *tit, int runmin, int runmax, int
#endif #endif
nf++; nf++;
cout << "=" ; cout << "="; // one "=" for every frame that's been processed
delete [] buff; delete [] buff;
} }
cout << nph << endl; cout << nph << endl; // number of photons found in file
if (filebin.is_open()) if (filebin.is_open())
filebin.close(); filebin.close();
else else
cout << "could not open file " << fname << endl; cout << "Could not open file :( ... " << fname << endl;
} }
if (hitfinder) if (hitfinder)
tall->Write(tall->GetName(),TObject::kOverwrite); tall->Write(tall->GetName(),TObject::kOverwrite);
@ -237,7 +238,7 @@ THStack *jungfrauReadData(char *fformat, char *tit, int runmin, int runmax, int
delete decoder; delete decoder;
cout << "Read " << nf << " frames" << endl; cout << "Read " << nf << " frames." << endl;
return hs; return hs;
} }

View File

@ -1,29 +1,24 @@
{ { // script to run Jungfrau data analysis
gROOT->ProcessLine(".L jungfrauReadData.C+"); gROOT->ProcessLine(".L jungfrauReadData.C+");
TFile *fout; // output file
THStack *hs2N; // collection of objects
fout=new TFile("/mnt/slitnas/datadir_jungfrau02/20140131_analysis/test/outfile.root","RECREATE"); // careful "RECREATE" will OVERWRITE!
hs2N=jungfrauReadData("/mnt/slitnas/datadir_jungfrau02/20140131_BeamSLS/datadir_310114/18keV_10us_HIGHG0_CDS550_%d.bin","tit",0,10,1500,-500,2500,1,0.,1,47,1,47,1,1); //0,1);
//hs2N->SetName("cds_g4");
//hs2N->SetTitle("cds_g4");
(TH2F*)(hs2N->GetHists()->At(0))->Write(); // write hists
TFile *fout;
THStack *hs2N;
fout=new TFile("/mnt/slitnas/datadir_jungfrau02/20140131_analysis/test/outfile.root","RECREATE");
hs2N=jungfrauReadData("/mnt/slitnas/datadir_jungfrau02/20140131_BeamSLS/datadir_310114/18keV_10us_HIGHG0_CDS550_%d.bin","tit",30,40,1500,-500,2500,1,0.,1,47,1,47, 0,1);
hs2N->SetName("cds_g4");
hs2N->SetTitle("cds_g4");
(TH2F*)(hs2N->GetHists()->At(0))->Write();
(TH2F*)(hs2N->GetHists()->At(1))->Write(); (TH2F*)(hs2N->GetHists()->At(1))->Write();
(TH2F*)(hs2N->GetHists()->At(2))->Write(); (TH2F*)(hs2N->GetHists()->At(2))->Write();
(TH2F*)(hs2N->GetHists()->At(3))->Write(); (TH2F*)(hs2N->GetHists()->At(3))->Write();
(TH2F*)(hs2N->GetHists()->At(4))->Write(); (TH2F*)(hs2N->GetHists()->At(4))->Write();
// fout->Close(); fout->Close();