00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "AtlfastAlgs/TrackDumper.h"
00010 #include "AtlfastEvent/Track.h"
00011 #include "AtlfastEvent/CollectionDefs.h"
00012
00013
00014
00015 #include "GaudiKernel/DataSvc.h"
00016 #include "GaudiKernel/MsgStream.h"
00017 #include <iostream>
00018 #include <iomanip>
00019
00020
00021
00022
00023 namespace Atlfast {
00024
00025 class TrackPrinter{
00026 public:
00027 TrackPrinter(MsgStream& log):m_count(0), m_log(log){}
00028 void operator()(const Track* t){
00029
00030 m_log<< MSG::INFO <<++m_count<<" "<<*t<<endreq;
00031 }
00032 private:
00033 int m_count;
00034 MsgStream& m_log;
00035 };
00036
00037 TrackDumper::TrackDumper (const std::string& name,
00038 ISvcLocator* pSvcLocator )
00039 : Algorithm( name, pSvcLocator ){
00040
00041
00042 m_inputLocation = "/Event/AtlfastTracks";
00043 declareProperty( "InputLocation", m_inputLocation ) ;
00044 }
00045
00046
00047
00048
00049 TrackDumper::~TrackDumper() {
00050 delete m_tesIO;
00051 }
00052
00053
00054
00055
00056
00057
00058 StatusCode TrackDumper::initialize(){
00059 MsgStream log( messageService(), name() ) ;
00060
00061 m_tesIO = new TesIO();
00062
00063 HeaderPrinter hp("Atlfast TrackDumper:", log);
00064 hp.add("Input Location ", m_inputLocation);
00065 hp.print();
00066 log << MSG::INFO << "Initialised successfully " << endreq ;
00067 return StatusCode::SUCCESS ;
00068 }
00069
00070
00071
00072
00073
00074 StatusCode TrackDumper::finalize(){
00075
00076 MsgStream log( messageService(), name() ) ;
00077
00078 log << MSG::INFO << "Finalised successfully " << endreq ;
00079
00080 return StatusCode::SUCCESS ;
00081 }
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099 StatusCode TrackDumper::execute( ){
00100
00101
00102
00103
00104 MsgStream log( messageService(), name() ) ;
00105 log << MSG::DEBUG << "Execute() " << endreq;
00106 cerr<<"TrackDumper execute"<<endl;
00107
00108
00109
00110
00111
00112
00113
00114
00115 std::vector<Track*> tracks;
00116
00117 m_tesIO->copy<TrackCollection>( tracks, m_inputLocation );
00118 TrackPrinter printer(log);
00119 HeaderPrinter hp("TrackDump:", log);
00120 std::for_each(tracks.begin(), tracks.end(), printer);
00121 return StatusCode::SUCCESS;
00122 }
00123 }
00124
00125
00126
00127
00128
00129
00130
00131
00132