130{
131 MsgStream log(messageService(), name());
132
133
134 int npart = 0;
135 int pid1,pid2,pid3,pid4,pst1,pst2;
136 pid1 = 11;
137 pid2 =-11;
138 pid3 = 211;
139 pid4 =-211;
140 pst1 = 1;
141 pst2 = 1;
142
143
144
145
146 GenEvent* evt = new GenEvent(1,1);
147
148 GenVertex* prod_vtx = new GenVertex();
149
150 evt->add_vertex( prod_vtx );
151
152
153 GenParticle* p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.p1[1][evtgen],
MOMSET.p1[2][evtgen],
155 11, 3);
156 p->suggest_barcode( ++npart );
157 prod_vtx->add_particle_in(p);
158
159
160
161 p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.q1[1][evtgen],
MOMSET.q1[2][evtgen],
163 -11, 3);
164
165 p->suggest_barcode( ++npart );
166 prod_vtx->add_particle_in(p);
167
168
169 p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.p2[1][evtgen],
MOMSET.p2[2][evtgen],
171 pid1,pst1);
172 p->suggest_barcode( ++npart );
173 prod_vtx->add_particle_out(p);
174
175
176 p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.q2[1][evtgen],
MOMSET.q2[2][evtgen],
178 pid2, pst2);
179 p->suggest_barcode( ++npart );
180 prod_vtx->add_particle_out(p);
181
182
183 p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.p3[1][evtgen],
MOMSET.p3[2][evtgen],
185 pid3,pst1);
186 p->suggest_barcode( ++npart );
187 prod_vtx->add_particle_out(p);
188
189
190 p =
new GenParticle( CLHEP::HepLorentzVector(
MOMSET.q3[1][evtgen],
MOMSET.q3[2][evtgen],
192 pid4, pst2);
193 p->suggest_barcode( ++npart );
194 prod_vtx->add_particle_out(p);
195
196
197
198 evtgen++;
199
200 if( log.level() < MSG::INFO )
201 {
202 evt->print();
203 }
204
205
206 SmartDataPtr<McGenEventCol> anMcCol(eventSvc(), "/Event/Gen");
207 if (anMcCol!=0)
208 {
209
210 MsgStream log(messageService(), name());
211 log << MSG::INFO << "Add McGenEvent to existing collection" << endreq;
213 anMcCol->push_back(mcEvent);
214 }
215 else
216 {
217
220 mcColl->push_back(mcEvent);
221 StatusCode sc = eventSvc()->registerObject("/Event/Gen",mcColl);
222 if (sc != StatusCode::SUCCESS)
223 {
224 log << MSG::ERROR << "Could not register McGenEvent" << endreq;
225 delete mcColl;
226 delete evt;
227 delete mcEvent;
228 return StatusCode::FAILURE;
229 }
230 else
231 {
232
233 }
234 }
235
236 return StatusCode::SUCCESS;
237}
ObjectVector< McGenEvent > McGenEventCol