MuonBinData.cxx

Go to the documentation of this file.
00001 #include "AtlfastAlgs/MuonBinData.h"
00002 
00003 namespace Atlfast 
00004 {
00005 
00006   //-----------------------------------------------
00007   // PUBLIC - Constructor
00008   //-----------------------------------------------
00009   
00010   MuonBinData::MuonBinData( BinID& id,
00011                             vector< ParameterResolutions* > sigma,
00012                             vector< ParameterResolutions* > correlations ) :
00013     m_id(id),
00014     m_sigmas(sigma),    
00015     m_correlations(correlations)
00016   {}    
00017 
00018 
00019   MuonBinData::~MuonBinData()
00020   {
00021     for (size_t i = 0; i < m_sigmas.size(); i++)
00022       delete m_sigmas[i];
00023     for (size_t i = 0; i < m_correlations.size(); i++)
00024       delete m_correlations[i];
00025   }
00026   
00027   
00028   //--------------------------------------------------------------------
00029   // PUBLIC - HepSymMatrix getMatrix(random)
00030   // returns appropriate Sigma (=covariance) matrix
00031   //
00032   // NOTE: the representation of Sigma is determined by the track 
00033   //       representation implicitly given in the parameter files,
00034   //       i.e., (d0, z0, phi0, cot(theta0), q/pT), which is for 
00035   //       internal use only.
00036   //
00037   //       The main advantage of this representation is that in 
00038   //       the context of the ID, for a solenoidal field, the three
00039   //       transverse track parameters (d0, phi0, q/pT) are to a 
00040   //       good approximation uncorrelated with the two longitudinal 
00041   //       ones (z0, cot(theta0)).  
00042   //
00043   //       Sigma has to be converted into the representation used 
00044   //       by Common Tracking, i.e. (d0, z0, phi0, theta0, q/p), 
00045   //       when it is written to CBNTs or AODs.  
00046   //--------------------------------------------------------------------
00047   HepSymMatrix MuonBinData::getMatrix( const TrackTrajectory& traj ) const 
00048   {
00049 
00050     HepSymMatrix Sigma(5,0);
00051 
00052     // diagonals
00053     for ( int param = 0; param < 5; param++ )
00054     {
00055        Sigma[param][param] = std::pow( m_sigmas[param]->resolution(traj), 2 );
00056     }
00057 
00058     // off-diagonals
00059     // NOTE: m_correlations[] holds correlation coefficients, need covariances
00060 
00061     // (1,3) ... cov(d0,phi0)
00062     // (1,5) ... cov(d0,q/pT)
00063     // (3,5) ... cov(phi0,q/pT)
00064     double rho13 = m_correlations[0]->resolution(traj);
00065     double rho15 = m_correlations[1]->resolution(traj);
00066     double rho35 = m_correlations[2]->resolution(traj);
00067     
00068     // covariance sub-matrix of transverse parameters needs to be positive definite
00069     // in order that its square root (cf. MuonMatrixManager) exists
00070     double det3 = 1 - rho13 * rho13 - rho15 * rho15 - rho35 * rho35 - 2 * rho13 * rho15 * rho35;
00071     if ( det3 < 0 )  rho13 = rho15 = rho35 = 0;
00072     
00073     // make sure that correlation coefficients stay within [-1,+1]
00074     if ( std::abs(rho13) > 1 )  rho13 *= 0.99 / std::abs(rho13);
00075     if ( std::abs(rho15) > 1 )  rho15 *= 0.99 / std::abs(rho15);
00076     if ( std::abs(rho35) > 1 )  rho35 *= 0.99 / std::abs(rho35);
00077     
00078     Sigma(1,3) = Sigma(3,1) = rho13 * std::sqrt( Sigma(1,1) * Sigma(3,3) );
00079     Sigma(1,5) = Sigma(5,1) = rho15 * std::sqrt( Sigma(1,1) * Sigma(5,5) );
00080     Sigma(3,5) = Sigma(5,3) = rho35 * std::sqrt( Sigma(3,3) * Sigma(5,5) );
00081 
00082     
00083     // (2,4) ... cov(z0,cot(theta0))
00084     double rho24 = m_correlations[3]->resolution(traj);
00085     // make sure that correlation coefficient stays within [-1,+1]
00086     if ( std::abs(rho24) > 1 )  rho24 *= 0.99 / std::abs(rho24);
00087     Sigma(2,4) = Sigma(4,2) = rho24 * std::sqrt( Sigma(2,2) * Sigma(4,4) );
00088 
00089     // DONE!
00090     return Sigma;
00091     
00092   }
00093   
00094 }//namespace bracket

Generated on Mon Sep 24 14:19:12 2007 for AtlfastAlgs by  doxygen 1.5.1