00001 #ifndef TSPADICV10PROC_H 00002 #define TSPADICV10PROC_H 00003 00004 #include "sp605/Iterator.h" 00005 00006 #include <vector> 00007 #include <stdint.h> 00008 00009 #include "TCBMBeamtimeProc.h" 00010 00011 #include "sp605/Message.h" 00012 #include "sp605/Board.h" 00013 00014 class TSpadicV10Param; 00015 class TPedestalExtractor; 00016 class TGo4MbsSubEvent; 00017 class TGet4MessageFull; 00018 00019 #include "TSpadicV10Event.h" 00020 #include "TSpadicV10Rec.h" 00021 00022 00023 class TSpadicV10Proc : public TCBMBeamtimeProc { 00024 public: 00025 TSpadicV10Proc(); 00026 TSpadicV10Proc(const char* name); 00027 virtual ~TSpadicV10Proc() ; 00028 00029 virtual void InitEvent(TGo4EventElement * evt); 00030 00031 virtual void ProcessSubevent(TGo4MbsSubEvent* subevt); 00032 00033 virtual void FinalizeEvent(); 00034 00035 protected: 00036 00038 //virtual void ProcessNxHit(sp605::Message* msg, Double_t nxadc_corr) {} 00039 00041 void ProcessExtendedMessage(unsigned sid, TSpadicV10Data* rocevent, TSpadicV10MessageExtended& msg, bool with_unprocessed = true); 00042 00043 void ProcessTriggerMessage(TSpadicV10Data* event, int brd_id, uint64_t fulltm); 00044 00045 void LoadPedestalFile(const char* fname); 00046 void SavePedestalFile(const char* fname); 00047 00049 // Bool_t ProcessGet4EpochMessage(UInt_t uSpadicV10Id, TSpadicV10Data* rocEvent, UInt_t uGet4IndexOffset, sp605::Message* mesData); 00050 // Bool_t ProcessGet4DataMessage(UInt_t uSpadicV10Id, UInt_t uGet4IndexOffset, sp605::Message* mesData); 00051 // Bool_t ProcessGet4ExtSyncMessage(UInt_t uGet4IndexOffset, sp605::Message* mesData); 00052 // Bool_t TimeOrderMessageBuffer( TSpadicV10Data* rocToSort); 00053 // 00054 Bool_t PrintSpadicV10EpochIndexes(Int_t uMessagePriority = 0); 00055 Bool_t PrintSpadicV10EpochCycles(Int_t uMessagePriority = 0); 00056 Bool_t PrintLocalEpochIndexes(Int_t uMessagePriority = 0); 00057 Bool_t PrintLocalEpochCycles(Int_t uMessagePriority = 0); 00058 Bool_t PrintUnsynchronizedEpochCount(Int_t uMessagePriority = 0); 00059 Bool_t PrintTotalUnsynchronizedEpochCount(Int_t uMessagePriority = 0); 00060 Bool_t PrintMessageBufferIndexes(Int_t uMessagePriority = 0); 00061 Bool_t PrintMessageBufferSizes(Int_t uMessagePriority = 0); 00062 00063 /* after event completion reset until next triggers are found*/ 00064 void ResetTrigger(); 00065 00066 /* after all input buffers are done, we reset end of buffer flag*/ 00067 void ResetEndOfBuffer(); 00068 00069 // /* subfunction which is called when trigger window is fullfilled.*/ 00070 // void ProcessTriggeredData(TSpadicV10MessageExtended& msg); 00071 00072 unsigned numBoards() const { return BRDS.size(); } 00073 00074 Bool_t AssertBoard(unsigned brd) 00075 { 00076 return brd < BRDS.size() ? BRDS[brd].fActive : kFALSE; 00077 } 00078 00079 Bool_t AssertSpadic(unsigned brd, unsigned spid) 00080 { 00081 return brd < BRDS.size() ? BRDS[brd].AssertSpadic(spid) : kFALSE; 00082 } 00083 00084 Bool_t AssertGroup(unsigned gid) 00085 { 00086 return gid < MAX_SPADICV10_GROUPS; 00087 } 00088 00089 TSpadicV10Param *fParam; 00090 00091 std::vector<TSpadicV10BoardRec> BRDS; 00092 00093 00094 Bool_t fIsTimeSorted; // true if messages within mbs container are strictly time sorted 00095 00096 TH1 *fEvntSize; 00097 00098 TH1 *fMsgsPerBoard; 00099 TH1 *fTriggersPerBoard; 00100 00101 TH1 *fSYNC1_R01; // example how compare SYNC from different boards 00102 TH1 *fAUX2_R01; // example how compare AUX from different boards 00103 00104 TH1* fDeltaTriggerTime; // absolute time difference of all hits with respect to global trigger 00105 TGo4WinCond* fGlobalTriggerWind; // time window to assign hits to output event (relative to last global trigger) 00106 TGo4WinCond* fGlobalAUXWind; // time window to assign AUX to output event (relative to last global trigger) 00107 00108 ULong_t fTotaldatasize; 00109 00110 UInt_t fCurrEvntTm; 00111 00112 Double_t fLastRateTm; // last time of rate measurement 00113 Double_t fRate; // currently calculated rate 00114 00115 TSpadicV10Event * fOutputEvent; 00116 Bool_t fFirstSubEvent; 00117 00118 Bool_t fHasNewGlobalTrigger; 00119 unsigned fTriggerCounter; 00120 00121 private: 00122 00123 00124 00125 ClassDef(TSpadicV10Proc,1) 00126 }; 00127 00128 #endif //TUNPACKPSPADICV10ESSOR_H 00129