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

Last change on this file since 15787 was 12364, checked in by kraehenb, 13 years ago
New version which is easier to use (by first getting the full calibrated event with FCalibrateEvent). Unfortunately a bit slower...
File size: 2.1 KB
Line 
1#include <cstdio>
2#include "FCalibrateEvent.c"
3#include <numeric>
4int 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[])
5//Data, calibration, data_roi, data_num, data_px, threshold, two histograms
6{
7 UInt_t start_sample = 10;
8 UInt_t end_sample = data_roi-60;
9 UInt_t min_dist = 150;
10 UInt_t integration_size = 10;
11 UInt_t integration_delay = 5;
12
13 vector<float> calevent(data_px*data_roi); //Vector for the calibrated event
14
15 float sample, last_sample, integral;
16 UInt_t drs_calib_offset;
17
18//**********************************************************************************
19 for (size_t i=0; i<datafile.GetNumRows(); i++)
20 {
21 datafile.GetRow(i);
22 cout << "Event number: " << data_num << endl;
23
24 FCalibrateEvent(data, data_offset, drs_basemean, drs_gainmean, drs_triggeroffsetmean, calevent, data_px, data_roi);
25
26 //Iterate over the pixels
27 for (int j=0; j<data_px; j++)
28 {
29// size_t j=pixelnr; //Fix the Pixel to a SoftID
30
31 //Iterate over the slices
32 for (UInt_t k=start_sample; k<end_sample; k++)
33 {
34 if((calevent[j*data_roi+k-1]<threshold)&&(calevent[j*data_roi+k]>threshold))
35 {
36 integral = 0; //std::accumulate(calevent.begin()[k+integration_delay],calevent.begin()[k+integration_delay+integration_size]);
37 for(UInt_t l=integration_delay; l<integration_delay+integration_size; l++)
38 {
39 integral+=calevent[j*data_roi+k+l];
40 }
41// if((integral>60)&&(integral<=300)) {
42// if((integral>60)&&(integral<=300)) {
43 //Iterate for the pulseshape
44// for(Int_t l=-10; l<60; l++)
45// {
46// drs_calib_offset = (k+l+data_offset[j])%data_roi;
47// 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;
48// }
49// }
50 spectrum[j]->Fill(integral);
51 k+=min_dist;
52 }
53 }
54 }
55 }
56 return 0;
57}
Note: See TracBrowser for help on using the repository browser.