156 {
157 MsgStream log(
msgSvc(), name() );
158
159 int npart = 0;
160 int pid1, pid2, pid3, pid4, pst1, pst2;
161 pid1 = 11;
162 pid2 = -11;
163 pid3 = 211;
164 pid4 = -211;
165 pst1 = 1;
166 pst2 = 1;
167
168
169 GenEvent* evt = new GenEvent( 1, 1 );
170
171 GenVertex* prod_vtx = new GenVertex();
172
173 evt->add_vertex( prod_vtx );
174
175
176 GenParticle* p =
177 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 evtgen++;
221
222 if ( log.level() < MSG::INFO ) { evt->print(); }
223
224
225 SmartDataPtr<McGenEventCol> anMcCol( eventSvc(), "/Event/Gen" );
226 if ( anMcCol != 0 )
227 {
228
229 MsgStream log(
msgSvc(), name() );
230 log << MSG::INFO << "Add McGenEvent to existing collection" << endmsg;
231 McGenEvent* mcEvent = new McGenEvent( evt );
232 anMcCol->push_back( mcEvent );
233 }
234 else
235 {
236
238 McGenEvent* mcEvent = new McGenEvent( evt );
239 mcColl->push_back( mcEvent );
240 StatusCode sc = eventSvc()->registerObject( "/Event/Gen", mcColl );
241 if ( sc != StatusCode::SUCCESS )
242 {
243 log << MSG::ERROR << "Could not register McGenEvent" << endmsg;
244 delete mcColl;
245 delete evt;
246 delete mcEvent;
247 return StatusCode::FAILURE;
248 }
249 else
250 {
251
252
253 }
254 }
255
256 return StatusCode::SUCCESS;
257}
ObjectVector< McGenEvent > McGenEventCol