00001 #ifndef TrackFitEvent_MeasurementFunctor_H 00002 #define TrackFitEvent_MeasurementFunctor_H 1 00003 00004 // Include files 00005 // ------------- 00006 #include <functional> 00007 #include "Event/Measurement.h" 00008 #include "Event/FitTrack.h" 00009 00024 namespace MeasurementFunctor 00025 { 00026 00027 //============================================================================= 00028 // Class to test equality of Measurements 00029 //============================================================================= 00030 // class equalTo: public std::unary_function<Measurement*, bool> { 00031 // private: 00032 // const Measurement& m_meas; 00033 // public: 00034 // explicit equalTo( const Measurement& meas ):m_meas(meas) {} 00035 // bool operator()( const Measurement* meas ) const 00036 // { 00037 // return m_meas.equal( meas ); 00038 // } 00039 // }; 00040 00041 //============================================================================= 00042 // Class to test equality of Measurement types 00043 //============================================================================= 00044 class typeEqualTo: public std::unary_function<Measurement*, bool> { 00045 private: 00046 const Measurement::Type& m_measType; 00047 public: 00048 explicit typeEqualTo( const Measurement::Type& measType ): 00049 m_measType( measType ) {} 00050 bool operator()( const Measurement* meas ) const 00051 { 00052 return meas -> checkType( m_measType ); 00053 // return m_measType == meas -> type(); 00054 } 00055 }; 00056 00057 //============================================================================= 00058 // Class to test if the z of a Measurement is < than a certain value 00059 //============================================================================= 00060 class less_z: public std::unary_function<Measurement*, bool> { 00061 private: 00062 double m_z; 00063 public: 00064 explicit less_z( double z ):m_z(z) {} 00065 bool operator()( const Measurement* meas ) const 00066 { 00067 return meas -> z() < m_z; 00068 } 00069 }; 00070 00071 //============================================================================= 00072 // Class to test if the z of a Measurement is > than a certain value 00073 //============================================================================= 00074 class greater_z: public std::unary_function<Measurement*, bool> { 00075 private: 00076 double m_z; 00077 public: 00078 explicit greater_z( double z ):m_z(z) {} 00079 bool operator()( const Measurement* meas ) const 00080 { 00081 return meas -> z() > m_z; 00082 } 00083 }; 00084 00085 //============================================================================= 00086 // Class for sorting Measurements by increasing z 00087 //============================================================================= 00088 class increasingByZ { 00089 public: 00090 bool operator()( const Measurement* firstHit, 00091 const Measurement* secondHit ) const 00092 { 00093 return (0==firstHit) ? true : (0==secondHit) ? 00094 false : firstHit->z() < secondHit->z(); 00095 } 00096 }; 00097 00098 //============================================================================= 00099 // Class for sorting Measurements by decreasing z 00100 //============================================================================= 00101 class decreasingByZ { 00102 public: 00103 bool operator()( const Measurement* firstHit, 00104 const Measurement* secondHit ) const 00105 { 00106 return (0==firstHit) ? true : (0==secondHit) ? 00107 false : firstHit->z() > secondHit->z(); 00108 } 00109 }; 00110 00111 //============================================================================= 00112 // Predicate returning if Measurement is on a Track 00113 //============================================================================= 00114 // // Temp direct use of concrete class FitTrack because of time shortage 00115 // class hasOnTrack: public std::unary_function<Measurement*, bool> { 00116 // private: 00117 // const FitTrack* m_track; 00118 // public: 00119 // explicit hasOnTrack( const FitTrack* track ):m_track(track) {} 00120 00121 // bool operator()( const Measurement* meas ) const { 00122 // return m_track -> hasOn( meas ); 00123 // } 00124 // }; 00125 00126 //============================================================================= 00127 // Predicate returning if Measurement is on a Track 00128 //============================================================================= 00129 // // Temp direct use of concrete class FitTrack because of time shortage 00130 // class hasOnTrackOfType: public std::unary_function<Measurement*, bool> { 00131 // private: 00132 // const FitTrack* m_track; 00133 // Measurement::Type m_measType; 00134 // public: 00135 // explicit hasOnTrackOfType( const FitTrack* track, 00136 // Measurement::Type measType ): 00137 // m_track(track), 00138 // m_measType(measType) {} 00139 00140 // bool operator()( const Measurement* meas ) const { 00141 // return (m_measType == meas->measType()) && m_track->hasOn(meas); 00142 // } 00143 // }; 00144 00145 } 00146 00147 #endif