#include <TruthDemo.h>
Public Member Functions | |
StatusCode | execute () |
StatusCode | execute () |
StatusCode | finalize () |
StatusCode | finalize () |
StatusCode | initialize () |
StatusCode | initialize () |
TruthDemo (const std::string &name, ISvcLocator *pSvcLocator) | |
TruthDemo (const std::string &name, ISvcLocator *pSvcLocator) | |
Private Attributes | |
IHistogram1D * | m_hgenerated |
IHistogram1D * | m_hgenerated |
IHistogram1D * | m_negStatus |
IHistogram1D * | m_negStatus |
bool | m_produceHistogram |
IHistogram1D * | m_pxBalance |
IHistogram1D * | m_pxBalance |
IHistogram1D * | m_pyBalance |
IHistogram1D * | m_pyBalance |
GenAccessIO * | m_tesIO |
GenAccessIO * | m_tesIO |
IHistogram1D * | m_totEnergy |
IHistogram1D * | m_totEnergy |
|
00042 : 00043 Algorithm(name, pSvcLocator) 00044 { 00045 //Declare the algorithm's properties 00046 declareProperty("HistogramFlag", m_produceHistogram = true ); 00047 // declareProperty("HistogramFlag", m_produceHistogram = false ); 00048 }
|
|
|
|
|
|
00067 { 00068 // HepMC::IO_PDG_ParticleDataTable pdg_io("PDGTABLE"); 00069 // static HepMC::ParticleDataTable *pp = NULL; 00070 // if (pp == NULL) pp = pdg_io.read_particle_data_table(); 00071 MsgStream msglog(messageService(), name()); 00072 msglog << MSG::INFO << ">>> TruthDemo from execute" << endreq; 00073 // 00074 // Px/Py Balance and total energy 00075 // 00076 float totenergy = 0.; 00077 float pxbalance = 0.; 00078 float pybalance = 0.; 00079 // Iterate over MC particles We are using the IsGenStable predicate from 00080 IsGenStable ifs; 00081 std::vector<const HepMC::GenParticle*> particles; 00082 StatusCode stat = m_tesIO->getMC(particles, &ifs); 00083 for (std::vector<const HepMC::GenParticle*>::iterator pitr = particles.begin(); 00084 pitr != particles.end(); pitr++) { 00085 pxbalance += (*pitr)->momentum().x(); 00086 pybalance += (*pitr)->momentum().y(); 00087 totenergy += (*pitr)->momentum().e(); 00088 } 00089 m_pxBalance->fill(pxbalance, 1.); 00090 m_pyBalance->fill(pybalance, 1.); 00091 m_totEnergy->fill(totenergy, 1.); 00092 // End of execution for each event 00093 return StatusCode::SUCCESS; 00094 }
|
|
|
|
00096 { 00097 MsgStream msglog(messageService(), name()); 00098 msglog << MSG::INFO << ">>> TruthDemo from finalize" << endreq; 00099 return StatusCode::SUCCESS; 00100 }
|
|
|
|
00050 { 00051 StatusCode result = StatusCode::SUCCESS; 00052 MsgStream msglog(messageService(), name()); 00053 msglog << MSG::INFO << ">>> Truthdemo from Initialize" << endreq; 00054 m_hgenerated = histoSvc()->book("/stat/1Dhist/1","Generated",100,0,1200); 00055 if (0 == m_hgenerated) { 00056 msglog << MSG::ERROR << " ERROR booking histogram" << endreq; 00057 result = StatusCode::FAILURE; 00058 } 00059 m_pxBalance = histoSvc()->book("/stat/1Dhist/25","px balance",50,-10.,10.); 00060 m_pyBalance = histoSvc()->book("/stat/1Dhist/26","py balance",50,-10.,10.); 00061 m_totEnergy = histoSvc()->book("/stat/1Dhist/27","total energy",50,10000.,20000.); 00062 m_tesIO = new GenAccessIO(); 00063 00064 // return StatusCode::SUCCESS; 00065 return result; 00066 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|