00001 #ifndef TGET4V1REC_H 00002 #define TGET4V1REC_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 "TGet4v1Event.h" 00013 #include "TGet4v1Param.h" 00014 00015 class TGet4Param; 00016 class TGo4MbsSubEvent; 00017 class TLatex; 00018 00019 class TGo4WinCond; 00020 00021 #define NUM_DIFFS 16 00022 #define MOD_DIFFS 7 00023 00024 struct TGet4v1Rec { 00025 00026 Int_t fRocId; 00027 roc::Iterator fIter; // iterator of current roc input buffer 00028 00029 TH1* fMsgTypes; // messages types 00030 TH1* fSysTypes; // system messages types 00031 TH1* fSysUserTypes; // user system messages 00032 TH1* fAUXch; // filling of AUX channels 00033 00034 TH1* fTrigger_All; // time shift between last trigger and hit 00035 TH1* fTrigger_AUX; // time shift between last trigger and all AUX 00036 TH1* fTrigger_All_100; // time shift between last trigger and hit (100ns bin) 00037 TH1* fTrigger_All_us; // time shift between last trigger and hit (1 us bin) 00038 TH1* fTrigger_All_ms; // time shift between last trigger and hit (1 ms bin) 00039 TH1* fTrigger_All_s; // time shift between last trigger and hit (1 s bin) 00040 TGo4WinCond* fTriggerWind; // time window to assign hits to event (relative to last trigger) 00041 TGo4WinCond* fAUXWind; // time window to assign AUX to event (relative to last trigger, differs from NX messages) 00042 TGo4WinCond* fSelfTrigWind; // time window to detect trigger inside data themselves 00043 TH1* fEvntMultipl; // event multiplicity (how many messages selected) 00044 00045 TH1* fALLt; // time distribution of all signals 00046 TH1* fDATAt; // time distribution of data signals 00047 TH1* fSelfTriggT; // time distribution of triggers from data 00048 TH1* fAUXt[MAX_AUX]; // time distribution of aux signals 00049 TH1* fSYNCt[MAX_SYNC]; // time distribution of sync signals 00050 00051 uint64_t fLastTm; // 00052 uint64_t fLastTriggerTm; // last time of trigger signal (defined by parameter) 00053 uint64_t fLastAuxTm[MAX_AUX]; // last time of rising edge of AUX signals 00054 uint64_t fLastSyncTm[MAX_SYNC]; // last time of SYNC signals 00055 uint32_t fLastSyncId[MAX_SYNC]; // last ID of SYNC signals 00056 uint64_t fStartSyncTm; // time of SYNC signal in the beginning of subevent 00057 uint64_t fStopSyncTm; // time of SYNC signal at the end of subevent 00058 00059 std::vector<TGet4v1MessageExtended> fUnprocessedMsg; // buffer of not accounted hit messages of previous mbs evnts 00060 00061 Int_t fDabcSeparator; // sync id of the dabc event separator. For event finalizing condition 00062 00063 Bool_t bIgnoreData; // true when data should be ignored during reconfiguration 00064 Int_t fIgnoreCnt; // counter used to process data when ignored, reset when ignore activated 00065 uint64_t fIgnoreTime; // time when ignore message was generated 00066 uint64_t fCollectTime; // time when collect message was generated 00067 00068 /* Modified part */ 00069 00070 // Epochs 00071 UInt_t fuCurrEpoch; // current epoch on the roc 00072 UInt_t fuEpochCycle; // Number of time the epoch counter cycled 00073 UInt_t fuCurrEpoch2[MAX_GET4_PER_ROC]; // current epoch2 for each get4 chip 00074 UInt_t fuEpoch2Cycle[MAX_GET4_PER_ROC]; // Number of time the epoch2 counter cycled 00075 TH1 *fDistribEpochs; 00076 TH2 *fDistribEpochs2; 00077 00078 // Buffers 00079 // ROC 00080 Bool_t fbBufferWithLastFullEpoch; 00081 std::vector<TGet4v1MessageExtended> fPrevEpochsBuffer[2]; // buffer of all ROC messages in current epoch and previous one 00082 Bool_t fbEpochSinceTrigger; 00083 std::vector<TGet4v1MessageExtended> fAfterTriggEpochsBuffer[2]; // buffer of all ROC messages in current epoch after a trigger and epoch after 00084 // GET4s 00085 Bool_t fbBufferWithLastFullEpoch2[MAX_GET4_PER_ROC]; 00086 std::vector<TGet4v1MessageExtended> fPrevEpochs2Buffer[MAX_GET4_PER_ROC][2]; // buffer of all get4 messages in current epoch and previous one 00087 Bool_t fbEpoch2SinceTrigger[MAX_GET4_PER_ROC]; 00088 std::vector<TGet4v1MessageExtended> fAfterTriggEpochs2Buffer[MAX_GET4_PER_ROC][2]; // buffer of all get4 messages in current epoch and previous one 00089 00090 // HitsSelection 00091 Bool_t fbPastEpochsRocDone; 00092 Bool_t fbSelectionRocDone; 00093 Bool_t fbPastEpochs2Done[MAX_GET4_PER_ROC]; 00094 Bool_t fbSelectionDone[MAX_GET4_PER_ROC]; 00095 TH1* fTrigger_Get4Channel[MAX_GET4_PER_ROC][NB_CHAN_GET4]; // time shift between last trigger and hit in this Get4 channel 00096 TH1* fTriggerMs_Get4Channel[MAX_GET4_PER_ROC][NB_CHAN_GET4]; // time shift between last trigger and hit in this Get4 channel 00097 TH1* fTriggerS_Get4Channel[MAX_GET4_PER_ROC][NB_CHAN_GET4]; // time shift between last trigger and hit in this Get4 channel 00098 00099 // Triggering on data themselves 00100 uint64_t fulLastTimeMainChannel; 00101 UInt_t fuLastEpoch2MainChannel; 00102 uint64_t fulLastTimeSecChannel[MAX_SEC_TDC]; 00103 UInt_t fuLastEpoch2SecChannel[MAX_SEC_TDC]; 00104 00105 TH2 *fChannelsMapping; 00106 TH1 *fChannelInputMessCount; 00107 TH2 *fChannelMultiplicity; 00108 00109 00110 /* 00111 * 24 & 32 bits variables & histograms 00112 */ 00113 TH1 *fTot[MAX_GET4_PER_ROC][NB_CHAN_GET4]; 00114 00115 /* 00116 * 24 bits specific variables & histograms 00117 */ 00118 // TGet4v1MessageExtended fextMessLasrRisingEdge[MAX_GET4_PER_ROC][NB_CHAN_GET4]; 00119 Get4v1Hit fHitTemp24[MAX_GET4_PER_ROC][NB_CHAN_GET4]; 00120 00121 /* 00122 * 32 bits specific variables & histograms 00123 */ 00124 Bool_t fb32bitsReadoutDetected; 00125 TH2 *fGet4V1SlowControlType; 00126 TH2 *fGet4V1SlowControlScaler; 00127 TH2 *fGet4V1SlowControlDeadTime; 00128 TH1 *fGet4ErrorChip; // Get4 System Error chip 00129 TH2 *fGet4ErrorChan; // Get4 System Error channel/edge 00130 TH2 *fGet4ErrorPatt; // Get4 System Error pattern 00131 Bool_t fbDllFlag[MAX_GET4_PER_ROC][NB_CHAN_GET4]; 00132 TH2 *fGet4V1DllLockBit; 00133 00134 TGet4v1MessageExtended fLastExtMess[MAX_GET4_PER_ROC][NB_CHAN_GET4]; 00135 TH2 *fGet4V1HitsDistanceNs[MAX_GET4_PER_ROC]; 00136 TH2 *fGet4V1HitsDistanceUs[MAX_GET4_PER_ROC]; 00137 TH2 *fGet4V1HitsDistanceMs[MAX_GET4_PER_ROC]; 00138 TH2 *fGet4V1HitsDistanceS[MAX_GET4_PER_ROC]; 00139 00140 /* 00141 * Debug Histograms for GET4 v1.x 00142 */ 00143 TH1 *fLeadingFTS[MAX_GET4_PER_ROC][NB_CHAN_GET4]; 00144 TH1 *fTrailingFTS[MAX_GET4_PER_ROC][NB_CHAN_GET4]; 00145 TH1 *fLeadingDnl[MAX_GET4_PER_ROC][NB_CHAN_GET4]; 00146 TH1 *fLeadingDnlSum[MAX_GET4_PER_ROC][NB_CHAN_GET4]; 00147 TH1 *fTrailingDnl[MAX_GET4_PER_ROC][NB_CHAN_GET4]; 00148 TH1 *fTrailingDnlSum[MAX_GET4_PER_ROC][NB_CHAN_GET4]; 00149 00150 TH1 *fTimeDiffInsideChip[2][NB_CHAN_GET4*(NB_CHAN_GET4-1)/2]; 00151 TH1 *fTimeDiffBetweenChips[NB_CHAN_GET4*NB_CHAN_GET4]; 00152 00153 TH1 *fFTCorrel[2][NB_CHAN_GET4*(NB_CHAN_GET4-1)/2]; 00154 TH2 *fFTCorrel2D[2][NB_CHAN_GET4*(NB_CHAN_GET4-1)/2]; 00155 TH1 *fFTCorrelChipToChip[NB_CHAN_GET4*NB_CHAN_GET4]; 00156 00157 TGet4v1Rec(); 00158 00159 UInt_t GetFullEpochNumber(); 00160 UInt_t GetFullEpoch2Number( UInt_t uGet4Id); 00161 }; 00162 00163 00164 #endif 00165 00166