75 for ( HepMC::GenEvent::particle_const_iterator genParticle =
genEvt_->particles_begin();
76 genParticle !=
genEvt_->particles_end(); ++genParticle ) {
80 hepeup.
NUP = numParticles;
90 std::map<int, int> barcodeToIdxMap;
91 int genParticleIdx = 0;
92 for ( HepMC::GenEvent::particle_const_iterator genParticle =
genEvt_->particles_begin();
93 genParticle !=
genEvt_->particles_end(); ++genParticle ) {
94 barcodeToIdxMap[(*genParticle)->barcode()] = genParticleIdx + 1;
95 int pdgId = (*genParticle)->pdg_id();
97 if ( pdgId == 2212 && !(*genParticle)->production_vertex() ) {
98 hepeup.
ISTUP[genParticleIdx] = -1;
100 hepeup.
ISTUP[genParticleIdx] = (*genParticle)->status();
102 if ( (*genParticle)->production_vertex() ) {
104 bool firstMother_initialized =
false;
106 bool lastMother_initialized =
false;
107 for ( HepMC::GenVertex::particles_in_const_iterator genMother = (*genParticle)->production_vertex()->particles_in_const_begin();
108 genMother != (*genParticle)->production_vertex()->particles_in_const_end(); ++genMother ) {
109 int genMotherBarcode = (*genMother)->barcode();
110 assert(barcodeToIdxMap.find(genMotherBarcode) != barcodeToIdxMap.end());
111 int genMotherIdx = barcodeToIdxMap[genMotherBarcode];
112 if ( genMotherIdx < firstMother || !firstMother_initialized ) {
113 firstMother = genMotherIdx;
114 firstMother_initialized =
true;
116 if ( genMotherIdx > lastMother || !lastMother_initialized ) {
117 lastMother = genMotherIdx;
118 lastMother_initialized =
true;
121 hepeup.
MOTHUP[genParticleIdx].first = firstMother;
122 hepeup.
MOTHUP[genParticleIdx].second = ( lastMother > firstMother ) ? lastMother : 0;
124 hepeup.
MOTHUP[genParticleIdx].first = 0;
125 hepeup.
MOTHUP[genParticleIdx].second = 0;
127 hepeup.
ICOLUP[genParticleIdx].first = 0;
128 hepeup.
ICOLUP[genParticleIdx].second = 0;
129 hepeup.
PUP[genParticleIdx][0] = (*genParticle)->momentum().px();
130 hepeup.
PUP[genParticleIdx][1] = (*genParticle)->momentum().py();
131 hepeup.
PUP[genParticleIdx][2] = (*genParticle)->momentum().pz();
132 hepeup.
PUP[genParticleIdx][3] = (*genParticle)->momentum().e();
133 hepeup.
PUP[genParticleIdx][4] = (*genParticle)->momentum().m();
134 if ( (*genParticle)->status() == 1 ) hepeup.
VTIMUP[genParticleIdx] = 1.e+6;
135 else hepeup.
VTIMUP[genParticleIdx] = 0.;
136 hepeup.
SPINUP[genParticleIdx] = 9;
138 std::cout <<
"adding genParticle #" << (genParticleIdx + 1)
139 <<
" (pdgId = " << hepeup.
IDUP[genParticleIdx] <<
", status = " << hepeup.
ISTUP[genParticleIdx] <<
"):"
140 <<
" En = " << hepeup.
PUP[genParticleIdx][3] <<
","
141 <<
" Px = " << hepeup.
PUP[genParticleIdx][0] <<
","
142 <<
" Py = " << hepeup.
PUP[genParticleIdx][1] <<
","
143 <<
" Pz = " << hepeup.
PUP[genParticleIdx][2] <<
" (mass = " << hepeup.
PUP[genParticleIdx][4] <<
")" << std::endl;
144 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
if(conf.exists("allCellsPositionCalc"))
std::vector< std::pair< int, int > > ICOLUP