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