LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
TrackMomentumCalculator.cxx File Reference

Go to the source code of this file.

Namespaces

 trkf
 

Functions

double my_mcs_chi2 (const double *x)
 

Function Documentation

double my_mcs_chi2 ( const double *  x)

Definition at line 7 of file TrackMomentumCalculator.cxx.

References eymeas, LOG_DEBUG, nmeas, xmeas, xx, and ymeas.

Referenced by trkf::TrackMomentumCalculator::GetMomentumMultiScatterChi2().

8 {
9  Double_t result = 0.0;
10 
11  Double_t p = x[0];
12 
13  Double_t theta0 = x[1];
14 
15  for ( Int_t i=0; i<nmeas; i++ )
16  {
17  Double_t xx = xmeas[i];
18 
19  Double_t yy = ymeas[i];
20 
21  Double_t ey = eymeas[i];
22 
23  Double_t rad_length = 14.0;
24 
25  Double_t l0 = xx/rad_length;
26 
27  Double_t res1 = 0.0;
28 
29  if ( xx>0 && p>0 ) res1 = ( 13.6/p )*sqrt( l0 )*( 1.0+0.038*TMath::Log( l0 ) );
30 
31  res1 = sqrt( res1*res1+theta0*theta0 );
32 
33  Double_t diff = yy-res1;
34 
35  if ( ey==0 ) { cout << " Zero denominator in my_mcs_chi2 ! " << endl; return -1; }
36 
37  Double_t incre = pow( diff/ey, 2.0 );
38 
39  result += incre;
40 
41  }
42 
43  result += 2.0/( 4.6 )*theta0; // *TMath::Log( 1.0/14.0 );
44 
45  if ( isnan( float(result) ) || isinf( float(result) ) ) {
46  LOG_DEBUG("TrackMomentumCalculator")<<" Is nan in my_mcs_chi2 ! ";
47  return -1; }
48 
49  return result;
50 
51 }
Float_t x
Definition: compare.C:6
Double_t xx
Definition: macro.C:12
Double_t eymeas[30]
Int_t nmeas
Double_t ymeas[30]
Double_t xmeas[30]
#define LOG_DEBUG(id)