Changeset 12364 for fact/tools
- Timestamp:
- 11/02/11 15:19:45 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/rootmacros/FOscilloscopeAllPx.c
r12166 r12364 1 1 #include <cstdio> 2 #include "FCalibrateEvent.c" 3 #include <numeric> 2 4 int 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 5 //Data, calibration, data_roi, data_num, data_px, threshold, two histograms … … 8 10 UInt_t integration_size = 10; 9 11 UInt_t integration_delay = 5; 12 13 vector<float> calevent(data_px*data_roi); //Vector for the calibrated event 10 14 11 15 float sample, last_sample, integral; … … 18 22 cout << "Event number: " << data_num << endl; 19 23 24 FCalibrateEvent(data, data_offset, drs_basemean, drs_gainmean, drs_triggeroffsetmean, calevent, data_px, data_roi); 25 20 26 //Iterate over the pixels 21 27 for (int j=0; j<data_px; j++) … … 24 30 25 31 //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 32 for (UInt_t k=start_sample; k<end_sample; k++) 29 33 { 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)) 33 35 { 34 integral = 0; 36 integral = 0; //std::accumulate(calevent.begin()[k+integration_delay],calevent.begin()[k+integration_delay+integration_size]); 35 37 for(UInt_t l=integration_delay; l<integration_delay+integration_size; l++) 36 38 { 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]; 39 40 } 40 41 // if((integral>60)&&(integral<=300)) { … … 50 51 k+=min_dist; 51 52 } 52 //TBD: mistake that after the deadtime the last_sample must be set new...53 //Solution: first process full pipeline54 last_sample = sample;55 53 } 56 54 }
Note:
See TracChangeset
for help on using the changeset viewer.