Changeset 13426 for fact/tools/pyscripts
- Timestamp:
- 04/24/12 13:57:18 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/pyscripts/sandbox/kraehenb/calfits.h
r13416 r13426 66 66 67 67 //Calibration variables 68 vector<float>calib_baselinemean;69 vector<float>calib_gainmean;70 vector<float>calib_triggeroffsetmean;68 float* calib_baselinemean; 69 float* calib_gainmean; 70 float* calib_triggeroffsetmean; 71 71 //ToDo: use arrays of size 1440x1024 (x2 for wrap-arounds) and read all variables into those 72 72 … … 74 74 UInt_t event_id; 75 75 UShort_t event_triggertype; 76 vector<int16_t> event_data; 77 vector<int16_t> event_offset; 78 vector<int32_t> event_boardtimes; 79 vector<float> event_caldata; //Vector for calibrated event 76 int16_t* event_data; 77 int16_t* event_offset; 78 int32_t* event_boardtimes; 80 79 double* npcaldata; 81 80 … … 118 117 //Read the calibration data 119 118 // std::cout << "...Reading calibration data..." << std::endl; 120 calib_baselinemean .resize(calibfile.GetN("BaselineMean"),0);121 calibfile.Set VecAddress("BaselineMean", calib_baselinemean);122 calib_gainmean .resize(calibfile.GetN("GainMean"),0);123 calibfile.Set VecAddress("GainMean", calib_gainmean);124 calib_triggeroffsetmean .resize(calibfile.GetN("TriggerOffsetMean"),0);125 calibfile.Set VecAddress("TriggerOffsetMean", calib_triggeroffsetmean);119 calib_baselinemean = new float[calibfile.GetN("BaselineMean")]; 120 calibfile.SetPtrAddress("BaselineMean", calib_baselinemean, calibfile.GetN("BaselineMean")); 121 calib_gainmean = new float[calibfile.GetN("GainMean")]; 122 calibfile.SetPtrAddress("GainMean", calib_gainmean, calibfile.GetN("GainMean")); 123 calib_triggeroffsetmean = new float[calibfile.GetN("TriggerOffsetMean")]; 124 calibfile.SetPtrAddress("TriggerOffsetMean", calib_triggeroffsetmean, calibfile.GetN("TriggerOffsetMean")); 126 125 calibfile.GetRow(0); 127 126 … … 131 130 datafile.SetRefAddress("TriggerType", event_triggertype); 132 131 133 event_data.resize(data_ndata,0); 134 event_caldata.resize(data_ndata,0); 135 datafile.SetVecAddress("Data", event_data); 132 event_data = new int16_t[data_ndata]; 133 datafile.SetPtrAddress("Data", event_data, data_ndata); 136 134 137 event_offset .resize(datafile.GetN("StartCellData"),0);138 datafile.Set VecAddress("StartCellData", event_offset);135 event_offset = new int16_t[datafile.GetN("StartCellData")]; 136 datafile.SetPtrAddress("StartCellData", event_offset, datafile.GetN("StartCellData")); 139 137 140 event_boardtimes.resize(datafile.GetN("BoardTime"),0); 141 datafile.SetVecAddress("BoardTime", event_boardtimes); 138 event_boardtimes = new int32_t[datafile.GetN("BoardTime")]; 139 datafile.SetPtrAddress("BoardTime", event_boardtimes, datafile.GetN("BoardTime")); 140 } 141 142 ~CalFits() 143 { 144 delete[] calib_baselinemean; 145 delete[] calib_gainmean; 146 delete[] calib_triggeroffsetmean; 147 delete[] event_data; 148 delete[] event_offset; 149 delete[] event_boardtimes; 142 150 } 143 151 … … 164 172 drs_calib_offset = (slice+event_offset[pixel])%calib_blm_size; 165 173 npcaldata[pixel*data_nroi+slice] = double((event_data[pixel*data_nroi+slice]*2000./4096.-calib_baselinemean[pixel*calib_blm_size+drs_calib_offset]-calib_triggeroffsetmean[pixel*data_nroi+slice])/calib_gainmean[pixel*calib_blm_size+drs_calib_offset]*1907.35); 166 // event_caldata[pixel*data_nroi+slice] = float((event_data[pixel*data_nroi+slice]*2000./4096.-calib_baselinemean[pixel*calib_blm_size+drs_calib_offset]-calib_triggeroffsetmean[pixel*data_nroi+slice])/calib_gainmean[pixel*calib_blm_size+drs_calib_offset]*1907.35);167 174 //Note: data_nroi=calib_nroi, calib_blm_size=calib_gm_size 168 175 }
Note:
See TracChangeset
for help on using the changeset viewer.