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

KinematicHelper.cxx

Go to the documentation of this file.
00001 //=============================================
00002 // Kinematic Helper class
00003 //=============================================
00004 //
00005 // Implementation
00006 //
00007 #include "AtlfastUtils/KinematicHelper.h"
00008 
00009 #include "AtlfastEvent/IKinematic.h"
00010 #include "AtlfastEvent/Phi.h"
00011 
00012 namespace Atlfast {
00013 
00014 //------------------------------------------
00015 // Return the distance in eta-phi space between two objects
00016   //template< class Item1, class Item2 >
00017   //double KinematicHelper::deltaR( Item1* aa , Item2* bb )
00018 double KinematicHelper::deltaR( IKinematic* a , IKinematic* b )
00019 { 
00020   //IKinematic* a = this->regulateType( aa ) ;
00021   //IKinematic* b = this->regulateType( bb ) ;
00022 
00023   // Doing this takes care of cyclic algebra
00024   Phi aphi(a->phi()) ;
00025   Phi bphi(b->phi()) ; 
00026 
00027   double dist = 
00028     sqrt(
00029          (aphi - bphi)*(aphi - bphi) +
00030          (a->eta() - b->eta())*(a->eta() - b->eta()) 
00031          );
00032   return dist ;
00033 }
00034 
00035 double KinematicHelper::deltaR( IKinematic& a , IKinematic& b )
00036 { 
00037   return this->deltaR( &a, &b ) ;
00038 }
00039 
00040 //------------------------------------------
00041 // Return the distance in phi space between two objects
00042 double KinematicHelper::deltaPhi( IKinematic* a , IKinematic* b )
00043 { 
00044   return std::abs( Phi( a->phi() - b->phi() ) ) ;
00045 }
00046 
00047 double KinematicHelper::deltaPhi( IKinematic& a , IKinematic& b )
00048 { 
00049   return this->deltaPhi( &a, &b ) ;
00050 }
00051 
00052 //------------------------------------------
00053 // Return the invariant mass of two objects
00054 double KinematicHelper::mass( IKinematic* a , IKinematic* b )
00055 { 
00056   return ( a->momentum() + b->momentum() ).m() ;
00057 }
00058 
00059 double KinematicHelper::mass( IKinematic& a , IKinematic& b )
00060 { 
00061   return this->mass( &a, &b ) ;
00062 }
00063 
00064 
00065 } // namespace end
00066 
00067 
00068 
00069 
00070 
00071 
00072 
00073 
00074 
00075 

Generated on Wed Jan 15 11:00:29 2003 for AtlfastUtils by doxygen1.3-rc1