Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

TrackFunctor.h

Go to the documentation of this file.
00001 #ifndef TrackEvent_TrackFunctor_H
00002 #define TrackEvent_TrackFunctor_H 1
00003 
00004 // Include files
00005 // -------------
00006 #include <functional>
00007 #include "Event/State.h"
00008 #include "Event/Track.h"
00009 
00024 namespace TrackFunctor
00025 {
00026 
00027 //=============================================================================
00028 // Class to test if the z of a class T is < than a certain value
00029 //=============================================================================
00030   template <class T>
00031   class less_z: public std::unary_function<T*, bool> {
00032   private:
00033     double m_z;
00034   public:
00035     explicit less_z( double z ):m_z(z) {}
00036     bool operator()( const T* t ) const 
00037     {
00038       return t -> z() < m_z;
00039     }
00040   };
00041   
00042 //=============================================================================
00043 // Class to test if the z of a class T is > than a certain value
00044 //=============================================================================
00045   template <class T>
00046   class greater_z: public std::unary_function<T*, bool> {
00047   private:
00048     double m_z;
00049   public:
00050     explicit greater_z( double z ):m_z(z) {}
00051     bool operator()( const T* t ) const 
00052     {
00053       return t -> z() > m_z;
00054     }
00055   };
00056   
00057 //=============================================================================
00058 // Class for sorting class T by z in order (+1/-1)
00059 //=============================================================================
00060   template <class T>
00061   class orderByZ {
00062   private:
00063     int m_order;
00064   public:
00065     explicit orderByZ( int order = +1):m_order(order) {}
00066     bool operator()( const T* t1,
00067                      const T* t2 ) const
00068     {
00069       return (m_order)*t1->z() > (m_order)*t2->z();
00070     }
00071   };
00072 
00073 //=============================================================================
00074 // Class for sorting class T by increasing z
00075 //=============================================================================
00076   template <class T>
00077   class increasingByZ {
00078   public:
00079     bool operator()( const T* t1,
00080                      const T* t2 ) const
00081     {
00082       return t1->z() < t2->z();
00083     }
00084   };
00085 
00086 //=============================================================================
00087 // Class for sorting class T by decreasing z
00088 //=============================================================================
00089   template <class T>
00090   class decreasingByZ {
00091   public:
00092     bool operator()( const T* t1,
00093                      const T* t2 ) const
00094     {
00095       return t1->z() > t2->z();
00096     }
00097   };
00098   
00099 }
00100 
00101 #endif   

Generated on Thu May 12 12:28:06 2005 for New Track Event Model by doxygen 1.4.1