![]() |
|
|||
File indexing completed on 2025-04-19 09:09:43
0001 // -*- C++ -*- 0002 /////////////////////////////////////////////////////////////////////////////// 0003 // File: momentum.h // 0004 // Description: header file for 4-momentum class Cmomentum // 0005 // This file is part of the SISCone project. // 0006 // For more details, see http://projects.hepforge.org/siscone // 0007 // // 0008 // Copyright (c) 2006 Gavin Salam and Gregory Soyez // 0009 // // 0010 // This program is free software; you can redistribute it and/or modify // 0011 // it under the terms of the GNU General Public License as published by // 0012 // the Free Software Foundation; either version 2 of the License, or // 0013 // (at your option) any later version. // 0014 // // 0015 // This program is distributed in the hope that it will be useful, // 0016 // but WITHOUT ANY WARRANTY; without even the implied warranty of // 0017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // 0018 // GNU General Public License for more details. // 0019 // // 0020 // You should have received a copy of the GNU General Public License // 0021 // along with this program; if not, write to the Free Software // 0022 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA // 0023 // // 0024 // $Revision:: $// 0025 // $Date:: $// 0026 /////////////////////////////////////////////////////////////////////////////// 0027 0028 #ifndef __VECTOR_H__ 0029 #define __VECTOR_H__ 0030 0031 #include <vector> 0032 #include <math.h> 0033 #include "reference.h" 0034 #include "geom_2d.h" 0035 #include "defines.h" 0036 0037 namespace siscone{ 0038 0039 /** 0040 * \class Cmomentum 0041 * \brief base class for dynamic coordinates management 0042 * 0043 * This class contains the information for particle or group of 0044 * particles management. 0045 * It includes all Lorentz properties as well as tools for summing them. 0046 * Note: 'sums' over phi angles are indeed averages. This allows to 0047 * deal with periodicity at each step 0048 */ 0049 class Cmomentum{ 0050 public: 0051 /// default ctor 0052 Cmomentum(); 0053 0054 /// ctor with initialisation 0055 Cmomentum(double _px, double _py, double _pz, double _E); 0056 0057 /// ctor with detailed initialisation 0058 Cmomentum(double _eta, double _phi, Creference _ref); 0059 0060 /// default dtor 0061 ~Cmomentum(); 0062 0063 /// computes pT 0064 inline double perp() const {return sqrt(perp2());} 0065 0066 /// computes pT^2 0067 inline double perp2() const {return px*px+py*py;} 0068 0069 /// computes m 0070 inline double mass() const {return sqrt(mass2());} 0071 0072 /// computes m^2 0073 inline double mass2() const {return perpmass2()-perp2();} 0074 0075 /// transverse mass, mt = sqrt(pt^2+m^2) = sqrt(E^2 - pz^2) 0076 inline double perpmass() const {return sqrt((E-pz)*(E+pz));} 0077 0078 /// transverse mass squared, mt^2 = pt^2+m^2 = E^2 - pz^2 0079 inline double perpmass2() const {return (E-pz)*(E+pz);} 0080 0081 /// computes transverse energy 0082 inline double Et() const {return E/sqrt(1.0+pz*pz/perp2());} 0083 0084 /// computes transverse energy (squared) 0085 inline double Et2() const {return E*E/(1.0+pz*pz/perp2());} 0086 0087 /// assignment of vectors 0088 Cmomentum& operator = (const Cmomentum &v); 0089 0090 /// addition of vectors 0091 /// !!! WARNING !!! no updating of eta and phi !!! 0092 const Cmomentum operator + (const Cmomentum &v); 0093 0094 /// incrementation of vectors 0095 /// !!! WARNING !!! no updating of eta and phi !!! 0096 Cmomentum& operator += (const Cmomentum &v); 0097 0098 /// decrementation of vectors 0099 /// !!! WARNING !!! no updating of eta and phi !!! 0100 Cmomentum& operator -= (const Cmomentum &v); 0101 0102 /// build eta-phi from 4-momentum info 0103 /// !!! WARNING !!! 0104 /// !!! computing eta and phi is time-consuming !!! 0105 /// !!! use this whenever you need eta or phi !!! 0106 /// !!! automatically called for single-particle !!! 0107 void build_etaphi(); 0108 0109 double px; ///< x-momentum 0110 double py; ///< y-momentum 0111 double pz; ///< z-momentum 0112 double E; ///< energy 0113 0114 double eta; ///< particle pseudo-rapidity 0115 double phi; ///< particle azimuthal angle 0116 int parent_index; ///< particle number in the parent list 0117 int index; ///< internal particle number 0118 0119 ////////////////////////////////////////////// 0120 // the following part is used for checksums // 0121 ////////////////////////////////////////////// 0122 Creference ref; ///< reference number for the vector 0123 }; 0124 0125 /// ordering of two vectors 0126 /// this is by default done w.r.t. their references 0127 bool operator < (const Cmomentum &v1, const Cmomentum &v2); 0128 0129 /// ordering of vectors in eta (e.g. used in collinear tests) 0130 bool momentum_eta_less(const Cmomentum &v1, const Cmomentum &v2); 0131 0132 /// ordering of vectors in pt 0133 bool momentum_pt_less(const Cmomentum &v1, const Cmomentum &v2); 0134 0135 0136 ////////////////////////// 0137 // some handy utilities // 0138 ////////////////////////// 0139 0140 /// get distance between to eta-phi points 0141 /// \param eta eta coordinate of first point 0142 /// \param phi phi coordinate of first point 0143 /// \param v vector defining the second point 0144 inline double get_distance(double eta, double phi, Cmomentum *v){ 0145 double dx, dy; 0146 0147 dx = eta - v->eta; 0148 dy = fabs(phi - v->phi); 0149 if (dy>M_PI) 0150 dy -= twopi; 0151 0152 return dx*dx+dy*dy; 0153 } 0154 0155 } 0156 0157 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |