00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
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
00021 #include "GaudiKernel/DataSvc.h"
00022
00023
00024
00025
00026
00027 namespace Atlfast {
00028 ReconstructedParticleDumper::ReconstructedParticleDumper
00029 ( const std::string& name, ISvcLocator* pSvcLocator )
00030 : Algorithm( name, pSvcLocator ){
00031
00032
00033
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
00064
00065
00066 StatusCode ReconstructedParticleDumper::initialize(){
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076 m_tesIO = new TesIO();
00077
00078 return StatusCode::SUCCESS ;
00079 }
00080
00081
00082
00083
00084
00085 StatusCode ReconstructedParticleDumper::finalize(){
00086
00087
00088 return StatusCode::SUCCESS ;
00089 }
00090
00091
00092
00093
00094
00095
00096
00097 StatusCode ReconstructedParticleDumper::execute( ){
00098
00099
00100
00101 MsgStream log( messageService(), name() ) ;
00102
00103
00104
00105
00106
00107
00108
00109
00110
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
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 };
00176
00177
00178
00179
00180
00181