001 #include "GaudiKernel/ToolFactory.h"
002 #include "GaudiKernel/SmartDataPtr.h"
003 #include "GaudiKernel/IDataProviderSvc.h"
004
005
006 #include "Particle/TrackParticle.h"
007 #include "Particle/TrackParticleContainer.h"
008
009 #include "TrkToolInterfaces/ITrackParticleCreatorTool.h"
010
011
012 #include "STACOTools/TrackToTrackParticleExtrTool.h"
013
014 TrackToTrackParticleExtrTool::TrackToTrackParticleExtrTool(const std::string& t,
015 const std::string& n,
016 const IInterface* p ):AthAlgTool(t,n,p),
017 p_ITrackParticleCreatorTool("Trk::TrackParticleCreatorTool/StacoParticleCreatorTool")
018
019 {
020 declareInterface<ITrackToTrackParticleExtrTool>(this);
021
022 declareProperty("ITrackParticleCreatorTool", p_ITrackParticleCreatorTool);
023
024 }
025
026 TrackToTrackParticleExtrTool::~TrackToTrackParticleExtrTool(){}
027
028
029 StatusCode TrackToTrackParticleExtrTool::initialize() {
030
031 StatusCode sc = StatusCode::SUCCESS;
032
033 msg(MSG::INFO) << "Initialisation started " << endreq;
034
035 sc = AthAlgTool::initialize();
036 if ( sc.isFailure() ) {
037 msg(MSG::FATAL) << " AthAlgTool::initialize() failed" << endreq;
038 return( StatusCode::FAILURE );
039 }
040
041
042 if ( p_ITrackParticleCreatorTool.retrieve().isFailure() ) {
043 msg(MSG::FATAL) << "Failed to retrieve tool " << p_ITrackParticleCreatorTool << endreq;
044 return StatusCode::FAILURE;
045 }
046 msg(MSG::INFO) << "Retrieved tool " << p_ITrackParticleCreatorTool << endreq;
047
048
049 msg(MSG::INFO) << "Initialisation ended " << endreq;
050
051 return StatusCode::SUCCESS;
052
053 }
054
055
056 StatusCode TrackToTrackParticleExtrTool::finalize(){return StatusCode::SUCCESS;}
057
058
059 Rec::TrackParticle* TrackToTrackParticleExtrTool::convert(
060 const Trk::Track* pTrack
061 ){
062
063
064 const Trk::VxCandidate* pVxCandidate = 0 ;
065 return p_ITrackParticleCreatorTool->createParticle(pTrack, pVxCandidate, Trk::NoVtx);
066
067 }
068
069 StatusCode TrackToTrackParticleExtrTool::convertCollection(
070 const TrackCollection* pTrackCollection,
071 Rec::TrackParticleContainer* pTrackParticleContainer
072 ){
073
074
075
076 for (TrackCollection::const_iterator it = pTrackCollection->begin(); it!=pTrackCollection->end(); ++it){
077
078 const Trk::Track* pTrack = *it ;
079 Rec::TrackParticle* pTrackParticle = convert(pTrack);
080
081 if (!pTrackParticle) msg(MSG::DEBUG) << " convert failed " <<endreq;
082
083 if ( pTrackParticle ) {
084
085 const Trk::Track* pTrackOfpTrackParticle = pTrackParticle->originalTrack();
086 double ThePX = ((pTrackOfpTrackParticle->perigeeParameters())->momentum()).x() ;
087 double ThePY = ((pTrackOfpTrackParticle->perigeeParameters())->momentum()).y() ;
088 double ThePZ = ((pTrackOfpTrackParticle->perigeeParameters())->momentum()).z() ;
089 double TheMuonMass = 105.659 ;
090 double TheE = sqrt( (TheMuonMass*TheMuonMass)+(ThePX*ThePX)+(ThePY*ThePY)+(ThePZ*ThePZ) );
091 pTrackParticle->setE(TheE);
092 pTrackParticle->setStorableObject(pTrackCollection);
093 pTrackParticleContainer->push_back(pTrackParticle);
094 }
095
096 }
097
098
099 return StatusCode::SUCCESS;
100
101 }
| Due to the LXR bug, the updates fail sometimes to remove references to deleted files. The Saturday's full rebuilds fix these problems |
|
This page was automatically generated by the
LXR engine.
|
|