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_kinehelper__
00019 #define __Atlfast_kinehelper__
00020 
00021 #include "AtlfastCode/IKinematic.h"
00022 #include "AtlfastCode/Cluster.h"
00023 #include "AtlfastCode/Phi.h"
00024 
00025 namespace Atlfast {
00030 class KinematicHelper { 
00031 
00032   public:
00033 
00034   // ---------------------------------------------------------
00035   // Return the distance in eta-phi space between two items
00036   //  template< class Item1, class Item2 >
00037   //    double deltaR( Item1* , Item2*  ) ;
00041   double deltaR( IKinematic& a, IKinematic& b ) ;
00045   double deltaR( IKinematic* a, IKinematic* b ) ;
00046 
00047 
00048   // ---------------------------------------------------------
00052   double deltaPhi( IKinematic& a, IKinematic& b ) ;
00056   double deltaPhi( IKinematic* a, IKinematic* b ) ;
00057 
00058 
00059   // ---------------------------------------------------------
00063   double mass( IKinematic& a, IKinematic& b ) ;
00067   double mass( IKinematic* a, IKinematic* b ) ;
00068 
00073     template< class Iter > 
00074     double mass( Iter begin, Iter end )
00075     {
00076       HepLorentzVector temp(0.,0.,0.,0.) ;
00077       for( Iter i = begin; i < end; ++i )
00078         {
00079           temp += (*i)->momentum() ;
00080         }
00081       return temp.m() ;
00082     }
00083 
00084 
00085   // --------------------------------------------------
00089   template< class Iter> //, class Reference >
00090     double sumETInCone( Iter begin, 
00091                         Iter end, 
00092                         IKinematic* reference,
00093                         double rCone 
00094                         )
00095 {  
00096   double result = 0.0;     
00097   for( Iter itr = begin; itr < end; ++itr )
00098     {       
00099       if( this->deltaR( reference, *itr ) < rCone ) 
00100         { 
00101           result += (*itr)->eT() ; 
00102         }
00103     }  
00104   return result ;
00105 }
00106 
00107 
00108 
00109 
00110   //  template< class Iterator> //, class Reference >
00111   //    double sumETInCone( Iterator begin, 
00112   //                    Iterator end, 
00113   //            IKinematic& reference,
00114   //            double rCone 
00115   //          ) ;
00116 
00117 
00118  private:
00119   
00120   // To convert the iterated and reference Types into a standard form
00121   //IKinematic* regulateType( IKinematic& x ) { return &x ; }
00122   //IKinematic* regulateType( IKinematic* x ) { return x ; }
00123 
00124 
00125 };
00126 
00127 } // namespace end
00128 
00129 #endif
00130 
00131 
00132 
00133 

Generated on Wed Jan 23 12:58:32 2002 for Atlfast by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001