hepmc - Diff between revs 455 and 523

Subversion Repositories:
Rev:
Show entire file - Ignore whitespace
Rev 455 Rev 523
Line 202... Line 202...
202         } 202         }
203     } 203     }
204 204
205     int signal_process_vertex = 0; 205     int signal_process_vertex = 0;
206     int num_vertices = 0, bp1 = 0, bp2 = 0; 206     int num_vertices = 0, bp1 = 0, bp2 = 0;
-   207     bool units_line = false;
207     // OK - now ready to start reading the event, so set the header flag 208     // OK - now ready to start reading the event, so set the header flag
208     info.set_reading_event_header(true); 209     info.set_reading_event_header(true);
209     // The flag will be set to false when we reach the end of the header 210     // The flag will be set to false when we reach the end of the header
210     while(info.reading_event_header()) { 211     while(info.reading_event_header()) {
211         switch(is.peek()) { 212         switch(is.peek()) {
Line 217... Line 218...
217             {   // get weight names 218             {   // get weight names
218                 read_weight_names( is ); 219                 read_weight_names( is );
219             } break; 220             } break;
220             case 'U': 221             case 'U':
221             {   // get unit information if it exists 222             {   // get unit information if it exists
-   223                 units_line = true;
222                 if( info.io_type() == gen ) { 224                 if( info.io_type() == gen ) {
223                     read_units( is ); 225                     read_units( is );
224                 } 226                 }
225             } break; 227             } break;
226             case 'C': 228             case 'C':
Line 286... Line 288...
286             default: 288             default:
287                 // ignore everything else 289                 // ignore everything else
288                 break; 290                 break;
289         } // switch on line type 291         } // switch on line type
290     } // while reading_event_header 292     } // while reading_event_header
-   293     // before proceeding - did we find a units line?
-   294     if( !units_line ) {
-   295         use_units( info.io_momentum_unit(),
-   296                        info.io_position_unit() );
-   297     }
291     // 298     //
292     // the end vertices of the particles are not connected until 299     // the end vertices of the particles are not connected until
293     //  after the event is read --- we store the values in a map until then 300     //  after the event is read --- we store the values in a map until then
294     TempParticleMap particle_to_end_vertex; 301     TempParticleMap particle_to_end_vertex;
295     // 302     //
Line 754... Line 761...
754     // after all particles and vertices have been created - so we keep 761     // after all particles and vertices have been created - so we keep
755     // a map of all particles that have end vertices 762     // a map of all particles that have end vertices
756     if ( end_vtx_code != 0 ) { 763     if ( end_vtx_code != 0 ) {
757         particle_to_end_vertex.addEndParticle(p,end_vtx_code); 764         particle_to_end_vertex.addEndParticle(p,end_vtx_code);
758     } 765     }
759     return is; -  
760 } -  
761 -  
762 std::istream & read_units( std::istream & is, GenEvent & evt ) -  
763 { -  
764     // -  
765     if ( !is ) { -  
766         std::cerr << "StreamHelpers read_units setting badbit." << std::endl; -  
767         is.clear(std::ios::badbit); -  
768         return is; -  
769     } -  
770     // -  
771     StreamInfo & info = get_stream_info(is); -  
772     // test to be sure the next entry is of type "U" then ignore it -  
773     // if we have no units, this is not an error -  
774     // releases prior to 2.04.00 did not write unit information -  
775     if ( is.peek() !='U') { -  
776         evt.use_units( info.io_momentum_unit(), -  
777                        info.io_position_unit() ); -  
778         return is; -  
779     } -  
780     is.ignore();        // ignore the first character in the line -  
781     std::string mom, pos; -  
782     is >> mom >> pos; -  
783     is.ignore(1);      // eat the extra whitespace -  
784     evt.use_units(mom,pos); -  
785     // -  
786     return is; 766     return is;
787 } 767 }
788 768
789 std::ostream & establish_output_stream_info( std::ostream & os ) 769 std::ostream & establish_output_stream_info( std::ostream & os )
790 { 770 {