00001 #ifndef TROCPROC_H 00002 #define TROCPROC_H 00003 00004 #include "TGo4EventProcessor.h" 00005 00006 #include <vector> 00007 #include <stdint.h> 00008 00009 class TRocParam; 00010 class TPedestalExtractor; 00011 class TGo4MbsSubEvent; 00012 00013 #define MAX_NX 4 00014 #define MAX_AUX 4 00015 #define MAX_SYNC 2 00016 00017 #define NUM_NXCHANNELS 128 00018 #define NUM_DIFFS 16 00019 #define MOD_DIFFS 7 00020 00021 namespace roc { 00022 class Message; 00023 } 00024 00025 struct TRocRec { 00026 uint32_t fCurrEpoch; // current epoch on the roc 00027 uint32_t fCurrEvent[2]; // current event 00028 00029 uint64_t fLastAUX; // last aux signal (one per roc) 00030 TH2* fADCs[MAX_NX]; // individual ADC histogram for each ROC/nxyter 00031 TH2* fBaseline[MAX_NX]; // individual baseline histogram for each ROC/nxyter 00032 TH2* fADCs_wo_baseline[MAX_NX]; // individual ADC wo baseline for each ROC/nxyter 00033 TH1* fChs[MAX_NX]; // individual ADC histogram for each ROC/nxyter 00034 TH1* fAUXt[MAX_AUX]; // time distribution of aux signals 00035 TH1* fSYNCt[MAX_SYNC]; // time distribution of sync signals 00036 TH1* fAUXch; // filling of AUX channels 00037 TH1* fMsgTypes; // messages types 00038 TH1* fSysTypes; // system messages types 00039 TH1* fSysUserTypes; // user system messages 00040 TH1* fFebADC[2]; // value of ADC on the FEBs 00041 00042 TH1* fTrigger_AllNX; // time shift between last trigger and nXYTER hit 00043 TH1* fTrigger_AllNX_100; // time shift between last trigger and nXYTER hit (100ns bin) 00044 TGo4WinCond* fTriggerWind; // time window to assign hits to event (relative to last trigger) 00045 TH1* fEvntMultipl_AllNX; // event multiplicity in time window after AUX2 signal 00046 TH1* fTrigger_NX[MAX_NX]; // time shift between last trigger and nXYTER hit 00047 TH1* fTrigger_Chs[MAX_NX]; // channel occupation for the trigger condition 00048 TH1* fEvntMultipl_NX[MAX_NX]; // event multiplicity in time window after AUX2 signal 00049 00050 uint64_t fLastTm; // 00051 uint64_t fLastTriggerTm; // last time of trigger signal (defined by parameter) 00052 uint64_t fNextTriggerTm; // time of next trigger, only possible in case when SYNC is trigger 00053 uint16_t fLastCh; // 00054 uint64_t fLastAuxTm[MAX_AUX]; // last time of rising edge of AUX signals 00055 uint64_t fLastSyncTm[MAX_SYNC]; // last time of SYNC signals 00056 uint32_t fEvMultipl_AllNX; // event multiplicity 00057 uint32_t fEvMultipl_NX[MAX_NX]; // event multiplicity 00058 00059 uint64_t fNxTm[MAX_NX][NUM_NXCHANNELS]; // time of last measured hit 00060 00061 TH1* fTmDiff[MAX_NX][NUM_DIFFS]; // time differences between NX channels 0 and 7 00062 00063 Bool_t bCollectBaseline; // indicate if collecting of base line is on 00064 Bool_t bIgnoreData; // true when data should be ignored during reconfiguration 00065 uint64_t fIgnoreTime; // time when ignore message was generated 00066 uint64_t fCollectTime; // time when collect message was generated 00067 00068 TPedestalExtractor *fPedestals; 00069 00070 TRocRec(); 00071 }; 00072 00073 class TRocProc : public TGo4EventProcessor { 00074 public: 00075 TRocProc(const char* name = 0); 00076 virtual ~TRocProc() ; 00077 00078 virtual Bool_t BuildEvent(TGo4EventElement*); // event processing function 00079 00080 protected: 00081 00083 virtual void ProcessRocMsg(roc::Message* msg) {} 00084 00086 virtual void ProcessNxHit(roc::Message* msg, Double_t nxadc_corr) {} 00087 00088 virtual void ProcessSubevent(TGo4MbsSubEvent* subevt) {} 00089 00090 virtual int32_t CalcDistanceToTrigger(int rocid, uint64_t fulltm); 00091 00092 void ProcessTriggerMessage(int rocid, uint64_t fulltm); 00093 00094 TRocParam *fParam; 00095 00096 unsigned fNumRocs; 00097 00098 bool nx_use_mask[MAX_NX]; 00099 00100 TH1 *fEvntSize; 00101 00102 TH1 *fMsgsPerRoc; 00103 TH1 *fTriggerPerRoc; 00104 00105 UInt_t fCurrEvntTm; 00106 00107 Double_t fLastRateTm; // last time of rate measurement 00108 Double_t fRate; // currently calculated rate 00109 00110 std::vector<TRocRec> ROC; 00111 00112 ClassDef(TRocProc,1) 00113 }; 00114 00115 #endif //TUNPACKPROCESSOR_H 00116