source: fact/tools/rootmacros/FOscilloscopeAllPx.c@ 12198

Last change on this file since 12198 was 12166, checked in by neise, 13 years ago
initial commit
File size: 2.6 KB
Line 
1#include <cstdio>
2int FOscilloscopeAllPx(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, float threshold, TH1F* spectrum[])
3//Data, calibration, data_roi, data_num, data_px, threshold, two histograms
4{
5 UInt_t start_sample = 10;
6 UInt_t end_sample = data_roi-60;
7 UInt_t min_dist = 150;
8 UInt_t integration_size = 10;
9 UInt_t integration_delay = 5;
10
11 float sample, last_sample, integral;
12 UInt_t drs_calib_offset;
13
14//**********************************************************************************
15 for (size_t i=0; i<datafile.GetNumRows(); i++)
16 {
17 datafile.GetRow(i);
18 cout << "Event number: " << data_num << endl;
19
20 //Iterate over the pixels
21 for (int j=0; j<data_px; j++)
22 {
23// size_t j=pixelnr; //Fix the Pixel to a SoftID
24
25 //Iterate over the slices
26 drs_calib_offset = (start_sample-1+data_offset[j])%data_roi;
27 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;
28 for (UInt_t k=start_sample; k<end_sample; k++)
29 {
30 drs_calib_offset = (k+data_offset[j])%data_roi;
31 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;
32 if((last_sample<threshold)&&(sample>threshold))
33 {
34 integral = 0;
35 for(UInt_t l=integration_delay; l<integration_delay+integration_size; l++)
36 {
37 drs_calib_offset = (k+l+data_offset[j])%data_roi;
38 integral+=(data[j*data_roi+k+l]*2000/4096.-drs_basemean[j*data_roi+drs_calib_offset]-drs_triggeroffsetmean[j*data_roi+k+l])/drs_gainmean[j*data_roi+drs_calib_offset]*1907.35;
39 }
40// if((integral>60)&&(integral<=300)) {
41// if((integral>60)&&(integral<=300)) {
42 //Iterate for the pulseshape
43// for(Int_t l=-10; l<60; l++)
44// {
45// drs_calib_offset = (k+l+data_offset[j])%data_roi;
46// sample = (data[j*data_roi+k+l]*2000/4096.-drs_basemean[j*data_roi+drs_calib_offset]-drs_triggeroffsetmean[j*data_roi+k+l])/drs_gainmean[j*data_roi+drs_calib_offset]*1907.35;
47// }
48// }
49 spectrum[j]->Fill(integral);
50 k+=min_dist;
51 }
52 //TBD: mistake that after the deadtime the last_sample must be set new...
53 //Solution: first process full pipeline
54 last_sample = sample;
55 }
56 }
57 }
58 return 0;
59}
Note: See TracBrowser for help on using the repository browser.