Go to the documentation of this file.00001 #ifndef TEPICSPROC_H
00002 #define TEPICSPROC_H
00003
00004 #include "TEpicsEvent.h"
00005 #include "TEpicsParam.h"
00006 #include "TGo4Picture.h"
00007 #include "TH1.h"
00008 #include "TH2.h"
00009 #include "TGraph.h"
00010 #include "TLatex.h"
00011 #include "TCBMBeamtimeProc.h"
00012
00013 #include <vector>
00014 #include <string>
00015
00016 class TGo4EventElement;
00017 class TGo4MbsSubEvent;
00018
00019 class TEpicsProc : public TCBMBeamtimeProc {
00020
00021 friend class TCBMBeamtimeProc;
00022
00023 public:
00024
00025 TEpicsProc();
00026 TEpicsProc(const char* name);
00027 virtual ~TEpicsProc();
00028
00029 virtual void InitEvent(TGo4EventElement*);
00030
00031
00032 virtual void ProcessSubevent(TGo4MbsSubEvent* subevt);
00033
00034
00035 virtual void FinalizeEvent();
00036
00037 protected:
00038
00039 struct VariableHist {
00040 TH1* fTrend;
00041 TH1* fStat;
00042 TGraph* fGraph;
00043 VariableHist() : fTrend(0), fStat(0), fGraph(0) {}
00044 bool Empty() const { return fGraph==0; }
00045 bool IsName(const std::string& name) const { return fGraph ? name==fGraph->GetName() : false; }
00046 };
00047
00048 VariableHist* CreateHist(const char* varname);
00049
00050 void UpdateHist(VariableHist* hst, double val, const char* varname);
00051
00052 void UpdateTrending(TH1* histo, Double_t val, time_t time);
00053
00054 void IncTrending( TH1 * histo, Double_t value, bool forwards );
00055
00056 void UpdateTimeGraph(TGraph* gr, Double_t value, time_t time);
00057
00058 TGraph* MakeTimeGraph(const TString& name, const TString& dir);
00059
00060 VariableHist* FindVariable(const char* name);
00061
00062 TEpicsParam * fPar;
00063 TEpicsEvent * fOutputEvent;
00064
00065 std::vector<VariableHist> all_hists;
00066
00067 ClassDef(TEpicsProc,2)
00068 };
00069
00070 #endif //TUNPACKPROCESSOR_H