12#include "GeneratorModule/GenModule.h"
16#include "GaudiKernel/MsgStream.h"
17#include "GaudiKernel/ISvcLocator.h"
18#include "GaudiKernel/DataSvc.h"
19#include "GaudiKernel/SmartDataPtr.h"
22#include "GaudiKernel/IIncidentSvc.h"
23#include "GaudiKernel/Incident.h"
25#include "GaudiKernel/IPartPropSvc.h"
28#include "CLHEP/Random/Ranlux64Engine.h"
29#include "CLHEP/Random/RandPoisson.h"
32#include "HepMC/GenVertex.h"
34#include "GeneratorObject/McGenEvent.h"
39 : Algorithm(name, pSvcLocator),
41 m_pPoissonGenerator(0)
67 MsgStream log(messageService(), name());
79 IPartPropSvc* p_PartPropSvc;
82 StatusCode PartPropStatus = service(
"PartPropSvc", p_PartPropSvc);
83 if (!PartPropStatus.isSuccess() || 0 == p_PartPropSvc) {
84 log << MSG::ERROR <<
" Could not initialize Particle Properties Service" << endreq;
85 return PartPropStatus;
94 log << MSG::INFO <<
"Standard Initialization: Single Interaction Mode "
98 log << MSG::INFO <<
"Fixed Number of Interactions per Event is: "
107 "Poisson Distribution of Interactions per Event with Mean: "
112 if (status.isFailure()) {
113 log << MSG::ERROR <<
"Could not initialize Generator properly" << endreq;
117 if (status1.isFailure()) {
118 log << MSG::ERROR <<
"Could not initialize user part properly" << endreq;
131 MsgStream log(messageService(), name());
133 log << MSG::DEBUG <<
"GenModule::execute()" << endreq;
144 for(
int i=0; i<numToGenerate; i++) {
150 GenEvent* evt =
new GenEvent(1,1);
157 SmartDataPtr<McGenEventCol> anMcCol(eventSvc(),
"/Event/Gen");
160 MsgStream log(messageService(), name());
161 log << MSG::INFO <<
"Add McGenEvent to existing collection" << endreq;
163 anMcCol->push_back(mcEvent);
169 mcColl->push_back(mcEvent);
171 StatusCode sc = eventSvc()->registerObject(
"/Event/Gen",mcColl);
173 if (sc != StatusCode::SUCCESS) {
174 MsgStream log(messageService(), name());
175 log << MSG::ERROR <<
"Could not register McGenEvent" << endreq;
179 return StatusCode::FAILURE;
189 IIncidentSvc *incSvc;
190 service(
"IncidentSvc",incSvc);
191 incSvc->fireIncident( Incident( name(),
"McGenEvent Generated") );
208 return StatusCode::SUCCESS;
214 return StatusCode::SUCCESS;
220 return StatusCode::SUCCESS;
226 return StatusCode::SUCCESS;
232 return StatusCode::SUCCESS;
238 MsgStream log(messageService(), name());
248 log << MSG::INFO <<
" !!!! NO SPECIFIC PARTON FOR STRIPOUT WAS REQUESTED => STRIPOUT ALL "
252 bool value_ok =
true;
261 log << MSG::INFO <<
" !!!! ILEGAL PDG-ID FOR STRIPOUT WAS REQUESTED => STRIPOUT ALL "
266 log << MSG::INFO <<
" THE FOLLOWING PARTON(S) WILL BE STRIPED OUT ";
295 for ( HepMC::GenEvent::vertex_iterator vtx = evt->vertices_begin();
296 vtx != evt->vertices_end(); ++vtx ) {
298 for ( HepMC::GenVertex::particle_iterator p = (*vtx)-> particles_begin(HepMC::children);
299 p != (*vtx)->particles_end(HepMC::children);
304 if ( (*p)->end_vertex() ) (*p)->end_vertex()->remove_particle(*p);
305 if ( (*p)->production_vertex() ) (*p)->production_vertex()->remove_particle(*p);
310 for ( HepMC::GenVertex::particle_iterator p = (*vtx)-> particles_begin(HepMC::parents);
311 p != (*vtx)->particles_end(HepMC::parents);
316 if ( (*p)->end_vertex() ) (*p)->end_vertex()->remove_particle(*p);
317 if ( (*p)->production_vertex() ) (*p)->production_vertex()->remove_particle(*p);
ObjectVector< McGenEvent > McGenEventCol
std::vector< int > m_AllPartons
void StripPartons(GenEvent *evt)
virtual StatusCode callGenerator()
HepPDT::ParticleDataTable * m_particleTable
virtual StatusCode genuserInitialize()
CLHEP::HepRandomEngine * m_pRandomEngine
GenModule(const std::string &name, ISvcLocator *pSvcLocator)
double m_meanInteractions
virtual StatusCode genFinalize()
std::vector< int > m_StripVector
void StripPartonsInit(void)
CLHEP::RandPoisson * m_pPoissonGenerator
virtual StatusCode genInitialize()
virtual StatusCode fillEvt(GenEvent *evt)