Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:31:17

0001 //
0002 //
0003 // File: hitfit/fourvec.h
0004 // Purpose: Define 3- and 4-vector types for the hitfit package, and
0005 //          supply a few additional operations.
0006 // Created: Jul, 2000, sss, based on run 1 mass analysis code.
0007 //
0008 // This file defines the types `Threevec' and `Fourvec' to be used
0009 // in hitfit code.  These are based on the corresponding CLHEP classes.
0010 // We also provide a handful of operations in addition to those that
0011 // CLHEP has.
0012 //
0013 // CMSSW File      : interface/fourvec.h
0014 // Original Author : Scott Stuart Snyder <snyder@bnl.gov> for D0
0015 // Imported to CMSSW by Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
0016 //
0017 
0018 /**
0019     @file fourvec.h
0020 
0021     @brief Define three-vector and four-vector classes for the HitFit
0022     package, and supply a few additional operations.
0023 
0024     This file defines the type Threevec and Fourvec to be used in HitFit.
0025     These classes are based on the corresponding CLHEP classes.
0026     This file also provides some other operations in addition to those
0027     that CLHEP has.
0028 
0029     @author Scott Stuart Snyder <snyder@bnl.gov>
0030 
0031     @par Creation date:
0032     Jul 2000.
0033 
0034     @par Modification History:
0035     Apr 2009: Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>:
0036     Imported to CMSSW.<br>
0037     Nov 2009: Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>:
0038     Added Doxygen tags for automatic generation of documentation.
0039 
0040     @par Terms of Usage:
0041     With consent from the original author (Scott Snyder).
0042  */
0043 
0044 #ifndef HITFIT_FOURVEC_H
0045 #define HITFIT_FOURVEC_H
0046 
0047 #include "CLHEP/Vector/LorentzVector.h"
0048 
0049 namespace hitfit {
0050 
0051   // Define the types that we want to use.
0052   /**
0053     @brief Typedef for a HepLorentzVector.
0054  */
0055   typedef CLHEP::HepLorentzVector Fourvec;
0056 
0057   /**
0058     @brief Typedef for a Hep3Vector.
0059  */
0060   typedef CLHEP::Hep3Vector Threevec;
0061 
0062   // Adjust the 3-vector part of V (leaving the energy unchanged) so that
0063   // it has mass MASS.
0064   /**
0065     @brief Adjust the three-vector part of v, leaving the energy unchanged,
0066 
0067     so that the four-vector has mass as specified in the argument.
0068 
0069     @param v The four-vector to scale.
0070 
0071     @param mass The desired mass of the four-vector.
0072 
0073     @par Output:
0074     <i>v</i> The scaled four-vector.
0075  */
0076   void adjust_p_for_mass(Fourvec& v, double mass);
0077 
0078   // Adjust the energy component of V (leaving the 3-vector part unchanged)
0079   // so that it has mass MASS.
0080   /**
0081     @brief Adjust the energy component of four-vector v (leaving the three-vector
0082     part unchanged) so that the four-vector has mass as specified in the
0083     argument.
0084 
0085     @param v The four-vector to scale.
0086 
0087     @param mass The desired-mass of the four-vector.
0088 
0089     @par Output:
0090     <i>v</i> The scaled four-vector.
0091  */
0092   void adjust_e_for_mass(Fourvec& v, double mass);
0093 
0094   // Rotate V through polar angle THETA.
0095   /**
0096     @brief Rotate four-vector v through a polar angle.
0097 
0098     @param v The four-vector to rotate.
0099 
0100     @param theta The rotation angle.
0101 
0102     @par Output:
0103     <i>v</i> The rotated vector.
0104  */
0105   void rottheta(Fourvec& v, double theta);
0106 
0107   // Rotate V through a polar angle such that its pseudorapidity changes by ETA.
0108   /**
0109     @brief Rotate four-vector v through a polar angle such that the four-vector
0110     pseudorapidity changes by a desired value.
0111 
0112     @param v The four-vector to rotate.
0113 
0114     @param eta The desired change in the pseudorapidity.
0115 
0116     @par Output:
0117     <i>v</i> The rotated four-vector.
0118  */
0119   void roteta(Fourvec& v, double eta);
0120 
0121   // Conversions between pseudorapidity and polar angle.
0122   /**
0123     @brief Convert pseudorapidity to polar angle.
0124 
0125     @param eta The value of pseudorapidity to convert.
0126  */
0127   double eta_to_theta(double eta);
0128   /**
0129     @brief Convert polar angle to pseudorapidity.
0130 
0131     @param theta The polar angle to convert.
0132  */
0133   double theta_to_eta(double theta);
0134 
0135   // Get the detector eta (D0-specific).  Needs a Z-vertex.
0136   /**
0137     @brief NOT USED ANYMORE: Get the detector \f$\eta\f$ (D0-specific),
0138     requires z-vertex.
0139 
0140     @param v The four-vector on which to operate.
0141 
0142     @param zvert z-vertex of the event.
0143 */
0144   double deteta(const Fourvec& v, double zvert);  // XXX
0145 
0146   //  Handle wraparound for a difference in azimuthal angles.
0147   /**
0148     @brief Normalized difference in azimuthal angles to a range
0149     between \f$[-\pi \dot \pi]\f$.
0150 
0151     @param phi The azimuthal to be normalized.
0152  */
0153   double phidiff(double phi);
0154 
0155   // Find the distance in R between two four-vectors.
0156   /**
0157     @brief Find the distance between two four-vectors in the two-dimensional
0158     space \f$\eta-\phi\f$.
0159  */
0160   double delta_r(const Fourvec& a, const Fourvec& b);
0161 
0162 }  // namespace hitfit
0163 
0164 #endif  // not HITFIT_FOURVEC_H