• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

newmonitor/nx/Processor.h (r3879/r3877)

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       // these variables for wrong last-epoch bit detection
00021       // idea is simple - every readout costs 32 ns
00022       // if last epoch is appears, one need to have long readout history
00023 
00024 /*      unsigned lasthittm;
00025       unsigned reversecnt;
00026       unsigned lasthit[128];
00027       unsigned lastch;
00028       unsigned lastepoch;
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 //      void corr_reset();
00036 //      void corr_nextepoch(unsigned epoch);
00037 //      int corr_nexthit_old(roc::Message& msg, bool docorr = false);
00038 //      int corr_nexthit_next(roc::Message& msg, bool docorr = false);
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          // this constant identify to which extend NX time can be disordered
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

Generated on Thu Dec 13 2012 04:52:22 for ROCsoft by  doxygen 1.7.1