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

ReconstructedParticleDumper.cxx

Go to the documentation of this file.
00001 // ================================================
00002 //ReconstructedParticleDumper class Implementation
00003 // ================================================
00004 //
00005 // THIS TEXT TO BE REPLACED BY ATLAS STANDARD FORMAT
00006 //
00007 // Namespace Atlfast::
00008 //
00009 
00010 // This algorithm includes
00011 #include "AtlfastAlgs/ReconstructedParticleDumper.h"
00012 #include "AtlfastEvent/ReconstructedParticle.h"
00013 #include "AtlfastEvent/Cluster.h"
00014 #include "AtlfastEvent/MsgStreamDefs.h"
00015 #include "AtlfastEvent/CollectionDefs.h"
00016 
00017 #include <cmath> 
00018 #include <algorithm>
00019 
00020 // Gaudi includes
00021 #include "GaudiKernel/DataSvc.h"
00022 
00023 //--------------------------------
00024 // Constructors and destructors
00025 //--------------------------------
00026 
00027 namespace Atlfast {
00028   ReconstructedParticleDumper::ReconstructedParticleDumper
00029   ( const std::string& name, ISvcLocator* pSvcLocator ) 
00030     : Algorithm( name, pSvcLocator ){
00031     
00032     
00033     // Default paths for entities in the TES
00034     m_inputLocation    = "/Event/Atlfast/ReconstructedParticle";
00035     
00036     m_writePDG        = true;
00037     m_writeFourVector = true;
00038     m_writeEta        = true;
00039     m_writePhi        = true;
00040     m_writePt         = true;
00041     m_writeEt         = false;
00042     m_writeMt         = false;
00043     m_writeTruth      = true;
00044     
00045     declareProperty( "InputLocation", m_inputLocation ) ;
00046     
00047     declareProperty( "WritePDG", m_writePDG );
00048     declareProperty( "WriteFourVector", m_writeFourVector );
00049     declareProperty( "WriteEta", m_writeEta );
00050     declareProperty( "WritePhi", m_writePhi );
00051     declareProperty( "WritePt", m_writePt );
00052     declareProperty( "WriteEt", m_writeEt );
00053     declareProperty( "WriteMt", m_writeMt );
00054     declareProperty( "WriteTruth", m_writeTruth );
00055     
00056   }
00057   
00058   
00059   ReconstructedParticleDumper::~ReconstructedParticleDumper() {} 
00060   
00061   
00062   //---------------------------------
00063   // initialise() 
00064   //---------------------------------
00065   
00066   StatusCode ReconstructedParticleDumper::initialize(){
00067     //MsgStream log( messageService(), name() ) ;
00068     
00069     // .. put any initialisation in here...
00070     
00071     // will need to build an appropriate smearer object here
00072     // when tools become avialble we will instead just pass an appropriate
00073     // tool via job options
00074     
00075     //  m_tesIO = new TesIO(eventDataService());
00076     m_tesIO = new TesIO();
00077     
00078     return StatusCode::SUCCESS ;
00079   }
00080   
00081   //---------------------------------
00082   // finalise() 
00083   //---------------------------------
00084   
00085   StatusCode ReconstructedParticleDumper::finalize(){
00086     // .. put any finalisation in here...
00087     
00088     return StatusCode::SUCCESS ;
00089   }
00090   
00091   
00092   //----------------------------------------------
00093   // execute() method called once per event
00094   //----------------------------------------------
00095   //
00096   
00097   StatusCode ReconstructedParticleDumper::execute( ){
00098     //................................
00099     // make a message logging stream
00100     
00101     MsgStream log( messageService(), name() ) ;
00102     
00103     //.............................
00104     // Make some locals stores which be used to keep pointers to
00105     // all of the entities from the event store which are needed by
00106     // this algorithm. These are all local and are typedefed in this class
00107     
00108     //t_reconstructedParticleCollection  myParticles ;
00109     //...............................
00110     // Extract the input particles which are to be tested for isolation.
00111     
00112     
00113     std::vector<ReconstructedParticle*> particles;
00114     if(!m_tesIO->copy<ReconstructedParticleCollection >
00115        (particles, m_inputLocation)){
00116       log << MSG::INFO 
00117           << "No reconstructed particles in TES at " 
00118           << m_inputLocation 
00119           << endreq ;
00120       return StatusCode::FAILURE ;
00121     }
00122     log << MSG::INFO << particles.size()  
00123         << " Reconstructed particles retrieved from TES at " 
00124         << m_inputLocation 
00125         << endreq;
00126     
00127     
00128     
00129     int count = 0;
00130     std::vector<ReconstructedParticle*>::const_iterator particle  = 
00131       particles.begin();
00132     for (; particle != particles.end(); ++particle) {
00133       count++;
00134       log << MSG::INFO << count;
00135       if (m_writePDG) {
00136         log << " PDG " << (*particle)->pdg_id();
00137       }
00138       if (m_writeFourVector) {
00139         log << " px " << (*particle)->momentum().px() 
00140             << " py " << (*particle)->momentum().py()
00141             << " pz " << (*particle)->momentum().pz()
00142             << " e  " << (*particle)->momentum().e();
00143       }
00144       if (m_writeEta) {
00145         log << " eta " << (*particle)->eta();
00146       }
00147       if (m_writePhi) {
00148         log << " phi " << (*particle)->phi();
00149       }
00150       if (m_writePt) {
00151         log << " pt " << (*particle)->pT();
00152       }
00153       if (m_writeEt) {
00154         log << " et " << (*particle)->eT();
00155       }
00156       if (m_writeMt) {
00157         log << " mt " << (*particle)->mT();
00158       }
00159       if (m_writeTruth) {
00160         log << " MC truth " << (*particle)->truth()->momentum();
00161       }
00162       
00163       log << endreq;
00164       
00165       // Now print any associations
00166       IAssociationManager* ia = *particle;
00167       Cluster c;
00168       log << "     it has " << ia->associations( c ).size() 
00169           << " associated clusters " << endreq;
00170     }
00171     
00172     return StatusCode::SUCCESS;
00173   }
00174   
00175 };  // end of namespace bracket
00176 
00177 
00178 
00179 
00180 
00181 

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