Rev 39 | Rev 47 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 39 | Rev 40 | ||
---|---|---|---|
Line 101... | Line 101... | ||
101 | 101 | ||
102 | // ------------------------------------------------------------------------------ |
102 | // ------------------------------------------------------------------------------ |
103 | 103 | ||
104 | int analysisBias(char* dfile0="test", int dbg=0, double tdcCut=5.0) |
104 | int analysisBias(char* dfile0="test", int dbg=0, double tdcCut=5.0) |
105 | { |
105 | { |
106 | const double c_tdcOffset = |
106 | const double c_tdcOffset = 368*TDC_BIN; // ns |
107 | 107 | ||
108 | 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"); |
109 | 109 | ||
110 | char fullname[256]; |
110 | char fullname[256]; |
111 | char sbuff[256]; |
111 | char sbuff[256]; |
Line 238... | Line 238... | ||
238 | 238 | ||
239 | //sprintf(hname, "htdc"); |
239 | //sprintf(hname, "htdc"); |
240 | //htdc = (TH2F*) gROOT->FindObject(hname); |
240 | //htdc = (TH2F*) gROOT->FindObject(hname); |
241 | //if (htdc) delete htdc; |
241 | //if (htdc) delete htdc; |
242 | //htdc = new TH2F("htdc",";TDC channel;SiPM channel",512,0,512,NCH,0,NCH); |
242 | //htdc = new TH2F("htdc",";TDC channel;SiPM channel",512,0,512,NCH,0,NCH); |
243 | h_correctedTDC = (TH3F*) gROOT->FindObject("h_correctedTDC"); |
- | |
244 | if (h_correctedTDC) delete h_correctedTDC; |
- | |
245 | nSteps = (run.thUp - run.thLow)/double(run.thStep) + 1; |
- | |
246 | if (dbg) printf("nSteps %d\n", nSteps); |
- | |
247 | h_correctedTDC = new TH3F("h_correctedTDC",";SiPM channel; ASD threshold [V]; t [ns]", |
- | |
248 |
|
243 | |
249 | -0.5, |
- | |
250 | NCH-0.5, |
- | |
251 | nSteps, |
- | |
252 | (run.thLow - 0.5*run.thStep)/1000.0, |
- | |
253 | (run.thUp + 0.5*run.thStep)/1000.0, |
- | |
254 | 2*tdcCut*TDC_BIN, |
- | |
255 | -tdcCut*TDC_BIN, |
- | |
256 | tdcCut*TDC_BIN); |
- | |
257 | //TH1F* gsumV673A[NCH/16] = new TH1F(hn,hname,256,-0.5,255.5); |
244 | //TH1F* gsumV673A[NCH/16] = new TH1F(hn,hname,256,-0.5,255.5); |
258 | for(int i=0; i<NCH; i++) { |
245 | for(int i=0; i<NCH; i++) { |
259 | /* |
246 | /* |
260 | sprintf(hname, "htdcpos%d", i); |
247 | sprintf(hname, "htdcpos%d", i); |
261 | htdcpos[i] = (TH1F*)gROOT->FindObject(hname); |
248 | htdcpos[i] = (TH1F*)gROOT->FindObject(hname); |
Line 294... | Line 281... | ||
294 | (run.y0 - OFFSETY - 0.5*run.dy)*MIKRO_BIN, |
281 | (run.y0 - OFFSETY - 0.5*run.dy)*MIKRO_BIN, |
295 | (run.y0 - OFFSETY + (run.ny-0.5)*run.dy)*MIKRO_BIN); |
282 | (run.y0 - OFFSETY + (run.ny-0.5)*run.dy)*MIKRO_BIN); |
296 | } |
283 | } |
297 | 284 | ||
298 | nBiasSteps = (run.biasUp - run.biasLow)/double(run.biasStep) + 1; |
285 | nBiasSteps = (run.biasUp - run.biasLow)/double(run.biasStep) + 1; |
- | 286 | ||
- | 287 | h_correctedTDC = (TH3F*) gROOT->FindObject("h_correctedTDC"); |
|
- | 288 | if (h_correctedTDC) delete h_correctedTDC; |
|
- | 289 | nSteps = (run.thUp - run.thLow)/double(run.thStep) + 1; |
|
- | 290 | if (dbg) printf("nSteps %d\n", nSteps); |
|
- | 291 | h_correctedTDC = new TH3F("h_correctedTDC",";SiPM channel; ASD threshold [V]; t [ns]", |
|
- | 292 | NCH, |
|
- | 293 | -0.5, |
|
- | 294 | NCH-0.5, |
|
- | 295 | nBiasSteps, |
|
- | 296 | (run.biasLow - 0.5*run.biasStep)/1000.0, |
|
- | 297 | (run.biasUp + 0.5*run.biasStep)/1000.0, |
|
- | 298 | 2*tdcCut+1, |
|
- | 299 | -tdcCut*TDC_BIN - 0.5*TDC_BIN, |
|
- | 300 | tdcCut*TDC_BIN + 0.5*TDC_BIN); |
|
- | 301 | ||
299 | h_bias = (TH2F*) gROOT->FindObject("h_bias"); |
302 | h_bias = (TH2F*) gROOT->FindObject("h_bias"); |
300 | if (h_bias) delete h_bias; |
303 | if (h_bias) delete h_bias; |
301 | h_bias = new TH2F("h_bias",";Channel; Bias [V]", 64, -0.5, 63.5, |
304 | h_bias = new TH2F("h_bias",";Channel; Bias [V]", 64, -0.5, 63.5, |
302 | nBiasSteps, |
305 | nBiasSteps, |
303 | (run.biasLow - 0.5*run.biasStep)/1000.0, |
306 | (run.biasLow - 0.5*run.biasStep)/1000.0, |
Line 390... | Line 393... | ||
390 | if (dbg) nt->Fill(channel, pos.ix, pos.iy, data); |
393 | if (dbg) nt->Fill(channel, pos.ix, pos.iy, data); |
391 | double tdcmin = tdcOffset[channel] - tdcCut; |
394 | double tdcmin = tdcOffset[channel] - tdcCut; |
392 | double tdcmax = tdcOffset[channel] + tdcCut; |
395 | double tdcmax = tdcOffset[channel] + tdcCut; |
393 | double time = data*TDC_BIN - tdcOffset[channel]; |
396 | double time = data*TDC_BIN - tdcOffset[channel]; |
394 | if(time >= -tdcCut and time <= tdcCut) { |
397 | if(time >= -tdcCut and time <= tdcCut) { |
395 | h_correctedTDC->Fill(channel, |
398 | h_correctedTDC->Fill(channel, bias.bias/1000.0, time); |
396 | hnhitsx[channel]->Fill((pos.xset - OFFSETX) * MIKRO_BIN); |
399 | hnhitsx[channel]->Fill((pos.xset - OFFSETX) * MIKRO_BIN); |
397 | hnhitsy[channel]->Fill((pos.yset - OFFSETY) * MIKRO_BIN); |
400 | hnhitsy[channel]->Fill((pos.yset - OFFSETY) * MIKRO_BIN); |
398 | h2d[channel]->Fill((pos.xset - OFFSETX) * MIKRO_BIN, (pos.yset - OFFSETY) * MIKRO_BIN); |
401 | h2d[channel]->Fill((pos.xset - OFFSETX) * MIKRO_BIN, (pos.yset - OFFSETY) * MIKRO_BIN); |
399 | 402 | ||
400 | if (position(pos.xset-OFFSETX, pos.yset-OFFSETY, channel)) { |
403 | if (position(pos.xset-OFFSETX, pos.yset-OFFSETY, channel)) { |
Line 495... | Line 498... | ||
495 | } |
498 | } |
496 | 499 | ||
497 | int position(int x, int y, int channel) |
500 | int position(int x, int y, int channel) |
498 | { |
501 | { |
499 | int flag = 0; |
502 | int flag = 0; |
500 | if ( (x > (padCenter[channel][0] - |
503 | if ( (x > (padCenter[channel][0] - 5040)) and (x < (padCenter[channel][0] + 5040)) and |
501 | (y > (padCenter[channel][1] - |
504 | (y > (padCenter[channel][1] - 5040)) and (y < (padCenter[channel][1] + 5040)) ) flag = 1; |
502 | return flag; |
505 | return flag; |
503 | } |
506 | } |