00001 /* @version $Revision: 1328 $ * @modifiedby $Author: jacquem $ * @lastmodified $Date: 2011-10-03 17:04:17 +0200 (Mon, 03 Oct 2011) $ */ 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 getBcId_Abs(void) const { return(bcId_Abs); }; 00037 inline const ui32 getBcId_Dif(void) const { return(bcId_Dif); }; 00038 inline const ui32 getBcId_Hit(void) const { return(bcId_Hit); }; 00039 inline const ui32 getBcId_Hit_Fine(void) const { return(bcId_Hit_Fine); }; 00040 inline void setHardrocTime(const ui64 ts, const ui32 aBcId_Abs, const ui32 aBcId_Dif, const ui32 aBcId_Hit,const ui32 aBcId_Hit_Fine) 00041 { timestamp = ts, bcId_Abs = aBcId_Abs, bcId_Dif = aBcId_Dif, bcId_Hit = aBcId_Hit; bcId_Hit_Fine= aBcId_Hit_Fine; }; 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 00046 //------ methods --------// 00047 public: 00048 // static void sortByValue(std::vector <ChannelHit *>&, bool ascending); 00049 void print(void) const; 00050 00051 // ------ data members -------// 00052 private: 00053 i16 analogValue; 00054 i16 digitalValue; 00055 const Channel &channel; 00056 // hardroc-specific data 00057 ui64 timestamp; // common unix timestamp 00058 ui32 bcId_Abs; // t1: absolute BCID (BCID_abs) 00059 ui32 bcId_Dif; // t2: BCID of the DIF (BCID_dif) 00060 ui32 bcId_Hit; // t3: BCID of the hit (BCID_hit) 00061 ui32 bcId_Hit_Fine; // permet de localiser en temps le Hit à l'intérieur de bcId_Dif avec une précision de 10ns. 00062 ui16 memoryOrder; // Ordre de lecture dans la memoire du Chip pour un meme trigger 00063 }; 00064 00065 ////////////////////////////////////////////////////////////////////////// 00066 // Used by std::sort on ChannelHit vector 00067 /* 00068 struct Descending 00069 { 00070 bool operator() (const ChannelHit * lhs, const ChannelHit * rhs) const 00071 { 00072 return lhs->getValue() > rhs->getValue(); 00073 } 00074 }; 00075 00076 struct Ascending 00077 { 00078 bool operator() (const ChannelHit * lhs, const ChannelHit * rhs) const 00079 { 00080 return lhs->getValue() < rhs->getValue(); 00081 } 00082 }; 00083 */ 00084 #endif // CHANNEL_HIT_HH