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