00001 #ifndef TSTSPROC_H 00002 #define TSTSPROC_H 00003 00004 #include "TRocProc.h" 00005 #include "TSTSEvent.h" 00006 #include "TEpicsEvent.h" 00007 //#include "TBeamMonitorEvent.h" 00008 //#include "TFiberHodEvent.h" 00009 #include "TSTSParam.h" 00010 #include "TGo4Picture.h" 00011 #include "TH1.h" 00012 #include "TH2.h" 00013 #include "TGo4WinCond.h" 00014 #include "TCBMBeamtimeProc.h" 00015 #include "TSTSTopology.h" 00016 #include "TSTSClusterizer.h" 00017 #include "TSTSHiterizer.h" 00018 #include "TSTSGeometry.h" 00019 00020 class TSTSProc : public TCBMBeamtimeProc { 00021 00022 friend class TCBMBeamtimeProc; // may call protected process methods 00023 00024 public: 00025 TSTSProc(const char* name = 0); 00026 virtual ~TSTSProc(); 00027 00028 virtual void InitEvent(TGo4EventElement*); 00029 00030 /* this is the main processing function here*/ 00031 virtual void FinalizeEvent(); 00032 00033 00034 00035 00036 protected: 00037 00038 00039 // Bool_t IsSTS(TRocMessageExtended& msg); 00040 00041 /* Evaluate current scan PV set. Returns true if processing of current message shall continue, 00042 * returns false if next message is to be processed immediately*/ 00043 Bool_t CheckScanSetup( uint32_t value , Int_t rocId); 00044 00045 Int_t STS_GetStrip(Int_t side, Int_t odd, Int_t nxCh); 00046 00047 void ProcessValidMessage( TRocMessageExtended& msg); 00048 00049 void EvaluateHits(); 00050 00051 00052 // static UChar_t fStsRocIds[TSTSTopology::kRocArrSize]; 00053 00061 // 00062 // std::vector< std::vector< TH1 * > > fSTSHit; 00063 00064 std::vector< std::vector< TH1 * > > fSTSDigiPos; 00065 std::vector< std::vector< TH1 * > > fSTSDigiAmp; 00066 std::vector< std::vector< TH1 * > > fSTSDigiTime; 00067 std::vector< std::vector< TH2 * > > fSTSDigiAmpVsPos; 00068 00069 // this is for testing the laser table scan: 00070 std::vector< std::vector< TH2 * > > fSTSDigiPosLaserX; 00071 std::vector< std::vector< TH2 * > > fSTSDigiPosLaserY; 00072 TH2* fLaserPosition; 00073 TH2* fNxChannelVsLaserX[MAX_ROC][MAX_NX]; 00074 TH2* fNxChannelVsLaserY[MAX_ROC][MAX_NX]; 00075 00076 00077 std::vector< std::vector< TH1 * > > fSTSClustPos; 00078 std::vector< std::vector< TH1 * > > fSTSClustAmp; 00079 std::vector< std::vector< TH2 * > > fSTSClustAmpVsPos; 00080 std::vector< std::vector< TH2 * > > fSTSClustAmpVsTime; 00081 00082 std::vector< TH2 * > fSTSHitXY; 00083 std::vector< TH2 * > fSTSHitXYBinned; 00084 std::vector< std::vector < TSTSClusterizer * > > fClusterizers; 00085 std::vector< TSTSHiterizer * > fHiterizers; 00086 00087 TSTSParam * fPar; 00088 TRocParam * fRocParam; 00089 00090 TSTSTopology fSTSTopology; 00091 TSTSGeometry fSTSGeometry; 00092 00094 TRocEvent * fRocInputEvent; 00095 TEpicsEvent * fEpicsInputEvent; 00096 00097 TSTSEvent * fOutputEvent; 00098 00099 TCBMBeamtimeEvent* fFullOutputEvent; 00100 00101 00102 /* buffer the laser measurement points here until the corresponding roc message occurs*/ 00103 std::vector<TSTSEvent::lasersetup_t> fLaserSetupBuffer; 00104 00105 /* buffer roc messages which arrive before we have epics setup*/ 00106 TRocEvent * fRocMessageBuffer; 00107 00108 /* note state of each data stream separately*/ 00109 Bool_t fOffScanpoint[MAX_ROC]; 00110 Bool_t fInScanpoint[MAX_ROC]; 00111 Bool_t fEventClosed[MAX_ROC]; 00112 UInt_t fNextScanId[MAX_ROC]; 00113 Bool_t fReplayBuffers; 00114 00115 00116 00117 Bool_t AllRocsHaveEventClosed() 00118 { 00119 for(int n=0;n<MAX_ROC;++n) 00120 { 00121 if(TRocEvent::ConfigRocs[n]==0) continue; 00122 if(!fEventClosed[n]) 00123 return kFALSE; 00124 } 00125 return kTRUE; 00126 } 00127 00128 00129 00130 ClassDef(TSTSProc,1) 00131 }; 00132 00133 #endif //TUNPACKPROCESSOR_H 00134