Rev 35 | Rev 39 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 35 | Rev 36 | ||
|---|---|---|---|
| Line 38... | Line 38... | ||
| 38 | #define RUNREC_ID 1 |
38 | #define RUNREC_ID 1 |
| 39 | #define ENDREC_ID 2 |
39 | #define ENDREC_ID 2 |
| 40 | #define POSREC_ID 3 |
40 | #define POSREC_ID 3 |
| 41 | #define EVTREC_ID 4 |
41 | #define EVTREC_ID 4 |
| 42 | #define THRREC_ID 5 |
42 | #define THRREC_ID 5 |
| - | 43 | #define BIASREC_ID 6 |
|
| 43 | 44 | ||
| 44 | typedef struct { |
45 | typedef struct { |
| 45 | unsigned int id,len; |
46 | unsigned int id,len; |
| 46 | unsigned int fver,time; |
47 | unsigned int fver,time; |
| 47 | unsigned int nev,nch,ped,xy; |
- | |
| 48 | unsigned int thLow, thUp, thStep; |
48 | unsigned int thLow, thUp, thStep; |
| - | 49 | unsigned int biasLow, biasUp, biasStep; |
|
| - | 50 | unsigned int nev,nch,ped,xy; |
|
| 49 | int nx,x0,dx,ny,y0,dy; |
51 | int nx,x0,dx,ny,y0,dy; |
| 50 | } RUNREC; |
52 | } RUNREC; |
| 51 | RUNREC *runrec; |
53 | RUNREC *runrec; |
| 52 | RUNREC run; |
54 | RUNREC run; |
| 53 | 55 | ||
| Line 74... | Line 76... | ||
| 74 | unsigned int id; |
76 | unsigned int id; |
| 75 | unsigned int len; |
77 | unsigned int len; |
| 76 | unsigned int nev; |
78 | unsigned int nev; |
| 77 | } EVTREC; |
79 | } EVTREC; |
| 78 | EVTREC *evtrec; |
80 | EVTREC *evtrec; |
| 79 | 81 | ||
| 80 | typedef struct { |
82 | typedef struct { |
| 81 | unsigned int id; |
83 | unsigned int id; |
| 82 | unsigned int len; |
84 | unsigned int len; |
| 83 | unsigned int threshold; |
85 | unsigned int threshold; |
| 84 | } THRREC; |
86 | } THRREC; |
| 85 | THRREC *thrrec; |
87 | THRREC *thrrec; |
| 86 | THRREC thr; |
88 | THRREC thr; |
| - | 89 | ||
| - | 90 | typedef struct { |
|
| - | 91 | unsigned int id; |
|
| - | 92 | unsigned int len; |
|
| - | 93 | unsigned int bias; |
|
| - | 94 | } BIASREC; |
|
| - | 95 | BIASREC *biasrec; |
|
| - | 96 | BIASREC bias; |
|
| 87 | 97 | ||
| 88 | double padCenter[NCH][2]; |
98 | double padCenter[NCH][2]; |
| 89 | 99 | ||
| 90 | int position(int, int, int); |
100 | int position(int, int, int); |
| 91 | 101 | ||
| 92 | // ------------------------------------------------------------------------------ |
102 | // ------------------------------------------------------------------------------ |
| 93 | 103 | ||
| 94 | int |
104 | int analysisBias(char* dfile0="test", int dbg=0, double tdcCut=5.0) |
| 95 | { |
105 | { |
| 96 | const double c_tdcOffset = 1; // ns |
106 | const double c_tdcOffset = 1; // ns |
| 97 | 107 | ||
| 98 | printf(" Data to root conversion program\nUsage:\nd2r(input file name <without.dat>, debug on/off, TDC cut +-[ns])\n\n"); |
108 | printf(" Data to root conversion program\nUsage:\nd2r(input file name <without.dat>, debug on/off, TDC cut +-[ns])\n\n"); |
| 99 | 109 | ||
| Line 182... | Line 192... | ||
| 182 | 101, 1.0, 2.0, |
192 | 101, 1.0, 2.0, |
| 183 | 33, -16.5*TDC_BIN, 16.5*TDC_BIN); |
193 | 33, -16.5*TDC_BIN, 16.5*TDC_BIN); |
| 184 | TH1F* hnhitsx[NCH]; // move to 2d with (channel, position) |
194 | TH1F* hnhitsx[NCH]; // move to 2d with (channel, position) |
| 185 | TH1F* hnhitsy[NCH]; //-||- |
195 | TH1F* hnhitsy[NCH]; //-||- |
| 186 | TH2F* h2d[NCH]; //-||- |
196 | TH2F* h2d[NCH]; //-||- |
| - | 197 | TH2F* h_bias = new TH2F("h_bias", "", 64, 0, 63, 20, 71.0,73.0); |
|
| 187 | TH2F* h_threshold = new TH2F("h_threshold",";SiPM ch;Threshold[V]", |
198 | TH2F* h_threshold = new TH2F("h_threshold",";SiPM ch;Threshold[V]", |
| 188 | 64,-0.5,63.5, |
199 | 64,-0.5,63.5, |
| 189 | 101, 1.0, 2.0); |
200 | 101, 1.0, 2.0); |
| 190 | TH2F* h_ch33 = new TH2F("h_ch33","ch. 33;x;y",100,20000,30000,100,0,10000); |
201 | TH2F* h_ch33 = new TH2F("h_ch33","ch. 33;x;y",100,20000,30000,100,0,10000); |
| 191 | TNtuple* nt = new TNtuple("nt", "nt", "ch:x:y:tdc"); |
202 | TNtuple* nt = new TNtuple("nt", "nt", "ch:x:y:tdc"); |
| Line 199... | Line 210... | ||
| 199 | 210 | ||
| 200 | 211 | ||
| 201 | if(dbg) printf("-----------------------------------------------\n"); |
212 | if(dbg) printf("-----------------------------------------------\n"); |
| 202 | if(dbg) printf("[%d] rec_id = %d | rec_len = %u\n", ceve, rec_id, rec_len); |
213 | if(dbg) printf("[%d] rec_id = %d | rec_len = %u\n", ceve, rec_id, rec_len); |
| 203 | 214 | ||
| 204 |
|
215 | int nSteps = 0; |
| - | 216 | int nBiasSteps = 0; |
|
| - | 217 | ||
| 205 | switch(rec_id) |
218 | switch(rec_id) |
| 206 | { |
219 | { |
| 207 | case RUNREC_ID: |
220 | case RUNREC_ID: |
| 208 | if (dbg) printf("RUNREC\n"); |
221 | if (dbg) printf("RUNREC\n"); |
| 209 | gzread(dfp, (voidp)&readbuf[2], (rec_len-2*ulsize)); |
222 | gzread(dfp, (voidp)&readbuf[2], (rec_len-2*ulsize)); |
| Line 279... | Line 292... | ||
| 279 | (run.x0 - OFFSETX + (run.nx-0.5)*run.dx)*MIKRO_BIN, |
292 | (run.x0 - OFFSETX + (run.nx-0.5)*run.dx)*MIKRO_BIN, |
| 280 | run.ny, |
293 | run.ny, |
| 281 | (run.y0 - OFFSETY - 0.5*run.dy)*MIKRO_BIN, |
294 | (run.y0 - OFFSETY - 0.5*run.dy)*MIKRO_BIN, |
| 282 | (run.y0 - OFFSETY + (run.ny-0.5)*run.dy)*MIKRO_BIN); |
295 | (run.y0 - OFFSETY + (run.ny-0.5)*run.dy)*MIKRO_BIN); |
| 283 | } |
296 | } |
| - | 297 | ||
| - | 298 | nBiasSteps = (run.biasUp - run.biasLow)/double(run.biasStep) + 1; |
|
| - | 299 | h_bias = (TH2F*) gROOT->FindObject("h_bias"); |
|
| - | 300 | if (h_bias) delete h_bias; |
|
| - | 301 | h_bias = new TH2F("h_bias",";Channel; Bias [V]", 64, -0.5, 63.5, |
|
| - | 302 | nBiasSteps, |
|
| - | 303 | (run.biasLow - 0.5*run.biasStep)/1000.0, |
|
| - | 304 | (run.biasUp + 0.5*run.biasStep)/1000.0); |
|
| - | 305 | ||
| 284 | 306 | ||
| 285 | if (h_threshold) delete h_threshold; |
307 | if (h_threshold) delete h_threshold; |
| 286 | h_threshold = new TH2F("h_threshold",";SiPM ch;Threshold[V]",64,-0.5,63.5, |
308 | h_threshold = new TH2F("h_threshold",";SiPM ch;Threshold[V]",64,-0.5,63.5, |
| 287 | nSteps, |
309 | nSteps, |
| 288 | (run.thLow - 0.5*run.thStep)/1000.0, |
310 | (run.thLow - 0.5*run.thStep)/1000.0, |
| Line 375... | Line 397... | ||
| 375 | hnhitsy[channel]->Fill((pos.yset - OFFSETY) * MIKRO_BIN); |
397 | hnhitsy[channel]->Fill((pos.yset - OFFSETY) * MIKRO_BIN); |
| 376 | h2d[channel]->Fill((pos.xset - OFFSETX) * MIKRO_BIN, (pos.yset - OFFSETY) * MIKRO_BIN); |
398 | h2d[channel]->Fill((pos.xset - OFFSETX) * MIKRO_BIN, (pos.yset - OFFSETY) * MIKRO_BIN); |
| 377 | 399 | ||
| 378 | if (position(pos.xset-OFFSETX, pos.yset-OFFSETY, channel)) { |
400 | if (position(pos.xset-OFFSETX, pos.yset-OFFSETY, channel)) { |
| 379 | h_ch33->Fill(pos.xset-OFFSETX, pos.yset-OFFSETY); |
401 | h_ch33->Fill(pos.xset-OFFSETX, pos.yset-OFFSETY); |
| 380 | h_threshold->Fill(channel, thr.threshold/1000.0); |
402 | h_threshold->Fill(channel, thr.threshold/1000.0); |
| - | 403 | h_bias->Fill(channel, bias.bias/1000.0); |
|
| 381 | } |
404 | } |
| 382 | } |
405 | } |
| 383 | //gV673A->Fill(data,channel); |
406 | //gV673A->Fill(data,channel); |
| 384 | //gsumV673A[channel/16]->Fill(data); |
407 | //gsumV673A[channel/16]->Fill(data); |
| 385 | } |
408 | } |
| Line 401... | Line 424... | ||
| 401 | break; |
424 | break; |
| 402 | 425 | ||
| 403 | case ENDREC_ID: |
426 | case ENDREC_ID: |
| 404 | gzread(dfp, (voidp)&readbuf[2], (rec_len-2*ulsize)); |
427 | gzread(dfp, (voidp)&readbuf[2], (rec_len-2*ulsize)); |
| 405 | endrec = (ENDREC *) readbuf; |
428 | endrec = (ENDREC *) readbuf; |
| - | 429 | ||
| - | 430 | case BIASREC_ID: |
|
| - | 431 | status = gzread(dfp, (voidp)&readbuf[2], (rec_len-2*ulsize)); |
|
| - | 432 | biasrec = (BIASREC*) readbuf; |
|
| - | 433 | bias = *biasrec; |
|
| - | 434 | if (dbg) printf("BIASREC id = %d len = %d bias %d\n", |
|
| - | 435 | bias.id, bias.len, bias.bias); |
|
| - | 436 | break; |
|
| 406 | 437 | ||
| 407 | if(dbg) { |
438 | if(dbg) { |
| 408 | printf("ENDREC_ID\n"); |
439 | printf("ENDREC_ID\n"); |
| 409 | printf("id = %d, len = %d, time = %d\n", endrec->id, endrec->len, endrec->time); |
440 | printf("id = %d, len = %d, time = %d\n", endrec->id, endrec->len, endrec->time); |
| 410 | } else printf(" ENDREC\n"); |
441 | } else printf(" ENDREC\n"); |