154{
155 MsgStream log(messageService(), name());
156
157
158 int npart = 0;
159 int pid1,pid2,pid3,pid4,pst1,pst2;
160 pid1 = 11;
161 pid2 =-11;
162 pid3 = 211;
163 pid4 =-211;
164 pst1 = 1;
165 pst2 = 1;
166
167
168
169
170 GenEvent* evt = new GenEvent(1,1);
171
172 GenVertex* prod_vtx = new GenVertex();
173
174 evt->add_vertex( prod_vtx );
175
176
177 GenParticle* p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.p1[1][evtgen],
MOMSET.p1[2][evtgen],
179 11, 3);
180 p->suggest_barcode( ++npart );
181 prod_vtx->add_particle_in(p);
182
183
184
185 p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.q1[1][evtgen],
MOMSET.q1[2][evtgen],
187 -11, 3);
188
189 p->suggest_barcode( ++npart );
190 prod_vtx->add_particle_in(p);
191
192
193 p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.p2[1][evtgen],
MOMSET.p2[2][evtgen],
195 pid1,pst1);
196 p->suggest_barcode( ++npart );
197 prod_vtx->add_particle_out(p);
198
199
200 p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.q2[1][evtgen],
MOMSET.q2[2][evtgen],
202 pid2, pst2);
203 p->suggest_barcode( ++npart );
204 prod_vtx->add_particle_out(p);
205
206
207 p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.p3[1][evtgen],
MOMSET.p3[2][evtgen],
209 pid3,pst1);
210 p->suggest_barcode( ++npart );
211 prod_vtx->add_particle_out(p);
212
213
214 p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.q3[1][evtgen],
MOMSET.q3[2][evtgen],
216 pid4, pst2);
217 p->suggest_barcode( ++npart );
218 prod_vtx->add_particle_out(p);
219
220
221
222 evtgen++;
223
224 if( log.level() < MSG::INFO )
225 {
226 evt->print();
227 }
228
229
230 SmartDataPtr<McGenEventCol> anMcCol(eventSvc(), "/Event/Gen");
231 if (anMcCol!=0)
232 {
233
234 MsgStream log(messageService(), name());
235 log << MSG::INFO << "Add McGenEvent to existing collection" << endreq;
237 anMcCol->push_back(mcEvent);
238 }
239 else
240 {
241
244 mcColl->push_back(mcEvent);
245 StatusCode sc = eventSvc()->registerObject("/Event/Gen",mcColl);
246 if (sc != StatusCode::SUCCESS)
247 {
248 log << MSG::ERROR << "Could not register McGenEvent" << endreq;
249 delete mcColl;
250 delete evt;
251 delete mcEvent;
252 return StatusCode::FAILURE;
253 }
254 else
255 {
256
257 }
258 }
259
260 return StatusCode::SUCCESS;
261}
ObjectVector< McGenEvent > McGenEventCol