00001 #include "TrgTrackToTrack.h" 00002 00003 #include "GaudiKernel/AlgFactory.h" 00004 #include "GaudiKernel/SmartDataPtr.h" 00005 #include "CLHEP/Units/SystemOfUnits.h" 00006 00007 //----------------------------------------------------------------------------- 00008 // Implementation file for class : TrgTrackToTrack 00009 // 00010 // 13/01/2005 : Jose A. Hernando 00011 //----------------------------------------------------------------------------- 00012 00013 // Declaration of the Algorithm Factory 00014 static const AlgFactory<TrgTrackToTrack> s_trgTrackToTrackFact ; 00015 const IAlgFactory& TrgTrackToTrackFactory = s_trgTrackToTrackFact ; 00016 00017 00018 TrgTrackToTrack::TrgTrackToTrack( const std::string& name, 00019 ISvcLocator* pSvcLocator) 00020 : GaudiAlgorithm ( name , pSvcLocator ) 00021 , m_trgContainer() 00022 { 00023 declareProperty( "TrgTracksName" , 00024 m_trgTracksName = TrgTrackLocation::SpaceVelo ); 00025 00026 declareProperty( "TrackLocation" , 00027 m_trackLocation = "/Event/Tracks" ); 00028 00029 } 00030 00031 TrgTrackToTrack::~TrgTrackToTrack() {}; 00032 00033 StatusCode TrgTrackToTrack::initialize() { 00034 00035 // initialize the gaudi-algorithm 00036 StatusCode sc = GaudiAlgorithm::initialize(); 00037 if ( sc.isFailure() ) return sc; 00038 00039 // get the dataProvider 00040 TrgDataProvider* trgData = tool<TrgDataProvider>( "TrgDataProvider" ); 00041 00043 m_trgContainer = trgData->tracks(m_trgTracksName); 00044 00046 release(trgData); 00047 00048 info() << " -- parameters of TrgTrackToTrack -- " << endreq; 00049 info() << " TrgTrack input container " << m_trgTracksName << endreq; 00050 info() << " Track output contaner " << m_trackLocation << endreq; 00051 info() << " --------------------------------------- " << endreq; 00052 00053 return StatusCode::SUCCESS; 00054 } 00055 00056 StatusCode TrgTrackToTrack::execute() { 00057 00058 size_t ntracks = m_trgContainer->size(); 00059 info() << " ================= HHH ============= " << std::endl; 00060 info() << " # of TrgTracks " << ntracks << std::endl; 00061 00062 Tracks* tracks = new Tracks(); 00063 00064 for (TrgTrackIterator it = m_trgContainer->begin(); 00065 it != m_trgContainer->end(); it++) { 00066 const TrgTrack& gtrack = *(*it); 00067 Track* track = TrgTrackConverter::toTrack(gtrack); 00068 tracks->insert(track); 00069 TrgTrackConverter::str(*track); 00070 } 00071 00072 // locate the tracks in the TES 00073 put( tracks, m_trackLocation); 00074 info() << " ================= HHH ============= " << std::endl; 00075 00076 return StatusCode::SUCCESS; 00077 00078 } 00079 00080 00081 StatusCode TrgTrackToTrack::finalize() { 00082 return StatusCode::SUCCESS; 00083 } 00084