Ignore:
Timestamp:
11/02/11 15:19:45 (13 years ago)
Author:
kraehenb
Message:
New version which is easier to use (by first getting the full calibrated event with FCalibrateEvent). Unfortunately a bit slower...
File:
1 edited

Legend:

Unmodified
Added
Removed
  • fact/tools/rootmacros/FOscilloscopeAllPx.c

    r12166 r12364  
    11#include <cstdio>
     2#include "FCalibrateEvent.c"
     3#include <numeric>
    24int 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[])
    35//Data, calibration, data_roi, data_num, data_px, threshold, two histograms
     
    810        UInt_t integration_size = 10;
    911        UInt_t integration_delay = 5;
     12       
     13        vector<float> calevent(data_px*data_roi); //Vector for the calibrated event
    1014       
    1115        float sample, last_sample, integral;
     
    1822                cout << "Event number: " << data_num << endl;
    1923               
     24                FCalibrateEvent(data, data_offset, drs_basemean, drs_gainmean, drs_triggeroffsetmean, calevent, data_px, data_roi);
     25               
    2026                //Iterate over the pixels
    2127                for (int j=0; j<data_px; j++)
     
    2430               
    2531                        //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;
    2832                        for (UInt_t k=start_sample; k<end_sample; k++)
    2933                        {
    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))
     34                                if((calevent[j*data_roi+k-1]<threshold)&&(calevent[j*data_roi+k]>threshold))
    3335                                {
    34                                         integral = 0;
     36                                        integral = 0; //std::accumulate(calevent.begin()[k+integration_delay],calevent.begin()[k+integration_delay+integration_size]);
    3537                                        for(UInt_t l=integration_delay; l<integration_delay+integration_size; l++)
    3638                                        {
    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                                                integral+=calevent[j*data_roi+k+l];
    3940                                        }
    4041//                                      if((integral>60)&&(integral<=300)) {
     
    5051                                        k+=min_dist;
    5152                                }
    52                                 //TBD: mistake that after the deadtime the last_sample must be set new...
    53                                 //Solution: first process full pipeline
    54                                 last_sample = sample;
    5553                        }
    5654                }
Note: See TracChangeset for help on using the changeset viewer.