5 #include <TDatabasePDG.h>
28 HepMC::GenEvent *theEvent = genevt->
getEvent();
33 cout <<
"ERROR: Missing GenEvent!" << endl;
38 for ( HepMC::GenEvent::particle_iterator
p = theEvent->particles_begin();
39 p != theEvent->particles_end(); ++
p ) {
42 if ( (*p)->pdg_id() ==
pid )
58 HepMC::GenParticle* particle_daughter = NULL;
63 else if ( particle_mother->end_vertex() )
66 for ( HepMC::GenVertex::particle_iterator
child
67 = particle_mother->end_vertex()->
68 particles_begin(HepMC::children);
69 child != particle_mother->end_vertex()->
70 particles_end(HepMC::children);
75 if ( (*child)->pdg_id() ==
pid )
77 particle_daughter = (*child);
78 UpdateFinalStateParticle( particle_daughter );
83 return particle_daughter;
97 cout <<
"ERROR: Missing GenEvent!" << endl;
101 HepMC::GenEvent* genEvent = theEvent->
getEvent();
103 particle = genEvent->beam_particles().first;
110 HepMC::GenParticle *
particle = NULL;
112 int embedding_id = 1;
118 cout <<
"ERROR: Missing GenEvent!" << endl;
122 HepMC::GenEvent* genEvent = theEvent->
getEvent();
124 particle = genEvent->beam_particles().second;
132 HepMC::GenParticle *
particle = NULL;
139 int pid_beam_lepton=0;
140 if(FindBeamLepton()==NULL)
147 pid_beam_lepton = FindBeamLepton()->pdg_id();
149 int embedding_id = 1;
152 HepMC::GenEvent *theEvent = genevt->
getEvent();
157 cout <<
"ERROR: Missing GenEvent!" << endl;
161 for ( HepMC::GenEvent::particle_iterator
p = theEvent->particles_begin();
162 p != theEvent->particles_end(); ++
p ) {
165 if ( (*p)->status() == 1 &&
166 (*p)->pdg_id() == pid_beam_lepton )
181 bool final_state =
false;
182 while ( !final_state )
185 if(!particle->end_vertex())
break;
188 for ( HepMC::GenVertex::particle_iterator
child
189 = particle->end_vertex()->particles_begin(HepMC::children);
190 child != particle->end_vertex()->particles_end(HepMC::children);
195 if ( (*child)->pdg_id() == particle->pdg_id() )
216 for ( HepMC::GenVertex::particle_iterator decay
217 = particle_mother->end_vertex()->
218 particles_begin(HepMC::children);
219 decay != particle_mother->end_vertex()->
220 particles_end(HepMC::children);
224 if(!(*decay)->end_vertex()){
227 TParticlePDG * pdg_p = TDatabasePDG::Instance()->GetParticle( (*decay)->pdg_id() );
230 if ( pdg_p->Charge() != 0 )
235 if (
string( pdg_p->ParticleClass() ) ==
"Lepton" )
239 else if ( (
string( pdg_p->ParticleClass() ) ==
"Meson" ) ||
240 (
string( pdg_p->ParticleClass() ) ==
"Baryon" ) )
246 else if((*decay)->end_vertex()){
249 for ( HepMC::GenVertex::particle_iterator second_decay
250 = (*decay)->end_vertex()->
251 particles_begin(HepMC::children);
252 second_decay != (*decay)->end_vertex()->
253 particles_end(HepMC::children);
258 TParticlePDG * pdg_p2 = TDatabasePDG::Instance()->GetParticle( (*second_decay)->pdg_id() );
261 if ( pdg_p2->Charge() != 0 )
266 if (
string( pdg_p2->ParticleClass() ) ==
"Lepton" )
270 else if ( (
string( pdg_p2->ParticleClass() ) ==
"Meson" ) ||
271 (
string( pdg_p2->ParticleClass() ) ==
"Baryon" ) )
333 HepMC::GenEvent *theEvent = genevt->
getEvent();
338 cout <<
"ERROR: Missing GenEvent!" << endl;
343 for ( HepMC::GenEvent::particle_iterator
p = theEvent->particles_begin();
344 p != theEvent->particles_end(); ++
p ) {
347 if ( (*p)->status() != 1 )
351 TParticlePDG * pdg_p = TDatabasePDG::Instance()->GetParticle( (*p)->pdg_id() );
354 if ( (
string( pdg_p->ParticleClass() ) ==
"Lepton" ) &&
355 ( pdg_p->Charge() == 0 ) )
359 px_sum += (*p)->momentum().px();
360 py_sum += (*p)->momentum().py();
366 pt_miss = sqrt( px_sum * px_sum + py_sum * py_sum );
367 pt_miss_phi = atan( py_sum / px_sum );