Changeset 13566
- Timestamp:
- 05/04/12 21:51:43 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/pyscripts/pyfact/calfactfits.h
r13551 r13566 139 139 calib_triggeroffsetmean = new float[calibfile.GetN("TriggerOffsetMean")]; 140 140 calibfile.SetPtrAddress("TriggerOffsetMean", calib_triggeroffsetmean, calibfile.GetN("TriggerOffsetMean")); 141 trigger_offset = new double[calibfile.GetN("TriggerOffsetMean") ];141 trigger_offset = new double[calibfile.GetN("TriggerOffsetMean")*2]; 142 142 143 143 calibfile.GetRow(0); 144 144 145 for (int i = 0; i < (int)calibfile.GetN("BaselineMean"); ++i) 145 int orig_index, new_index1, new_index2; 146 for (int pix=0 ; pix < (int)calib_npix; ++pix) 146 147 { 147 baseline[i] = double(calib_baselinemean[i]) *4096./2000.; 148 baseline[i+(int)calibfile.GetN("BaselineMean")] = double(calib_baselinemean[i]) *4096./2000.; 148 for (int sl = 0; sl < (int)calib_blm_size; ++sl) 149 { 150 orig_index = pix * (int)calib_blm_size + sl; 151 new_index1 = 2*pix * (int)calib_blm_size + sl; 152 new_index2 = (2*pix+1) * (int)calib_blm_size + sl; 153 154 baseline[new_index2] = baseline[new_index1] = double(calib_baselinemean[orig_index]) *4096./2000.; 155 } 149 156 } 150 151 for (int i = 0; i < (int)calibfile.GetN("GainMean"); ++i) 157 for (int pix=0 ; pix < (int)calib_npix; ++pix) 152 158 { 153 gain[i] = double(calib_gainmean[i]) * 1907.35; 154 gain[i+(int)calibfile.GetN("GainMean")] = double(calib_gainmean[i]) * 1907.35 *4096. /2000.; 159 for (int sl = 0; sl < (int)calib_gm_size; ++sl) 160 { 161 orig_index = pix * (int)calib_gm_size + sl; 162 new_index1 = 2*pix * (int)calib_gm_size + sl; 163 new_index2 = (2*pix+1) * (int)calib_gm_size + sl; 164 165 gain[new_index2] = gain[new_index1] = double(calib_gainmean[orig_index]) /( 1907.35 /4096. *2000.); 166 } 155 167 } 156 168 157 for (int i = 0; i < (int)calibfile.GetN("TriggerOffsetMean"); ++i)169 for (int pix=0 ; pix < (int)calib_npix; ++pix) 158 170 { 159 trigger_offset[i] = double(calib_triggeroffsetmean[i])*4096./2000.; 160 trigger_offset[i+(int)calibfile.GetN("TriggerOffsetMean")] = double(calib_triggeroffsetmean[i])*4096./2000.; 171 for (int sl = 0; sl < (int)calib_tom_size; ++sl) 172 { 173 orig_index = pix * (int)calib_tom_size + sl; 174 new_index1 = 2*pix * (int)calib_tom_size + sl; 175 new_index2 = (2*pix+1) * (int)calib_tom_size + sl; 176 177 trigger_offset[new_index2] = trigger_offset[new_index1] = double(calib_triggeroffsetmean[orig_index]) *4096. /2000.; 178 } 161 179 } 162 180 … … 180 198 ~CalFactFits() //Standard destructor 181 199 { 182 //cout << "Destructor called " << endl;183 //cout << "calib_baselinemean " << calib_baselinemean << endl;184 //cout << "calib_gainmean " << calib_gainmean << endl;185 //cout << "calib_triggeroffsetmean " << calib_triggeroffsetmean << endl;186 //cout << "event_data " << event_data << endl;187 //cout << "event_offset " << event_offset << endl;188 //cout << "event_boardtimes " << event_boardtimes << endl;189 //cout << "baseline " << baseline << endl;190 //cout << "gain " << gain << endl;191 //cout << "trigger_offset " << trigger_offset << endl;192 193 200 delete[] calib_baselinemean; 194 201 delete[] calib_gainmean; 195 //delete[] calib_triggeroffsetmean;202 delete[] calib_triggeroffsetmean; 196 203 delete[] event_data; 197 204 delete[] event_offset; 198 205 delete[] event_boardtimes; 199 206 delete[] baseline; 200 //delete[] gain;207 delete[] gain; 201 208 delete[] trigger_offset; 202 209 } … … 225 232 for(UInt_t slice = 0; slice < data_nroi; slice++) 226 233 { 227 234 drs_calib_offset = slice + event_offset[pixel]; 228 235 raw = (double)event_data[pixel*data_nroi+slice]; 229 raw_bsl = raw - baseline[pixel*calib_blm_size+drs_calib_offset]; 230 shifted = raw_bsl - trigger_offset[pixel*data_nroi+slice]; 231 npcaldata[pixel*data_nroi+slice] = shifted / gain[pixel*calib_blm_size+drs_calib_offset]; 232 //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); 236 raw_bsl = raw - baseline[pixel*calib_blm_size*2+drs_calib_offset]; 237 shifted = raw_bsl - trigger_offset[pixel*data_nroi*2+slice]; 238 npcaldata[pixel*data_nroi+slice] = shifted / gain[pixel*calib_blm_size*2+drs_calib_offset]; 233 239 //Note: data_nroi=calib_nroi, calib_blm_size=calib_gm_size 234 240 }
Note:
See TracChangeset
for help on using the changeset viewer.