Changeset 16834 for trunk/FACT++
- Timestamp:
- 06/14/13 10:54:35 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/EventBuilderWrapper.h
r16745 r16834 493 493 // Keep a copy of the currently valid drs calibration 494 494 // and associate it to the run control structure 495 evt.runCtrl->calib = shared_ptr<DrsCalibration>(new DrsCalibration(DataCalib::GetCalibration()));495 evt.runCtrl->calib = make_shared<DrsCalibration>(DataCalib::GetCalibration()); 496 496 497 497 /* … … 631 631 632 632 // If a Drs Calibration has just been finished, all following events 633 // should also be processed with this calibration 633 // should also be processed with this calibration. 634 // Note that this is a generally dangerous operation. Here, the previous 635 // DRS calibration shared_ptr gets freed and if it is the last in use, 636 // the memory will vanish. If another thread accesses that pointer, 637 // it _must_ make a copy of the shared_ptr first to ensure that 638 // the memory will stay in scope until the end of its operation. 634 639 const DrsCalibration &cal = DataCalib::GetCalibration(); 635 640 if (!run.calib || run.calib->fStep != cal.fStep || run.calib->fRoi!=cal.fRoi) 636 run.calib = shared_ptr<DrsCalibration>(new DrsCalibration(cal));641 run.calib = make_shared<DrsCalibration>(cal); 637 642 } 638 643 … … 903 908 // (Is that necessray, or would a simple offset correct do well already?) 904 909 910 // This is a very important step. Making a copy of the shared pointer ensures 911 // that another thread (here: runClose) can set a new shared_ptr with new 912 // data without this thread being affected. If we just did run.calib->Apply 913 // the shared_pointer in use here might vanash during the processing, the 914 // memory is freed and we access invalid memory. It is not important 915 // which memory we acces (the old or the new one) because it is just for 916 // display purpose anyway. 917 const shared_ptr<DrsCalibration> cal = run.calib; 918 905 919 // There seems to be a problem using std::array... maybe the size is too big? 906 920 // array<float, (1440+160)*1024> vec2; 907 921 vector<float> vec((1440+160)*roi); 908 run.calib->Apply(vec.data(), event->Adc_Data, start, roi);922 cal->Apply(vec.data(), event->Adc_Data, start, roi); 909 923 910 924 // ------------------- Appy DRS-step correction -------------------------- … … 940 954 // ------------------ Update dim service (statistics) --------------------- 941 955 942 if (fQueueEventData.empty() && now>fLastDimEventData+boost::posix_time:: seconds(3))956 if (fQueueEventData.empty() && now>fLastDimEventData+boost::posix_time::microseconds(3141593)) 943 957 { 944 958 fQueueEventData.emplace(evt.time, evt.trgTyp, evt.trgTyp==0 ? fMaxEvent.second : stats);
Note:
See TracChangeset
for help on using the changeset viewer.