00001
00002
00003
00004 #include "GaudiKernel/ToolFactory.h"
00005
00006
00007 #include "TrackProjectors/TrackOTProjector.h"
00008 #include "Event/OTMeasurement.h"
00009
00010
00011
00012
00013
00014
00015
00016
00017 static const ToolFactory<TrackOTProjector> s_factory ;
00018 const IToolFactory& TrackOTProjectorFactory = s_factory ;
00019
00020
00021
00022
00023
00024 StatusCode TrackOTProjector::project( const State& state,
00025 Measurement& meas )
00026 {
00027 double x = state.x();
00028 double y = state.y();
00029 double tx = state.tx();
00030 double ty = state.ty();
00031
00032 OTMeasurement& otmeas = *( dynamic_cast<OTMeasurement*>(&meas) );
00033
00034 OTChannelID OTChan = meas.lhcbID().otID();
00035 DeOTModule* module = m_det -> module( OTChan );
00036 double stereoAngle = module -> stereoAngle();
00037
00038 double driftVelocity = m_det -> driftDelay();
00039 double wireVelocity = m_det -> propagationDelay();
00040
00041 HepPoint3D VwirePos = module->centerOfStraw( OTChan.straw() );
00042 double wirePos = VwirePos.x() * cos(stereoAngle)
00043 + VwirePos.y() * sin(stereoAngle);
00044
00045 double wireLength = module -> wireLength();
00046
00047 double cosA = cos( stereoAngle );
00048 double sinA = sin( stereoAngle );
00049 double tu = ( otmeas.tu() > 990.0 ) ? (tx * cosA + ty * sinA) : tu = otmeas.tu();
00050 double cosU = 1./sqrt( 1.+ tu*tu );
00051 double du = (x * cosA + y * sinA - wirePos) * driftVelocity;
00052 double wireDist = ( x * cosA + y * sinA - wirePos ) * cosU;
00053 double time = driftVelocity * wireDist
00054 + wireVelocity * otmeas.ambiguity() * ( wireLength - fabs(y) );
00055
00056 unsigned int n = state.nParameters();
00057 m_H = HepVector(n,0);
00058 m_H[0] = cosA * cosU * driftVelocity;
00059 m_H[1] = sinA * cosU * driftVelocity
00060 - otmeas.ambiguity() * wireVelocity * y/fabs(y);
00061 if ( tu > 990.0 ) {
00062 m_H[2] = -du * tu * pow( cosU, 3) * cosA;
00063 m_H[3] = -du * tu * pow( cosU, 3) * sinA;
00064 }
00065 else {
00066 m_H[2] = 0.;
00067 m_H[3] = 0.;
00068 }
00069
00070
00071 m_residual = meas.measure() - time;
00072
00073 computeErrorResidual( state, meas );
00074
00075 return StatusCode::SUCCESS;
00076 }
00077
00078
00079
00080
00081 StatusCode TrackOTProjector::initialize()
00082 {
00083 StatusCode sc = GaudiTool::initialize();
00084 if ( sc.isFailure() )
00085 return Error( "Failed to initialize!", sc );
00086
00087 m_det = getDet<DeOTDetector>( m_otTrackerPath );
00088
00089 return StatusCode::SUCCESS;
00090 }
00091
00092
00093
00094
00095 TrackOTProjector::TrackOTProjector( const std::string& type,
00096 const std::string& name,
00097 const IInterface* parent )
00098 : TrackProjector ( type, name , parent )
00099 {
00100 declareInterface<ITrackProjector>(this);
00101
00102 declareProperty( "OTGeometryPath",
00103 m_otTrackerPath = DeOTDetectorLocation::Default );
00104 }
00105
00106
00107
00108 TrackOTProjector::~TrackOTProjector() {};
00109
00110