Changeset 13416 for fact/tools/pyscripts/sandbox
- Timestamp:
- 04/23/12 14:15:38 (13 years ago)
- Location:
- fact/tools/pyscripts/sandbox/kraehenb
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/pyscripts/sandbox/kraehenb/CalFitsTest.py
r13401 r13416 11 11 calibfilename = '/fact/raw/2012/04/17/20120417_003.drs.fits.gz' 12 12 13 import numpy as np 14 13 15 from ROOT import gSystem 14 16 gSystem.Load("calfits_h.so") … … 16 18 print "Testing object creation: " 17 19 caltest = CalFits(datafilename,calibfilename) 20 npcalevent = np.empty( caltest.npix * caltest.nroi, np.float64) #.reshape(caltest.npix ,caltest.nroi) 21 caltest.SetNpcaldataPtr(npcalevent) 18 22 19 23 print "Common variables:" … … 45 49 46 50 #while caltest.GetCalEvent(): 47 # print caltest.event_id, caltest.event_triggertype, caltest.event_caldata[0] 51 # if caltest.event_id>10: 52 # break 53 # print caltest.event_id, caltest.event_triggertype, caltest.event_caldata[10] 48 54 #print 49 55 -
fact/tools/pyscripts/sandbox/kraehenb/calfits.h
r13400 r13416 78 78 vector<int32_t> event_boardtimes; 79 79 vector<float> event_caldata; //Vector for calibrated event 80 double* npcaldata; 80 81 81 82 CalFits(const string &datafilename, const string &calibfilename) //Constructor with two filenames 82 83 : datafile(datafilename), 83 calibfile(calibfilename) 84 calibfile(calibfilename), 85 npcaldata(NULL) 84 86 { 85 87 //Read basic parameters of the two files … … 124 126 calibfile.GetRow(0); 125 127 126 //Get the column sizes per pixel127 //...128 129 128 //Set the event pointers 130 129 // std::cout << "...Setting event pointers..." << std::endl; … … 145 144 bool GetCalEvent() 146 145 { 146 if(!npcaldata) { 147 ostringstream str; 148 str << "Pointer to the calibrated data not initialized!"; 149 #ifdef __EXCEPTIONS 150 throw runtime_error(str.str()); 151 #else 152 gLog << ___err___ << "ERROR - " << str.str() << endl; 153 return false; 154 #endif 155 } 147 156 if(datafile.GetNextRow() == false) { 148 157 // std::cout << "Last event reached..." << std::endl; … … 154 163 for(UInt_t slice=0;slice<data_nroi;slice++) { 155 164 drs_calib_offset = (slice+event_offset[pixel])%calib_blm_size; 156 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); 165 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); 157 167 //Note: data_nroi=calib_nroi, calib_blm_size=calib_gm_size 158 168 } … … 161 171 return true; 162 172 } 173 174 void SetNpcaldataPtr(double *ptr) 175 { 176 npcaldata = ptr; 177 return; 178 } 163 179 }; 164 180 #endif
Note:
See TracChangeset
for help on using the changeset viewer.