76 for ( HepMC::GenEvent::particle_const_iterator genParticle =
genEvt_->particles_begin();
77 genParticle !=
genEvt_->particles_end(); ++genParticle ) {
81 hepeup.
NUP = numParticles;
91 std::map<int, int> barcodeToIdxMap;
92 int genParticleIdx = 0;
93 for ( HepMC::GenEvent::particle_const_iterator genParticle =
genEvt_->particles_begin();
94 genParticle !=
genEvt_->particles_end(); ++genParticle ) {
95 barcodeToIdxMap[(*genParticle)->barcode()] = genParticleIdx + 1;
96 int pdgId = (*genParticle)->pdg_id();
98 if ( pdgId == 2212 && !(*genParticle)->production_vertex() ) {
99 hepeup.
ISTUP[genParticleIdx] = -1;
101 hepeup.
ISTUP[genParticleIdx] = (*genParticle)->status();
103 if ( (*genParticle)->production_vertex() ) {
105 bool firstMother_initialized =
false;
107 bool lastMother_initialized =
false;
108 for ( HepMC::GenVertex::particles_in_const_iterator genMother = (*genParticle)->production_vertex()->particles_in_const_begin();
109 genMother != (*genParticle)->production_vertex()->particles_in_const_end(); ++genMother ) {
110 int genMotherBarcode = (*genMother)->barcode();
111 assert(barcodeToIdxMap.find(genMotherBarcode) != barcodeToIdxMap.end());
112 int genMotherIdx = barcodeToIdxMap[genMotherBarcode];
113 if ( genMotherIdx < firstMother || !firstMother_initialized ) {
114 firstMother = genMotherIdx;
115 firstMother_initialized =
true;
117 if ( genMotherIdx > lastMother || !lastMother_initialized ) {
118 lastMother = genMotherIdx;
119 lastMother_initialized =
true;
122 hepeup.
MOTHUP[genParticleIdx].first = firstMother;
123 hepeup.
MOTHUP[genParticleIdx].second = ( lastMother > firstMother ) ? lastMother : 0;
125 hepeup.
MOTHUP[genParticleIdx].first = 0;
126 hepeup.
MOTHUP[genParticleIdx].second = 0;
128 hepeup.
ICOLUP[genParticleIdx].first = 0;
129 hepeup.
ICOLUP[genParticleIdx].second = 0;
130 hepeup.
PUP[genParticleIdx][0] = (*genParticle)->momentum().px();
131 hepeup.
PUP[genParticleIdx][1] = (*genParticle)->momentum().py();
132 hepeup.
PUP[genParticleIdx][2] = (*genParticle)->momentum().pz();
133 hepeup.
PUP[genParticleIdx][3] = (*genParticle)->momentum().e();
134 hepeup.
PUP[genParticleIdx][4] = (*genParticle)->momentum().m();
135 if ( (*genParticle)->status() == 1 ) hepeup.
VTIMUP[genParticleIdx] = 1.e+6;
136 else hepeup.
VTIMUP[genParticleIdx] = 0.;
137 hepeup.
SPINUP[genParticleIdx] = 9;
139 std::cout <<
"adding genParticle #" << (genParticleIdx + 1)
140 <<
" (pdgId = " << hepeup.
IDUP[genParticleIdx] <<
", status = " << hepeup.
ISTUP[genParticleIdx] <<
"):"
141 <<
" En = " << hepeup.
PUP[genParticleIdx][3] <<
","
142 <<
" Px = " << hepeup.
PUP[genParticleIdx][0] <<
","
143 <<
" Py = " << hepeup.
PUP[genParticleIdx][1] <<
","
144 <<
" Pz = " << hepeup.
PUP[genParticleIdx][2] <<
" (mass = " << hepeup.
PUP[genParticleIdx][4] <<
")" << std::endl;
145 std::cout <<
"(mothers = " << hepeup.
MOTHUP[genParticleIdx].first <<
":" << hepeup.
MOTHUP[genParticleIdx].second <<
")" << std::endl;
std::vector< double > VTIMUP
const HepMC::GenEvent * genEvt_
std::pair< double, double > XPDWUP
std::vector< std::pair< int, int > > MOTHUP
std::vector< FiveVector > PUP
static void fillHEPEUP(const HEPEUP *hepeup)
std::vector< double > SPINUP
std::vector< std::pair< int, int > > ICOLUP