SISCone  2.0.5
siscone/momentum.h
00001 // -*- C++ -*-
00003 // File: momentum.h                                                          //
00004 // Description: header file for 4-momentum class Cmomentum                   //
00005 // This file is part of the SISCone project.                                 //
00006 // For more details, see http://projects.hepforge.org/siscone                //
00007 //                                                                           //
00008 // Copyright (c) 2006 Gavin Salam and Gregory Soyez                          //
00009 //                                                                           //
00010 // This program is free software; you can redistribute it and/or modify      //
00011 // it under the terms of the GNU General Public License as published by      //
00012 // the Free Software Foundation; either version 2 of the License, or         //
00013 // (at your option) any later version.                                       //
00014 //                                                                           //
00015 // This program is distributed in the hope that it will be useful,           //
00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of            //
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             //
00018 // GNU General Public License for more details.                              //
00019 //                                                                           //
00020 // You should have received a copy of the GNU General Public License         //
00021 // along with this program; if not, write to the Free Software               //
00022 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA //
00023 //                                                                           //
00024 // $Revision:: 163                                                          $//
00025 // $Date:: 2007-04-26 22:31:02 +0200 (Thu, 26 Apr 2007)                     $//
00027 
00028 #ifndef __VECTOR_H__
00029 #define __VECTOR_H__
00030 
00031 #include <vector>
00032 #include <math.h>
00033 #include "reference.h"
00034 #include "geom_2d.h"
00035 #include "defines.h"
00036 
00037 namespace siscone{
00038 
00049 class Cmomentum{
00050  public:
00052   Cmomentum();
00053 
00055   Cmomentum(double _px, double _py, double _pz, double _E);
00056 
00058   Cmomentum(double _eta, double _phi, Creference _ref);
00059 
00061   ~Cmomentum();
00062 
00064   inline double perp() const {return sqrt(perp2());}
00065 
00067   inline double perp2() const {return px*px+py*py;}
00068 
00070   inline double mass() const {return sqrt(mass2());}
00071 
00073   inline double mass2() const {return perpmass2()-perp2();}
00074 
00076   inline double perpmass() const {return sqrt((E-pz)*(E+pz));}
00077 
00079   inline double perpmass2() const {return (E-pz)*(E+pz);}
00080 
00082   inline double Et() const {return E/sqrt(1.0+pz*pz/perp2());}
00083 
00085   inline double Et2() const {return E*E/(1.0+pz*pz/perp2());}
00086 
00088   Cmomentum& operator = (const Cmomentum &v);
00089 
00092   const Cmomentum operator + (const Cmomentum &v);
00093 
00096   Cmomentum& operator += (const Cmomentum &v);
00097 
00100   Cmomentum& operator -= (const Cmomentum &v);
00101 
00107   void build_etaphi();
00108 
00109   double px;        
00110   double py;        
00111   double pz;        
00112   double E;         
00113 
00114   double eta;       
00115   double phi;       
00116   int parent_index; 
00117   int index;        
00118 
00120   // the following part is used for checksums //
00122   Creference ref;   
00123 };
00124 
00127 bool operator < (const Cmomentum &v1, const Cmomentum &v2);
00128 
00130 bool momentum_eta_less(const Cmomentum &v1, const Cmomentum &v2);
00131 
00133 bool momentum_pt_less(const Cmomentum &v1, const Cmomentum &v2);
00134 
00135 
00137 // some handy utilities //
00139 
00144 inline double get_distance(double eta, double phi, Cmomentum *v){
00145   double dx, dy;
00146 
00147   dx = eta - v->eta;
00148   dy = fabs(phi - v->phi);
00149   if (dy>M_PI) 
00150     dy -= twopi;
00151 
00152   return dx*dx+dy*dy;
00153 }
00154 
00155 }
00156 
00157 #endif
The SISCone project has been developed by Gavin Salam and Gregory Soyez
Documentation generated on Mon Jun 4 2012 18:23:38 for SISCone by  Doxygen 1.7.6.1