00001
00002
00003
00004
00005 #include "GaudiKernel/ToolFactory.h"
00006
00007
00008 #include "Event/Track.h"
00009 #include "Event/State.h"
00010
00011
00012 #include "TrackExtrapolators/TrackExtrapolator.h"
00013
00014
00015
00016
00017
00018
00019
00020
00021 static const ToolFactory<TrackExtrapolator> s_factory ;
00022 const IToolFactory& TrackExtrapolatorFactory = s_factory ;
00023
00024
00025
00026
00027 StatusCode TrackExtrapolator::propagate( const Track& track,
00028 double z,
00029 State& state,
00030 ParticleID pid )
00031 {
00032
00033 const State& closest = track.closestState( z );
00034 state = closest;
00035
00036
00037 StatusCode sc = propagate( state, z, pid );
00038
00039 return sc;
00040 }
00041
00042
00043
00044
00045 StatusCode TrackExtrapolator::propagate( const Track& track,
00046 const HepPlane3D& plane,
00047 State& state,
00048 ParticleID pid )
00049 {
00050
00051 const State& closest = track.closestState( plane );
00052 state = closest;
00053
00054
00055 StatusCode sc = propagate( state, plane, pid );
00056
00057 return sc;
00058 }
00059
00060
00061
00062
00063
00064 StatusCode TrackExtrapolator::positionAndMomentum( const Track& track,
00065 double z,
00066 HepPoint3D& pos,
00067 HepVector3D& mom,
00068 HepSymMatrix& cov6D,
00069 ParticleID pid )
00070 {
00071 State tmpState;
00072
00073 StatusCode sc = propagate( track, z, tmpState, pid );
00074
00075 if ( sc.isSuccess() )
00076 tmpState.positionAndMomentum( pos, mom, cov6D );
00077
00078 return sc;
00079 }
00080
00081
00082
00083
00084
00085
00086 StatusCode TrackExtrapolator::positionAndMomentum( const Track& track,
00087 const HepPlane3D& plane,
00088 HepPoint3D& pos,
00089 HepVector3D& mom,
00090 HepSymMatrix& cov6D,
00091 ParticleID pid )
00092 {
00093 State tmpState;
00094
00095 StatusCode sc = propagate( track, plane, tmpState, pid );
00096
00097 if ( sc.isSuccess() )
00098 tmpState.positionAndMomentum( pos, mom, cov6D );
00099
00100 return sc;
00101 }
00102
00103
00104
00105
00106 StatusCode TrackExtrapolator::positionAndMomentum( const Track& track,
00107 double z,
00108 HepPoint3D& pos,
00109 HepVector3D& mom,
00110 ParticleID pid )
00111 {
00112 State tmpState;
00113
00114 StatusCode sc = propagate( track, z, tmpState, pid );
00115
00116 if ( sc.isSuccess() ) {
00117 pos = tmpState.position();
00118 mom = tmpState.momentum();
00119 }
00120
00121 return sc;
00122
00123 }
00124
00125
00126
00127
00128
00129 StatusCode TrackExtrapolator::positionAndMomentum( const Track& track,
00130 const HepPlane3D& plane,
00131 HepPoint3D& pos,
00132 HepVector3D& mom,
00133 ParticleID pid )
00134 {
00135
00136 State tmpState;
00137
00138 StatusCode sc = propagate( track, plane, tmpState, pid );
00139
00140 if ( sc.isSuccess() ) {
00141 pos = tmpState.position();
00142 mom = tmpState.momentum();
00143 }
00144
00145 return sc;
00146 }
00147
00148
00149
00150
00151
00152 StatusCode TrackExtrapolator::position( const Track& track,
00153 double z,
00154 HepPoint3D& pos,
00155 HepSymMatrix& errPos,
00156 ParticleID pid )
00157
00158 {
00159 State tmpState;
00160
00161 StatusCode sc = propagate( track, z, tmpState, pid );
00162
00163 if ( sc.isSuccess() ) {
00164 pos = tmpState.position();
00165 errPos = tmpState.errPosition();
00166 }
00167
00168 return sc;
00169 }
00170
00171
00172
00173
00174
00175 StatusCode TrackExtrapolator::position( const Track& track,
00176 const HepPlane3D& plane,
00177 HepPoint3D& pos,
00178 HepSymMatrix& errPos,
00179 ParticleID pid )
00180 {
00181 State tmpState;
00182
00183 StatusCode sc = propagate( track, plane, tmpState, pid );
00184
00185 if ( sc.isSuccess() ) {
00186 pos = tmpState.position();
00187 errPos = tmpState.errPosition();
00188 }
00189 return sc;
00190 }
00191
00192
00193
00194
00195 StatusCode TrackExtrapolator::position( const Track& track,
00196 double z,
00197 HepPoint3D& pos,
00198 ParticleID pid )
00199
00200 {
00201 State tmpState;
00202
00203 StatusCode sc = propagate( track, z, tmpState, pid );
00204
00205 if ( sc.isSuccess() ) {
00206 pos = tmpState.position();
00207 }
00208
00209 return sc;
00210 }
00211
00212
00213
00214
00215
00216 StatusCode TrackExtrapolator::position( const Track& track,
00217 const HepPlane3D& plane,
00218 HepPoint3D& pos,
00219 ParticleID pid )
00220 {
00221 State tmpState;
00222
00223 StatusCode sc = propagate( track, plane, tmpState, pid );
00224
00225 if ( sc.isSuccess() ) {
00226 pos = tmpState.position();
00227 }
00228
00229 return sc;
00230 }
00231
00232
00233
00234
00235
00236 StatusCode TrackExtrapolator::slopes( const Track& track,
00237 double z,
00238 HepVector3D& slopes,
00239 HepSymMatrix& errSlopes,
00240 ParticleID pid )
00241 {
00242 State tmpState;
00243
00244 StatusCode sc = propagate( track, z, tmpState, pid );
00245
00246 if ( sc.isSuccess() ) {
00247 slopes = tmpState.slopes();
00248 errSlopes = tmpState.errSlopes();
00249 }
00250
00251 return sc;
00252 }
00253
00254
00255
00256
00257
00258 StatusCode TrackExtrapolator::slopes( const Track& track,
00259 const HepPlane3D& plane,
00260 HepVector3D& slopes,
00261 HepSymMatrix& errSlopes,
00262 ParticleID pid )
00263 {
00264 State tmpState;
00265
00266 StatusCode sc = propagate( track, plane, tmpState, pid );
00267
00268 if ( sc.isSuccess() ) {
00269 slopes = tmpState.slopes();
00270 errSlopes = tmpState.errSlopes();
00271 }
00272
00273 return sc;
00274 }
00275
00276
00277
00278
00279 StatusCode TrackExtrapolator::slopes( const Track& track,
00280 double z,
00281 HepVector3D& slopes,
00282 ParticleID pid )
00283 {
00284 State tmpState;
00285
00286 StatusCode sc = propagate( track, z, tmpState, pid );
00287
00288 if ( sc.isSuccess() ) {
00289 slopes = tmpState.slopes();
00290 }
00291 return sc;
00292 }
00293
00294
00295
00296
00297
00298 StatusCode TrackExtrapolator::slopes( const Track& track,
00299 const HepPlane3D& plane,
00300 HepVector3D& slopes,
00301 ParticleID pid )
00302 {
00303 State tmpState;
00304
00305 StatusCode sc = propagate( track, plane, tmpState, pid );
00306
00307 if ( sc.isSuccess() ) {
00308 slopes = tmpState.slopes();
00309 }
00310 return sc;
00311 }
00312
00313
00314
00315
00316 StatusCode TrackExtrapolator::p( const Track& track,
00317 double z,
00318 double& p,
00319 ParticleID pid )
00320 {
00321 State tmpState;
00322
00323 StatusCode sc = propagate( track, z, tmpState, pid );
00324
00325 if ( sc.isSuccess() ) {
00326 p = tmpState.p();
00327 }
00328 return sc;
00329 }
00330
00331
00332
00333
00334 StatusCode TrackExtrapolator::p( const Track& track,
00335 const HepPlane3D& plane,
00336 double& p,
00337 ParticleID pid )
00338 {
00339 State tmpState;
00340
00341 StatusCode sc = propagate( track, plane, tmpState, pid );
00342
00343 if ( sc.isSuccess() ) {
00344 p = tmpState.p();
00345 }
00346
00347 return sc;
00348 }
00349
00350
00351
00352
00353 StatusCode TrackExtrapolator::pt( const Track& track,
00354 double z,
00355 double& pt,
00356 ParticleID pid )
00357 {
00358 State tmpState;
00359
00360 StatusCode sc = propagate( track, z, tmpState, pid );
00361
00362 if ( sc.isSuccess() ) {
00363 pt = tmpState.pt();
00364 }
00365 return sc;
00366 }
00367
00368
00369
00370
00371
00372 StatusCode TrackExtrapolator::pt( const Track& track,
00373 const HepPlane3D& plane,
00374 double& pt,
00375 ParticleID pid )
00376 {
00377 State tmpState;
00378
00379 StatusCode sc = propagate( track, plane, tmpState, pid );
00380
00381 if ( sc.isSuccess() ) {
00382 pt = tmpState.pt();
00383 }
00384 return sc;
00385
00386 }
00387
00388
00389
00390
00391
00392 StatusCode TrackExtrapolator::momentum( const Track& track,
00393 double z,
00394 HepVector3D& mom,
00395 HepSymMatrix& errMom,
00396 ParticleID pid )
00397 {
00398 State tmpState;
00399
00400 StatusCode sc = propagate( track, z, tmpState, pid );
00401
00402 if ( sc.isSuccess() ) {
00403 mom = tmpState.momentum();
00404 errMom = tmpState.errMomentum();
00405 }
00406 return sc;
00407 }
00408
00409
00410
00411
00412
00413 StatusCode TrackExtrapolator::momentum( const Track& track,
00414 const HepPlane3D& plane,
00415 HepVector3D& mom,
00416 HepSymMatrix& errMom,
00417 ParticleID pid )
00418 {
00419 State tmpState;
00420
00421 StatusCode sc = propagate( track, plane, tmpState, pid );
00422
00423 if ( sc.isSuccess() ) {
00424 mom = tmpState.momentum();
00425 errMom = tmpState.errMomentum();
00426 }
00427 return sc;
00428
00429 }
00430
00431
00432
00433
00434 StatusCode TrackExtrapolator::momentum( const Track& track,
00435 double z,
00436 HepVector3D& mom,
00437 ParticleID pid )
00438 {
00439 State tmpState;
00440
00441 StatusCode sc = propagate( track, z, tmpState, pid );
00442
00443 if ( sc.isSuccess() ) {
00444 mom = tmpState.momentum();
00445 }
00446 return sc;
00447 }
00448
00449
00450
00451
00452
00453 StatusCode TrackExtrapolator::momentum( const Track& track,
00454 const HepPlane3D& plane,
00455 HepVector3D& mom,
00456 ParticleID pid )
00457 {
00458 State tmpState;
00459
00460 StatusCode sc = propagate( track, plane, tmpState, pid );
00461
00462 if ( sc.isSuccess() ) {
00463 mom = tmpState.momentum();
00464 }
00465 return sc;
00466 }
00467
00468
00469
00470
00471 const HepMatrix& TrackExtrapolator::transportMatrix() const
00472 {
00473 return m_F;
00474 };
00475
00476
00477
00478
00479 TrackExtrapolator::TrackExtrapolator( const std::string& type,
00480 const std::string& name,
00481 const IInterface* parent )
00482 : GaudiTool ( type, name , parent )
00483 , m_F()
00484 {
00485 declareInterface<ITrackExtrapolator>( this );
00486
00487
00488 m_F = HepMatrix(5, 5, 1);
00489 }
00490
00491
00492
00493
00494 TrackExtrapolator::~TrackExtrapolator() {};
00495
00496
00497
00498
00499 void TrackExtrapolator::updateState( State& state, double z ) const
00500 {
00501
00502 HepVector& tX = state.state();
00503 HepSymMatrix& tC = state.covariance();
00504
00505
00506 state.setZ( z );
00507 tX = m_F * tX;
00508 tC = tC.similarity(m_F);
00509 }
00510
00511