00001 #ifndef TEPICSEVENT_H 00002 #define TEPICSEVENT_H 00003 00004 #include "TGo4EventElement.h" 00005 00006 #include <vector> 00007 #include <algorithm> 00008 /* 00009 * Put all definitions here and use them in processor, 00010 * since they are necessary for data structure of event 00011 */ 00012 00013 00014 #define CBM_EPIX_useDOUBLES 1 00015 #define CBM_EPIX_DOUBLESCALE 1000000000 00016 00017 #define CBM_EPIX_STRLEN 1024 00018 00019 // number of trend histograms for display 00020 00021 #define _VARPRINT_ 0 00022 00023 class TEpicsEvent : public TGo4EventElement { 00024 00025 public: 00026 00027 TEpicsEvent(); 00028 TEpicsEvent(const char* name, Short_t id=0); 00029 virtual ~TEpicsEvent(); 00030 00032 virtual void Clear(Option_t *t=""); 00033 00034 virtual void PrintEvent(); 00035 00036 /* called by processor to discard previous values*/ 00037 void ResetData(); 00038 00039 /* initialize record name mapping with known setup - need only for cosy-dec10 setup*/ 00040 void InitRecordNames(); 00041 00042 /* Returns true if event content is consistent */ 00043 bool CheckConsistent(bool printerr = false); 00044 00045 /* update record name mapping from descriptor delivered in mbs event*/ 00046 void UpdateRecordNames(const char* descriptor, size_t dlen); 00047 00048 /* Deliver date string expression from update time*/ 00049 const char* GetUpdateTimeString(); 00050 00051 UInt_t GetUpdateTimeSeconds() { return fUTimeSeconds; } 00052 00053 bool IsLong(const std::string& pvname) const; 00054 00055 bool IsDouble(const std::string& pvname) const; 00056 00057 Long64_t GetLong(const std::string& pvname) const; 00058 00059 Double_t GetDouble(const std::string& pvname) const; 00060 00061 std::string GetLongName(UInt_t index) 00062 { return index<fEpicsLongIndices.size() ? fEpicsLongIndices[index] : std::string(""); } 00063 00064 Long64_t GetLong(UInt_t index) const 00065 { return index<GetNumLongs() ? fLongRecords[index] : 0; } 00066 00067 std::string GetDoubleName(unsigned index) 00068 { return index<fEpicsDoubleIndices.size() ? fEpicsDoubleIndices[index] : std::string(""); } 00069 00070 Double_t GetDouble(UInt_t index) const 00071 { return index<fDoubleRecords.size() ? fDoubleRecords[index] : 0.; } 00072 00073 UInt_t GetNumLongs() const { return fLongRecords.size(); } 00074 00075 UInt_t GetNumDoubles() const { return fDoubleRecords.size(); } 00076 00077 /* Mbs event id to match*/ 00078 UInt_t fEventId; 00079 00080 /* Time of last update from ioc*/ 00081 UInt_t fUTimeSeconds; 00082 00083 char fcTimeString[CBM_EPIX_STRLEN]; 00084 00085 /* long records in order of their defined indices*/ 00086 std::vector<Long64_t> fLongRecords; 00087 00088 /* double records in order of their defined indices*/ 00089 std::vector<Double_t> fDoubleRecords; 00090 00091 /* provides mapping of process variable names to indices*/ 00092 std::vector<std::string> fEpicsLongIndices; 00093 00094 /* provides mapping of process variable names to indices*/ 00095 std::vector<std::string> fEpicsDoubleIndices; 00096 00097 ClassDef(TEpicsEvent, 1) 00098 }; 00099 00100 #endif //TEVENT_H 00101