00001 #include "AtlfastAlgs/MuonBinData.h"
00002
00003 namespace Atlfast
00004 {
00005
00006
00007
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
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 HepSymMatrix MuonBinData::getMatrix( const TrackTrajectory& traj ) const
00048 {
00049
00050 HepSymMatrix Sigma(5,0);
00051
00052
00053 for ( int param = 0; param < 5; param++ )
00054 {
00055 Sigma[param][param] = std::pow( m_sigmas[param]->resolution(traj), 2 );
00056 }
00057
00058
00059
00060
00061
00062
00063
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
00069
00070 double det3 = 1 - rho13 * rho13 - rho15 * rho15 - rho35 * rho35 - 2 * rho13 * rho15 * rho35;
00071 if ( det3 < 0 ) rho13 = rho15 = rho35 = 0;
00072
00073
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
00084 double rho24 = m_correlations[3]->resolution(traj);
00085
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
00090 return Sigma;
00091
00092 }
00093
00094 }