00001 #include "TrackToTrgTrack.h"
00002
00003 #include "GaudiKernel/AlgFactory.h"
00004 #include "GaudiKernel/SmartDataPtr.h"
00005 #include "CLHEP/Units/SystemOfUnits.h"
00006
00007
00008
00009
00010
00011
00012
00013
00014 static const AlgFactory<TrackToTrgTrack> s_traToTrgTraFact ;
00015 const IAlgFactory& TrackToTrgTrackFactory = s_traToTrgTraFact ;
00016
00017
00018 TrackToTrgTrack::TrackToTrgTrack( const std::string& name,
00019 ISvcLocator* pSvcLocator)
00020 : GaudiAlgorithm ( name , pSvcLocator )
00021 {
00022
00023 declareProperty( "TracksLocation" ,
00024 m_tracksLocation = "/Event/Tracks" );
00025
00026 declareProperty( "TrgTracksLocation" ,
00027 m_trgTracksLocation = "/Event/TrgTracks" );
00028 }
00029
00030 TrackToTrgTrack::~TrackToTrgTrack() {};
00031
00032 StatusCode TrackToTrgTrack::initialize() {
00033
00034
00035 StatusCode sc = GaudiAlgorithm::initialize();
00036 if ( sc.isFailure() ) return sc;
00037
00038 info() << " -- parameters of TrackToTrgTrack -- " << endreq;
00039 info() << " Track input contaner " << m_tracksLocation << endreq;
00040 info() << " TrgTrack output container " << m_trgTracksLocation << endreq;
00041 info() << " ----------------------------------- " << endreq;
00042
00043 return StatusCode::SUCCESS;
00044 }
00045
00046 StatusCode TrackToTrgTrack::execute() {
00047
00048 Tracks* tracks = get<Tracks>(m_tracksLocation);
00049
00050 TrgTracks* gtracks = new TrgTracks();
00051
00052 for (Tracks::const_iterator it = tracks->begin();
00053 it != tracks->end(); it++) {
00054 const Track& track = *(*it);
00055 TrgTrack* gtrack = new TrgTrack();
00056 TrgTrackConverter::toTrgTrack(track,*gtrack);
00057 gtracks->insert(gtrack);
00058 debug() << " Track: \t " << track << endreq;
00059 debug() << " TrgTrack: \t" << *gtrack << endreq;
00060 }
00061
00062
00063 put(gtracks, m_trgTracksLocation);
00064
00065 debug() << " # of Input Tracks " << tracks->size() << std::endl;
00066 debug() << " number of converted TrgTracks " << gtracks->size() << endreq;
00067
00068 return StatusCode::SUCCESS;
00069
00070 }
00071
00072 StatusCode TrackToTrgTrack::finalize() {
00073 return StatusCode::SUCCESS;
00074 }
00075