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