Changeset 17264 for trunk/Mars/mcore/factfits.h
- Timestamp:
- 10/18/13 17:52:38 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/mcore/factfits.h
r17038 r17264 11 11 #include "zfits.h" 12 12 13 #ifndef __MARS__14 namespace std15 {16 #endif17 18 13 class factfits : public zfits 19 14 { 20 15 public: 21 16 // Default constructor 22 factfits(const st ring& fname, conststring& tableName="", bool force=false) :17 factfits(const std::string& fname, const std::string& tableName="", bool force=false) : 23 18 zfits(fname, tableName, force), 24 19 fOffsetCalibration(0), … … 32 27 33 28 // Alternative constructor 34 factfits(const st ring& fname, const string& fout, conststring& tableName, bool force=false) :29 factfits(const std::string& fname, const std::string& fout, const std::string& tableName, bool force=false) : 35 30 zfits(fname, fout, tableName, force), 36 31 fOffsetCalibration(0), … … 48 43 { 49 44 zfits::StageRow(row, dest); 45 50 46 // This file does not contain fact data or no calibration to be applied 51 52 53 54 55 56 57 58 47 if (fOffsetCalibration.empty()) 48 return; 49 50 //re-get the pointer to the data to access the offsets 51 const uint8_t offset = (row*fTable.bytes_per_row)%4; 52 53 int16_t *startCell = reinterpret_cast<int16_t*>(fBufferRow.data() + offset + fOffsetStartCellData); 54 int16_t *data = reinterpret_cast<int16_t*>(fBufferRow.data() + offset + fOffsetData); 59 55 60 56 /* … … 71 67 */ 72 68 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 }69 // This version is faster because the compilers optimization 70 // is not biased by the evaluation of %1024 71 for (int ch=0; ch<1440; ch++) 72 { 73 if (startCell[ch]<0) 74 { 75 data += fNumRoi; 76 continue; 77 } 78 79 const int16_t modStart = startCell[ch] % 1024; 80 const int16_t *off = fOffsetCalibration.data() + ch*1024; 81 82 const int16_t *cal = off+modStart; 83 const int16_t *end_stride = data+fNumRoi; 84 85 if (modStart+fNumRoi>1024) 86 { 87 while (cal<off+1024) 88 *data++ += *cal++; 89 90 cal = off; 91 } 92 while (data<end_stride) 93 *data++ += *cal++; 94 } 95 96 } 101 97 102 98 bool init() … … 129 125 130 126 // Read the Drs calibration data 131 void readDrsCalib(const st ring& fileName)127 void readDrsCalib(const std::string& fileName) 132 128 { 133 129 //should not be mandatory, but improves the perfs a lot when reading not compressed, gzipped files … … 205 201 }; //class factfits 206 202 207 #ifndef __MARS__ 208 }; //namespace std 209 #endif 210 211 #endif 203 #endif
Note:
See TracChangeset
for help on using the changeset viewer.