Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

TrackDumper.cxx

Go to the documentation of this file.
00001 // ================================================
00002 // TrackDumper class Implementation
00003 // ================================================
00004 //
00005 // THIS TEXT TO BE REPLACED BY ATLAS STANDARD FORMAT
00006 //
00007 // Namespace Atlfast::
00008 //
00009 #include "AtlfastAlgs/TrackDumper.h"
00010 #include "AtlfastEvent/Track.h"
00011 #include "AtlfastEvent/CollectionDefs.h"
00012 
00013 
00014 // Gaudi includes
00015 #include "GaudiKernel/DataSvc.h"
00016 #include "GaudiKernel/MsgStream.h"
00017 #include <iostream>
00018 #include <iomanip>
00019 //--------------------------------
00020 // Constructors and destructors
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       //      cout<<setw(10)<<++m_count<<" "<<*t<<endl;
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     // Default paths for entities in the TES
00042     m_inputLocation    = "/Event/AtlfastTracks";
00043     declareProperty( "InputLocation",    m_inputLocation ) ;
00044   }
00045   
00046   //----------------------------
00047   // Destructor
00048   //----------------------------
00049   TrackDumper::~TrackDumper() {
00050     delete m_tesIO;
00051   } 
00052   
00053   
00054   //---------------------------------
00055   // initialise() 
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   // finalise() 
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   // execute() method called once per event
00086   //----------------------------------------------
00087   //
00088   //  This algorithm creates smeared Tracks passing cuts. 
00089   //  It scans the list of HepMC::GenParticles from the Monte Carlo truth. 
00090   //  It creates a Track object by smearing the Trajectory track parameters
00091   //  corresponding to the HepMC::GenParticle. 
00092   // 
00093   //  It then applies kinematic criteria on the properties of the Track
00094   //  Those which pass the cuts are kept.
00095   //  Finally all successful ReconstructedParticles are added to 
00096   //the event store.
00097   //
00098   
00099   StatusCode TrackDumper::execute( ){
00100 
00101     //................................
00102     // make a message logging stream
00103     
00104     MsgStream log( messageService(), name() ) ;
00105     log << MSG::DEBUG << "Execute() " << endreq;
00106     cerr<<"TrackDumper execute"<<endl;
00107     
00108 
00109     //.........................................................
00110     // We now need to access the HepMC event record(s) in the event store
00111     // and iterate over them to extract HepMC::GenParticles.
00112     // This method will only select the particles which are required
00113     // and add them to a local store (mcParticles)
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 } // end namespace bracket
00124 
00125 
00126 
00127 
00128 
00129 
00130 
00131 
00132 

Generated on Tue Mar 18 11:18:25 2003 for AtlfastAlgs by doxygen1.3-rc1