Changeset 13478 for trunk/FACT++/gui
- Timestamp:
- 04/30/12 22:32:50 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/gui/FactGui.h
r13254 r13478 27 27 #include "src/FAD.h" 28 28 #include "src/PixelMap.h" 29 29 #include "src/DimData.h" 30 30 31 31 #include "TROOT.h" … … 433 433 434 434 DimStampedInfo fDimBiasNominal; 435 DimStampedInfo fDimBiasVolt; 435 436 DimStampedInfo fDimBiasDac; 436 437 DimStampedInfo fDimBiasCurrent; … … 743 744 } 744 745 } 745 746 // ======================================================================747 748 struct DimData749 {750 const int qos;751 const string name;752 const string format;753 const vector<char> data;754 const Time time;755 756 Time extract(DimInfo *inf) const757 {758 // Must be called in exactly this order!759 const int tsec = inf->getTimestamp();760 const int tms = inf->getTimestampMillisecs();761 762 return Time(tsec, tms*1000);763 }764 765 // DimInfo *info; // this is ONLY for a fast check of the type of the DimData!!766 767 DimData(DimInfo *inf) :768 qos(inf->getQuality()),769 name(inf->getName()),770 format(inf->getFormat()),771 data(inf->getString(), inf->getString()+inf->getSize()),772 time(extract(inf))/*,773 info(inf)*/774 {775 }776 777 template<typename T>778 T get(uint32_t offset=0) const { return *reinterpret_cast<const T*>(data.data()+offset); }779 780 template<typename T>781 const T *ptr(uint32_t offset=0) const { return reinterpret_cast<const T*>(data.data()+offset); }782 783 template<typename T>784 const T &ref(uint32_t offset=0) const { return *reinterpret_cast<const T*>(data.data()+offset); }785 786 // vector<char> vec(int b) const { return vector<char>(data.begin()+b, data.end()); }787 // string str(unsigned int b) const { return b>=data.size()?string():string(data.data()+b, data.size()-b); }788 const char *c_str() const { return (char*)data.data(); }789 /*790 vector<boost::any> any() const791 {792 const Converter conv(format);793 conv.Print();794 return conv.GetAny(data.data(), data.size());795 }*/796 size_t size() const { return data.size(); }797 };798 746 799 747 // ======================= DNS ========================================== … … 2710 2658 void handleFeedbackCalibration(const DimData &d) 2711 2659 { 2712 if (!CheckSize(d, 2*416*sizeof(float)))2660 if (!CheckSize(d, 3*416*sizeof(float))) 2713 2661 return; 2714 2662 2715 2663 const float *ptr = d.ptr<float>(); 2716 fBiasOffsets.assign(ptr , ptr+416);2664 fBiasOffsets.assign(ptr+2*416, ptr+3*416); 2717 2665 } 2718 2666 … … 2834 2782 }; 2835 2783 2836 const uint16_t i = uint16_t(floor(fmod(ptr[6]+1 80+11.25, 360)/22));2784 const uint16_t i = uint16_t(floor(fmod(ptr[6]+11.25, 360)/22)); 2837 2785 fMagicWindDir->setText(dir[i]); 2838 2786 } … … 2840 2788 // ========================== FSC ======================================= 2841 2789 2790 vector<float> fVecBiasVolt; 2842 2791 vector<int16_t> fVecBiasDac; 2843 2792 vector<int16_t> fVecBiasCurrent; … … 2857 2806 } 2858 2807 2808 void handleBiasVolt(const DimData &d) 2809 { 2810 if (!CheckSize(d, 416*sizeof(float))) 2811 return; 2812 2813 const float *ptr = d.ptr<float>(); 2814 fVecBiasVolt.assign(ptr, ptr+416); 2815 } 2816 2859 2817 void handleBiasDac(const DimData &d) 2860 2818 { … … 2863 2821 2864 2822 const int16_t *ptr = d.ptr<int16_t>(); 2865 2866 2823 fVecBiasDac.assign(ptr, ptr+2*416); 2867 2824 … … 2897 2854 */ 2898 2855 2899 dat[i] = abs(ptr[entry.hv()]) ;2900 if (fBiasOffsets.size()>0) 2901 dat[i] -= fBiasOffsets[entry.hv()];2902 dat[i] *= 5000./4096;2903 2904 dat[i] /= entry.group()==0 ? 4 : 5;2856 dat[i] = abs(ptr[entry.hv()]) * 5000./4096; 2857 2858 if (fBiasOffsets.size()>0 && fVecBiasVolt.size()>0) 2859 dat[i] -= fVecBiasVolt[entry.hv()]/fBiasOffsets[entry.hv()]*1e6; 2860 2861 //dat[i] /= entry.group()==0 ? 4 : 5; 2905 2862 2906 2863 fBiasCamA->SetEnable(i, uint16_t(ptr[entry.hv()])!=0x8000); … … 3510 3467 return PostInfoHandler(&FactGui::handleBiasNominal); 3511 3468 3469 if (getInfo()==&fDimBiasVolt) 3470 return PostInfoHandler(&FactGui::handleBiasVolt); 3471 3512 3472 if (getInfo()==&fDimBiasDac) 3513 3473 return PostInfoHandler(&FactGui::handleBiasDac); … … 3838 3798 if (fVecBiasCurrent.size()>0) 3839 3799 { 3840 double val = abs(fVecBiasCurrent[ihw]); 3841 if (fBiasOffsets.size()>0) 3842 val -= fBiasOffsets[ihw]; 3843 val *= 5000/4096; 3800 double val = abs(fVecBiasCurrent[ihw]) * 5000./4096; 3801 if (fBiasOffsets.size()>0 && fVecBiasVolt.size()>0) 3802 val -= fVecBiasVolt[ihw]/fBiasOffsets[ihw]*1e6; 3844 3803 3845 3804 fBiasCurrent->setValue(val); … … 3848 3807 } 3849 3808 3850 if (fBiasOffsets.size()>0) 3851 fBiasOffset->setValue(fBiasOffsets[ihw]*5000./4096); 3852 fBiasOffset->setEnabled(fBiasOffsets.size()>0); 3809 if (fBiasOffsets.size()>0 && fVecBiasVolt.size()>0) 3810 fBiasOffset->setValue(fVecBiasVolt[ihw]/fBiasOffsets[ihw]*1e6); 3811 3812 fBiasOffset->setEnabled(fBiasOffsets.size()>0 && fVecBiasVolt.size()>0); 3853 3813 } 3854 3814 … … 4098 4058 fDimFadRoi ("FAD_CONTROL/REGION_OF_INTEREST", (void*)NULL, 0, this), 4099 4059 fDimFadDac ("FAD_CONTROL/DAC", (void*)NULL, 0, this), 4100 fDimFadDrsCalibration ("FAD_CONTROL/ DRS_CALIBRATION", (void*)NULL, 0, this),4060 fDimFadDrsCalibration ("FAD_CONTROL/XDRS_CALIBRATION", (void*)NULL, 0, this), 4101 4061 fDimFadStatus ("FAD_CONTROL/STATUS", (void*)NULL, 0, this), 4102 4062 fDimFadStatistics1 ("FAD_CONTROL/STATISTICS1", (void*)NULL, 0, this), … … 4114 4074 //- 4115 4075 fDimBiasNominal ("BIAS_CONTROL/NOMINAL", (void*)NULL, 0, this), 4076 fDimBiasVolt ("BIAS_CONTROL/VOLTAGE", (void*)NULL, 0, this), 4116 4077 fDimBiasDac ("BIAS_CONTROL/DAC", (void*)NULL, 0, this), 4117 4078 fDimBiasCurrent ("BIAS_CONTROL/CURRENT", (void*)NULL, 0, this),
Note:
See TracChangeset
for help on using the changeset viewer.