Index: trunk/Utilities/HepMC/src/CommonIO.cc
===================================================================
--- trunk/Utilities/HepMC/src/CommonIO.cc	(revision 571)
+++ 	(revision )
@@ -1,491 +1,0 @@
-//--------------------------------------------------------------------------
-//
-// CommonIO.cc
-// Author:  Lynn Garren
-//
-// ----------------------------------------------------------------------
-
-#include <string>
-#include <sstream>
-
-#include "CommonIO.h"
-#include "GenEvent.h"
-#include "HeavyIon.h"
-#include "PdfInfo.h"
-#include "TempParticleMap.h"
-#include "ParticleDataTable.h"
-
-namespace HepMC {
-
-int CommonIO::find_file_type( std::istream& istr )
-{
-    std::string line;
-    while ( std::getline(istr,line) ) {
-	//
-	// search for event listing key before first event only.
-	//
-	if( line == m_io_genevent_start ) {
-	    m_io_type = gen;
-	    return gen;
-	} else if( line == m_io_ascii_start ) {
-	    m_io_type = ascii;
-	    return ascii;
-	} else if( line == m_io_extendedascii_start ) {
-	    m_io_type = extascii;
-	    return extascii;
-	} else if( line == m_io_ascii_pdt_start ) {
-	    m_io_type = ascii_pdt;
-	    return ascii_pdt;
-	} else if( line == m_io_extendedascii_pdt_start ) {
-	    m_io_type = extascii_pdt;
-	    return extascii_pdt;
-	}
-    }
-    return -1;
-}
-
-int CommonIO::find_end_key( std::istream& istr )
-{
-    // peek at the first character before proceeding
-    if( istr.peek()!='H' ) return false;
-    //
-    // we only check the next line
-    std::string line;
-    std::getline(istr,line);
-    //
-    // check to see if this is an end key
-    int iotype = 0;
-    if( line == m_io_genevent_end ) {
-	m_io_type = gen;
-    } else if( line == m_io_ascii_end ) {
-	m_io_type = ascii;
-    } else if( line == m_io_extendedascii_end ) {
-	m_io_type = extascii;
-    } else if( line == m_io_ascii_pdt_end ) {
-	m_io_type = ascii_pdt;
-    } else if( line == m_io_extendedascii_pdt_end ) {
-	m_io_type = extascii_pdt;
-    }
-    if( iotype != 0 && m_io_type != iotype ) {
-        std::cerr << "CommonIO::find_end_key: iotype keys have changed" << std::endl;
-    } else {
-        return iotype;
-    }
-    //
-    // if we get here, then something has gotten badly confused
-    std::cerr << "CommonIO::find_end_key: MALFORMED INPUT" << std::endl;
-    return -1;
-}
-
-void CommonIO::use_input_units( Units::MomentumUnit mom, Units::LengthUnit len ) 
-{
-     m_io_momentum_unit = mom;
-     m_io_position_unit = len;
-}
-
-bool CommonIO::read_io_ascii( std::istream* istr, GenEvent* evt )
-{
-	// read values into temp variables, then create a new GenEvent
-	int event_number = 0, signal_process_id = 0, signal_process_vertex = 0,
-	    num_vertices = 0, random_states_size = 0, weights_size = 0;
-	double eventScale = 0, alpha_qcd = 0, alpha_qed = 0;
-	*istr >> event_number >> eventScale >> alpha_qcd >> alpha_qed
-	       >> signal_process_id >> signal_process_vertex
-	       >> num_vertices >> random_states_size;
-	std::vector<long> random_states(random_states_size);
-	for ( int i = 0; i < random_states_size; ++i ) {
-	    *istr >> random_states[i];
-	}
-	*istr >> weights_size;
-	WeightContainer weights(weights_size);
-	for ( int ii = 0; ii < weights_size; ++ii ) *istr >> weights[ii];
-	istr->ignore(2,'\n');
-	// 
-	// fill signal_process_id, event_number, weights, random_states
-	evt->set_signal_process_id( signal_process_id );
-	evt->set_event_number( event_number );
-	evt->weights() = weights;
-	evt->set_random_states( random_states );
-	// no unit information, so just set it
-	// this is done before the event has any vertices, so it is safe
- 	evt->use_units( m_io_momentum_unit, m_io_position_unit );
-	//
-	// the end vertices of the particles are not connected until
-	//  after the event is read --- we store the values in a map until then
-       	TempParticleMap particle_to_end_vertex;
-	//
-	// read in the vertices
-	for ( int iii = 1; iii <= num_vertices; ++iii ) {
-	    GenVertex* v = read_vertex(istr,particle_to_end_vertex);
-	    evt->add_vertex( v );
-	}
-	// set the signal process vertex
-	if ( signal_process_vertex ) {
-	    evt->set_signal_process_vertex( 
-		evt->barcode_to_vertex(signal_process_vertex) );
-	}
-	//
-	// last connect particles to their end vertices
-	for ( std::map<int,GenParticle*>::iterator pmap 
-		  = particle_to_end_vertex.order_begin(); 
-	      pmap != particle_to_end_vertex.order_end(); ++pmap ) {
-	    GenParticle* p =  pmap->second;
-	    int vtx = particle_to_end_vertex.end_vertex( p );
-	    GenVertex* itsDecayVtx = evt->barcode_to_vertex(vtx);
-	    if ( itsDecayVtx ) itsDecayVtx->add_particle_in( p );
-	    else {
-		std::cerr << "IO_Ascii::fill_next_event ERROR particle points"
-			  << "\n to null end vertex. " <<std::endl;
-	    }
-	}
-	return true;
-}
-
-bool CommonIO::read_io_extendedascii( std::istream* istr, GenEvent* evt )
-{
-	// read values into temp variables, then create a new GenEvent
-	int event_number = 0, signal_process_id = 0, signal_process_vertex = 0,
-	    num_vertices = 0, random_states_size = 0, weights_size = 0,
-	    nmpi = 0, bp1 = 0, bp2 = 0;
-	double eventScale = 0, alpha_qcd = 0, alpha_qed = 0;
-	*istr >> event_number >> nmpi >> eventScale >> alpha_qcd >> alpha_qed
-	       >> signal_process_id >> signal_process_vertex
-	       >> num_vertices >> bp1 >> bp2 >> random_states_size;
-	std::vector<long> random_states(random_states_size);
-	for ( int i = 0; i < random_states_size; ++i ) {
-	    *istr >> random_states[i];
-	}
-	*istr >> weights_size;
-	WeightContainer weights(weights_size);
-	for ( int ii = 0; ii < weights_size; ++ii ) *istr >> weights[ii];
-	istr->ignore(2,'\n');
-	// 
-	// fill signal_process_id, event_number, weights, random_states
-	evt->set_signal_process_id( signal_process_id );
-	evt->set_event_number( event_number );
-	evt->set_mpi( nmpi );
-	evt->weights() = weights;
-	evt->set_random_states( random_states );
-	evt->set_event_scale( eventScale );
-	evt->set_alphaQCD( alpha_qcd );
-	evt->set_alphaQED( alpha_qed );
-	// get HeavyIon and PdfInfo
-	HeavyIon* ion = read_heavy_ion(istr);
-	if(ion) evt->set_heavy_ion( *ion );
-	PdfInfo* pdf = read_pdf_info(istr);
-	if(pdf) evt->set_pdf_info( *pdf );
-	// no unit information, so just set it
-	// this is done before the event has any vertices, so it is safe
- 	evt->use_units( m_io_momentum_unit, m_io_position_unit );
-	//
-	// the end vertices of the particles are not connected until
-	//  after the event is read --- we store the values in a map until then
-       	TempParticleMap particle_to_end_vertex;
-	//
-	// read in the vertices
-	for ( int iii = 1; iii <= num_vertices; ++iii ) {
-	    GenVertex* v = read_vertex(istr,particle_to_end_vertex);
-	    evt->add_vertex( v );
-	}
-	// set the signal process vertex
-	if ( signal_process_vertex ) {
-	    evt->set_signal_process_vertex( 
-		evt->barcode_to_vertex(signal_process_vertex) );
-	}
-	//
-	// last connect particles to their end vertices
-	GenParticle* beam1(0);
-	GenParticle* beam2(0);
-	for ( std::map<int,GenParticle*>::iterator pmap 
-		  = particle_to_end_vertex.order_begin(); 
-	      pmap != particle_to_end_vertex.order_end(); ++pmap ) {
-	    GenParticle* p =  pmap->second;
-	    int vtx = particle_to_end_vertex.end_vertex( p );
-	    GenVertex* itsDecayVtx = evt->barcode_to_vertex(vtx);
-	    if ( itsDecayVtx ) itsDecayVtx->add_particle_in( p );
-	    else {
-		std::cerr << "read_io_extendedascii: ERROR particle points"
-			  << "\n to null end vertex. " <<std::endl;
-	    }
-	    // also look for the beam particles
-	    if( p->barcode() == bp1 ) beam1 = p;
-	    if( p->barcode() == bp2 ) beam2 = p;
-	}
-	evt->set_beam_particles(beam1,beam2);
-	return true;
-}
-
-bool CommonIO::read_io_genevent( std::istream* is, GenEvent* evt )
-{
-    /// this method ONLY works if called from fill_next_event
-    //
-    // assume that we've been handed a valid stream and event pointer
-    //
-    // read values into temp variables, then fill GenEvent
-    int event_number = 0, signal_process_id = 0, signal_process_vertex = 0,
-	num_vertices = 0, random_states_size = 0, weights_size = 0,
-	nmpi = 0, bp1 = 0, bp2 = 0;
-    double eventScale = 0, alpha_qcd = 0, alpha_qed = 0;
-    *is >> event_number >> nmpi >> eventScale >> alpha_qcd >> alpha_qed
-	   >> signal_process_id >> signal_process_vertex
-	   >> num_vertices >> bp1 >> bp2 >> random_states_size;
-    std::vector<long> random_states(random_states_size);
-    for ( int i = 0; i < random_states_size; ++i ) {
-	*is >> random_states[i];
-    }
-    *is >> weights_size;
-    WeightContainer weights(weights_size);
-    for ( int ii = 0; ii < weights_size; ++ii ) *is >> weights[ii];
-    is->ignore(2,'\n');
-    // 
-    // fill signal_process_id, event_number, weights, random_states, etc.
-    evt->set_signal_process_id( signal_process_id );
-    evt->set_event_number( event_number );
-    evt->set_mpi( nmpi );
-    evt->weights() = weights;
-    evt->set_random_states( random_states );
-    evt->set_event_scale( eventScale );
-    evt->set_alphaQCD( alpha_qcd );
-    evt->set_alphaQED( alpha_qed );
-    // get unit information if it exists
-    read_units( is, evt );
-    // get HeavyIon and PdfInfo
-    HeavyIon* ion = read_heavy_ion(is);
-    if(ion) evt->set_heavy_ion( *ion );
-    PdfInfo* pdf = read_pdf_info(is);
-    if(pdf) evt->set_pdf_info( *pdf );
-    //
-    // the end vertices of the particles are not connected until
-    //  after the event is read --- we store the values in a map until then
-    TempParticleMap particle_to_end_vertex;
-    //
-    // read in the vertices
-    for ( int iii = 1; iii <= num_vertices; ++iii ) {
-	GenVertex* v = read_vertex(is,particle_to_end_vertex);
-	evt->add_vertex( v );
-    }
-    // set the signal process vertex
-    if ( signal_process_vertex ) {
-	evt->set_signal_process_vertex( 
-	    evt->barcode_to_vertex(signal_process_vertex) );
-    }
-    //
-    // last connect particles to their end vertices
-    GenParticle* beam1(0);
-    GenParticle* beam2(0);
-    for ( std::map<int,GenParticle*>::iterator pmap 
-	      = particle_to_end_vertex.order_begin(); 
-	  pmap != particle_to_end_vertex.order_end(); ++pmap ) {
-	GenParticle* p =  pmap->second;
-	int vtx = particle_to_end_vertex.end_vertex( p );
-	GenVertex* itsDecayVtx = evt->barcode_to_vertex(vtx);
-	if ( itsDecayVtx ) itsDecayVtx->add_particle_in( p );
-	else {
-	    std::cerr << "read_io_genevent: ERROR particle points"
-		      << " to null end vertex. " <<std::endl;
-	}
-	// also look for the beam particles
-	if( p->barcode() == bp1 ) beam1 = p;
-	if( p->barcode() == bp2 ) beam2 = p;
-    }
-    evt->set_beam_particles(beam1,beam2);
-    return true;
-}
-
-bool CommonIO::read_io_particle_data_table( std::istream* is, ParticleDataTable* pdt )
-{
-    // 
-    // read Individual GenParticle data entries
-    while ( read_particle_data( is, pdt ) ) ;
-    return true;
-}
-
-HeavyIon* CommonIO::read_heavy_ion(std::istream* is)
-{
-    // assumes mode has already been checked
-    //
-    // test to be sure the next entry is of type "H" then ignore it
-    if ( !(*is) || is->peek()!='H' ) {
-	std::cerr << "CommonIO::read_heavy_ion setting badbit." << std::endl;
-	is->clear(std::ios::badbit); 
-	return false;
-    } 
-    is->ignore();
-    // read values into temp variables, then create a new HeavyIon object
-    int nh =0, np =0, nt =0, nc =0, 
-        neut = 0, prot = 0, nw =0, nwn =0, nwnw =0;
-    float impact = 0., plane = 0., xcen = 0., inel = 0.; 
-    *is >> nh >> np >> nt >> nc >> neut >> prot
-	   >> nw >> nwn >> nwnw >> impact >> plane >> xcen >> inel;
-    is->ignore(2,'\n');
-    if( nh == 0 ) return false;
-    HeavyIon* ion = new HeavyIon(nh, np, nt, nc, neut, prot,
-	                         nw, nwn, nwnw, 
-				 impact, plane, xcen, inel );
-    //
-    return ion;
-}
-
-PdfInfo* CommonIO::read_pdf_info(std::istream* is)
-{
-    // assumes mode has already been checked
-    //
-    // test to be sure the next entry is of type "F" then ignore it
-    if ( !(*is) || is->peek() !='F') {
-	std::cerr << "CommonIO::read_pdf_info setting badbit." << std::endl;
-	is->clear(std::ios::badbit); 
-	return false;
-    } 
-    is->ignore();
-    // read values into temp variables, then create a new PdfInfo object
-    int id1 =0, id2 =0, pdf_id1=0, pdf_id2=0;
-    double  x1 = 0., x2 = 0., scale = 0., pdf1 = 0., pdf2 = 0.; 
-    *is >> id1 >> id2 >> x1 >> x2 >> scale >> pdf1 >> pdf2;
-    // check to see if we are at the end of the line
-    if( is->peek() != 10 ) {
-        *is >> pdf_id1 >> pdf_id2;
-    }
-    is->ignore(2,'\n');
-    if( id1 == 0 ) return false;
-    PdfInfo* pdf = new PdfInfo( id1, id2, x1, x2, scale, pdf1, pdf2,
-                                pdf_id1, pdf_id2 );
-    //
-    return pdf;
-}
-
-GenVertex* CommonIO::read_vertex( std::istream* is, TempParticleMap& particle_to_end_vertex )
-{
-    // assumes mode has already been checked
-    //
-    // test to be sure the next entry is of type "V" then ignore it
-    if ( !(*is) || is->peek()!='V' ) {
-	std::cerr << "CommonIO::read_vertex setting badbit." << std::endl;
-	std::string line;
-	*is >> line;
-	std::cerr << "attempting to read " << line << std::endl;
-	is->clear(std::ios::badbit); 
-	return false;
-    } 
-    is->ignore();
-    // read values into temp variables, then create a new GenVertex object
-    int identifier =0, id =0, num_orphans_in =0, 
-        num_particles_out = 0, weights_size = 0;
-    double x = 0., y = 0., z = 0., t = 0.; 
-    *is >> identifier >> id >> x >> y >> z >> t
-	   >> num_orphans_in >> num_particles_out >> weights_size;
-    WeightContainer weights(weights_size);
-    for ( int i1 = 0; i1 < weights_size; ++i1 ) *is >> weights[i1];
-    is->ignore(2,'\n');
-    GenVertex* v = new GenVertex( FourVector(x,y,z,t),
-			    id, weights);
-    v->suggest_barcode( identifier );
-    //
-    // read and create the associated particles. outgoing particles are
-    //  added to their production vertices immediately, while incoming
-    //  particles are added to a map and handles later.
-    for ( int i2 = 1; i2 <= num_orphans_in; ++i2 ) {
-	read_particle(is,particle_to_end_vertex);
-    }
-    for ( int i3 = 1; i3 <= num_particles_out; ++i3 ) {
-	v->add_particle_out( read_particle(is,particle_to_end_vertex) );
-    }
-    return v;
-}
-
-GenParticle* CommonIO::read_particle(std::istream* is,
-    TempParticleMap& particle_to_end_vertex ){
-    // assumes mode has already been checked
-    //
-    // test to be sure the next entry is of type "P" then ignore it
-    if ( !(*is) || is->peek()!='P' ) { 
-	std::cerr << "CommonIO::read_particle setting badbit." 
-		  << std::endl;
-	is->clear(std::ios::badbit); 
-	return false;
-    } 
-    is->ignore();
-    //
-    // declare variables to be read in to, and read everything except flow
-    double px = 0., py = 0., pz = 0., e = 0., m = 0., theta = 0., phi = 0.;
-    int bar_code = 0, id = 0, status = 0, end_vtx_code = 0, flow_size = 0;
-    if( m_io_type == ascii ) {
-	*is >> bar_code >> id >> px >> py >> pz >> e >> status 
-	    >> theta >> phi >> end_vtx_code >> flow_size;
-    } else {
-        *is >> bar_code >> id >> px >> py >> pz >> e >> m >> status 
-	    >> theta >> phi >> end_vtx_code >> flow_size;
-    }
-    //
-    // read flow patterns if any exist
-    Flow flow;
-    int code_index, code;
-    for ( int i = 1; i <= flow_size; ++i ) {
-	*is >> code_index >> code;
-	flow.set_icode( code_index,code);
-    }
-    is->ignore(2,'\n'); // '\n' at end of entry
-    GenParticle* p = new GenParticle( FourVector(px,py,pz,e), 
-				id, status, flow, 
-				Polarization(theta,phi) );
-    if( m_io_type != ascii ) {
-        p->set_generated_mass( m );
-    }
-    p->suggest_barcode( bar_code );
-    //
-    // all particles are connected to their end vertex separately 
-    // after all particles and vertices have been created - so we keep
-    // a map of all particles that have end vertices
-    if ( end_vtx_code != 0 ) {
-	particle_to_end_vertex.addEndParticle(p,end_vtx_code);
-    }
-    return p;
-}
-
-ParticleData* CommonIO::read_particle_data( std::istream* is, ParticleDataTable* pdt ) {
-    // assumes mode has already been checked
-    //
-    // test to be sure the next entry is of type "D" then ignore it
-    if ( !(*is) || is->peek()!='D' ) return 0;
-    is->ignore();
-    //
-    // read values into temp variables then create new ParticleData object
-    char its_name[22];
-    int its_id = 0, its_spin = 0;  
-    double its_charge = 0, its_mass = 0, its_clifetime = 0;
-    *is >> its_id >> its_charge >> its_mass 
-	   >> its_clifetime >> its_spin;
-    is->ignore(1); // eat the " "
-    is->getline( its_name, 22, '\n' );
-    ParticleData* pdata = new ParticleData( its_name, its_id, its_charge, 
-					    its_mass, its_clifetime, 
-					    double(its_spin)/2.);
-    pdt->insert(pdata);
-    return pdata;
-}
-
-bool CommonIO::read_units( std::istream* is, GenEvent* evt ) {
-    // assumes mode has already been checked
-    //
-    // test to be sure the next entry is of type "F" then ignore it
-    if ( !(*is) ) {
-	std::cerr << "CommonIO::read_units setting badbit." << std::endl;
-	is->clear(std::ios::badbit); 
-	return false;
-    } 
-    // have no units, but this is not an error
-    // releases prior to 2.04.00 did not write unit information
-    if ( is->peek() !='U') {
- 	evt->use_units( m_io_momentum_unit, m_io_position_unit );
-	return true;
-    } 
-    is->ignore();	// ignore the first character in the line
-    std::string mom, pos;
-    *is >> mom >> pos;
-    is->ignore(1);      // eat the extra whitespace
-    evt->use_units(mom,pos);
-    //
-    return true;
-}
-
-}	// end namespace HepMC
-
Index: trunk/Utilities/HepMC/src/IO_Ascii.cc
===================================================================
--- trunk/Utilities/HepMC/src/IO_Ascii.cc	(revision 571)
+++ 	(revision )
@@ -1,348 +1,0 @@
-//--------------------------------------------------------------------------
-
-//////////////////////////////////////////////////////////////////////////
-// Matt.Dobbs@Cern.CH, January 2000
-// event input/output in ascii format for machine reading
-//////////////////////////////////////////////////////////////////////////
-
-#include "IO_Ascii.h"
-#include "GenEvent.h"
-#include "ParticleDataTable.h"
-#include "CommonIO.h"
-#include "Version.h"
-
-namespace HepMC {
-
-    IO_Ascii::IO_Ascii( const char* filename, std::ios::openmode mode ) 
-	: m_mode(mode), m_file(filename, mode), m_finished_first_event_io(0),
-          m_common_io()  
-    {
-        std::cout << "-------------------------------------------------------" << std::endl;
-        std::cout << "Use of HepMC/IO_Ascii is deprecated" << std::endl;
-        std::cout << "-------------------------------------------------------" << std::endl;
-	if ( (m_mode&std::ios::out && m_mode&std::ios::in) ||
-	     (m_mode&std::ios::app && m_mode&std::ios::in) ) {
-	    std::cerr << "IO_Ascii::IO_Ascii Error, open of file requested "
-		      << "of input AND output type. Not allowed. Closing file."
-		      << std::endl;
-	    m_file.close();
-	    return;
-	}
-	// precision 16 (# digits following decimal point) is the minimum that
-	//  will capture the full information stored in a double
-	m_file.precision(16);
-	// we use decimal to store integers, because it is smaller than hex!
-	m_file.setf(std::ios::dec,std::ios::basefield);
-	m_file.setf(std::ios::scientific,std::ios::floatfield);
-    }
-
-    IO_Ascii::~IO_Ascii() {
-	write_end_listing();
-	m_file.close();
-    }
-
-    void IO_Ascii::print( std::ostream& ostr ) const { 
-	ostr << "IO_Ascii: unformated ascii file IO for machine reading.\n" 
-	     << "\tFile openmode: " << m_mode 
-	     << " file state: " << m_file.rdstate()
-	     << " bad:" << (m_file.rdstate()&std::ios::badbit)
-	     << " eof:" << (m_file.rdstate()&std::ios::eofbit)
-	     << " fail:" << (m_file.rdstate()&std::ios::failbit)
-	     << " good:" << (m_file.rdstate()&std::ios::goodbit) << std::endl;
-    }
-
-    void IO_Ascii::write_event( const GenEvent* evt ) {
-	/// Writes evt to m_file. It does NOT delete the event after writing.
-	//
-	// check the state of m_file is good, and that it is in output mode
-	if ( !evt || !m_file ) return;
-	if ( !(m_mode&std::ios::out) ) {
-	    std::cerr << "HepMC::IO_Ascii::write_event "
-		      << " attempt to write to input file." << std::endl;
-	    return;
-	}
-	//
-	// write event listing key before first event only.
-	if ( !m_finished_first_event_io ) {
-	    m_finished_first_event_io = 1;
-	    m_file << "\n" << "HepMC::Version " << versionName();
-	    m_file << "\n" << "HepMC::IO_Ascii-START_EVENT_LISTING\n";
-	}
-	//
-	// output the event data including the number of primary vertices
-	//  and the total number of vertices
-	std::vector<long int> random_states = evt->random_states();
-	m_file << 'E';
-	output( evt->event_number() );
-	output( evt->event_scale() );
-	output( evt->alphaQCD() );
-	output( evt->alphaQED() );
-	output( evt->signal_process_id() );
-	output(   ( evt->signal_process_vertex() ?
-		    evt->signal_process_vertex()->barcode() : 0 )   );
-	output( evt->vertices_size() ); // total number of vertices.
-	output( (int)random_states.size() );
-	for ( std::vector<long int>::iterator rs = random_states.begin(); 
-	      rs != random_states.end(); ++rs ) {
-	    output( *rs );
-	}
-	output( (int)evt->weights().size() );
-	for ( WeightContainer::const_iterator w = evt->weights().begin(); 
-	      w != evt->weights().end(); ++w ) {
-	    output( *w );
-	}
-	output('\n');
-	//
-	// Output all of the vertices - note there is no real order.
-	for ( GenEvent::vertex_const_iterator v = evt->vertices_begin();
-	      v != evt->vertices_end(); ++v ) {
-	    write_vertex( *v );
-	}
-    }
-
-    bool IO_Ascii::fill_next_event( GenEvent* evt ){
-	//
-	//
-	// test that evt pointer is not null
-	if ( !evt ) {
-	    std::cerr 
-		<< "IO_Ascii::fill_next_event error - passed null event." 
-		<< std::endl;
-	    return false;
-	}
-	// check the state of m_file is good, and that it is in input mode
-	if ( !m_file ) return false;
-	if ( !(m_mode&std::ios::in) ) {
-	    std::cerr << "HepMC::IO_Ascii::fill_next_event "
-		      << " attempt to read from output file." << std::endl;
-	    return false;
-	}
-	//
-	// search for event listing key before first event only.
-	//
-	// skip through the file just after first occurence of the start_key
-	int iotype;
-	if ( !m_finished_first_event_io ) {
-	    m_file.seekg( 0 ); // go to position zero in the file.
-	    iotype = m_common_io.find_file_type(m_file);
-	    if( iotype != ascii ) {
-		std::cerr << "IO_Ascii::fill_next_event start key not found "
-			  << "setting badbit." << std::endl;
-		m_file.clear(std::ios::badbit); 
-		return false;
-	    }
-	    m_finished_first_event_io = 1;
-	}
-	//
-	// test to be sure the next entry is of type "E" then ignore it
-	if ( !m_file ) { 
-		std::cerr << "IO_Ascii::fill_next_event end of stream found "
-			  << "setting badbit." << std::endl;
-		m_file.clear(std::ios::badbit); 
-		return false;
-	}
-	if ( !m_file || m_file.peek()!='E' ) { 
-	    // if the E is not the next entry, then check to see if it is
-	    // the end event listing key - if yes, search for another start key
-	    if ( m_common_io.find_end_key(m_file) ) {
-		iotype = m_common_io.find_file_type(m_file);
-		if( iotype != ascii ) {
-		    // this is the only case where we set an EOF state
-		    m_file.clear(std::ios::eofbit);
-		    return false;
-		}
-	    } else {
-		std::cerr << "IO_Ascii::fill_next_event end key not found "
-			  << "setting badbit." << std::endl;
-		m_file.clear(std::ios::badbit); 
-		return false;
-	    }
-	} 
-	m_file.ignore();
-	// call the read method
-	return m_common_io.read_io_ascii(&m_file, evt);
-    }
-
-    void IO_Ascii::write_comment( const std::string comment ) {
-	// check the state of m_file is good, and that it is in output mode
-	if ( !m_file ) return;
-	if ( !(m_mode&std::ios::out) ) {
-	    std::cerr << "HepMC::IO_Ascii::write_particle_data_table "
-		      << " attempt to write to input file." << std::endl;
-	    return;
-	}
-	// write end of event listing key if events have already been written
-	write_end_listing();
-	// insert the comment key before the comment
-	m_file << "\n" << "HepMC::IO_Ascii-COMMENT\n";
-	m_file << comment << std::endl;
-    }
-
-    void IO_Ascii::write_particle_data_table( const ParticleDataTable* pdt) {
-	//
-	// check the state of m_file is good, and that it is in output mode
-	if ( !m_file ) return;
-	if ( !(m_mode&std::ios::out) ) {
-	    std::cerr << "HepMC::IO_Ascii::write_particle_data_table "
-		      << " attempt to write to input file." << std::endl;
-	    return;
-	}
-	// write end of event listing key if events have already been written
-	write_end_listing();
-	//
-	m_file << "\n" << "HepMC::IO_Ascii-START_PARTICLE_DATA\n";
-        for ( ParticleDataTable::const_iterator pd = pdt->begin(); 
-	      pd != pdt->end(); pd++ ) {
-	    write_particle_data( pd->second );
-        }
-	m_file << "HepMC::IO_Ascii-END_PARTICLE_DATA\n" << std::flush;
-    }
-
-    bool IO_Ascii::fill_particle_data_table( ParticleDataTable* pdt ) {
-	//
-	// test that pdt pointer is not null
-	if ( !pdt ) {
-	    std::cerr 
-		<< "IO_Ascii::fill_particle_data_table - passed null table." 
-		<< std::endl;
-	    return false;
-	}
-	//
-	// check the state of m_file is good, and that it is in input mode
-	if ( !m_file ) return false;
-	if ( !m_mode&std::ios::in ) {
-	    std::cerr << "HepMC::IO_Ascii::fill_particle_data_table "
-		      << " attempt to read from output file." << std::endl;
-	    return false;
-	}
-	// position to beginning of file
-	int initial_file_position = m_file.tellg();
-	std::ios::iostate initial_state = m_file.rdstate();
-	m_file.seekg( 0 );
-	// skip through the file just after first occurence of the start_key
-	int iotype;
-	iotype = m_common_io.find_file_type(m_file);
-	if( iotype != ascii_pdt ) {
-	    m_file.seekg( initial_file_position );
-	    std::cerr << "IO_Ascii::fill_particle_data_table start key not  "
-		      << "found setting badbit." << std::endl;
-	    m_file.clear(std::ios::badbit); 
-	    return false;
-	}
-	//
-	pdt->set_description("Read with IO_Ascii");
-	m_common_io.read_io_particle_data_table( &m_file, pdt );
-	//
-	// check for the end event listing key
-	iotype =  m_common_io.find_end_key(m_file);
-	if( iotype != ascii_pdt ) {
-	    std::cerr << "IO_Ascii::fill_particle_data_table end key not  "
-		      << "found setting badbit." << std::endl;
-	    m_file.clear(std::ios::badbit);
-	}
-	// put the file back into its original state and position
-	m_file.clear( initial_state );
-	m_file.seekg( initial_file_position );
-	return true;
-    }
-
-    void IO_Ascii::write_vertex( GenVertex* v ) {
-	// assumes mode has already been checked
-	if ( !v || !m_file ) {
-	    std::cerr << "IO_Ascii::write_vertex !v||!m_file, "
-		      << "v="<< v << " setting badbit" << std::endl;
-	    m_file.clear(std::ios::badbit); 
-	    return;
-	}
-	// First collect info we need
-	// count the number of orphan particles going into v
-	int num_orphans_in = 0;
-	for ( GenVertex::particles_in_const_iterator p1
-		  = v->particles_in_const_begin();
-	      p1 != v->particles_in_const_end(); ++p1 ) {
-	    if ( !(*p1)->production_vertex() ) ++num_orphans_in;
-	}
-	//
-	m_file << 'V';
-	output( v->barcode() ); // v's unique identifier
-	output( v->id() );
-	output( v->position().x() );
-	output( v->position().y() );
-	output( v->position().z() );
-	output( v->position().t() );
-	output( num_orphans_in );
-	output( (int)v->particles_out_size() );
-	output( (int)v->weights().size() );
-	for ( WeightContainer::iterator w = v->weights().begin(); 
-	      w != v->weights().end(); ++w ) {
-	    output( *w );
-	}
-	output('\n');
-	for ( GenVertex::particles_in_const_iterator p2 
-		  = v->particles_in_const_begin();
-	      p2 != v->particles_in_const_end(); ++p2 ) {
-	    if ( !(*p2)->production_vertex() ) {
-		write_particle( *p2 );
-	    }
-	}
-	for ( GenVertex::particles_out_const_iterator p3 
-		  = v->particles_out_const_begin();
-	      p3 != v->particles_out_const_end(); ++p3 ) {
-	    write_particle( *p3 );
-	}
-    }
-
-    void IO_Ascii::write_particle( GenParticle* p ) {
-	// assumes mode has already been checked
-	if ( !p || !m_file ) {
-	    std::cerr << "IO_Ascii::write_particle !p||!m_file, "
-		      << "p="<< p << " setting badbit" << std::endl;
-	    m_file.clear(std::ios::badbit); 
-	    return;
-	}
-	m_file << 'P';
-	output( p->barcode() );
-	output( p->pdg_id() );
-	output( p->momentum().px() );
-	output( p->momentum().py() );
-	output( p->momentum().pz() );
-	output( p->momentum().e() );
-	output( p->status() );
-	output( p->polarization().theta() );
-	output( p->polarization().phi() );
-	// since end_vertex is oftentimes null, this CREATES a null vertex
-	// in the map
-	output(   ( p->end_vertex() ? p->end_vertex()->barcode() : 0 )  );
-	m_file << ' ' << p->flow() << "\n";
-    }
-
-    void IO_Ascii::write_particle_data( const ParticleData* pdata ) {
-	// assumes mode has already been checked
-	if ( !pdata || !m_file ) {
-	    std::cerr << "IO_Ascii::write_vertex !pdata||!m_file, "
-		      << "pdata="<< pdata << " setting badbit" << std::endl;
-	    m_file.clear(std::ios::badbit); 
-	    return;
-	}
-	m_file << 'D';
-	output( pdata->pdg_id() );
-	output( pdata->charge() );
-	output( pdata->mass() );
-	output( pdata->clifetime() );
-	output( (int)(pdata->spin()*2.+.1) );
-	// writes the first 21 characters starting with 0
-	m_file << " " << pdata->name().substr(0,21) << "\n";
-    }
-
-    bool IO_Ascii::write_end_listing() {
-    	if ( m_finished_first_event_io && m_mode&std::ios::out ) {
-	    m_common_io.write_IO_Ascii_End(m_file);
-	    m_file << std::flush;
-	    m_finished_first_event_io = 0;
-	    return true;
-	}
-	return false;
-    }
-	
-} // HepMC
-
Index: trunk/Utilities/HepMC/src/IO_PDG_ParticleDataTable.cc
===================================================================
--- trunk/Utilities/HepMC/src/IO_PDG_ParticleDataTable.cc	(revision 571)
+++ 	(revision )
@@ -1,236 +1,0 @@
-//--------------------------------------------------------------------------
-
-//////////////////////////////////////////////////////////////////////////
-// Matt.Dobbs@Cern.CH, January 2000
-// Reads a particle data table from file supplied in PDG format
-// For the most recent table see: http://pdg.lbl.gov/computer_read.html
-//////////////////////////////////////////////////////////////////////////
-
-#include <ctype.h>      // for isspace() etc.
-#include <string>
-#include <vector>
-#include <cstdlib>      // needed for abort()
-#include <cstring>	// for strlen()
-#include "IO_PDG_ParticleDataTable.h"
-
-namespace HepMC {
-
-    IO_PDG_ParticleDataTable::IO_PDG_ParticleDataTable( const char* filename ) 
-        : m_filename(filename), m_file(filename) {
-        std::cout << "-------------------------------------------------------" << std::endl;
-        std::cout << "Use of HepMC/IO_PDG_ParticleDataTable is deprecated" << std::endl;
-        std::cout << "Use of HepMC/ParticleDataTable is deprecated" << std::endl;
-        std::cout << "-------------------------------------------------------" << std::endl;
-    }
-    
-    IO_PDG_ParticleDataTable::~IO_PDG_ParticleDataTable() {
-	m_file.close();
-    }
-
-    bool IO_PDG_ParticleDataTable::fill_particle_data_table( 
-	ParticleDataTable* pdt) 
-    {
-	//
-	// test that pdt pointer is not null
-	if ( !pdt ) {
-	    std::cerr 
-		<< "IO_Ascii::fill_particle_data_table - passed null table." 
-		<< std::endl;
-	    return false;
-	}
-	//
-	// test the file is good and advance to keyword
-        if (!m_file ) {
-	  // return false;
-	  std::cerr << "IO_PDG_ParticleDataTable::fill_particle_data_table "
-		    << " ERROR, file " << m_filename << " does not exist, "
-		    << " ABORT." << std::endl;
-	  abort();
-	}	
-	m_file.seekg( 0 );
-	if ( !search_for_key_end(m_file,"\nM") ) {
-	    std::cerr << "IO_PDG_ParticleDataTable: "
-		      << "Error advancing to first entry." 
-		      << std::endl;
-	    return false;
-	}
-	// set description
-	std::string description = "Read from " + m_filename 
-				  + " by IO_PDG_ParticleDataTable";
-	pdt->set_description( description );
-	m_file.putback('M');
-	// read in each entry one by one
-	while ( m_file.rdstate() == 0 ) {
-	    read_entry( pdt );
-	}
-	return true;
-    }
-
-    void IO_PDG_ParticleDataTable::read_entry( ParticleDataTable* pdt ) {
-	int position = m_file.tellg();
-	// variables for input
-	char code;
-	int id[4] = { 0,0,0,0 };
-	int charge[4] = { 999, 999, 999, 999 };
-	double value;
-	std::string name;
-
-	code = m_file.get();
-	if ( code == EOF ) {
-	    m_file.clear( std::ios::eofbit );
-	    return;
-	}
-
-	if ( code == '\n' ) return; // ignore empty lines.
-
-	if ( code!='M' && code!='W' ) {
-	    std::cerr << "IO_PDG_ParticleDataTable::read_entry cannot "
-		      << "understand syntax, setting badbit."
-		      << std::endl;
-	    m_file.putback( code );
-	    m_file.clear( std::ios::badbit ); 
-            return;
-        } 
-	// read the particle ID's -- here I assume there is atleast one
-	// white space b/t the 4 id columns.
-	for ( int id_i1 = 0; id_i1 < 4; ++id_i1 ) {
-	    m_file.seekg( position+1+(id_i1*8) );
-	    for ( int i = 0; i < 8; ++i ) {
-		if ( !isspace(m_file.peek()) ) {
-		    //m_file.width(8-i); // has no effect
-		    // how do I limit to reading only 8-i characters?
-		    // setw(8-i) has no effect either.
-		    m_file >> id[id_i1];
-		    break;
-		}
-		m_file.ignore(); 
-	    }
-	}
-	//m_file.width(0);
-	m_file.seekg(position+33);
-	m_file >> value;
-	m_file.seekg(position+66);
-	m_file >> name;
-	// loop over all remaining columns of the name section, where the 
-	// charge is stored --- until \n is reached
-	// Here I assume there is atleast one white space between the name
-	// and the charge. This is true for the 1998 PDG table, and I expect
-	// it will always be true.
-	int id_i2 = 0;
-	while ( m_file.rdstate() == 0 ) {
-	    char c = m_file.get();
-	    if ( c == '\n' || c == EOF ) break;
-	    if ( isspace(c) || c==',' ) {
-	    } else if ( c=='-' ) { 
-		charge[id_i2] = -1; 
-		++id_i2; 
-	    } else if ( c=='0' ) {
-		charge[id_i2] = 0;
-		++id_i2; 
-	    } else if ( c=='+' ) {
-		charge[id_i2] = 1;
-		if ( m_file.peek() == '+' ) {
-		    charge[id_i2] = 2;
-		    m_file.ignore();
-		}
-		++id_i2;
-	    }
-	}
-	// add the new information to the particle data table.
-	for ( int id_i3 = 0; id_i3 < 4; ++id_i3 ) {
-	    if ( id[id_i3] == 0 ) continue;
-	    std::string scharge;
-	    if ( charge[id_i3] == -1 ) { 
-		scharge = "-";
-	    } else if ( charge[id_i3] == 1 ) { 
-		scharge = "+";
-	    } else if ( charge[id_i3] == 2 ) { 
-		scharge = "++"; 
-	    }
-	    ParticleData* pdata = pdt->find( id[id_i3] );
-	    if ( pdata ) {
-		if ( code == 'M' ) {
-		    pdata->set_mass( value );
-		} else if ( code == 'W' ) {
-		    pdata->set_clifetime( clifetime_from_width(value) );
-		}
-	    } else if ( code == 'M' ) {
-		pdata = new ParticleData( name+scharge, 
-					  id[id_i3], (double)charge[id_i3], 
-					  value );
-		pdt->insert(pdata);
-	    } else if ( code == 'W' ) {
-		pdata = new ParticleData( name+scharge, 
-					  id[id_i3], (double)charge[id_i3],
-					  0, clifetime_from_width(value) );
-		pdt->insert(pdata);
-	    }
-	}
-    }
-
-    void IO_PDG_ParticleDataTable::add_quarks_to_table( 
-	ParticleDataTable& pdt ) {
-	/// since quarks aren't included in PDG table, this method adds them
-	// in
-	std::vector<std::string> name(6);
-	name[0] = "d";
-	name[1] = "u";
-	name[2] = "s";
-	name[3] = "c";
-	name[4] = "b";
-	name[5] = "t";
-	int id[6] = { 1, 2, 3, 4, 5, 6 };
-	double charge[6] = { -1./3., 2./3., -1./3., 2./3., -1./3., 2./3. };
-	// take central values from PDG July 1998 for masses
-	double mass[6] = { 0.006, 0.00325, 0.115, 1.25, 4.25, 173.8 };
-	for ( int i = 0; i<6; ++i ) {
-	    // build the particle
-	    ParticleData* pdata = pdt.find(id[i]);
-	    if ( pdata ) {
-		mass[i] = pdata->mass();
-		pdt.erase(pdata);
-		delete pdata;
-	    }
-	    pdata = new ParticleData( name[i], id[i], charge[i], mass[i], -1.,
-				      .5 );
-	    pdt.insert(pdata);
-	    // build the antiparticle
-	    pdata = pdt.find(-1*id[i]);
-	    if ( pdata ) {
-		pdt.erase(pdata);
-		delete pdata;
-	    }
-	    pdata = new ParticleData( name[i]+"~", -1*id[i], -1*charge[i], 
-				      mass[i], -1., .5 );
-	    pdt.insert(pdata);
-	}
-    }
-
-    bool IO_PDG_ParticleDataTable::search_for_key_end( std::istream& in, 
-						       const char* key ) {
-	/// (this method borrowed from IO_Ascii class)
-        /// reads characters from in until the string of characters matching
-        /// key is found (success) or EOF is reached (failure).
-        /// It stops immediately thereafter. Returns T/F for success/fail
-        // 
-        char c[1];
-        unsigned int index = 0;
-        while ( in.get(c[0]) ) {
-            if ( c[0] == key[index] ) { 
-                ++index;
-            } else { index = 0; }
-            if ( index == strlen(key) ) return true;
-        }
-        return false;
-    }
-
-} // HepMC
-
-
-
-
-
-
-
-
-
Index: trunk/Utilities/HepMC/src/ParticleData.cc
===================================================================
--- trunk/Utilities/HepMC/src/ParticleData.cc	(revision 571)
+++ 	(revision )
@@ -1,126 +1,0 @@
-//////////////////////////////////////////////////////////////////////////
-// Matt.Dobbs@Cern.CH, September 1999
-//
-// particle properties common to all particles of a given PDG id
-//////////////////////////////////////////////////////////////////////////
-
-#include "ParticleData.h"
-#include <cstdio>       // needed for formatted output using sprintf 
-
-namespace HepMC {
-
-    ParticleData::ParticleData( std::string name, int id, double charge, 
-				double mass, double clifetime, double spin ) :
-	m_name(name), m_pdg_id(id), m_mass(mass), m_clifetime(clifetime)
-    {
-	/// Units ID: defined by PDG group (particles are +ve, antipart are -ve)
-	///              also consistent with the Pythia definitions
-	///       charge: fraction of proton charge
-	///       mass
-	///       cLifetime: c*time
-	/// Default mass=0 and cLifetime is -1 which means stable (width= 0.)
-	/// These defaults exist because many very basic MC generators
-	///   may produce only massless stable particles in the event record.
-	//
-	set_charge(charge);
-	set_spin(spin);
-        s_counter++;
-    }
-
-    ParticleData::ParticleData( const char* name, int id, double charge, 
-				double mass, double clifetime, double spin ):
-	m_name(name), m_pdg_id(id), m_mass(mass), m_clifetime(clifetime)
-    {
-	/// note, this constructor is redundant to the one above, 
-	/// i.e. one could use: 
-	/// new HepMC::ParticleData(string("electron"),11,-1,0.000511,-1,.5);
-	/// but we keep it because it is convenient.
-	//
-	set_charge(charge);
-	set_spin(spin);	
-        s_counter++;
-    }
-
-    ParticleData::~ParticleData() {
-	s_counter--;
-    }
-
-    void ParticleData::print( std::ostream& ostr ) const {
-	ostr << "ParticleData: " << name() << "\t"
-	     << " ID[pdg]:" << pdg_id()
-	     << " Charge[e+]:" << charge()
-	     << " Mass:" << mass()
-	     << " Tau:" << clifetime()
-	     << " J:" << spin() << std::endl;
-    }
-
-    ////////////////////
-    // access methods //
-    ////////////////////
-
-    int ParticleData::model_independent_pdg_id_() const { 
-	/// returns the particle id with the seventh
-	/// digit removed for susy/excited/technicolor particles.
-	/// Thus en excited electron (40000011) would be returned as 11
-	/// Useful only internally for sorting particles!
-	int id = m_pdg_id;
-	if ( id/1000000 >=1 && id/1000000 <= 4 ) id %= 1000000;
-	return id;
-    }
-
-    double ParticleData::width() const { 
-	double width;
-	if ( m_clifetime > 0 ) { 
-	    width = HepMC_hbarc/m_clifetime;
-	} else if ( m_clifetime == 0 ) { 
-	    width = -1;
-	} else { 
-	    width = 0; 
-	}
-	return width;
-    }
-
-    /////////////
-    // Static  //
-    /////////////
-    unsigned int ParticleData::counter() { return s_counter; }
-    unsigned int ParticleData::s_counter = 0; 
-
-    /////////////
-    // Friends //
-    /////////////
-
-    /// write to ostr
-    std::ostream& operator<<( std::ostream& ostr, const ParticleData& pdata ) {
-	char outline[80];
-	sprintf( outline,"%+9d%21s%+6.2f%19.11e%19.11e%5.1f",
-		 pdata.pdg_id(),
-		 pdata.name().substr(0,21).c_str(),
-		 pdata.charge(),
-		 pdata.mass(),
-		 pdata.clifetime(),
-		 pdata.spin() );
-	return ostr << outline;
-    }
-
-    //////////////////////
-    // Related Methods  //
-    //////////////////////
-
-    double clifetime_from_width( double width ) {
-	/// if you want to instantiate the particle lifetime from its width,
-	/// use this static method inside the constructor:
-	// i.e. new ParticleData(
-	if ( width > 0 ) return HepMC_hbarc/width;
-	if ( width == 0. ) return -1.;
-	return 0.;
-    }
-    
-} // HepMC
-
-
-
-
-
-
-
Index: trunk/Utilities/HepMC/src/Units.cc
===================================================================
--- trunk/Utilities/HepMC/src/Units.cc	(revision 571)
+++ 	(revision )
@@ -1,64 +1,0 @@
-//--------------------------------------------------------------------------
-// Units.cc
-// Author:  A. Buckley, D. Grellscheid
-//
-// units used by a GenEvent
-// The default units are set here at compile time.
-//--------------------------------------------------------------------------
-
-#include "Units.h"
-
-namespace HepMC {
-
-  namespace Units {
-
-   // helper functions
-    std::string name(MomentumUnit m) {
-      switch (m) {
-        case MEV : return "MEV";
-        case GEV : return "GEV";
- 	default  : return "badValue";
-      } 
-    }
-
-    std::string name(LengthUnit l) {
-      switch (l) {
-        case MM : return "MM";
-        case CM : return "CM";
-  	default : return "badValue";
-     } 
-    }
-
-    double conversion_factor(MomentumUnit from, MomentumUnit to) 
-    {
-      if ( from == to )
-	return 1.0;
-      else if ( from == MEV && to == GEV )
-	return 0.001;
-      else
-	return 1000.0;
-    }
-
-    double conversion_factor(LengthUnit from, LengthUnit to) 
-    {
-      if ( from == to )
-	return 1.0;
-      else if ( from == MM && to == CM )
-	return 0.1;
-      else
-	return 10.0;
-    }
-
-    // if this function fails to compile, rerun configure using --with-length_units
-    LengthUnit default_length_unit() {
-      return MM ;
-    }
-
-    // if this function fails to compile, rerun configure using --with-momentum_units
-    MomentumUnit default_momentum_unit() {
-      return GEV ;
-    }
-
-  }	// Units
-
-}	// HepMC
