hepmc - Diff between revs 43 and 65
Subversion Repositories:
| Rev 43 | Rev 65 | |||
|---|---|---|---|---|
| Line 90... | Line 90... | |||
| 90 | << " print_inconsistency_errors = " | 90 | << " print_inconsistency_errors = " | |
| 91 | << m_print_inconsistency_errors << std::endl; | 91 | << m_print_inconsistency_errors << std::endl; | |
| 92 | } | 92 | } | |
| 93 | 93 | |||
| 94 | bool IO_HERWIG::fill_next_event( GenEvent* evt ) { | 94 | bool IO_HERWIG::fill_next_event( GenEvent* evt ) { | |
| 95 | // read one event from the Herwig HEPEVT common block and fill GenEvent | - | ||
| 96 | // return T/F =success/failure | - | ||
| - | 95 | /// read one event from the Herwig HEPEVT common block and fill GenEvent | ||
| - | 96 | /// return T/F =success/failure | ||
| 97 | // | 97 | // | |
| 98 | // 0. Test that evt pointer is not null and set event number | 98 | // 0. Test that evt pointer is not null and set event number | |
| 99 | if ( !evt ) { | 99 | if ( !evt ) { | |
| 100 | std::cerr | 100 | std::cerr | |
| 101 | << "IO_HERWIG::fill_next_event error - passed null event." | 101 | << "IO_HERWIG::fill_next_event error - passed null event." | |
| Line 196... | Line 196... | |||
| 196 | 196 | |||
| 197 | void IO_HERWIG::build_production_vertex(int i, | 197 | void IO_HERWIG::build_production_vertex(int i, | |
| 198 | std::vector<GenParticle*>& | 198 | std::vector<GenParticle*>& | |
| 199 | hepevt_particle, | 199 | hepevt_particle, | |
| 200 | GenEvent* evt ) { | 200 | GenEvent* evt ) { | |
| 201 | // | - | ||
| 202 | // for particle in HEPEVT with index i, build a production vertex | - | ||
| 203 | // if appropriate, and add that vertex to the event | - | ||
| - | 201 | /// | ||
| - | 202 | /// for particle in HEPEVT with index i, build a production vertex | ||
| - | 203 | /// if appropriate, and add that vertex to the event | ||
| 204 | GenParticle* p = hepevt_particle[i]; | 204 | GenParticle* p = hepevt_particle[i]; | |
| 205 | // a. search to see if a production vertex already exists | 205 | // a. search to see if a production vertex already exists | |
| 206 | int mother = HEPEVT_Wrapper::first_parent(i); | 206 | int mother = HEPEVT_Wrapper::first_parent(i); | |
| 207 | GenVertex* prod_vtx = p->production_vertex(); | 207 | GenVertex* prod_vtx = p->production_vertex(); | |
| 208 | while ( !prod_vtx && mother > 0 ) { | 208 | while ( !prod_vtx && mother > 0 ) { | |
| Line 267... | Line 267... | |||
| 267 | } | 267 | } | |
| 268 | 268 | |||
| 269 | void IO_HERWIG::build_end_vertex | 269 | void IO_HERWIG::build_end_vertex | |
| 270 | ( int i, std::vector<GenParticle*>& hepevt_particle, GenEvent* evt ) | 270 | ( int i, std::vector<GenParticle*>& hepevt_particle, GenEvent* evt ) | |
| 271 | { | 271 | { | |
| 272 | // | - | ||
| 273 | // for particle in HEPEVT with index i, build an end vertex | - | ||
| 274 | // if appropriate, and add that vertex to the event | - | ||
| - | 272 | /// | ||
| - | 273 | /// for particle in HEPEVT with index i, build an end vertex | ||
| - | 274 | /// if appropriate, and add that vertex to the event | ||
| 275 | // Identical steps as for build_production_vertex | 275 | // Identical steps as for build_production_vertex | |
| 276 | GenParticle* p = hepevt_particle[i]; | 276 | GenParticle* p = hepevt_particle[i]; | |
| 277 | // a. | 277 | // a. | |
| 278 | int daughter = HEPEVT_Wrapper::first_child(i); | 278 | int daughter = HEPEVT_Wrapper::first_child(i); | |
| 279 | GenVertex* end_vtx = p->end_vertex(); | 279 | GenVertex* end_vtx = p->end_vertex(); | |
| Line 334... | Line 334... | |||
| 334 | build_production_vertex( i, hepevt_particle, evt ); | 334 | build_production_vertex( i, hepevt_particle, evt ); | |
| 335 | } | 335 | } | |
| 336 | } | 336 | } | |
| 337 | 337 | |||
| 338 | GenParticle* IO_HERWIG::build_particle( int index ) { | 338 | GenParticle* IO_HERWIG::build_particle( int index ) { | |
| 339 | // Builds a particle object corresponding to index in HEPEVT | - | ||
| - | 339 | /// Builds a particle object corresponding to index in HEPEVT | ||
| 340 | // | 340 | // | |
| 341 | GenParticle* p | 341 | GenParticle* p | |
| 342 | = new GenParticle( FourVector( HEPEVT_Wrapper::px(index), | 342 | = new GenParticle( FourVector( HEPEVT_Wrapper::px(index), | |
| 343 | HEPEVT_Wrapper::py(index), | 343 | HEPEVT_Wrapper::py(index), | |
| 344 | HEPEVT_Wrapper::pz(index), | 344 | HEPEVT_Wrapper::pz(index), | |
| Line 356... | Line 356... | |||
| 356 | if ( iter == m.end() ) return 0; | 356 | if ( iter == m.end() ) return 0; | |
| 357 | return iter->second; | 357 | return iter->second; | |
| 358 | } | 358 | } | |
| 359 | 359 | |||
| 360 | void IO_HERWIG::repair_hepevt() const { | 360 | void IO_HERWIG::repair_hepevt() const { | |
| 361 | // This routine takes the HEPEVT common block as used in HERWIG, | - | ||
| 362 | // and converts it into the HEPEVT common block in the standard format | - | ||
| 363 | // | - | ||
| 364 | // This means it: | - | ||
| 365 | // - removes the color structure, which herwig overloads | - | ||
| 366 | // into the mother/daughter fields | - | ||
| 367 | // - zeros extra entries for hard subprocess, etc. | - | ||
| 368 | // | - | ||
| 369 | // | - | ||
| 370 | // Special HERWIG status codes | - | ||
| 371 | // 101,102 colliding beam particles | - | ||
| 372 | // 103 beam-beam collision CMS vector | - | ||
| 373 | // 120 hard subprocess CMS vector | - | ||
| 374 | // 121,122 hard subprocess colliding partons | - | ||
| 375 | // 123-129 hard subprocess outgoing particles | - | ||
| 376 | // 141-149 (ID=94) mirror image of hard subrpocess particles | - | ||
| 377 | // 100 (ID=0 cone) | - | ||
| 378 | // | - | ||
| 379 | // Special HERWIG particle id's | - | ||
| 380 | // 91 clusters | - | ||
| 381 | // 94 jets | - | ||
| 382 | // 0 others with no pdg code | - | ||
| - | 361 | /// This routine takes the HEPEVT common block as used in HERWIG, | ||
| - | 362 | /// and converts it into the HEPEVT common block in the standard format | ||
| - | 363 | /// | ||
| - | 364 | /// This means it: | ||
| - | 365 | /// - removes the color structure, which herwig overloads | ||
| - | 366 | /// into the mother/daughter fields | ||
| - | 367 | /// - zeros extra entries for hard subprocess, etc. | ||
| - | 368 | /// | ||
| - | 369 | /// | ||
| - | 370 | /// Special HERWIG status codes | ||
| - | 371 | /// 101,102 colliding beam particles | ||
| - | 372 | /// 103 beam-beam collision CMS vector | ||
| - | 373 | /// 120 hard subprocess CMS vector | ||
| - | 374 | /// 121,122 hard subprocess colliding partons | ||
| - | 375 | /// 123-129 hard subprocess outgoing particles | ||
| - | 376 | /// 141-149 (ID=94) mirror image of hard subrpocess particles | ||
| - | 377 | /// 100 (ID=0 cone) | ||
| - | 378 | /// | ||
| - | 379 | /// Special HERWIG particle id's | ||
| - | 380 | /// 91 clusters | ||
| - | 381 | /// 94 jets | ||
| - | 382 | /// 0 others with no pdg code | ||
| 383 | 383 | |||
| 384 | // Make sure hepvt isn't empty. | 384 | // Make sure hepvt isn't empty. | |
| 385 | if ( HEPEVT_Wrapper::number_entries() <= 0 ) return; | 385 | if ( HEPEVT_Wrapper::number_entries() <= 0 ) return; | |
| 386 | 386 | |||
| 387 | // Find the index of the beam-beam collision and of the hard subprocess | 387 | // Find the index of the beam-beam collision and of the hard subprocess | |
| Line 629... | Line 629... | |||
| 629 | 629 | |||
| 630 | if ( m_no_gaps_in_barcodes ) remove_gaps_in_hepevt(); | 630 | if ( m_no_gaps_in_barcodes ) remove_gaps_in_hepevt(); | |
| 631 | } | 631 | } | |
| 632 | 632 | |||
| 633 | void IO_HERWIG::remove_gaps_in_hepevt() const { | 633 | void IO_HERWIG::remove_gaps_in_hepevt() const { | |
| 634 | // in this scenario, we do not allow there to be zero-ed | - | ||
| 635 | // entries in the HEPEVT common block, and so be reshuffle | - | ||
| 636 | // the common block, removing the zeero-ed entries as we | - | ||
| 637 | // go and making sure we keep the mother/daughter | - | ||
| 638 | // relationships appropriate | - | ||
| - | 634 | /// in this scenario, we do not allow there to be zero-ed | ||
| - | 635 | /// entries in the HEPEVT common block, and so be reshuffle | ||
| - | 636 | /// the common block, removing the zeero-ed entries as we | ||
| - | 637 | /// go and making sure we keep the mother/daughter | ||
| - | 638 | /// relationships appropriate | ||
| 639 | std::vector<int> mymap(HEPEVT_Wrapper::number_entries()+1,0); | 639 | std::vector<int> mymap(HEPEVT_Wrapper::number_entries()+1,0); | |
| 640 | int ilast = 0; | 640 | int ilast = 0; | |
| 641 | for ( int i=1; i <=HEPEVT_Wrapper::number_entries(); i++ ) { | 641 | for ( int i=1; i <=HEPEVT_Wrapper::number_entries(); i++ ) { | |
| 642 | if (HEPEVT_Wrapper::status(i)==0 && HEPEVT_Wrapper::id(i)==0) { | 642 | if (HEPEVT_Wrapper::status(i)==0 && HEPEVT_Wrapper::id(i)==0) { | |
| 643 | // we remove all entries for which stat=0, id=0 | 643 | // we remove all entries for which stat=0, id=0 | |
| Line 700... | Line 700... | |||
| 700 | HEPEVT_Wrapper::set_mass( i, 0 ); | 700 | HEPEVT_Wrapper::set_mass( i, 0 ); | |
| 701 | HEPEVT_Wrapper::set_position( i, 0, 0, 0, 0 ); | 701 | HEPEVT_Wrapper::set_position( i, 0, 0, 0, 0 ); | |
| 702 | } | 702 | } | |
| 703 | 703 | |||
| 704 | int IO_HERWIG::translate_herwig_to_pdg_id( int id ) const { | 704 | int IO_HERWIG::translate_herwig_to_pdg_id( int id ) const { | |
| 705 | // This routine is copied from Lynn Garren's stdhep 5.01. | - | ||
| 706 | // see http://www-pat.fnal.gov/stdhep.html | - | ||
| - | 705 | /// This routine is copied from Lynn Garren's stdhep 5.01. | ||
| - | 706 | /// see http:///cepa.fnal.gov/psm/stdhep/ | ||
| 707 | 707 | |||
| 708 | // example -9922212 | 708 | // example -9922212 | |
| 709 | int hwtran = id; // -9922212 | 709 | int hwtran = id; // -9922212 | |
| 710 | int ida = abs(id); // 9922212 | 710 | int ida = abs(id); // 9922212 | |
| 711 | int j1 = ida%10; // 2 | 711 | int j1 = ida%10; // 2 | |
