source: fact/tools/rootmacros/FCalibrateEvent.c@ 17633

Last change on this file since 17633 was 12362, checked in by kraehenb, 13 years ago
New version of the calscope-script which is easier to adapt. The included file TPKplotevent was dropped for the FCalibrateEvent.C, which takes an event and returns an array with the DRS-calibrated pipeline.
File size: 984 bytes
Line 
1#include <cstdio>
2int FCalibrateEvent(vector<int16_t> &data, vector<int16_t> &data_offset, vector<float> &drs_basemean, vector<float> &drs_gainmean, vector<float> &drs_triggeroffsetmean, vector<float> &calevent, UInt_t data_px, UInt_t data_roi)
3{
4//-------------------------------------------
5//Iterate over the pixels
6//-------------------------------------------
7 for (int j=0; j<data_px; j++)
8 {
9//-------------------------------------------
10//Iterate over the slices
11//-------------------------------------------
12 for (UInt_t k=0; k<data_roi; k++)
13 {
14 UInt_t drs_calib_offset = (k+data_offset[j])%data_roi;
15 float 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;
16// float usample = data[j*data_roi+k]; //Uncalibrated sample value
17 calevent[j*data_roi+k]=sample;
18 }
19// cout << "Plotting successful..." << endl;
20 }
21 return 0;
22}
Note: See TracBrowser for help on using the repository browser.