Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

KinematicHelper.h

Go to the documentation of this file.
00001 //=============================================
00002 // Helper class
00003 //=============================================
00004 //
00005 // This class is a holding place for a set of useful manipulations
00006 // on quantities honourinf the
00007 //           IKinematic interface
00008 //
00009 // In a sense this is not very OO in that it is all based upon the user
00010 // having collections of IKinematics, and then wanting to sum them, take an
00011 // invariant mass...etc. Perhaps there is a more OO view of this sort
00012 // of operation which needs to be developed. 
00013 //
00014 // Nevertheless at present the functionality is implemented here in one place.
00015 //
00016 // Most methods are overloaded to allow for references or pointers as arguments 
00017    
00018 #ifndef ATLFAST_KINEMATICHELPER_H
00019 #define ATLFAST_KINEMATICHELPER_H
00020 
00021 #ifndef CLHEP_LORENTZVECTOR_H
00022 #define CLHEP_LORENTZVECTOR_H
00023 #include "CLHEP/Vector/LorentzVector.h"
00024 #endif
00025 
00026 namespace Atlfast {
00027   class IKinematic;
00032 class KinematicHelper { 
00033 
00034   public:
00035 
00036   // ---------------------------------------------------------
00037   // Return the distance in eta-phi space between two items
00038   //  template< class Item1, class Item2 >
00039   //    double deltaR( Item1* , Item2*  ) ;
00043   double deltaR( IKinematic& a, IKinematic& b ) ;
00047   double deltaR( IKinematic* a, IKinematic* b ) ;
00048 
00049 
00050   // ---------------------------------------------------------
00054   double deltaPhi( IKinematic& a, IKinematic& b ) ;
00058   double deltaPhi( IKinematic* a, IKinematic* b ) ;
00059 
00060 
00061   // ---------------------------------------------------------
00065   double mass( IKinematic& a, IKinematic& b ) ;
00069   double mass( IKinematic* a, IKinematic* b ) ;
00070 
00075     template< class Iter > 
00076     double mass( Iter begin, Iter end )
00077     {
00078       HepLorentzVector temp(0.,0.,0.,0.) ;
00079       for( Iter i = begin; i < end; ++i )
00080         {
00081           temp += (*i)->momentum() ;
00082         }
00083       return temp.m() ;
00084     }
00085 
00086 
00087   // --------------------------------------------------
00091   template< class Iter> //, class Reference >
00092     double sumETInCone( Iter begin, 
00093                         Iter end, 
00094                         IKinematic* reference,
00095                         double rCone 
00096                         )
00097 {  
00098   double result = 0.0;     
00099   for( Iter itr = begin; itr < end; ++itr )
00100     {       
00101       if( this->deltaR( reference, *itr ) < rCone ) 
00102         { 
00103           result += (*itr)->eT() ; 
00104         }
00105     }  
00106   return result ;
00107 }
00108 
00109 
00110 
00111 
00112   //  template< class Iterator> //, class Reference >
00113   //    double sumETInCone( Iterator begin, 
00114   //                    Iterator end, 
00115   //            IKinematic& reference,
00116   //            double rCone 
00117   //          ) ;
00118 
00119 
00120  private:
00121   
00122   // To convert the iterated and reference Types into a standard form
00123   //IKinematic* regulateType( IKinematic& x ) { return &x ; }
00124   //IKinematic* regulateType( IKinematic* x ) { return x ; }
00125 
00126 
00127 };
00128 
00129 } // namespace end
00130 
00131 #endif
00132 
00133 
00134 
00135 

Generated on Thu Feb 21 14:30:46 2002 for Atlfast by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001