EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LSLEQM.cxx
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file LSLEQM.cxx
1 /* Copyright 2008-2009, Technische Universitaet Muenchen,
2  Authors: Christian Hoeppner & Sebastian Neubert
3 
4  This file is part of GENFIT.
5 
6  GENFIT is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Lesser General Public License as published
8  by the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  GENFIT is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public License
17  along with GENFIT. If not, see <http://www.gnu.org/licenses/>.
18 */
19 //-----------------------------------------------------------
20 // File and Version Information:
21 // $Id$
22 //
23 // Description:
24 // Implementation of class LSLEQM
25 // see LSLEQM.hh for details
26 //
27 // Environment:
28 // Software developed for the PANDA Detector at FAIR.
29 //
30 // Author List:
31 // Sebastian Neubert TUM (original author)
32 //
33 //
34 //-----------------------------------------------------------
35 
36 // Panda Headers ----------------------
37 
38 // This Class' Header ------------------
39 #include "LSLEQM.h"
40 
41 // C/C++ Headers ----------------------
42 #include <iostream>
43 #include "TMath.h"
44 // Collaborating Class Headers --------
45 #include "GFAbsBField.h"
46 
47 // Class Member definitions -----------
48 
49 
50 TVectorT<double>
51 LSLEQM::eval(const TVectorT<double>&u,
52  const TVectorT<double>& uprim,
53  const TVectorT<double>& par) {
54  // default values in case no bfield is given
55  double Bx=0.; double By=0.;
56  double Bz=2.;
57  if(u[2]>200.)Bz=0.;
58  if(u[2]>350. && u[2]<450.)By=0.5;
59 
60  TVector3 uu(u[0],u[1],u[2]);
61  if(_field!=NULL){
62  //std::cout<<"using fieldmap"<<std::endl;
63  TVector3 B=_field->get(uu);
64  //B field is now in kGauss, so convert to Tesla
65  B*=0.1;
66  Bx=B.X();By=B.Y();Bz=B.Z();;
67  }
68 
69  //if(uprim[0]!=1.)
70  // std::cout<<"uprim("<<uprim[0]<<","<<uprim[1]<<")"<<std::endl;
71 
72 // limit possible slopes
73  double xprim=uprim[0];
74  double yprim=uprim[1];
75  if(TMath::Abs(xprim)>1E4)xprim<0 ? xprim=-1E4 : xprim=1E4;
76  if(TMath::Abs(yprim)>1E4)yprim<0 ? yprim=-1E4 : yprim=1E4;
77  double xprim2=xprim*xprim;
78  double yprim2=yprim*yprim;
79  double dsdz=TMath::Sqrt(1.+xprim2+yprim2);
80  double kappP=0.00299792458*par[0]; // [GeV/c T^-1 cm^-1]
81  TVectorT<double> result(u);
82 
83  result[0]=kappP*dsdz*(xprim*yprim*Bx-(1+xprim2)*By+yprim*Bz);
84  result[1]=kappP*dsdz*(-xprim*yprim*By+(1+yprim2)*Bx-xprim*Bz);
85  result[2]=0;
86  return result;
87 }