/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Generator/GenAnalysisTools/TruthExamples/TruthExamples-00-00-07/src/DumpMC.cxx

Go to the documentation of this file.
00001 #include "TruthExamples/DumpMC.h"
00002 #include "GeneratorModule/GeneratorName.h"
00003 // #include "GeneratorObject/McEventCollection.h"
00004 #include "GaudiKernel/MsgStream.h"
00005 #include "GaudiKernel/DataSvc.h"
00006 
00007 // #include "StoreGate/StoreGateSvc.h"
00008 
00009 DumpMC::DumpMC(const std::string& name, ISvcLocator* pSvcLocator) :
00010   Algorithm(name, pSvcLocator)
00011 {}
00012 
00013 StatusCode DumpMC::initialize(){
00014 
00015   MsgStream log(messageService(), name());
00016         log << MSG::INFO << ">>> DumpMC from Initialize" << endreq;
00017         std::cout << "----- DumpMC World From initialize" << std::endl;
00018 
00019         /*      
00020         StatusCode sc = service("StoreGateSvc", m_sgSvc);
00021         if (sc.isFailure()) {
00022           log << MSG::ERROR << "Could not find StoreGateSvc" << endreq;
00023           return sc;
00024         }
00025         */
00026 
00027   // Initialization terminated
00028         return StatusCode::SUCCESS;
00029 }
00030 StatusCode DumpMC::execute() {
00031 
00032   MsgStream log(messageService(), name());
00033   log << MSG::INFO << ">>> DumpMC from execute" << endreq;
00034   std::cout << "----- DumpMC World From execute" << std::endl;
00035   
00036   // Read Data from Transient Store
00037 //    SmartDataPtr<McEventCollection> mcCollptr(eventDataService(),
00038 //                                          "/Event/McEventCollection");
00039 //    if(!mcCollptr) {
00040 //      std::cout << " No McCollptr" << std::endl;
00041 //    }
00042 //    else {
00043 //      std::cout << " ---- Begin Iterating Over McEventCollection --- " << std::endl;
00044 //      McEventCollection::iterator it;
00045 //      for(it=mcCollptr->begin(); it!=mcCollptr->end(); it++) {
00046 //        std::cout << "Next event in the bag" << std::endl;
00047 //        std::cout << "     Generator: " << (*it)->generatorName() << std::endl;
00048 //        (*it)->pGenEvt()->print();
00049 //      }
00050 //    }
00051 
00052 /*
00053   const McEventCollection* mcCollptr;
00054   if ( m_sgSvc->retrieve(mcCollptr).isFailure() ) {
00055     log << MSG::ERROR << "Could not retrieve McEventCollection"
00056         << endreq;
00057     return StatusCode::FAILURE;
00058   }
00059   
00060   // Loop over all events in McEventCollection
00061   McEventCollection::const_iterator itr;
00062   for (itr = mcCollptr->begin(); itr!=mcCollptr->end(); ++itr) {
00063     std::cout << "Next event in the bag" << std::endl;
00064     int g_id = (*itr)->signal_process_id();
00065     GeneratorName_print(g_id);
00066     std::cout << std::endl;
00067     (*itr)->print();
00068   }       
00069 */
00070   
00071   // End of execution for each event
00072   return StatusCode::SUCCESS;
00073 }
00074 StatusCode DumpMC::finalize() {
00075 
00076   MsgStream log(messageService(), name());
00077   log << MSG::INFO << ">>> DumpMC from finalize" << endreq;
00078   std::cout << "----- DumpMC World From finalize" << std::endl;
00079 
00080   // End of finalization step
00081         return StatusCode::SUCCESS;
00082 }
00083 

Generated on Tue Nov 29 23:12:39 2016 for BOSS_7.0.2 by  doxygen 1.4.7