15   declareInterface<IMuonSegmentMomentumEstimator>(
this);
 
   25   ATH_MSG_VERBOSE(
" Executing MuonSegmentMomentumTool  fitMomentumVectorSegments ");
 
   26   ATH_MSG_DEBUG(
" fitMomentumVectorSegments " << segments.size() << 
" segments ");
 
   28   std::vector<const Muon::MuonSegment*>::const_iterator 
it = segments.begin();
 
   29   std::vector<const Muon::MuonSegment*>::const_iterator it2 = segments.begin();
 
   30   std::vector<const Muon::MuonSegment*>::const_iterator it_end = segments.end();
 
   32   double pmin = 10000000000.;
 
   33   for(; 
it < it_end ; ++
it )  {
 
   34     for(it2 = 
it; it2 < it_end ; ++it2 )  {
 
   35       if (
it == it2) 
continue;
 
   38       ATH_MSG_DEBUG(
" Fit pair of segments signed momentum " << smom);
 
   39       if (fabs(smom) < fabs(pmin)) pmin = smom; 
 
   43   signedMomentum = pmin; 
 
   44   if (signedMomentum < 100. && signedMomentum > 0 ) signedMomentum = 100.; 
 
   45   if (signedMomentum > -100. && signedMomentum <= 0 ) signedMomentum = -100.; 
 
   47   ATH_MSG_DEBUG( 
" Estimated signed momentum " << signedMomentum);
 
   59   ATH_MSG_VERBOSE(
" Executing MuonSegmentMomentumTool  fitMomentum2Segments ");
 
   83   double z_end = 15000.;
 
   93   double thesp  = atan2( rs, zs);
 
  102   double thespe  = atan2( rse,zse);
 
  104   ATH_MSG_DEBUG(
" radius1 " << rs << 
" radius2 " <<  rse << 
" z1 " << zs << 
" z2 " << zse << 
" theta1 " << thetas << 
" theta2 " << thetase << 
" thetasp1 " << thesp << 
" thetasp2 " << thespe);
 
  107   if (fabs(
cos(thesp)) < cos_barrel || fabs(
cos(thespe)) < cos_barrel ) 
barrel = 
true;
 
  108   bool forward = 
false;
 
  109   if (fabs(
cos(thesp)) > cos_barrel || fabs(
cos(thespe)) > cos_barrel ) forward = 
true;
 
  113   if (forward) scf = 2*scf;
 
  115   if (forward) scfn = 2*scfn;
 
  121   double ers2 = 0.1*0.1+scf*scf+scfn*scfn; 
 
  122   double ebs2 = 50*50*fabs(
sin(thetas)*
sin(thetase))+ers2; 
 
  123   double ets21 = era1*era1 + 0.002*0.002*scf*scf; 
 
  124   double ets22 = era2*era2 + 0.002*0.002*scf*scf; 
 
  131   if ( zs < 0 ) 
sign = -1.;
 
  151     ym(2,0)= 
cos(thetas)/
sin(thetas);
 
  153     ym(4,0)= 
cos(thetase)/
sin(thetase);
 
  170     if (fabs(zs) > 
z_end+2000) {
 
  176     if (fabs(zse) > 
z_end+2000) {
 
  186     ym(2,0)= 
tan(thetas);
 
  188     ym(4,0)= 
tan(thetase);
 
  191   ATH_MSG_DEBUG(
" distance segments " << sqrt((zs-zse)*(zs-zse)+(rs-rse)*(rs-rse)) );
 
  193   for(
int i = 0; 
i <3 ; ++
i )  {
 
  200   for(
int i = 0; 
i <3 ; ++
i )  {
 
  201     for(
int j = 0; j <3 ; ++j )  {
 
  210   covT = covTI.inverse();
 
  214   double theta=0.; 
double invcurvature=0.;
 
  218   } 
else if (imeth == 1) {
 
  219     theta = atan2(1.,1./
t(1,0));
 
  223   signedMomentum = (1./invcurvature)/10.;
 
  225   ATH_MSG_DEBUG(
" MuonSegmentMomentum in MeV " << (1./invcurvature)/10. << 
" theta fit " << 
theta << 
" cos theta " << 
cos(
theta) );
 
  228   for(
int i = 0; 
i <5 ; ++
i )  {
 
  231   double chi2 = resi(0,0)*resi(0,0)/ebs2 + resi(1,0)*resi(1,0)/ers2 + resi(2,0)*resi(2,0)/ets21
 
  232     + resi(3,0)*resi(3,0)/ers2 + resi(4,0)*resi(4,0)/ets22;
 
  234   ATH_MSG_DEBUG(
" Track parameters Matrix T00 " << 
t(0,0) << 
" T10 " << 
t(1,0) << 
" T20 " << 
t(2,0) );
 
  240   for(
int i = 0; 
i<4 ; ++
i )  {
 
  244   std::vector <double> 
pull(4);
 
  247   for(
int i = 0; 
i <4 ; ++
i )  {
 
  252     if ( fabs( 
pull[
i] ) > 5 ) toobig = 
true;
 
  256     ATH_MSG_DEBUG(
" Pull too BIGFIT " << 
" rad pos1 " << rs << 
" rad pos2 " << rse << 
" ang1 " << thetas << 
" ang2 " << thetase );
 
  259     ATH_MSG_DEBUG(
" z pos1 " << zs << 
" z pos2 " << zse << 
" phi pos 1 " << phisp << 
" phi pos 2 " << phispe );
 
  265   ATH_MSG_DEBUG( 
" Fit2MomentumSegments: residual 0 " << 
res[0] << 
" pull 0 " << 
pull[0] << 
" residual 1 " << 
res[1] << 
" pull 1 " << 
pull[1] );
 
  266   ATH_MSG_DEBUG(
" Fit2MomentumSegments: residual 2 " << 
res[2] << 
" pull 2 " << 
pull[2] << 
" residual 3 " << 
res[3] << 
" pull 3 " << 
pull[3] );
 
  267   ATH_MSG_DEBUG(
" radius 1  " << ym(1,0) << 
" cottan theta 1 " << ym(2,0) << 
" radius 2  " << ym(3,0)
 
  268                        << 
" cottan theta 2 " << ym(4,0) );
 
  269   ATH_MSG_DEBUG(
" radius fit 1  " << -(
res[0]+ym(1,0)) << 
" cottan theta fit 1 " << -(
res[1]+ym(2,0)) << 
" radius 2 fit  " << -(
res[2]+ym(3,0))
 
  270                        << 
" cottan theta 2 fit " << -(
res[3]+ym(4,0)) );