more debugging with moench

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorCalibration@20 113b152e-814d-439b-b186-022a431db7b5
This commit is contained in:
bergamaschi 2014-01-20 16:16:08 +00:00
parent df64805059
commit 4d71f07cde
2 changed files with 146 additions and 131 deletions

View File

@ -26,7 +26,7 @@ using namespace std;
#define NR 160
//#define MY_DEBUG 1
#define MY_DEBUG 1
#ifdef MY_DEBUG
#include <TCanvas.h>
#endif
@ -53,7 +53,7 @@ Loops over data file to find single photons, fills the tree (and writes it to fi
*/
THStack *moenchReadData(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=0, int xmax=NC, int ymin=0, int ymax=NR, int cmsub=0) {
THStack *moenchReadData(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=0, int xmax=NC, int ymin=0, int ymax=NR, int cmsub=0, int hitfinder=1) {
moench02ModuleData *decoder=new moench02ModuleData(hc);
moenchCommonMode *cmSub=NULL;
@ -88,7 +88,7 @@ THStack *moenchReadData(char *fformat, char *tit, int runmin, int runmax, int nb
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);
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);
@ -97,6 +97,7 @@ THStack *moenchReadData(char *fformat, char *tit, int runmin, int runmax, int nb
hs->Add(h3);
hs->Add(hetaX);
hs->Add(hetaY);
}
@ -107,27 +108,37 @@ THStack *moenchReadData(char *fformat, char *tit, int runmin, int runmax, int nb
Int_t iFrame;
TTree *tall=filter->initEventTree(tit, &iFrame);
TTree *tall;
if (hitfinder)
tall=filter->initEventTree(tit, &iFrame);
double tot, tl, tr, bl, br, v;
#ifdef MY_DEBUG
TCanvas *myC=new TCanvas();
TH2F *he=new TH2F("he","Event Mask",xmax-xmin, xmin, xmax, ymax-ymin, ymin, ymax);
TCanvas *myC;
TH2F *he;
TCanvas *cH1;
TCanvas *cH2;
TCanvas *cH3;
if (hitfinder) {
myC=new TCanvas();
he=new TH2F("he","Event Mask",xmax-xmin, xmin, xmax, ymax-ymin, ymin, ymax);
he->SetStats(kFALSE);
he->Draw("colz");
TCanvas *cH1=new TCanvas();
cH1=new TCanvas();
cH1->SetLogz();
h1->Draw("colz");
TCanvas *cH2=new TCanvas();
cH2=new TCanvas();
cH2->SetLogz();
h2->Draw("colz");
TCanvas *cH3=new TCanvas();
cH3=new TCanvas();
cH3->SetLogz();
h3->Draw("colz");
}
#endif
filter->newDataSet();
@ -160,17 +171,20 @@ THStack *moenchReadData(char *fformat, char *tit, int runmin, int runmax, int nb
thisEvent=filter->getEventType(buff, ix, iy, cmsub);
#ifdef MY_DEBUG
if (hitfinder) {
if (iev%1000==0)
he->SetBinContent(ix+1-xmin, iy+1-ymin, (int)thisEvent);
}
#endif
if (nf>1000) {
h1->Fill(filter->getClusterElement(0,0), iy+NR*ix);
if (hitfinder) {
tot=0;
tl=0;
tr=0;
bl=0;
br=0;
h1->Fill(filter->getClusterElement(0,0), iy+NR*ix);
// if (nf%1000==0 && ix==20 && iy==20) cout << " val="<< decoder->getClusterElement(0,0)<< endl;
@ -256,6 +270,7 @@ THStack *moenchReadData(char *fformat, char *tit, int runmin, int runmax, int nb
}
}
}
//////////////////////////////////////////////////////////
@ -272,9 +287,9 @@ THStack *moenchReadData(char *fformat, char *tit, int runmin, int runmax, int nb
}
iev++;
#endif
nf++;
cout << "=" ;
nf++;
delete [] buff;
}
cout << nph << endl;
@ -283,6 +298,7 @@ THStack *moenchReadData(char *fformat, char *tit, int runmin, int runmax, int nb
else
cout << "could not open file " << fname << endl;
}
if (hitfinder)
tall->Write(tall->GetName(),TObject::kOverwrite);

View File

@ -9,7 +9,7 @@
#include "commonModeSubtraction.h"
/*#define MYROOT1*/
#define MYROOT1
#ifdef MYROOT1
#include <TTree.h>
@ -198,7 +198,7 @@ class singlePhotonDetector {
if (eventMask[iy][ix]==UNDEFINED) {
// if (eventMask[iy][ix]==UNDEFINED) {
eventMask[iy][ix]=PEDESTAL;
@ -229,28 +229,27 @@ class singlePhotonDetector {
if (eventMask[iy][ix]!=PHOTON && tot>sqrt(clusterSizeY*clusterSize)*nSigma*cluster->rms) {
eventMask[iy][ix]=NEIGHBOUR;
} else if (eventMask[iy][ix]==PHOTON) {
if (cluster->get_data(0,0)>=max) {
eventMask[iy][ix]=PHOTON_MAX;
/* if (iframe%1000==0) { */
/* for (int ir=-(clusterSizeY/2); ir<(clusterSizeY/2)+1; ir++) { */
/* for (int ic=-(clusterSize/2); ic<(clusterSize/2)+1; ic++) { */
/* if ((iy+ir)>=0 && (iy+ir)<ny && (ix+ic)>=0 && (ix+ic)<nx) { */
/* if (eventMask[iy+ir][ix+ic]==UNDEFINED) */
/* eventMask[iy+ir][ix+ic]=NEIGHBOUR; */
/* } */
/* /\* if (eventMask[iy+ir][ix+ic]==UNDEFINED) *\/ */
/* /\* eventMask[iy+ir][ix+ic]=NEIGHBOUR; *\/ */
/* cout << cluster->get_data(ic,ir) << " "; */
/* } */
/* } */
/* } */
/* cout << endl;; */
/* } */
}
} else if (eventMask[iy][ix]==PEDESTAL) {
if (cm==0)
addToPedestal(det->getValue(data, ix, iy),ix,iy);
}
}
// }
return eventMask[iy][ix];