mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 18:17:59 +02:00
Jungfrau stuff updated
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorCalibration@48 113b152e-814d-439b-b186-022a431db7b5
This commit is contained in:
@ -15,12 +15,12 @@
|
||||
//#include <queue>
|
||||
#include <fstream>
|
||||
#include "jungfrau02Data.h"
|
||||
#include "moenchCommonMode.h"
|
||||
#include "jungfrau02CommonMode.h"
|
||||
#include "singlePhotonDetector.h"
|
||||
|
||||
//#include "MovingStat.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
#define NC 48
|
||||
@ -49,18 +49,37 @@ Loops over data file to find single photons, fills the tree (and writes it to fi
|
||||
\param xmax maximum x coordinate
|
||||
\param ymin minimum y coordinate
|
||||
\param ymax maximum y coordinate
|
||||
\param cmsub enable commonmode subtraction -> Currently, CM subtraction is not implemented for Jungfrau!
|
||||
\param cmsub enable commonmode subtraction
|
||||
\param hitfinder if 0: performs pedestal subtraction, not hit finding; if 1: performs both pedestal subtraction and hit finding
|
||||
\param fcal -> calibration file, which contains 7 columns per pixel; 1) pixel #, 2) cal. offset G0, 3) cal. slope G0, 4) cal. offset G1, 5) cal. slope G1, 6) cal. offset G2, 7) cal. slope G2
|
||||
\returns pointer to histo stack with cluster spectra
|
||||
*/
|
||||
|
||||
|
||||
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){
|
||||
|
||||
// read in calibration file
|
||||
ifstream calfile("/mnt/slitnas/datadir_jungfrau02/analysis_tests/CalibrationParametersTest_fake.txt");
|
||||
if (calfile.is_open()==0){cout << "Unable to open calibration file!" << endl;}
|
||||
int pix;
|
||||
double of0,sl0,of1,sl1,of2,sl2;
|
||||
double of_0[NC*NR], of_1[NC*NR], of_2[NC*NR], sl_0[NC*NR], sl_1[NC*NR], sl_2[NC*NR];
|
||||
while (calfile >> pix >> of0 >> sl0 >> of1 >> sl1 >> of2 >> sl2){
|
||||
of_0[pix]=of0;
|
||||
sl_0[pix]=sl0;
|
||||
of_1[pix]=of1;
|
||||
sl_1[pix]=sl1;
|
||||
of_2[pix]=of2;
|
||||
sl_2[pix]=sl2; //if(pix==200) cout << "sl_2[200] " << sl_2[200] << endl;
|
||||
}
|
||||
calfile.close();
|
||||
|
||||
jungfrau02Data *decoder=new jungfrau02Data(1,0,0);
|
||||
jungfrau02CommonMode *cmSub=NULL;//moenchCommonMode *cmSub=NULL; //
|
||||
// if (cmsub)
|
||||
// cmSub=new moenchCommonMode();
|
||||
double adc_value, num_photon;
|
||||
|
||||
jungfrau02Data *decoder=new jungfrau02Data(1,0,0);//(3,0,0); // (adc,offset,crosstalk) //(1,0,0) //(3,0,0) for readout of GB
|
||||
jungfrau02CommonMode *cmSub=NULL;
|
||||
if (cmsub)
|
||||
cmSub=new jungfrau02CommonMode();
|
||||
|
||||
int nph=0;
|
||||
int iev=0;
|
||||
@ -85,9 +104,11 @@ THStack *jungfrauReadData(char *fformat, char *tit, int runmin, int runmax, int
|
||||
THStack *hs=new THStack("hs",fformat);
|
||||
|
||||
|
||||
|
||||
TH2F *h1=new TH2F("h1",tit,nbins,hmin-0.5,hmax-0.5,NC*NR,-0.5,NC*NR-0.5);
|
||||
hs->Add(h1);
|
||||
|
||||
|
||||
|
||||
|
||||
if (hitfinder) {
|
||||
h2=new TH2F("h2",tit,nbins,hmin-0.5,hmax-0.5,NC*NR,-0.5,NC*NR-0.5);
|
||||
@ -101,7 +122,6 @@ THStack *jungfrauReadData(char *fformat, char *tit, int runmin, int runmax, int
|
||||
}
|
||||
|
||||
|
||||
|
||||
ifstream filebin;
|
||||
|
||||
|
||||
@ -143,7 +163,7 @@ THStack *jungfrauReadData(char *fformat, char *tit, int runmin, int runmax, int
|
||||
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);
|
||||
cout << "file name " << fname << endl;
|
||||
filebin.open((const char *)(fname), ios::in | ios::binary);
|
||||
@ -173,19 +193,25 @@ THStack *jungfrauReadData(char *fformat, char *tit, int runmin, int runmax, int
|
||||
|
||||
|
||||
thisEvent=filter->getEventType(buff, ix, iy, cmsub);
|
||||
int gainBits=decoder->getGainBits(buff,ix,iy); // get gain bits
|
||||
|
||||
#ifdef MY_DEBUG
|
||||
if (hitfinder) {
|
||||
if (iev%1000==0)
|
||||
he->SetBinContent(ix+1-xmin, iy+1-ymin, (int)thisEvent);
|
||||
|
||||
//he->SetBinContent(ix+1-xmin, iy+1-ymin, (int)thisEvent); // show single photon hits // original
|
||||
//he->SetBinContent(ix+1-xmin, iy+1-ymin, cmSub->getCommonMode(ix,iy)); //show common mode!
|
||||
he->SetBinContent(iy+1-ymin, ix+1-xmin, (int)gainBits); //show gain bits
|
||||
//he->SetBinContent(ix+1-xmin, iy+1-ymin, (int)gainBits); // rows and columns reversed!!!
|
||||
}
|
||||
#endif
|
||||
|
||||
if (nf>1000) {
|
||||
if (nf>1000) { // only start filing data after 1000 frames
|
||||
|
||||
// h1->Fill(decoder->getValue(buff,ix,iy), iy+NR*ix);
|
||||
h1->Fill(filter->getClusterTotal(1), iy+NR*ix);
|
||||
|
||||
|
||||
|
||||
if (hitfinder) {
|
||||
|
||||
if (thisEvent==PHOTON_MAX ) {
|
||||
|
Reference in New Issue
Block a user