Go to the documentation of this file.00001 #ifndef NX_PROCESSOR_H
00002 #define NX_PROCESSOR_H
00003
00004 #include "base/SysCoreProc.h"
00005
00006 #include "roc/Iterator.h"
00007
00008 namespace nx {
00009
00010 class SubEvent;
00011
00012 struct NxRec {
00013 bool used;
00014
00015 base::H1handle fChannels;
00016 base::H2handle fADCs;
00017 base::H1handle fHITt;
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 uint64_t lastfulltm1;
00031 uint64_t lastfulltm2;
00032
00033 NxRec() : used(false), fChannels(0), fADCs(0), fHITt(0), lastfulltm1(0), lastfulltm2(0) {}
00034
00035
00036
00037
00038
00039 int corr_nexthit(roc::Message& msg, uint64_t fulltm, bool docorr = false, bool firstscan = true);
00040 };
00041
00042 class Processor : public base::SysCoreProc {
00043
00044 protected:
00045 roc::Iterator fIter;
00046 roc::Iterator fIter2;
00047
00048 base::H1handle fMsgsKind;
00049 base::H1handle fSysTypes;
00050
00051 std::vector<nx::NxRec> NX;
00052
00053 int fNumHits;
00054 int fNumBadHits;
00055 int fNumCorrHits;
00056
00057 bool nx_in_use(unsigned id) { return id < NX.size() ? NX[id].used : false; }
00058
00059 bool IsValidBufIndex(unsigned indx) const { return indx<fQueue.size(); }
00060
00061 void AssignBufferTo(roc::Iterator& iter, const base::Buffer& buf);
00062
00063
00064 virtual double MaximumDisorderTm() const { return fNXDisorderTm; }
00065
00067 virtual unsigned GetTriggerMultipl(unsigned indx);
00068
00069 virtual void SortDataInSubEvent(base::SubEvent*);
00070
00071 static double fNXDisorderTm;
00072 static bool fLastEpochCorr;
00073
00074 public:
00075
00076 Processor(unsigned rocid, unsigned nxmask = 0x5);
00077 virtual ~Processor();
00078
00080 virtual bool FirstBufferScan(const base::Buffer& buf);
00081
00083 virtual bool SecondBufferScan(const base::Buffer& buf);
00084
00085 static void SetDisorderTm(double v) { fNXDisorderTm = v; }
00086 static void SetLastEpochCorr(bool on) { fLastEpochCorr = on; }
00087 static bool IsLastEpochCorr() { return fLastEpochCorr; }
00088 };
00089 }
00090
00091 #endif