00001 /* @version $Revision: 1831 $ * @modifiedby $Author: lcdet $ * @lastmodified $Date: 2012-08-20 11:48:00 +0200 (Mon, 20 Aug 2012) $ */ 00002 00003 #ifndef CHANNEL_HIT_HH 00004 #define CHANNEL_HIT_HH 00005 00006 ////////////////////////////////////////////////////////////////////////// 00007 // 00008 // ChannelHit for MICROMEGAS READOUT 00009 // 00010 ////////////////////////////////////////////////////////////////////////// 00011 00012 #include "geometry/Channel.hh" 00013 #include "mTypes.h" 00014 00015 #include <string> 00016 #include <vector> 00017 00018 ////////////////////////////////////////////////////////////////////////// 00019 /// CLASS ChannelHit // 00020 ////////////////////////////////////////////////////////////////////////// 00021 class ChannelHit { 00022 00023 public: 00024 ChannelHit(const Channel &); 00025 ChannelHit(const Channel &, const i16 aDigitalValue, const i16 aAnalogValue); 00026 // ChannelHit(const Channel &, const i16 aDigitalValue, const i16 aAnalogValue, int *threshold); 00027 00028 virtual ~ChannelHit() ; // Un destucteur virtuel permet d'apple le destructeur de la classe derivee 00029 00030 inline i16 getDigitalValue(void) const { return digitalValue; } 00031 inline i16 getAnalogValue(void) const { return analogValue; } 00032 inline bool setDigitalValue(i16 aValue) { digitalValue = aValue; return true; } 00033 inline bool setAnalogValue(i16 aValue) { analogValue = aValue; return true; } 00034 inline const Channel& getChannel(void) const { return channel; } 00035 inline const ui64 getTimestamp(void) const { return(timestamp); }; 00036 inline const ui32 getBcIdAbs(void) const { return(bcIdAbs); }; 00037 inline const ui32 getBcIdDif(void) const { return(bcIdDif); }; 00038 inline const ui32 getBcIdHit(void) const { return(bcIdHit); }; 00039 inline const ui32 getBcIdHitFine(void) const { return(bcIdHitFine); }; 00040 inline void setHardrocTime(const ui64 ts, const ui32 aBcIdAbs, const ui32 aBcIdDif, const ui32 aBcIdHit,const ui32 aBcIdHitFine) 00041 { timestamp = ts, bcIdAbs = aBcIdAbs, bcIdDif = aBcIdDif, bcIdHit = aBcIdHit; bcIdHitFine= aBcIdHitFine; }; 00042 inline void setTimestamp(const ui64 ts) { timestamp = ts; }; 00043 inline void setMemoryOrder(const ui16 order) { memoryOrder = order; }; 00044 inline ui16 getMemoryOrder(void)const { return memoryOrder ;} ; 00045 ui32 getAbsTime(void ) const; 00046 00047 00048 //------ methods --------// 00049 public: 00050 // static void sortByValue(std::vector <ChannelHit *>&, bool ascending); 00051 void print(void) const; 00052 00053 // ------ data members -------// 00054 private: 00055 i16 analogValue; 00056 i16 digitalValue; 00057 const Channel &channel; 00058 // hardroc-specific data 00059 ui64 timestamp; // common unix timestamp 00060 ui32 bcIdAbs; // t1: absolute BCID (BCID_abs) 00061 ui32 bcIdDif; // t2: BCID of the DIF (BCID_dif) 00062 ui32 bcIdHit; // t3: BCID of the hit (BCID_hit) 00063 ui32 bcIdHitFine; // permet de localiser en temps le Hit à l'intérieur de bcId_Dif avec une précision de 10ns. 00064 ui16 memoryOrder; // Ordre de lecture dans la memoire du Chip pour un meme trigger 00065 }; 00066 00067 ////////////////////////////////////////////////////////////////////////// 00068 // Used by std::sort on ChannelHit vector 00069 /* 00070 struct Descending 00071 { 00072 bool operator() (const ChannelHit * lhs, const ChannelHit * rhs) const 00073 { 00074 return lhs->getValue() > rhs->getValue(); 00075 } 00076 }; 00077 00078 struct Ascending 00079 { 00080 bool operator() (const ChannelHit * lhs, const ChannelHit * rhs) const 00081 { 00082 return lhs->getValue() < rhs->getValue(); 00083 } 00084 }; 00085 */ 00086 #endif // CHANNEL_HIT_HH