Changeset 11700 for trunk/FACT++
- Timestamp:
- 07/29/11 14:31:47 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/EventBuilderWrapper.h
r11689 r11700 129 129 static vector<int32_t> fTrgOff; 130 130 131 static vector<float> fStats; 132 131 133 static uint32_t fNumOffset; 132 134 static uint32_t fNumGain; … … 135 137 static int fStep; 136 138 139 DimDescribedService &fDim; 140 137 141 public: 138 DataFileCalib(uint32_t id, MessageImp &imp) : DataFileImp(id, imp) 139 { 140 } 141 142 static void Restart() { fStep = 0; } 142 DataFileCalib(uint32_t id, DimDescribedService &dim, MessageImp &imp) : DataFileImp(id, imp), fDim(dim) 143 { 144 } 145 146 static void Restart() 147 { 148 // Default gain: 149 // 0.575*[45590]*2.5V / 2^16 = 0.99999 V 150 fOffset.assign(1440*1024, 0); 151 fGain.assign (1440*1024, 2); 152 fTrgOff.assign(1440*1024, 0); 153 154 fNumOffset = 1; 155 fNumGain = 1; 156 fNumTrgOff = 1; 157 158 reinterpret_cast<uint32_t*>(fStats.data())[0] = 0; 159 reinterpret_cast<uint32_t*>(fStats.data())[1] = 0; 160 reinterpret_cast<uint32_t*>(fStats.data())[2] = 0; 161 162 int i=0; 163 while (i<1024*1440*2+3) // Set mean and RMS to 0 164 fStats[i++] = 0; 165 while (i<1024*1440*3+3) 166 fStats[i++] = 0.5; // Set mean to 0.5 167 while (i<1024*1440*6+3) 168 fStats[i++] = 0; // Set everything else to 0 169 170 fStep = 0; 171 } 172 173 static void Update(DimDescribedService &dim) 174 { 175 dim.Update(fStats); 176 } 143 177 144 178 bool OpenFile(RUN_HEAD* h) … … 169 203 InitSize(1440, 1024); 170 204 171 if (fStep==0)172 {173 // Default gain:174 // 0.575*[45590]*2.5V / 2^16 = 0.99999 V175 fOffset.assign(1440*1024, 0);176 fGain.assign (1440*1024, 2);177 fTrgOff.assign(1440*1024, 0);178 179 fNumOffset = 1;180 fNumGain = 1;181 fNumTrgOff = 1;182 }183 184 205 return true; 185 206 } … … 209 230 fOffset.assign(fSum.begin(), fSum.end()); 210 231 fNumOffset = fNumEntries; 232 reinterpret_cast<uint32_t*>(fStats.data())[0] = GetRunId();; 233 GetSampleStats(fStats.data()+3, 0.5); 211 234 } 212 235 if (fStep==1) … … 214 237 fGain.assign(fSum.begin(), fSum.end()); 215 238 fNumGain = fNumEntries*1000; 239 reinterpret_cast<uint32_t*>(fStats.data())[1] = GetRunId();; 216 240 // Scale from Volt to Millivolt 241 GetSampleStats(fStats.data()+1024*1440*2+3, 0.5); 217 242 } 218 243 if (fStep==2) … … 220 245 fTrgOff.assign(fSum.begin(), fSum.end()); 221 246 fNumTrgOff = fNumEntries; 222 } 247 reinterpret_cast<uint32_t*>(fStats.data())[2] = GetRunId();; 248 GetSampleStats(fStats.data()+1024*1440*4+3, 0.5); 249 } 250 251 fDim.Update(fStats); 252 223 253 fStep++; 224 254 … … 248 278 vector<int32_t> DataFileCalib::fGain (1440*1024, 2); 249 279 vector<int32_t> DataFileCalib::fTrgOff(1440*1024, 0); 280 vector<float> DataFileCalib::fStats (1440*1024*6+3); 250 281 251 282 uint32_t DataFileCalib::fNumOffset = 1; … … 939 970 DimDescribedService fDimRoi; 940 971 DimDescribedService fDimDac; 972 DimDescribedService fDimDrsCalibration; 941 973 DimDescribedService fDimStatistics1; 942 974 DimDescribedService fDimStatistics2; … … 991 1023 fDimRoi ("FAD_CONTROL/REGION_OF_INTEREST", "S:2", ""), 992 1024 fDimDac ("FAD_CONTROL/DAC", "S:336", ""), 1025 fDimDrsCalibration("FAD_CONTROL/DRS_CALIBRATION", "I:3;F:1474560;F:1474560;F:1474560;F:1474560;F:1474560;F:1474560", ""), 993 1026 fDimStatistics1 ("FAD_CONTROL/STATISTICS1", "I:3;I:5;X:4;I:3;I:3;I:40;I:1;I:2;C:40;I:40;I:40;X:40", ""), 994 1027 fDimStatistics2 ("FAD_CONTROL/STATISTICS2", "I:1;I:280;X:40;I:40;I:4;I:4;I:2;I:2;I:3;C:40", ""), … … 1204 1237 fFileFormat = f; 1205 1238 if (fFileFormat==kCalib) 1239 { 1206 1240 DataFileCalib::Restart(); 1241 DataFileCalib::Update(fDimDrsCalibration); 1242 fMsg.Message("Resetted DRS calibration."); 1243 } 1207 1244 } 1208 1245 … … 1311 1348 case kFits: file = new DataFileFits(runid, fMsg); break; 1312 1349 case kRaw: file = new DataFileRaw(runid, fMsg); break; 1313 case kCalib: file = new DataFileCalib(runid, f Msg); break;1350 case kCalib: file = new DataFileCalib(runid, fDimDrsCalibration, fMsg); break; 1314 1351 } 1315 1352 … … 1567 1604 Time newt; 1568 1605 1606 // FIXME: Only send events if the have newer run-numbers 1569 1607 if (newt<oldt+boost::posix_time::seconds(1)) 1570 1608 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.