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