00001 #ifndef TROCREC_H 00002 #define TROCREC_H 00003 00004 00005 #include <vector> 00006 #include <stdint.h> 00007 00008 #include "TCBMBeamtimeProc.h" 00009 #include "roc/Iterator.h" 00010 #include "roc/Message.h" 00011 #include "roc/Board.h" 00012 #include "TRocEvent.h" 00013 00014 class TRocParam; 00015 class TPedestalExtractor; 00016 class TGo4MbsSubEvent; 00017 class TLatex; 00018 00019 class TGo4WinCond; 00020 00021 00022 #define NUM_DIFFS 16 00023 #define MOD_DIFFS 7 00024 00025 00026 struct TRocRec { 00027 00028 Int_t fRocId; 00029 roc::Iterator fIter; // iterator of current roc input buffer 00030 00031 uint32_t fCurrEpoch; // current epoch on the roc 00032 00033 TH2* fADCs[MAX_NX]; // individual ADC histogram for each ROC/nxyter 00034 TH2* fTrigADCs[MAX_NX]; // individual ADC histogram for each ROC/nxyter 00035 TH2* fBaseline[MAX_NX]; // individual baseline histogram for each ROC/nxyter 00036 TH2* fADCs_wo_baseline[MAX_NX]; // individual ADC wo baseline for each ROC/nxyter 00037 TH1* fChs[MAX_NX]; // individual ADC histogram for each ROC/nxyter 00038 TH1* fAUXt[MAX_AUX]; // time distribution of aux signals 00039 TH1* fSYNCt[MAX_SYNC]; // time distribution of sync signals 00040 TH1* fHITt[MAX_NX]; // time distribution of hit signals 00041 TH1* fALLt; // time distribution of all signals 00042 TH1* fAUXch; // filling of AUX channels 00043 TH1* fMsgTypes; // messages types 00044 TH1* fSysTypes; // system messages types 00045 TH1* fSysUserTypes; // user system messages 00046 TH1* fFebADC[2]; // value of ADC on the FEBs 00047 00048 TH1* fTrigger_AllNX; // time shift between last trigger and nXYTER hit 00049 TH1* fTrigger_AUX; // time shift between last trigger and all AUX 00050 TH1* fTrigger_AllNX_100; // time shift between last trigger and nXYTER hit (100ns bin) 00051 TGo4WinCond* fTriggerWind; // time window to assign hits to event (relative to last trigger) 00052 TGo4WinCond* fAUXWind; // time window to assign AUX to event (relative to last trigger, differs from NX messages) 00053 TH1* fEvntMultipl; // event multiplicity (how many messages selected) 00054 TH1* fTrigger_NX[MAX_NX]; // time shift between last trigger and nXYTER hit 00055 TH1* fTrigger_Chs[MAX_NX]; // channel occupation for the trigger condition 00056 00057 uint64_t fLastTm; // 00058 uint64_t fLastTriggerTm; // last time of trigger signal (defined by parameter) 00059 uint64_t fLastAuxTm[MAX_AUX]; // last time of rising edge of AUX signals 00060 uint64_t fLastSyncTm[MAX_SYNC]; // last time of SYNC signals 00061 uint32_t fLastSyncId[MAX_SYNC]; // last ID of SYNC signals 00062 uint64_t fStartSyncTm; // time of SYNC signal in the beginning of subevent 00063 uint64_t fStopSyncTm; // time of SYNC signal at the end of subevent 00064 00065 uint64_t fNxTm[MAX_NX][NUM_NXCHANNELS]; // time of last measured hit 00066 00067 TH1* fTmDiff[MAX_NX][NUM_DIFFS]; // time differences between NX channels 0 and 7 00068 00069 std::vector<TRocMessageExtended> fUnprocessedMsg; // buffer of not accounted hit messages of previous mbs evnts 00070 00071 std::vector<TRocMessageExtended> fTmpMessages; // temporary buffer to transfer messages via two mbs events 00072 00073 00074 Bool_t fIsEventComplete; // flag to indicate that all messages in time window are captured 00075 Bool_t fHasNewData; // flag indicates if new data was produced for the ROC 00076 Bool_t fHasNewTrigger; // flag to indicate that we have new local trigger message for this ROC 00077 Bool_t fHasEndOfBuffer; // flag to indicate that mbs input buffer is fully processed 00078 UInt_t fTriggersPerBuffer; // count number of aux triggers per buffer (new buffer if this is above parameter maximum) 00079 UInt_t fLoopsPerBuffer; // count loops over same mbs input event in keep mode. (new buffer is this is above parameter maximumd) 00080 00081 Int_t fDabcSeparator; // sync id of the dabc event separator. For event finalizing condition 00082 00083 Bool_t bCollectBaseline; // indicate if collecting of base line is on 00084 Bool_t bIgnoreData; // true when data should be ignored during reconfiguration 00085 Int_t fIgnoreCnt; // counter used to process data when ignored, reset when ignore activated 00086 uint64_t fIgnoreTime; // time when ignore message was generated 00087 uint64_t fCollectTime; // time when collect message was generated 00088 00089 // GET4 part 00090 00091 00092 uint32_t fLastEpoch2[MAX_GET4]; // last epoch2 time 00093 uint32_t fLastEpoch2Sync[MAX_GET4]; // last epoch2 time with sync=1 00094 uint64_t fLastGet4Tm[MAX_GET4][MAX_GET4_CH][2]; // last time stamp on each Get4 channel 00095 TH1* fGet4SysTypes; // Get4 System message type 00096 TH1* fGet4Chips; // count of GET4 messages from single chips 00097 TH1* fGet4Channels[MAX_GET4]; // distribution of channels in GET4 chip 00098 TH1* fGet4Tm[MAX_GET4]; // distribution of GET4 time stamps 00099 TH1* fGet4TmCh[MAX_GET4][MAX_GET4_CH][2]; // distribution of GET4 time stamps for single channels/flank 00100 TH1* fGet4DiffSync[MAX_GET4]; // distribution of GET4 time stamps relative to last sync epoch 00101 TH1* fGet4Trigger[MAX_GET4]; // distribution of GET4 time stamps relative to last trigger 00102 TH1* fGet4Trigger100[MAX_GET4]; // distribution of GET4 time stamps relative to last trigger 00103 TLatex* fGet4Info[MAX_GET4]; // statistic info about each channel 00104 int fGet4ChCnt[MAX_GET4][MAX_GET4_CH][2]; // counter for GET4 messages per channel 00105 int fGet4EdgeCnt[MAX_GET4][MAX_GET4_CH]; // counter for GET4 edges per channel 00106 int fGet4ErrCnt[MAX_GET4][MAX_GET4_CH]; // counter for GET4 edges errors per channel 00107 int fGet4ChangeCnt[MAX_GET4][MAX_GET4_CH]; // how many edge changes was detected 00108 int fGet4SuspiciousCnt[MAX_GET4][MAX_GET4_CH]; // how many suspicious edge changes was detected 00109 uint32_t fLastEpoch2Info[MAX_GET4]; // last Epoch2, used to produce information 00110 int fEpoch2cnt[MAX_GET4]; // counter for epoch2 messages 00111 00112 TRocRec(); 00113 00114 void ProcessEpoch2(unsigned g4id, uint32_t epoch2, uint32_t sync, Bool_t debug = kFALSE); 00115 }; 00116 00117 00118 #endif 00119 00120