source: fact/tools/rootmacros/DrsCalibration.C@ 12383

Last change on this file since 12383 was 12383, checked in by neise, 13 years ago
Now the first 12 and the last 12 slices wil be removed from Ameas
  • Property svn:executable set to *
File size: 1.7 KB
Line 
1
2
3float getValue( int slice, int pixel,
4 vector<float> &drs_basemean,
5 vector<float> &drs_gainmean,
6 vector<float> &drs_triggeroffsetmean,
7 UInt_t RegionOfInterest,
8 vector<int16_t> AllPixelDataVector,
9 vector<int16_t> StartCellVector
10){
11 const float dconv = 2000/4096.0;
12
13 float vraw, vcal;
14
15 unsigned int pixel_pt;
16 unsigned int slice_pt;
17 unsigned int cal_pt;
18 unsigned int drs_cal_offset;
19
20 // printf("pixel = %d, slice = %d\n", slice, pixel);
21
22 pixel_pt = pixel * RegionOfInterest;
23 slice_pt = pixel_pt + slice;
24 drs_cal_offset = ( slice + StartCellVector[ pixel ] )%RegionOfInterest;
25 cal_pt = pixel_pt + drs_cal_offset;
26
27 vraw = AllPixelDataVector[ slice_pt ] * dconv;
28 vcal = ( vraw - drs_basemean[ cal_pt ] - drs_triggeroffsetmean[ slice_pt ] ) / drs_gainmean[ cal_pt ]*1907.35;
29
30 return( vcal );
31}
32
33size_t applyDrsCalibration( vector<float> &destination,
34 int pixel,
35 int LeaveOutLeft,
36 int LeaveOutRight,
37 vector<float> &drs_basemean,
38 vector<float> &drs_gainmean,
39 vector<float> &drs_triggeroffsetmean,
40 UInt_t RegionOfInterest,
41 vector<int16_t> AllPixelDataVector,
42 vector<int16_t> StartCellVector
43){
44 destination.clear();
45 const float dconv = 2000/4096.0;
46 float vraw, vcal;
47 unsigned int pixel_pt;
48 unsigned int slice_pt;
49 unsigned int cal_pt;
50 unsigned int drs_cal_offset;
51
52 pixel_pt = pixel * RegionOfInterest;
53
54
55 for ( unsigned int sl = LeaveOutLeft; sl < RegionOfInterest-LeaveOutRight ; sl++){
56 slice_pt = pixel_pt + sl;
57 drs_cal_offset = ( sl + StartCellVector[ pixel ] )%RegionOfInterest;
58 cal_pt = pixel_pt + drs_cal_offset;
59
60 vraw = AllPixelDataVector[ slice_pt ] * dconv;
61 vcal = ( vraw - drs_basemean[ cal_pt ] - drs_triggeroffsetmean[ slice_pt ] ) / drs_gainmean[ cal_pt ]*1907.35;
62
63 destination.push_back(vcal);
64 }
65
66 return destination.size();
67}
Note: See TracBrowser for help on using the repository browser.