00001 #ifndef TFIBERHODPROC_H 00002 #define TFIBERHODPROC_H 00003 00004 #include "TCBMBeamtimeProc.h" 00005 00006 #include "TFiberHodEvent.h" 00007 00008 class TFiberHodParam; 00009 class TRocEvent; 00010 00011 class TFiberHodProc : public TCBMBeamtimeProc { 00012 public: 00013 TFiberHodProc(); // required for ROOT streamer 00014 TFiberHodProc(const char* name); 00015 virtual ~TFiberHodProc(); 00016 00017 virtual void InitEvent(TGo4EventElement*); 00018 virtual void FinalizeEvent(); 00019 00020 protected: 00021 00022 void InitializeDecoding(Int_t altflag=0); 00023 00024 void PrintAllHits(); 00025 00026 void PrintAllClusters(); 00027 00028 // Structures for defining decoding 00029 // ------------------------------------------------------------- 00030 00031 // struct to build decoding table, stored s vector fDecoding 00032 struct decodingentry_t { 00033 Int_t FEBchannel; //readout channel [0..127] 00034 Int_t fiber; //fiber number [1..64] 00035 Int_t plane; //[1..2], 1=X, 2=y 00036 Int_t pixel; //[1..64] 00037 Int_t lcn; //[1..16] 00038 Int_t cable; //[1..4] linear cable nr 00039 Double_t position; // in [mm], 0-point in middle of array, between fibers 32 and 33 00040 }; 00041 00042 // struct to build hit bank, stored as fHitbank 00043 struct hitbankentry_t { 00044 Int_t FEBchannel; 00045 Int_t fiber; 00046 Int_t plane; 00047 Int_t pixel; 00048 Double_t ADC; 00049 Double_t ADCraw; 00050 Double_t time; 00051 #ifdef HODOSCOPE_FULLTIMESTAMP 00052 uint64_t fulltime; // absolute ts 00053 #endif 00054 Double_t position; 00055 Int_t status; // 0:not clustered, 1:already clustered, 2:crosstalk 00056 }; 00057 00058 // comparison operator to be able to sort hitbank according to increasing plane and decreasing adc value 00059 struct adccompare { 00060 bool operator() ( const hitbankentry_t a, const hitbankentry_t b) 00061 { 00062 if (a.plane != b.plane) return a.plane < b.plane; 00063 return b.ADC < a.ADC; 00064 } 00065 }; 00066 00067 // struct to build clusterbank, stored as fClusterbank 00068 struct clusterbankentry_t { 00069 Int_t NrHits; 00070 Int_t plane; 00071 Double_t meanposition; 00072 Double_t meanfiber; 00073 Double_t sumADC; 00074 Double_t meantime; 00075 #ifdef HODOSCOPE_FULLTIMESTAMP 00076 uint64_t meanfulltime; // absolute ts 00077 #endif 00078 }; 00079 00080 // define data structures: decoding, hitbank, clusterbank using static vectors 00081 // --------------------------------------------------------------------------- 00082 00083 TFiberHodParam* fParam; 00084 00085 00086 // define geometry decoding table 00087 decodingentry_t fDecoding[128]; 00088 00089 TRocEvent* fRocEvent; 00090 TFiberHodEvent* fHodEvent; 00091 00092 std::vector<hitbankentry_t> fHitbank; 00093 00094 std::vector <clusterbankentry_t> fClusterbank; 00095 00096 Int_t fSingleEventSlice; 00097 00098 // Histogram pointers 00099 TH2 *hSingleEventHit2D; 00100 TH2 *hSingleEventCluster2D[5]; 00101 00102 TH1 *hMaxCh; 00103 TH1 *hMaxFiberall; 00104 TH1 *hMaxFiberpl1; 00105 TH1 *hMaxFiberpl2; 00106 TH1 *hADC; 00107 TH2 *hMaxADC; 00108 TH2 *hMaxADCraw; 00109 TH2 *hMaxFiber2D; 00110 TH1 *hNrHits; 00111 TH1 *hNrClusters; 00112 TH2 *hNrClusters2D; 00113 TH1 *hMaxClusterTimediff; 00114 TH1 *hPosition2D; 00115 00116 // Conditions 00117 TGo4WinCond *fADC_cond; 00118 00119 ClassDef(TFiberHodProc,1) 00120 }; 00121 00122 #endif 00123