- Timestamp:
- 09/11/11 21:32:40 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/gui/FactGui.h
r12050 r12065 29 29 #include "TSystem.h" 30 30 #include "TGraph.h" 31 #include "TGraphErrors.h" 31 32 #include "TH2.h" 32 33 #include "TBox.h" … … 1574 1575 fEventCanv3->SetData(arr3); 1575 1576 fEventCanv4->SetData(arr4); 1577 1578 fEventCanv1->updateCamera(); 1579 fEventCanv2->updateCamera(); 1580 fEventCanv3->updateCamera(); 1581 fEventCanv4->updateCamera(); 1576 1582 } 1577 1583 … … 1947 1953 fGraphFtmRate.SetPoint(fGraphFtmRate.GetN(), now, sdata.fTriggerRate); 1948 1954 1949 if (t1-t0> 60)1955 if (t1-t0>300) 1950 1956 { 1951 1957 h->GetXaxis()->SetTimeFormat("%Hh%M'"); … … 1983 1989 1984 1990 fRatesCanv->SetData(dat); 1991 fRatesCanv->updateCamera(); 1985 1992 } 1986 1993 … … 2466 2473 // ========================== Feedback ================================== 2467 2474 2475 #ifdef HAVE_ROOT 2476 TGraphErrors fGraphFeedbackDev; 2477 TGraphErrors fGraphFeedbackCmd; 2478 2479 void UpdateFeedback(TQtWidget &rwidget, const Time &time, TGraphErrors &graph, double avg, double rms) 2480 { 2481 TCanvas *c = rwidget.GetCanvas(); 2482 2483 TH1 *h = (TH1*)c->FindObject("TimeFrame"); 2484 2485 while (graph.GetN()>500) 2486 graph.RemovePoint(0); 2487 2488 const double now = time.RootTime(); 2489 2490 while (graph.GetN()>0 && now-graph.GetX()[0]>3600) 2491 graph.RemovePoint(0); 2492 2493 const int n = graph.GetN(); 2494 2495 const double xmin = n>0 ? graph.GetX()[0] : now; 2496 2497 h->SetBins(n+1, xmin-1, now+1); 2498 graph.SetPoint(n, now, avg); 2499 graph.SetPointError(n, 0, rms); 2500 2501 h->GetXaxis()->SetTimeFormat(now-xmin>300 ? "%Hh%M'" : "%M'%S\""); 2502 2503 c->Modified(); 2504 c->Update(); 2505 } 2506 #endif 2507 2468 2508 void handleFeedbackDeviation(const DimData &d) 2469 2509 { … … 2474 2514 2475 2515 valarray<float> dev(1440); 2476 valarray<float> ref(1440); 2516 valarray<float> cmd(1440); 2517 2518 double avgdev = 0; 2519 double avgcmd = 0; 2520 2521 double rmsdev = 0; 2522 double rmscmd = 0; 2477 2523 2478 2524 for (int i=0; i<1440; i++) … … 2480 2526 const PixelMapEntry &entry = fPixelMap.index(i); 2481 2527 2482 dev[i] = ptr[entry.hv()]; 2483 ref[i] = ptr[entry.hv()+416]; 2484 } 2528 dev[i] = 1000*ptr[entry.hv()]; 2529 cmd[i] = 1000*ptr[entry.hv()+416]; 2530 2531 avgdev += dev[i]; 2532 avgcmd += cmd[i]; 2533 2534 rmsdev += dev[i]*dev[i]; 2535 rmscmd += cmd[i]*cmd[i]; 2536 } 2537 2538 avgdev /= 1440; 2539 avgcmd /= 1440; 2540 2541 rmsdev = sqrt(rmsdev/1440 - avgdev*avgdev); 2542 rmscmd = sqrt(rmscmd/1440 - avgcmd*avgcmd); 2485 2543 2486 2544 fFeedbackDevCam->SetData(dev); 2487 fFeedback RefCam->SetData(ref);2545 fFeedbackCmdCam->SetData(cmd); 2488 2546 2489 2547 fFeedbackDevCam->updateCamera(); 2490 fFeedbackRefCam->updateCamera(); 2548 fFeedbackCmdCam->updateCamera(); 2549 2550 #ifdef HAVE_ROOT 2551 UpdateFeedback(*fFeedbackDev, d.time, fGraphFeedbackDev, avgdev, rmsdev); 2552 UpdateFeedback(*fFeedbackCmd, d.time, fGraphFeedbackCmd, avgcmd, rmscmd); 2553 #endif 2491 2554 } 2492 2555 … … 3545 3608 fDimFadRuns ("FAD_CONTROL/RUNS", (void*)NULL, 0, this), 3546 3609 fDimFadEvents ("FAD_CONTROL/EVENTS", (void*)NULL, 0, this), 3547 fDimFadRawData ("FAD_CONTROL/RAW _DATA", (void*)NULL, 0, this),3610 fDimFadRawData ("FAD_CONTROL/RAWX_DATA", (void*)NULL, 0, this), 3548 3611 fDimFadEventData ("FAD_CONTROL/EVENT_DATA", (void*)NULL, 0, this), 3549 3612 fDimFadConnections ("FAD_CONTROL/CONNECTIONS", (void*)NULL, 0, this), … … 3731 3794 #ifdef HAVE_ROOT 3732 3795 3796 fGraphFeedbackDev.SetLineColor(kBlue); 3797 fGraphFeedbackDev.SetMarkerColor(kBlue); 3798 fGraphFeedbackDev.SetMarkerStyle(kFullDotMedium); 3799 3800 fGraphFeedbackCmd.SetLineColor(kBlue); 3801 fGraphFeedbackCmd.SetMarkerColor(kBlue); 3802 fGraphFeedbackCmd.SetMarkerStyle(kFullDotMedium); 3803 3804 // Evolution of control deviation 3805 // Evolution of command values (bias voltage change) 3806 fGraphFeedbackDev.SetName("ControlDev"); 3807 fGraphFeedbackCmd.SetName("CommandVal"); 3808 3809 TCanvas *c = fFeedbackDev->GetCanvas(); 3810 c->SetBorderMode(0); 3811 c->SetFrameBorderMode(0); 3812 c->SetFillColor(kWhite); 3813 c->SetRightMargin(0.03); 3814 c->SetTopMargin(0.03); 3815 c->SetGrid(); 3816 c->cd(); 3817 3818 TH1 *hf = DrawTimeFrame("Control deviation [mV] "); 3819 hf->GetXaxis()->SetLabelSize(0.07); 3820 hf->GetYaxis()->SetLabelSize(0.07); 3821 hf->GetYaxis()->SetTitleSize(0.08); 3822 hf->GetYaxis()->SetTitleOffset(0.55); 3823 hf->GetXaxis()->SetTitle(""); 3824 hf->GetYaxis()->SetRangeUser(-99, 99); 3825 3826 fGraphFeedbackDev.Draw("LP"); 3827 3828 c = fFeedbackCmd->GetCanvas(); 3829 c->SetBorderMode(0); 3830 c->SetFrameBorderMode(0); 3831 c->SetFillColor(kWhite); 3832 c->SetRightMargin(0.03); 3833 c->SetTopMargin(0.03); 3834 c->SetGrid(); 3835 c->cd(); 3836 3837 hf = DrawTimeFrame("Command delta value [mV] "); 3838 hf->GetXaxis()->SetLabelSize(0.07); 3839 hf->GetYaxis()->SetLabelSize(0.07); 3840 hf->GetYaxis()->SetTitleSize(0.08); 3841 hf->GetYaxis()->SetTitleOffset(0.55); 3842 hf->GetXaxis()->SetTitle(""); 3843 hf->GetYaxis()->SetRangeUser(-99*5, 99*5); 3844 3845 fGraphFeedbackCmd.Draw("LP"); 3846 3847 // -------------------------------------------------------------------------- 3848 3849 fGraphFtmRate.SetMarkerStyle(kFullDotSmall); 3850 fGraphFtmRate.Draw("LP"); 3851 3733 3852 fGraphFtmRate.SetLineColor(kBlue); 3734 3853 fGraphFtmRate.SetMarkerColor(kBlue); … … 3781 3900 // -------------------------------------------------------------------------- 3782 3901 3783 TCanvas *c = fFtmRateCanv->GetCanvas();3902 c = fFtmRateCanv->GetCanvas(); 3784 3903 //c->SetBit(TCanvas::kNoContextMenu); 3785 3904 c->SetBorderMode(0); … … 3791 3910 c->cd(); 3792 3911 3793 TH1 *hf = DrawTimeFrame("Trigger rate [Hz]");3912 hf = DrawTimeFrame("Trigger rate [Hz]"); 3794 3913 hf->GetYaxis()->SetRangeUser(0, 1010); 3795 3914 3796 3915 fGraphFtmRate.SetMarkerStyle(kFullDotSmall); 3797 3916 fGraphFtmRate.Draw("LP"); 3917 3918 // -------------------------------------------------------------------------- 3919 3920 fFeedbackDevCam->SetMin(fFeedbackDevMin->value()*0.001); 3921 fFeedbackDevCam->SetMax(fFeedbackDevMax->value()*0.001); 3922 fFeedbackDevCam->updateCamera(); 3923 3924 fFeedbackCmdCam->SetMin(fFeedbackCmdMin->value()*0.001); 3925 fFeedbackCmdCam->SetMax(fFeedbackCmdMax->value()*0.001); 3926 fFeedbackCmdCam->updateCamera(); 3798 3927 3799 3928 // -------------------------------------------------------------------------- … … 3851 3980 3852 3981 fFeedbackDevCam->setTitle("Control deviation (Pulser amplitude voltage)"); 3853 fFeedback RefCam->setTitle("Applied voltage change (BIAS voltage)");3854 3855 fFeedbackDevCam->setUnits(" V");3856 fFeedback RefCam->setUnits("V");3982 fFeedbackCmdCam->setTitle("Applied voltage change (BIAS voltage)"); 3983 3984 fFeedbackDevCam->setUnits("mV"); 3985 fFeedbackCmdCam->setUnits("mV"); 3857 3986 3858 3987 // --------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.