Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:05:01

0001 /****************************************************************************
0002  * Authors:
0003  *   Jan Kašpar
0004  *   Laurent Forthomme
0005  ****************************************************************************/
0006 
0007 #include "DataFormats/ProtonReco/interface/ForwardProton.h"
0008 
0009 #include <set>
0010 
0011 using namespace reco;
0012 
0013 ForwardProton::ForwardProton()
0014     : time_(0.),
0015       time_err_(0.),
0016       xi_(0.),
0017       chi2_(0.),
0018       ndof_(0),
0019       valid_fit_(false),
0020       method_(ReconstructionMethod::invalid) {}
0021 
0022 ForwardProton::ForwardProton(double chi2,
0023                              double ndof,
0024                              const Point& vtx,
0025                              const Vector& momentum,
0026                              float xi,
0027                              const CovarianceMatrix& cov,
0028                              ReconstructionMethod method,
0029                              const CTPPSLocalTrackLiteRefVector& local_tracks,
0030                              bool valid,
0031                              const float time,
0032                              const float time_err)
0033     : vertex_(vtx),
0034       momentum_(momentum),
0035       time_(time),
0036       time_err_(time_err),
0037       xi_(xi),
0038       covariance_(cov),
0039       chi2_(chi2),
0040       ndof_(ndof),
0041       valid_fit_(valid),
0042       method_(method),
0043       contributing_local_tracks_(local_tracks) {}
0044 
0045 float ForwardProton::calculateT(double beam_mom, double proton_mom, double theta) {
0046   const double t0 = 2. * (massSquared_ + beam_mom * proton_mom -
0047                           sqrt((massSquared_ + beam_mom * beam_mom) * (massSquared_ + proton_mom * proton_mom)));
0048   const double S = sin(theta / 2.);
0049   return t0 - 4. * beam_mom * proton_mom * S * S;
0050 }
0051 
0052 float ForwardProton::t() const {
0053   const double beam_mom = p() / (1. - xi());
0054   const double theta = std::hypot(thetaX(), thetaY());
0055   return calculateT(beam_mom, p(), theta);
0056 }