Subversion Repositories f9daq

Compare Revisions

Ignore whitespace Rev 33 → Rev 34

/sipmScan/src/analysisBias.cpp
38,12 → 38,14
#define POSREC_ID 3
#define EVTREC_ID 4
#define THRREC_ID 5
#define BIASREC_ID 6
 
typedef struct {
unsigned int id,len;
unsigned int fver,time;
unsigned int thLow, thUp, thStep;
unsigned int biasLow, biasUp, biasStep;
unsigned int nev,nch,ped,xy;
unsigned int thLow, thUp, thStep;
int nx,x0,dx,ny,y0,dy;
} RUNREC;
RUNREC *runrec;
83,6 → 85,14
THRREC *thrrec;
THRREC thr;
 
typedef struct {
unsigned int id;
unsigned int len;
unsigned int bias;
} BIASREC;
BIASREC *biasrec;
BIASREC bias;
 
double padCenter[NCH][2];
 
int position(int, int, int);
89,7 → 99,7
 
// ------------------------------------------------------------------------------
 
int d2r(char* dfile0="test", int dbg=0, double tdcCut=5.0)
int analysisBias(char* dfile0="test", int dbg=0, double tdcCut=5.0)
{
 
const double c_tdcOffset = +2.5; // ns
162,6 → 172,7
TH2F *h2d[NCH];
TH2F *h_threshold;
TH2F *h_ch33;
TH2F *h_bias;
TNtuple *nt;
247,6 → 258,7
printf("nx = %d, x0 = %d, dx = %d\n", run.nx, run.x0, run.dx);
printf("ny = %d, y0 = %d, dy = %d\n", run.ny, run.y0, run.dy);
printf("thLow = %d, thUp = %d, thStep = %d\n", run.thLow, run.thUp, run.thStep);
printf("biasLow = %d, biasUp = %d, biasStep = %d\n", run.biasLow, run.biasUp, run.biasStep);
}
//create histograms
259,6 → 271,7
if (h_correctedTDC) delete h_correctedTDC;
h_correctedTDC = new TH2F("h_correctedTDC","Corrected TDC;t [ns];SiPM channel",33, -16.5*TDC_BIN,16.5*TDC_BIN,NCH,0,NCH);
//TH1F* gsumV673A[NCH/16] = new TH1F(hn,hname,256,-0.5,255.5);
h_bias = new TH2F("h_bias","",20, 71.0, 73.0, 33, -16.5*TDC_BIN, 16.5*TDC_BIN);
for(int i=0; i<NCH; i++) {
/*
sprintf(hname, "htdcpos%d", i);
393,6 → 406,7
hnhitsy[channel]->Fill((pos.yset - OFFSETY) * MIKRO_BIN);
h2d[channel]->Fill((pos.xset - OFFSETX) * MIKRO_BIN, (pos.yset - OFFSETY) * MIKRO_BIN);
//h_threshold->Fill(channel, thr.threshold);
h_bias->Fill(bias.bias/1000.0, (time-tdcOffset[channel]));
if (position(pos.xset-OFFSETX, pos.yset-OFFSETY, channel)) {
h_ch33->Fill(pos.xset-OFFSETX, pos.yset-OFFSETY);
h_threshold->Fill(channel, thr.threshold);
450,6 → 464,14
if (dbg) printf("THRREC id = %d len = %d threshold %d\n",
thrrec->id, thrrec->len, thrrec->threshold);
break;
case BIASREC_ID:
status = gzread(dfp, (voidp)&readbuf[2], (rec_len-2*ulsize));
biasrec = (BIASREC*) readbuf;
bias = *biasrec;
if (dbg) printf("BIASREC id = %d len = %d bias %d\n",
bias.id, bias.len, bias.bias);
break;
case ENDREC_ID:
gzread(dfp, (voidp)&readbuf[2], (rec_len-2*ulsize));