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 // --------------------------------------------------
00113   template< class Iter> //, class Reference >
00114     double sumETInHalo( Iter begin,
00115                         Iter end,
00116                         IKinematic* reference,
00117                         double rLower,
00118                         double rHigher
00119                         )
00120     {
00121       double result = 0.0;
00122       for( Iter itr = begin; itr < end; ++itr )
00123         {
00124           if( this->deltaR( reference, *itr ) > rLower 
00125               && this->deltaR( reference, *itr ) < rHigher
00126               )
00127             {
00128               result += (*itr)->eT() ;
00129             }
00130         }
00131       return result ;
00132     }  
00133   
00134   // --------------------------------------------------
00138   template< class Iter> //, class Reference >
00139     HepLorentzVector sumMomentumInHalo( Iter begin,
00140                                         Iter end,
00141                                         IKinematic* reference,
00142                                         double rLower,
00143                                         double rHigher
00144                                         )
00145     {
00146       HepLorentzVector result(0.,0.,0.,0.);
00147       for( Iter itr = begin; itr < end; ++itr )
00148         {
00149           if( this->deltaR( reference, *itr ) > rLower
00150               && this->deltaR( reference, *itr ) < rHigher
00151               )
00152             {
00153               result += (*itr)->momentum() ;
00154             }
00155         }
00156       return result ;
00157     }
00158   
00159 
00160   //  template< class Iterator> //, class Reference >
00161   //    double sumETInCone( Iterator begin, 
00162   //                    Iterator end, 
00163   //            IKinematic& reference,
00164   //            double rCone 
00165   //          ) ;
00166 
00167 
00168  private:
00169   
00170   // To convert the iterated and reference Types into a standard form
00171   //IKinematic* regulateType( IKinematic& x ) { return &x ; }
00172   //IKinematic* regulateType( IKinematic* x ) { return x ; }
00173 
00174 
00175 };
00176 
00177 } // namespace end
00178 
00179 #endif
00180 
00181 
00182 
00183 

Generated on Fri Sep 21 13:20:36 2007 for AtlfastUtils by  doxygen 1.5.1