- Timestamp:
- 08/06/11 16:05:30 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/DataCalib.cc
r11774 r11810 4 4 #include "FitsFile.h" 5 5 #include "DimDescriptionService.h" 6 7 #include "externals/fits.h" 6 8 7 9 using namespace std; … … 108 110 109 111 return true; 112 } 113 114 bool DataCalib::ReadFits(const string &str) 115 { 116 try 117 { 118 fits file(str); 119 if (!file) 120 return false; 121 122 if (file.GetStr("TELESCOP")!="FACT") 123 { 124 Error("Reading "+str+" failed: Not a valid FACT file (TELESCOP not FACT in header)"); 125 return false; 126 } 127 128 if (!file.HasKey("STEP")) 129 { 130 Error("Reading "+str+" failed: Is not a DRS calib file (STEP not found in header)"); 131 return false; 132 } 133 134 if (file.GetNumRows()!=1) 135 { 136 Error("Reading "+str+" failed: Number of rows in table is not 1."); 137 return false; 138 } 139 140 vector<float> data(1440*1024*6+3); 141 142 float *base = data.data(); 143 144 file.SetPtrAddress("RunNumberBaseline", base, sizeof(float)); 145 file.SetPtrAddress("RunNumberGain", base+1, sizeof(float)); 146 file.SetPtrAddress("RunNumberTriggerOffset", base+2, sizeof(float)); 147 file.SetPtrAddress("BaselineMean", base+0*1024*1440+3, sizeof(float)*1024*1440); 148 file.SetPtrAddress("BaselineRms", base+1*1024*1440+3, sizeof(float)*1024*1440); 149 file.SetPtrAddress("GainMean", base+2*1024*1440+3, sizeof(float)*1024*1440); 150 file.SetPtrAddress("GainRms", base+3*1024*1440+3, sizeof(float)*1024*1440); 151 file.SetPtrAddress("TriggerOffsetMean", base+4*1024*1440+3, sizeof(float)*1024*1440); 152 file.SetPtrAddress("TriggerOffsetRms", base+5*1024*1440+3, sizeof(float)*1024*1440); 153 154 if (!file.GetNextRow()) 155 { 156 Error("Reading data from "+str+" failed."); 157 return false; 158 } 159 160 fStep = file.GetUInt("STEP"); 161 162 memcpy(fStats.data(), base, fStats.size()*sizeof(float)); 163 164 return true; 165 } 166 catch (const runtime_error &e) 167 { 168 Error("Exception reading "+str+": "+e.what()); 169 return false; 170 } 110 171 } 111 172
Note:
See TracChangeset
for help on using the changeset viewer.