BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
DumpMC.cxx
Go to the documentation of this file.
1#include "DumpMC.h"
2#include "GeneratorModule/GeneratorName.h"
3// #include "GeneratorObject/McEventCollection.h"
4#include "GaudiKernel/DataSvc.h"
5#include "GaudiKernel/MsgStream.h"
6
7// #include "StoreGate/StoreGateSvc.h"
8
9DumpMC::DumpMC( const std::string& name, ISvcLocator* pSvcLocator )
10 : Algorithm( name, pSvcLocator ) {}
11
12StatusCode DumpMC::initialize() {
13
14 MsgStream log( msgSvc(), name() );
15 log << MSG::INFO << ">>> DumpMC from Initialize" << endmsg;
16 std::cout << "----- DumpMC World From initialize" << std::endl;
17
18 /*
19 StatusCode sc = service("StoreGateSvc", m_sgSvc);
20 if (sc.isFailure()) {
21 log << MSG::ERROR << "Could not find StoreGateSvc" << endmsg;
22 return sc;
23 }
24 */
25
26 // Initialization terminated
27 return StatusCode::SUCCESS;
28}
29StatusCode DumpMC::execute() {
30
31 MsgStream log( msgSvc(), name() );
32 log << MSG::INFO << ">>> DumpMC from execute" << endmsg;
33 std::cout << "----- DumpMC World From execute" << std::endl;
34
35 // Read Data from Transient Store
36 // SmartDataPtr<McEventCollection> mcCollptr(eventDataService(),
37 // "/Event/McEventCollection");
38 // if(!mcCollptr) {
39 // std::cout << " No McCollptr" << std::endl;
40 // }
41 // else {
42 // std::cout << " ---- Begin Iterating Over McEventCollection --- " << std::endl;
43 // McEventCollection::iterator it;
44 // for(it=mcCollptr->begin(); it!=mcCollptr->end(); it++) {
45 // std::cout << "Next event in the bag" << std::endl;
46 // std::cout << " Generator: " << (*it)->generatorName() << std::endl;
47 // (*it)->pGenEvt()->print();
48 // }
49 // }
50
51 /*
52 const McEventCollection* mcCollptr;
53 if ( m_sgSvc->retrieve(mcCollptr).isFailure() ) {
54 log << MSG::ERROR << "Could not retrieve McEventCollection"
55 << endmsg;
56 return StatusCode::FAILURE;
57 }
58
59 // Loop over all events in McEventCollection
60 McEventCollection::const_iterator itr;
61 for (itr = mcCollptr->begin(); itr!=mcCollptr->end(); ++itr) {
62 std::cout << "Next event in the bag" << std::endl;
63 int g_id = (*itr)->signal_process_id();
64 GeneratorName_print(g_id);
65 std::cout << std::endl;
66 (*itr)->print();
67 }
68 */
69
70 // End of execution for each event
71 return StatusCode::SUCCESS;
72}
73StatusCode DumpMC::finalize() {
74
75 MsgStream log( msgSvc(), name() );
76 log << MSG::INFO << ">>> DumpMC from finalize" << endmsg;
77 std::cout << "----- DumpMC World From finalize" << std::endl;
78
79 // End of finalization step
80 return StatusCode::SUCCESS;
81}
IMessageSvc * msgSvc()
StatusCode initialize()
Definition DumpMC.cxx:12
StatusCode execute()
Definition DumpMC.cxx:29
StatusCode finalize()
Definition DumpMC.cxx:73
DumpMC(const std::string &name, ISvcLocator *pSvcLocator)
Definition DumpMC.cxx:9