source: fact/tools/rootmacros/FOscilloscope.c@ 16336

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