Changeset 17329
- Timestamp:
- 11/21/13 17:14:09 (11 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/DataWriteFits.cc
r16055 r17329 2 2 3 3 #include "HeadersFAD.h" 4 #include " FAD.h"4 #include "EventBuilder.h" 5 5 #include "Converter.h" 6 6 … … 10 10 DataWriteFits::~DataWriteFits() 11 11 { 12 Close(); 12 if (fFile.IsOpen()) 13 { 14 WriteFooter(); 15 fFile.Close(); 16 } 17 13 18 delete fConv; 14 19 } … … 187 192 fTstop[0] = 0; 188 193 189 memset(fTriggerCounter.data(), 0, fTriggerCounter.size()*sizeof(uint32_t));194 fTriggerCounter.fill(0); 190 195 191 196 //Last but not least, add header keys that will be updated when closing the file 192 return WriteFooter( NULL);197 return WriteFooter(); 193 198 } 194 199 … … 198 203 //! @param e the pointer to the EVENT 199 204 // 200 bool DataWriteFits::WriteEvt(const EV ENT &e)205 bool DataWriteFits::WriteEvt(const EVT_CTRL2 &evt) 201 206 { 202 207 if (!fFile.AddRow()) 203 208 return false; 204 209 205 if (e.TriggerType && !(e.TriggerType & FAD::EventHeader::kAll)) 206 fTriggerCounter[0]++; 207 else if ((e.TriggerType&FAD::EventHeader::kPedestal) && !(e.TriggerType&FAD::EventHeader::kTIM)) 208 fTriggerCounter[1]++; 209 else if (e.TriggerType & FAD::EventHeader::kLPext) 210 fTriggerCounter[2]++; 211 else if (e.TriggerType & (FAD::EventHeader::kTIM|FAD::EventHeader::kPedestal)) 212 fTriggerCounter[3]++; 213 else if (e.TriggerType & FAD::EventHeader::kLPint) 214 fTriggerCounter[4]++; 215 else if (e.TriggerType & FAD::EventHeader::kExt1) 216 fTriggerCounter[5]++; 217 else if (e.TriggerType & FAD::EventHeader::kExt2) 218 fTriggerCounter[6]++; 219 else 220 fTriggerCounter[7]++; 210 fTriggerCounter = evt.runCtrl->triggerCounter; 211 212 const EVENT &e = *evt.fEvent; 221 213 222 214 memcpy(fTstop, &e.PCTime, 2*sizeof(uint32_t)); … … 232 224 } 233 225 234 bool DataWriteFits::WriteFooter( const RUN_TAIL */*rt*/)226 bool DataWriteFits::WriteFooter() 235 227 { 236 228 try … … 288 280 //! @param rt the pointer to the RUN_TAIL data structure 289 281 // 290 bool DataWriteFits::Close(const RUN_TAIL *rt)282 bool DataWriteFits::Close(const EVT_CTRL2 &evt) 291 283 { 292 284 if (!fFile.IsOpen()) 293 285 return false; 294 286 295 WriteFooter(rt); 287 // Just for safety 288 fTriggerCounter = evt.triggerCounter; 289 WriteFooter(); 296 290 297 291 fFile.Close(); -
trunk/FACT++/src/DataWriteFits.h
r16055 r17329 23 23 void WriteKey(const string &name, const int idx, const T &value, const string &comment); 24 24 25 bool WriteFooter( const RUN_TAIL *rt);25 bool WriteFooter(); 26 26 27 27 virtual int GetDrsStep() const { return -1; } … … 36 36 37 37 bool Open(const RUN_HEAD &h, const FAD::RunDescription &d); 38 bool WriteEvt(const EV ENT &e);39 bool Close(const RUN_TAIL *rt = 0);38 bool WriteEvt(const EVT_CTRL2 &); 39 bool Close(const EVT_CTRL2 &); 40 40 }; 41 41 -
trunk/FACT++/src/DataWriteFits2.cc
r17299 r17329 4 4 5 5 #include "HeadersFAD.h" 6 #include " FAD.h"6 #include "EventBuilder.h" 7 7 8 8 #include "externals/factofits.h" … … 156 156 fTstop[1] = 0; 157 157 158 memset(fTriggerCounter.data(), 0, fTriggerCounter.size()*sizeof(uint32_t)); 159 160 //Last but not least, add header keys that will be updated when closing the file 161 WriteFooter(NULL); 158 fTriggerCounter.fill(0); 159 160 WriteFooter(); 162 161 163 162 fFile->WriteTableHeader("Events"); … … 248 247 //! @param e the pointer to the EVENT 249 248 // 250 bool DataWriteFits2::WriteEvt(const EVENT &e) 251 { 252 if (e.TriggerType && !(e.TriggerType & FAD::EventHeader::kAll)) 253 fTriggerCounter[0]++; 254 else if ((e.TriggerType&FAD::EventHeader::kPedestal) && !(e.TriggerType&FAD::EventHeader::kTIM)) 255 fTriggerCounter[1]++; 256 else if (e.TriggerType & FAD::EventHeader::kLPext) 257 fTriggerCounter[2]++; 258 else if (e.TriggerType & (FAD::EventHeader::kTIM|FAD::EventHeader::kPedestal)) 259 fTriggerCounter[3]++; 260 else if (e.TriggerType & FAD::EventHeader::kLPint) 261 fTriggerCounter[4]++; 262 else if (e.TriggerType & FAD::EventHeader::kExt1) 263 fTriggerCounter[5]++; 264 else if (e.TriggerType & FAD::EventHeader::kExt2) 265 fTriggerCounter[6]++; 266 else 267 fTriggerCounter[7]++; 268 269 fTstop[0] = e.PCTime; 270 fTstop[1] = e.PCUsec; 249 bool DataWriteFits2::WriteEvt(const EVT_CTRL2 &evt) 250 { 251 fTriggerCounter = evt.runCtrl->triggerCounter; 252 253 fTstop[0] = evt.time.tv_sec; 254 fTstop[1] = evt.time.tv_usec; 255 256 const EVENT &e = *evt.fEvent; 271 257 272 258 const int realRoiTM = (e.RoiTM > e.Roi) ? e.Roi : 0; … … 294 280 } 295 281 296 void DataWriteFits2::WriteFooter( const RUN_TAIL */*rt*/)282 void DataWriteFits2::WriteFooter() 297 283 { 298 284 //FIXME shouldn't we convert start and stop time to MjD first ? … … 330 316 //! @param rt the pointer to the RUN_TAIL data structure 331 317 // 332 bool DataWriteFits2::Close(const RUN_TAIL *rt)318 bool DataWriteFits2::Close(const EVT_CTRL2 &evt) 333 319 { 334 320 if (!fFile->is_open()) … … 340 326 try 341 327 { 342 WriteFooter(rt); 328 // Just for safety 329 fTriggerCounter = evt.triggerCounter; 330 331 WriteFooter(); 343 332 } 344 333 catch (const exception &e) -
trunk/FACT++/src/DataWriteFits2.h
r17266 r17329 20 20 21 21 void WriteHeader(const RUN_HEAD &h, const FAD::RunDescription &d); 22 void WriteFooter( const RUN_TAIL *rt);22 void WriteFooter(); 23 23 24 24 virtual int GetDrsStep() const { return -1; } … … 29 29 30 30 bool Open(const RUN_HEAD &h, const FAD::RunDescription &d); 31 bool WriteEvt(const EV ENT&e);32 bool Close(const RUN_TAIL *rt = 0);31 bool WriteEvt(const EVT_CTRL2 &e); 32 bool Close(const EVT_CTRL2 &); 33 33 34 34 Time GetTstart() const { return Time(fTstart[0], fTstart[1]); }
Note:
See TracChangeset
for help on using the changeset viewer.