1 | #include <cstdio>
|
---|
2 | int FIntFixedPosAllPx(fits &datafile, vector<int16_t> &data, vector<int16_t> &data_offset, unsigned int &data_num, UInt_t data_px, vector<float> &drs_basemean, vector<float> &drs_gainmean, vector<float> &drs_triggeroffsetmean, UInt_t data_roi, UInt_t integration_size, UInt_t integration_delay, TH1F* spectrum[])
|
---|
3 | //Data, calibration, data_roi, data_num, data_px, threshold, two histograms
|
---|
4 | {
|
---|
5 | // UInt_t integration_size = 5;
|
---|
6 | // UInt_t integration_delay = 238;
|
---|
7 |
|
---|
8 | // float sample, last_sample, integral;
|
---|
9 | float integral;
|
---|
10 | UInt_t drs_calib_offset;
|
---|
11 |
|
---|
12 | //**********************************************************************************
|
---|
13 | for (size_t i=0; (i<datafile.GetNumRows()) && (i<100000); i++)
|
---|
14 | {
|
---|
15 | datafile.GetRow(i);
|
---|
16 | cout << "Event number: " << data_num << endl;
|
---|
17 |
|
---|
18 | //Iterate over the pixels
|
---|
19 | for (int j=0; j<data_px; j++)
|
---|
20 | {
|
---|
21 | // size_t j=pixelnr; //Fix the Pixel to a SoftID
|
---|
22 |
|
---|
23 | //Integrate
|
---|
24 | integral = 0;
|
---|
25 | for(UInt_t l=integration_delay; l<integration_delay+integration_size; l++)
|
---|
26 | {
|
---|
27 | drs_calib_offset = (l+data_offset[j])%data_roi;
|
---|
28 | integral+=(data[j*data_roi+l]*2000/4096.-drs_basemean[j*data_roi+drs_calib_offset]-drs_triggeroffsetmean[j*data_roi+l])/drs_gainmean[j*data_roi+drs_calib_offset]*1907.35;
|
---|
29 | }
|
---|
30 | spectrum[j]->Fill(integral);
|
---|
31 | // for(Int_t l=-10; l<60; l++)
|
---|
32 | // {
|
---|
33 | // drs_calib_offset = (l+data_offset[j])%data_roi;
|
---|
34 | // sample = (data[j*data_roi+l]*2000/4096.-drs_basemean[j*data_roi+drs_calib_offset]-drs_triggeroffsetmean[j*data_roi+l])/drs_gainmean[j*data_roi+drs_calib_offset]*1907.35;
|
---|
35 | // }
|
---|
36 | // k+=min_dist;
|
---|
37 | //
|
---|
38 | // drs_calib_offset = (start_sample-1+data_offset[j])%data_roi;
|
---|
39 | // last_sample = (data[j*data_roi+start_sample-1]*2000/4096.-drs_basemean[j*data_roi+drs_calib_offset]-drs_triggeroffsetmean[j*data_roi+start_sample-1])/drs_gainmean[j*data_roi+drs_calib_offset]*1907.35;
|
---|
40 | // for (UInt_t k=start_sample; k<end_sample; k++)
|
---|
41 | // {
|
---|
42 | // drs_calib_offset = (k+data_offset[j])%data_roi;
|
---|
43 | // sample = (data[j*data_roi+k]*2000/4096.-drs_basemean[j*data_roi+drs_calib_offset]-drs_triggeroffsetmean[j*data_roi+k])/drs_gainmean[j*data_roi+drs_calib_offset]*1907.35;
|
---|
44 | // if((last_sample<threshold)&&(sample>threshold))
|
---|
45 | // {
|
---|
46 | // }
|
---|
47 | // //TBD: mistake that after the deadtime the last_sample must be set new...
|
---|
48 | // //Solution: first process full pipeline
|
---|
49 | // last_sample = sample;
|
---|
50 | // }
|
---|
51 | }
|
---|
52 | }
|
---|
53 | return 0;
|
---|
54 | }
|
---|