CMS 3D CMS Logo

fourvec.h
Go to the documentation of this file.
1 //
2 //
3 // File: hitfit/fourvec.h
4 // Purpose: Define 3- and 4-vector types for the hitfit package, and
5 // supply a few additional operations.
6 // Created: Jul, 2000, sss, based on run 1 mass analysis code.
7 //
8 // This file defines the types `Threevec' and `Fourvec' to be used
9 // in hitfit code. These are based on the corresponding CLHEP classes.
10 // We also provide a handful of operations in addition to those that
11 // CLHEP has.
12 //
13 // CMSSW File : interface/fourvec.h
14 // Original Author : Scott Stuart Snyder <snyder@bnl.gov> for D0
15 // Imported to CMSSW by Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
16 //
17 
44 #ifndef HITFIT_FOURVEC_H
45 #define HITFIT_FOURVEC_H
46 
47 #include "CLHEP/Vector/LorentzVector.h"
48 
49 namespace hitfit {
50 
51  // Define the types that we want to use.
55  typedef CLHEP::HepLorentzVector Fourvec;
56 
60  typedef CLHEP::Hep3Vector Threevec;
61 
62  // Adjust the 3-vector part of V (leaving the energy unchanged) so that
63  // it has mass MASS.
76  void adjust_p_for_mass(Fourvec& v, double mass);
77 
78  // Adjust the energy component of V (leaving the 3-vector part unchanged)
79  // so that it has mass MASS.
92  void adjust_e_for_mass(Fourvec& v, double mass);
93 
94  // Rotate V through polar angle THETA.
105  void rottheta(Fourvec& v, double theta);
106 
107  // Rotate V through a polar angle such that its pseudorapidity changes by ETA.
119  void roteta(Fourvec& v, double eta);
120 
121  // Conversions between pseudorapidity and polar angle.
127  double eta_to_theta(double eta);
133  double theta_to_eta(double theta);
134 
135  // Get the detector eta (D0-specific). Needs a Z-vertex.
144  double deteta(const Fourvec& v, double zvert); // XXX
145 
146  // Handle wraparound for a difference in azimuthal angles.
153  double phidiff(double phi);
154 
155  // Find the distance in R between two four-vectors.
160  double delta_r(const Fourvec& a, const Fourvec& b);
161 
162 } // namespace hitfit
163 
164 #endif // not HITFIT_FOURVEC_H
void adjust_e_for_mass(Fourvec &v, double mass)
Adjust the energy component of four-vector v (leaving the three-vector part unchanged) so that the fo...
Definition: fourvec.cc:119
double phidiff(double phi)
Normalized difference in azimuthal angles to a range between .
Definition: fourvec.cc:220
double theta_to_eta(double theta)
Convert polar angle to pseudorapidity.
Definition: fourvec.cc:191
void roteta(Fourvec &v, double eta)
Rotate four-vector v through a polar angle such that the four-vector pseudorapidity changes by a desi...
Definition: fourvec.cc:156
double eta_to_theta(double eta)
Convert pseudorapidity to polar angle.
Definition: fourvec.cc:177
double delta_r(const Fourvec &a, const Fourvec &b)
Find the distance between two four-vectors in the two-dimensional space .
Definition: fourvec.cc:238
CLHEP::HepLorentzVector Fourvec
Typedef for a HepLorentzVector.
Definition: fourvec.h:55
double deteta(const Fourvec &v, double zvert)
NOT USED ANYMORE: Get the detector (D0-specific), requires z-vertex.
Definition: fourvec.cc:205
void adjust_p_for_mass(Fourvec &v, double mass)
Adjust the three-vector part of v, leaving the energy unchanged,.
Definition: fourvec.cc:95
CLHEP::Hep3Vector Threevec
Typedef for a Hep3Vector.
Definition: fourvec.h:60
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
void rottheta(Fourvec &v, double theta)
Rotate four-vector v through a polar angle.
Definition: fourvec.cc:135
Geom::Theta< T > theta() const