Index: /trunk/Utilities/HepMC/VERSION
===================================================================
--- /trunk/Utilities/HepMC/VERSION	(revision 573)
+++ /trunk/Utilities/HepMC/VERSION	(revision 574)
@@ -1,1 +1,1 @@
-2.04.01
+2.06.05
Index: unk/Utilities/HepMC/interface/CommonIO.h
===================================================================
--- /trunk/Utilities/HepMC/interface/CommonIO.h	(revision 573)
+++ 	(revision )
@@ -1,147 +1,0 @@
-#ifndef HEPMC_COMMON_IO_H
-#define HEPMC_COMMON_IO_H
-// ----------------------------------------------------------------------
-//
-// CommonIO.h
-// Author:  Lynn Garren
-//
-//  Allowed keys used at the beginning and end of HepMC data dumps
-//
-// ----------------------------------------------------------------------
-
-#include <fstream>
-#include <string>
-
-#include "GenEvent.h"
-#include "TempParticleMap.h"
-#include "ParticleDataTable.h"
-
-namespace HepMC {
-
-/// The known_io enum is used to track which type of input is being read
-enum known_io { gen=1, ascii, extascii, ascii_pdt, extascii_pdt };
-
-class CommonIO {
-
-public:
-
-  CommonIO();
-  ~CommonIO() {;}
-
-  // input keys - IO_GenEvent is strongly recommended
-  std::string IO_GenEvent_Key()          const { return m_io_genevent_start; }
-  std::string IO_GenEvent_End()          const { return m_io_genevent_end; }
-  // IO_Ascii is deprecated, but we want to be able to read these files
-  std::string IO_Ascii_Key()             const { return m_io_ascii_start; }
-  std::string IO_Ascii_End()             const { return m_io_ascii_end; }
-  // IO_ExtendedAscii has been removed, but we want to be able to read these files
-  std::string IO_ExtendedAscii_Key()     const { return m_io_extendedascii_start; }
-  std::string IO_ExtendedAscii_End()     const { return m_io_extendedascii_end; }
-  /// get IO type
-  int io_type() const { return m_io_type; }
-
-  // write keys
-  void write_IO_GenEvent_Key( std::ostream& );
-  void write_IO_GenEvent_End( std::ostream& );
-  // write keys for deprecated IO methods
-  void write_IO_Ascii_Key( std::ostream& );
-  void write_IO_Ascii_End( std::ostream& );
-  // write keys for deprecated particle data IO methods
-  void write_IO_Ascii_PDT_Key( std::ostream& );
-  void write_IO_Ascii_PDT_End( std::ostream& );
-
-  // methods to read input
-
-  /// look for line type (key)
-  int find_file_type( std::istream& );
-
-  /// look for line type (key)
-  int find_end_key( std::istream& );
-
-  bool read_io_ascii( std::istream* is, GenEvent* evt );
-
-  bool read_io_extendedascii( std::istream* is, GenEvent* evt );
-
-  bool read_io_genevent( std::istream* is, GenEvent* evt );
-
-  bool read_units( std::istream* is, GenEvent* evt );
-
-  /// needed when reading a file without units if those units are 
-  /// different than the declared default units 
-  /// (e.g., the default units are MeV, but the file was written with GeV)
-  /// This method is not necessary if the units are written in the file
-  void use_input_units( Units::MomentumUnit, Units::LengthUnit );
-
-  /// ParticleDataTable is deprecated.
-  /// We include this method for reading old files which may have ParticleData information.
-  bool read_io_particle_data_table( std::istream*, ParticleDataTable* );
- 
-protected:
-  // methods used by the read_io* methods
-  HeavyIon*    read_heavy_ion( std::istream* );
-  PdfInfo*     read_pdf_info( std::istream* );
-  GenParticle* read_particle( std::istream*, TempParticleMap&  );
-  GenVertex*   read_vertex( std::istream*, TempParticleMap&  );
-  /// ParticleDataTable is deprecated.
-  /// We include this method for reading old files which may have ParticleData information.
-  ParticleData* read_particle_data( std::istream*, ParticleDataTable* );
-
-private:
-  std::string m_io_genevent_start;
-  std::string m_io_ascii_start;
-  std::string m_io_extendedascii_start;
-  std::string m_io_genevent_end;
-  std::string m_io_ascii_end;
-  std::string m_io_extendedascii_end;
-  // particle data method keys
-  std::string m_io_ascii_pdt_start;
-  std::string m_io_extendedascii_pdt_start;
-  std::string m_io_ascii_pdt_end;
-  std::string m_io_extendedascii_pdt_end;
-  // io type
-  int         m_io_type;
-  // default io units - used only when reading a file with no units
-  Units::MomentumUnit m_io_momentum_unit;
-  Units::LengthUnit   m_io_position_unit;
-
-};
-
-// inline methods
-
-inline CommonIO::CommonIO()
-: m_io_genevent_start("HepMC::IO_GenEvent-START_EVENT_LISTING"),
-  m_io_ascii_start("HepMC::IO_Ascii-START_EVENT_LISTING"),
-  m_io_extendedascii_start("HepMC::IO_ExtendedAscii-START_EVENT_LISTING"),
-  m_io_genevent_end("HepMC::IO_GenEvent-END_EVENT_LISTING"),
-  m_io_ascii_end("HepMC::IO_Ascii-END_EVENT_LISTING"),
-  m_io_extendedascii_end("HepMC::IO_ExtendedAscii-END_EVENT_LISTING"),
-  m_io_ascii_pdt_start("HepMC::IO_Ascii-START_PARTICLE_DATA"),
-  m_io_extendedascii_pdt_start("HepMC::IO_ExtendedAscii-START_PARTICLE_DATA"),
-  m_io_ascii_pdt_end("HepMC::IO_Ascii-END_PARTICLE_DATA"),
-  m_io_extendedascii_pdt_end("HepMC::IO_ExtendedAscii-END_PARTICLE_DATA"),
-  m_io_type(0),
-  m_io_momentum_unit(Units::default_momentum_unit()),
-  m_io_position_unit(Units::default_length_unit())
-  {}
-
-inline void CommonIO::write_IO_GenEvent_Key( std::ostream& os )
-{ os << m_io_genevent_start << "\n"; }
-
-inline void CommonIO::write_IO_GenEvent_End( std::ostream& os )
-{ os << m_io_genevent_end << "\n"; }
-
-inline void CommonIO::write_IO_Ascii_Key( std::ostream& os )
-{ os << m_io_ascii_start << "\n"; }
-
-inline void CommonIO::write_IO_Ascii_End( std::ostream& os )
-{ os << m_io_ascii_end << "\n"; }
-
-inline void CommonIO::write_IO_Ascii_PDT_Key( std::ostream& os )
-{ os << m_io_ascii_pdt_start << "\n"; }
-
-inline void CommonIO::write_IO_Ascii_PDT_End( std::ostream& os )
-{ os << m_io_ascii_pdt_end << "\n"; }
-
-} // HepMC
-
-#endif // HEPMC_COMMON_IO_H
Index: unk/Utilities/HepMC/interface/IO_Ascii.h
===================================================================
--- /trunk/Utilities/HepMC/interface/IO_Ascii.h	(revision 573)
+++ 	(revision )
@@ -1,134 +1,0 @@
-//--------------------------------------------------------------------------
-#ifndef HEPMC_IO_ASCII_H
-#define HEPMC_IO_ASCII_H
-
-//////////////////////////////////////////////////////////////////////////
-// Matt.Dobbs@Cern.CH, January 2000, refer to:
-// M. Dobbs and J.B. Hansen, "The HepMC C++ Monte Carlo Event Record for
-// High Energy Physics", Computer Physics Communications (to be published).
-//
-// event input/output in ascii format for machine reading
-//////////////////////////////////////////////////////////////////////////
-//
-// Strategy for reading or writing events/particleData as machine readable
-//  ascii to a file. When instantiating, the mode of file to be created 
-//  must be specified. Options are:
-//      std::ios::in     open file for input 
-//      std::ios::out    open file for output
-//      std::ios::trunc  erase old file when opening (i.e. ios::out|ios::trunc
-//                    removes oldfile, and creates a new one for output )
-//      std::ios::app    append output to end of file
-//  for the purposes of this class, simultaneous input and output mode 
-//  ( std::ios::in | std::ios::out ) is not allowed.
-// 
-// Event listings are preceded by the key:
-//  "HepMC::IO_Ascii-START_EVENT_LISTING\n"
-//  and terminated by the key:
-//  "HepMC::IO_Ascii-END_EVENT_LISTING\n"
-// GenParticle Data tables are preceded by the key:
-//  "HepMC::IO_Ascii-START_PARTICLE_DATA\n"
-//  and terminated by the key:
-//  "HepMC::IO_Ascii-END_PARTICLE_DATA\n"
-// Comments are allowed. They need not be preceded by anything, though if
-//  a comment is written using write_comment( const string ) then it will be
-//  preceded by "HepMC::IO_Ascii-COMMENT\n"
-// Each event, vertex, particle, particle data is preceded by 
-//  "E ","V ","P ","D "    respectively.
-// Comments may appear anywhere in the file -- so long as they do not contain
-//  any of the 4 start/stop keys.
-//
-
-#include <fstream>
-#include <string>
-#include <map>
-#include <vector>
-#include "IO_BaseClass.h"
-#include "TempParticleMap.h"
-#include "CommonIO.h"
-
-namespace HepMC {
-
-    class GenEvent;
-    class GenVertex;
-    class GenParticle;
-    class ParticleData;
-
-    //! IO_Ascii is used to read or write from an ascii file
-
-    ///
-    /// \class  IO_Ascii
-    /// Strategy for reading or writing events/particleData as machine readable
-    ///  ascii to a file. When instantiating, the mode of file to be created 
-    ///  must be specified. 
-    ///
-    class IO_Ascii : public IO_BaseClass {
-    public:
-        /// constructor requiring a file name and std::ios mode
-	IO_Ascii( const char* filename="IO_Ascii.dat", 
-		  std::ios::openmode mode=std::ios::out );
-	virtual       ~IO_Ascii();
-
-        /// write this event
-	void          write_event( const GenEvent* evt );
-        /// get the next event
-	bool          fill_next_event( GenEvent* evt );
-	void          write_particle_data_table(const ParticleDataTable*);
-	bool          fill_particle_data_table( ParticleDataTable* );
-	/// insert a comment directly into the output file --- normally you
-	///  only want to do this at the beginning or end of the file. All
-	///  comments are preceded with "HepMC::IO_Ascii-COMMENT\n"
-  	void          write_comment( const std::string comment );
-
-	int           rdstate() const;  //!< check the state of the IO stream
-	void          clear();  //!< clear the IO stream
-
-        /// write to ostr
-	void          print( std::ostream& ostr = std::cout ) const;
-
-    protected: // for internal use only
-	/// write vertex information
-	void          write_vertex( GenVertex* );
-	/// write particle information
-	void          write_particle( GenParticle* p );
-	/// write ParticleDataTable information
-	void          write_particle_data( const ParticleData* d );
-	/// write end tag
-	bool          write_end_listing();
-
-	void          output( const double& );  //!< write double
-	void          output( const int& );  //!< write int
-	void          output( const long int& );  //!< write long int
-	void          output( const char& );  //!< write a single character
-    private: // use of copy constructor is not allowed
-	IO_Ascii( const IO_Ascii& ) : IO_BaseClass() {}
-    private: // data members
-	std::ios::openmode  m_mode;
-	std::fstream        m_file;
-	bool                m_finished_first_event_io;
-	CommonIO            m_common_io;
-    };
-
-    //////////////
-    // Inlines  //
-    //////////////
-
-    inline void IO_Ascii::output( const double& d ) {
-	if ( d == 0. ) {
-	    m_file << ' ' << (int)0;
-	} else {
-	    m_file << ' ' << d;
-	}
-    }
-    inline void IO_Ascii::output( const int& i ) { m_file << ' ' << i; }
-    inline void IO_Ascii::output( const long int& i ) { m_file << ' ' << i; }
-    inline void IO_Ascii::output( const char& c ) { m_file << c; }
-    inline int  IO_Ascii::rdstate() const { return (int)m_file.rdstate(); }
-    inline void IO_Ascii::clear() { m_file.clear(); }
-
-} // HepMC
-
-#endif  // HEPMC_IO_ASCII_H
-//--------------------------------------------------------------------------
-
-
-
Index: unk/Utilities/HepMC/interface/IO_PDG_ParticleDataTable.h
===================================================================
--- /trunk/Utilities/HepMC/interface/IO_PDG_ParticleDataTable.h	(revision 573)
+++ 	(revision )
@@ -1,104 +1,0 @@
-//--------------------------------------------------------------------------
-#ifndef HEPMC_IO_PDG_PARTICLEDATATABLE_H
-#define HEPMC_IO_PDG_PARTICLEDATATABLE_H
-
-//////////////////////////////////////////////////////////////////////////
-// Matt.Dobbs@Cern.CH, November 1999, refer to:
-// M. Dobbs and J.B. Hansen, "The HepMC C++ Monte Carlo Event Record for
-// High Energy Physics", Computer Physics Communications (to be published).
-//
-// Reads a particle data table from file supplied in PDG format
-// For the most recent table see: http://pdg.lbl.gov/computer_read.html
-//////////////////////////////////////////////////////////////////////////
-//
-// Example of reading from file PDG98_ParticleDataTable.txt
-//
-//	IO_PDG_ParticleDataTable pdg_io("PDG98_ParticleDataTable.txt");
-// 	ParticleDataTable pdt = *pdg_io.read_particle_data_table();
-//      (note the read_particle_data_table method comes from the IO_Baseclass)
-//  or
-//	IO_PDG_ParticleDataTable pdg_io("PDG98_ParticleDataTable.txt");
-// 	ParticleDataTable* pdt;
-//      pdg_io >> pdt;       
-//  in both cases IO_PDG_ParticleDataTable creates an instance of the 
-//  ParticleDataTable which the user becomes owner of (i.e. user is 
-//  responsible for deleting)
-//
-// Note the PDG table does not include antiparticles nor quarks (except top)
-// You can make anti-particle entries corresponding to each charged entry with
-// the method make_antiparticles_from_particles() and you can make default
-// entries for the 6 quarks + anti-quarks with the method add_quarks_to_table()
-// Continuing with the above example:
-//      pdt->make_antiparticles_from_particles();
-//      pdg_io.add_quarks_to_table( *pdt );
-//
-
-#include "IO_BaseClass.h"
-#include <fstream>
-
-namespace HepMC {
-
-    class GenEvent;
-
-    //! an example ParticleDataTable IO method
-    
-    ///
-    /// \class IO_PDG_ParticleDataTable
-    /// Example of reading from file PDG98_ParticleDataTable.txt
-    ///
-    class IO_PDG_ParticleDataTable : public IO_BaseClass {
-    public:
-        /// constructor using filename
-	IO_PDG_ParticleDataTable( const char* filename
-				  ="PDG98_ParticleDataTable.txt" );
-	virtual ~IO_PDG_ParticleDataTable();
-	/// read the input and fill the table
-	bool    fill_particle_data_table( ParticleDataTable* );
-	/// add u, d, s, c, b, and t
-	void    add_quarks_to_table( ParticleDataTable& );
-	/// write to ostr
-	void    print( std::ostream& ostr = std::cout ) const;
-
-        /// check the IO state
-	int     rdstate() const { return (int)m_file.rdstate(); }
-    protected: // for internal use only
-        /// for internal use
-	bool search_for_key_end( std::istream& in, const char* key );
-	/// read a line
-	void read_entry( ParticleDataTable* );
-    private: // following are not implemented
-	void write_event( const GenEvent* ){}
-	bool fill_next_event( GenEvent* ){ return false; }
-	void write_particle_data_table( const ParticleDataTable* ){}
-    private: // use of copy constructor is not allowed
-	IO_PDG_ParticleDataTable( const IO_PDG_ParticleDataTable& ) : 
-	    IO_BaseClass() {}
-    private: // member data
-	std::string   m_filename;
-	std::ifstream m_file;
-    };
-
-    //////////////
-    // Inlines  //
-    //////////////
-
-    inline void IO_PDG_ParticleDataTable::print( std::ostream& ostr ) const { 
-	ostr << "IO_PDG_ParticleDataTable: for computer readable PDG tables.\n"
-             << " 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;
-    }
-
-} // HepMC
-
-#endif  // HEPMC_IO_BASECLASS_H
-//--------------------------------------------------------------------------
-
-
-
-
-
-
-
Index: unk/Utilities/HepMC/interface/ParticleData.h
===================================================================
--- /trunk/Utilities/HepMC/interface/ParticleData.h	(revision 573)
+++ 	(revision )
@@ -1,233 +1,0 @@
-//--------------------------------------------------------------------------
-#ifndef HEPMC_PARTICLE_DATA_H
-#define HEPMC_PARTICLE_DATA_H
-
-//////////////////////////////////////////////////////////////////////////
-// Matt.Dobbs@Cern.CH, September 1999, refer to:
-// M. Dobbs and J.B. Hansen, "The HepMC C++ Monte Carlo Event Record for
-// High Energy Physics", Computer Physics Communications (to be published).
-//
-// GenParticle Data common to all particles of a given PDG id
-//////////////////////////////////////////////////////////////////////////
-//
-// Units  ID: defined by PDG group (particles are +ve, antiparticles are -ve) 
-//              also consistent with the Pythia definitions
-//              See: http://d0lblt.lbl.gov/wwwpdg/mc_numbers.htm
-//        charge: fraction of proton charge
-//        mass in user defined energy units
-//        width:  ( stored as cLifetime = hbar / Width )
-//        cLifetime: c*time
-//        spin: fraction of photon spin (always a positive number)
-//
-// Default mass is 0.
-// Default cLifetime is -1 which means stable (setting width = 0 gives this)
-//     (we define cLifetime = -1 --> width = 0 (i.e stable), 
-//                    width = -1 --> cLifetime = 0 (i.e. prompt)  )
-// These defaults exist because many very basic MC generators
-//     may produce only massless stable particles in the event record.
-//
-// It is intended that a different ParticleData object is created for each 
-//     particle and its anti-particle - useful for CP violation studies.
-//
-// There are few set methods for this class, there should be no reason
-//     to change anything after instantiating. If you need to, then
-//     create a new object and kill the old one.
-//
-// Example: 
-//  HepMC::ParticleData* pd_electron = 
-//                    new HepMC::ParticleData("electron",11,-1,0.000511,-1,.5);
-// A method is provided to allow you to set the lifetime from the
-//     width in the constructor
-// Example: new HepMC::ParticleData("W+",24,+1,80.396,
-//                                  HepMC::clifetime_from_width(2.06),1);
-// Example of finding a ParticleData object from its PDG ID 
-// in ParticleDataTable pdt:
-//        HepMC::ParticleData* electron = pdt.find(11);
-// or if you just wanted two know the electron mass, you could do:
-//        pdt.find(11)->mass();
-
-#include <iostream>
-#include <string>
-#include <stdlib.h>	// for integer abs()
-
-namespace HepMC {
-
-    /// hbar * c --> calculated with units of [mm*GeV]
-    static const double HepMC_hbarc   = (6.6260755e-34 * (1.e-6/1.60217733e-19) / (2*3.14159265358979323846))
-                                        * (2.99792458e+8 * 1000.) * 1.e+3;
-
-    // if you want to instantiate the particle lifetime from its width,
-    // use this static method inside the constructor:
-    double clifetime_from_width( double width );  //!< set lifetime from width
-
-    //! an example ParticleData class
-    
-    ///
-    /// \class ParticleData
-    /// Particle Data common to all particles of a given PDG id
-    ///
-    class ParticleData {
-  
-	friend std::ostream&  operator<<( std::ostream&, const ParticleData& );
-
-    public:
-        /// constructor requiring name, ID, and charge
-	ParticleData( std::string name, int id, double charge, double mass = 0,
-		      double cLifetime = -1, double spin = 0 );
-        /// constructor requiring name, ID, and charge
-	ParticleData( const char* name, int id, double charge, double mass = 0,
-		      double cLifetime = -1, double spin = 0 );
-	virtual ~ParticleData();
-
-	bool    operator==( const ParticleData& ) const; //!< equality
-	bool    operator!=( const ParticleData& ) const; //!< inequality
-
-        /// write particle data information to ostr
-	void    print( std::ostream& ostr = std::cout ) const;
-
-	bool    is_lepton() const;        //!< true if charged lepton /neutrino
-	bool    is_charged_lepton() const;//!< true if a charged lepton
-	bool    is_em() const;            //!< true if an electron or photon
-	bool    is_neutrino() const;      //!< true if a neutrino
-	bool    is_hadron() const;        //!< true if a hadron
-	bool    is_boson() const;         //!< true if a gauge or higgs boson
-
-	////////////////////
-	// access methods //
-	////////////////////
-	
-	/// description of the particle according to PDG, i.e. "Delta(1900) S_31"
-	std::string  name() const;
-	/// PDG ID number
-	int          pdg_id() const;
-	/// charge
-	double       charge() const;
-	/// nominal mass
-	double       mass() const;
-	/// width as calculated from clifetime
-	double       width() const; 
-	/// lifetime in mm
-	double       clifetime() const;
-	/// J spin
-	double       spin() const;
-
-	void         set_charge( double ); //!< set charge
-	void         set_mass( double ); //!< set nominal mass
-	void         set_width( double ); //!< set width
-	void         set_clifetime( double ); //!< set lifetime in mm
-	void         set_spin( double ); //!< set J spin
-
-    protected:
-	static unsigned int counter(); //!< num ParticleData objects in memory
-    
-	/// omits susy/excited/technicolor digit from returned ID
-	int    model_independent_pdg_id_() const;
-
-    private:
-	std::string   m_name;   // description of the particle according to PDG
-                                // i.e. "Delta(1900) S_31"
-	int           m_pdg_id; // PDG ID number (note we allow -ve)
-	int           m_3charge;// 3*electric charge in units of proton charge
-	double        m_mass;   // nominal mass in user defined energy units
-	double        m_clifetime; // [mm]
-	unsigned char m_2spin;  // 2*spin (J) of particle
-
-	static unsigned int s_counter;
-    };
-
-    ///////////////////////////
-    // INLINES               //
-    ///////////////////////////
-
-    inline bool ParticleData::is_lepton() const {
-	/// true if a charged lepton or neutrino --> | 11,13,15,12,14,16,17,18 |
-	return ( abs(pdg_id()) >=11 &&  abs(pdg_id()) <= 18 );
-    }
-    inline bool ParticleData::is_charged_lepton() const {
-	/// true if a charged lepton --> | 11,13,15 |
-	return ( is_lepton() && abs(pdg_id())%2==1 );
-    }
-    inline bool ParticleData::is_neutrino() const {
-	/// true if a neutrino --> | 12,14,16 |
-	return ( is_lepton() && abs(pdg_id())%2==0 );
-    }
-    inline bool ParticleData::is_em() const {
-	/// true if an electron or photon --> | 11, 22 |
-	return ( abs(pdg_id()) == 11 || abs(pdg_id()) == 22 );
-    }
-    inline bool ParticleData::is_hadron() const {
-	/// true if a hadron --> q,g,meson,baryon
-	return ( abs(pdg_id()) <= 9 || abs(pdg_id()) == 21 
-		 || abs(pdg_id()) >100 );
-    }
-    inline bool ParticleData::is_boson() const {
-	/// true if a gauge or higgs boson --> | 9, 21-39 | 
-	return ( ( abs(pdg_id()) >20 && abs(pdg_id()) <=40 )
-		 || abs(pdg_id()) == 9 );
-    }
-
-    ///////////////////////////
-    // INLINE Access Methods //
-    ///////////////////////////
-
-    inline std::string ParticleData::name() const { return m_name; }
-    inline int         ParticleData::pdg_id() const { return m_pdg_id; }
-    inline double      ParticleData::charge() const { 
-	return ( (double)m_3charge )/3.; 
-    }
-    inline double      ParticleData::mass() const { return m_mass; }
-    inline double      ParticleData::clifetime() const { return m_clifetime; }
-    inline double      ParticleData::spin() const { return m_2spin/2.; }
-    inline void        ParticleData::set_charge( double charge ) {
-	if ( charge > 0 ) { 
-	    m_3charge = (int)(3.*charge+.1); 
-	} else if ( charge < 0. ) { 
-	    m_3charge = (int)(3.*charge-.1); 
-	} else { 
-	    m_3charge = 0; 
-	}
-    }
-    inline void        ParticleData::set_mass( double its_mass ) {
-	m_mass = its_mass;
-    }
-    inline void        ParticleData::set_width( double width ) {
-	if ( width > 0 ) { 
-	    m_clifetime = HepMC_hbarc/width;
-	} else if ( width == 0. ) { 
-	    m_clifetime = -1.;
-	} else { 
-	    m_clifetime = 0.; 
-	}
-    }
-    inline void        ParticleData::set_clifetime( double its_clifetime ) {
-	m_clifetime = its_clifetime; 
-    }
-    inline void        ParticleData::set_spin( double spin ) {
-	m_2spin = (unsigned char)(2.*spin+.1);
-    }
-
-    ///////////////////////////
-    // INLINE Operators      //
-    ///////////////////////////
-
-    inline bool ParticleData::operator==( const ParticleData& a ) const {
-	// compares everything except the particle's name
-	return ( a.m_pdg_id != m_pdg_id ||
-		 a.m_mass != m_mass ||
-		 a.m_clifetime != m_clifetime ||
-		 a.m_3charge != m_3charge ||
-		 a.m_2spin != m_2spin            ) ? 0 : 1;
-    }
-
-    inline bool ParticleData::operator!=( const ParticleData& a ) const {
-	// compares everything except the particle's name
-	return ( a.pdg_id() != this->pdg_id() );
-    }
-
-} // HepMC
-
-#endif  // HEPMC_PARTICLE_DATA_H
-//--------------------------------------------------------------------------
-
-
-
Index: unk/Utilities/HepMC/interface/ParticleDataTable.h
===================================================================
--- /trunk/Utilities/HepMC/interface/ParticleDataTable.h	(revision 573)
+++ 	(revision )
@@ -1,270 +1,0 @@
-//--------------------------------------------------------------------------
-#ifndef HEPMC_PARTICLE_DATA_TABLE_H
-#define HEPMC_PARTICLE_DATA_TABLE_H
-
-//////////////////////////////////////////////////////////////////////////
-// Matt.Dobbs@Cern.CH, Jan 2000, refer to:
-// M. Dobbs and J.B. Hansen, "The HepMC C++ Monte Carlo Event Record for
-// High Energy Physics", Computer Physics Communications (to be published).
-//
-// Container for GenParticle Data Instances --- basically just an interface
-//   to STL map -- the same naming conventions are used
-// A GenParticle may belong to any number of ParticleDataTables. 
-// The ParticleDataTable does not own the ParticleData objects and will NOT
-//   delete them unless explicity told to do so with the delete_all method.
-// Each ParticleData entry in the table MUST have a unique pdg_id (otherwise
-//   an attempt to insert it as a new entry will fail).
-// Updated 2000.02.08 M.Dobbs added merge_table and 
-//                            make_antiparticles_from_particles
-//////////////////////////////////////////////////////////////////////////
-
-#include <iostream>
-#include <map>
-#include <cstdio>       // needed for formatted output using sprintf 
-#include "ParticleData.h"
-
-namespace HepMC {
-
-    //! an example ParticleDataTable class
-    
-    ///
-    /// \class ParticleDataTable
-    /// Example container for ParticleData instances. 
-    /// Basically just an interface to STL map.
-    ///
-    class ParticleDataTable {
-  
-    public:
-        /// constructor with optional description
-	ParticleDataTable( std::string description = std::string() );
-        /// constructor with description
-	ParticleDataTable( const char description );
-	/// copy constructor
-	ParticleDataTable( const ParticleDataTable& );
-        /// Shallow: does not delete ParticleData entries
-	virtual ~ParticleDataTable(); 
-	/// shallow: does not copy the entries, only makes new pointers 
-	ParticleDataTable& operator=( const ParticleDataTable& );
-
-        /// make corresponding anti-particles for all particles in table
-	void    make_antiparticles_from_particles();
-	/// merge two tables
-	int     merge_table( const ParticleDataTable& );
-
-        /// write the table to ostr
-	void    print( std::ostream& ostr = std::cout ) const;
-
-	void    delete_all(); //!<delete all ParticleData instances in this table
-	void    clear();      //!<clears table without deleting
-
-        /// return pointer to requested ParticleData
-	ParticleData*       operator[]( int id ) const;
-        /// return pointer to requested ParticleData
-	ParticleData*       find( int id ) const;
-	/// size of table
-	int                 size() const;
-	/// true if the table is empty
-	bool                empty() const;
-	/// true if successful
-	bool                insert( ParticleData* ); 
-	/// removes from table - does not delete
-	bool                erase( ParticleData* );  
-	/// removes from table - does not delete
-	bool                erase( int id );       
-	/// iterator for ParticleData map
-	typedef std::map<int,HepMC::ParticleData*>::iterator iterator;
-	/// const iterator for ParticleData map
-	typedef std::map<int,HepMC::ParticleData*>::const_iterator const_iterator;
-	/// begin iteration
-	iterator            begin();
-	/// end iteration
-	iterator            end();
-	/// begin const iteration
-	const_iterator      begin() const;
-	/// end const iteration
-	const_iterator      end() const;
-	
-	////////////////////
-	// access methods //
-	////////////////////
-	
-	/// table description
-	std::string description() const;
-	/// set table description
-	void        set_description( std::string );
-	/// set table description
-	void        set_description( const char );
-
-    private:
-	std::string                        m_description;
-	std::map<int,HepMC::ParticleData*> m_data_table;
-    };
-
-    ///////////////////////////
-    // INLINES               //
-    ///////////////////////////
-
-    inline ParticleDataTable::ParticleDataTable( std::string description ) 
-	: m_description(description) {
-	std::cout << "-------------------------------------------------------" << std::endl;
-	std::cout << "Use of HepMC/ParticleDataTable is deprecated" << std::endl;
-	std::cout << "-------------------------------------------------------" << std::endl;
-    }
-
-    inline ParticleDataTable::ParticleDataTable( const char description ) {
-	m_description = description; 
-
-        std::cout << "-------------------------------------------------------" << std::endl;
-        std::cout << "Use of HepMC/ParticleDataTable is deprecated" << std::endl;
-        std::cout << "-------------------------------------------------------" << std::endl;
-    }
-
-    inline ParticleDataTable::ParticleDataTable( const ParticleDataTable& pdt){
-	*this = pdt;
-    }
-
-    inline ParticleDataTable::~ParticleDataTable(){}
-
-    inline ParticleDataTable& ParticleDataTable::operator=( const 
-							    ParticleDataTable& 
-							    pdt) {
-	m_description = pdt.m_description;
-	m_data_table = pdt.m_data_table;
-	return *this;
-    }
-
-    inline void ParticleDataTable::make_antiparticles_from_particles() {
-        /// make corresponding anti-particles for all particles in table
-	ParticleDataTable new_data;
-	for ( ParticleDataTable::iterator p = begin(); p != end(); ++p ) {
-	    ParticleData* pdata = p->second;
-	    if ( pdata->charge() ) {
-		new_data.insert( new ParticleData( pdata->name()+"~",
-						   -1*pdata->pdg_id(),
-						   -1.*pdata->charge(), 
-						   pdata->mass(),
-						   pdata->clifetime(), 
-						   pdata->spin() ));
-	    }
-	}
-	merge_table( new_data );
-    }
-
-    inline void ParticleDataTable::print( std::ostream& ostr ) const {
-        /// prints a summary of all particle Data currently in memory
-        //
-        ostr << "________________________________________"
-             << "________________________________________\n";
-	ostr << "ParticleData:   *****  ParticleDataTable"
-             << "  *****   ( " << size() 
-             << " entries )\n";
-	ostr << " Description: " << m_description << "\n";
-        ostr << "   PDG ID " << "       PARTICLE NAME "
-             << "CHARGE" <<    "     MASS     "
-             << "  C*LIFETIME (CM) " << " SPIN\n";
-        for ( std::map< int,ParticleData* >::const_iterator pd 
-                  = m_data_table.begin(); pd != m_data_table.end(); pd++ ) {
-            ostr << *(pd->second) << "\n";
-        }
-        ostr << "________________________________________"
-             << "________________________________________" << std::endl;
-    }      
-
-    inline ParticleData* ParticleDataTable::find( int id ) const {
-	/// finds a ParticleData pointer corresponding to id IF it exists in
-	///  the table. If not returns NULL
-	std::map<int,ParticleData*>::const_iterator iter 
-	    = m_data_table.find(id);
-	return ( iter == m_data_table.end() ) ? 0 : iter->second;
-    }
-
-    inline ParticleData* ParticleDataTable::operator[]( int id ) const {
-	return find(id);
-    }
-
-    inline int ParticleDataTable::size() const { 
-	return (int)m_data_table.size();
-    }
-
-    inline bool ParticleDataTable::empty() const {
-	return (bool)m_data_table.empty();
-    }
-
-    inline bool ParticleDataTable::insert( ParticleData* pdata ) {
-	/// inserts pdata in the table IFF pdata's id has not already been used.
-	/// It does NOT replace entries with the same id. True if successful.
-	/// If you wish to overwrite another entry, first use erase()
-	if ( m_data_table.count(pdata->pdg_id()) ) return 0;
-	return ( m_data_table[pdata->pdg_id()] = pdata ); // true is success
-    }
-
-    inline bool ParticleDataTable::erase( ParticleData* pdata ) {
-	/// removes from table does not delete
-	/// returns True is an entry pdata existed in the table and was erased
-	return (bool)m_data_table.erase( pdata->pdg_id() );
-    }
-
-
-    inline bool ParticleDataTable::erase( int id ) {
-	/// removes from table does not delete
-	/// returns True is an entry pdata existed in the table and was erased
-	return (bool)m_data_table.erase( id );
-    }
-
-    inline ParticleDataTable::iterator ParticleDataTable::begin() { 
-	return m_data_table.begin(); 
-    }
-
-    inline ParticleDataTable::iterator ParticleDataTable::end() { 
-	return m_data_table.end(); 
-    }
-
-    inline ParticleDataTable::const_iterator ParticleDataTable::begin() const {
-	return m_data_table.begin(); 
-    }
-
-    inline ParticleDataTable::const_iterator ParticleDataTable::end() const { 
-	return m_data_table.end(); 
-    }
-
-    inline std::string ParticleDataTable::description() const { 
-	return m_description; 
-    }
-
-    inline void ParticleDataTable::set_description( std::string description ) {
-	m_description = description;
-    }
-
-    inline void ParticleDataTable::set_description( const char description ) {
-	m_description = description;
-    }
-
-    inline void ParticleDataTable::delete_all() {
-        /// deletes all ParticleData instances in this table
-        for ( std::map<int,ParticleData*>::iterator pd = m_data_table.begin();
-              pd != m_data_table.end(); pd++) delete pd->second;
-	clear();
-    }
-
-    inline void ParticleDataTable::clear() { m_data_table.clear(); }
-
-    inline int ParticleDataTable::merge_table( const ParticleDataTable& pdt ) {
-	/// merges pdt into this table
-	/// each entry from pdt is inserted only if this table does not
-	///  already have an entry matching the ParticleData's id
-	/// returns the number of new entries inserted into this table.
-	int count_number_insertions =0;
-	for ( ParticleDataTable::const_iterator p = pdt.begin(); 
-	      p != pdt.end(); ++p ) {
-	    if ( insert(p->second) ) ++count_number_insertions;
-	}
-	return count_number_insertions;
-    }
-
-} // HepMC
-
-#endif  // HEPMC_PARTICLE_DATA_TABLE_H
-//--------------------------------------------------------------------------
-
-
-
Index: /trunk/Utilities/HepMC/interface/StreamInfo.h
===================================================================
--- /trunk/Utilities/HepMC/interface/StreamInfo.h	(revision 574)
+++ /trunk/Utilities/HepMC/interface/StreamInfo.h	(revision 574)
@@ -0,0 +1,128 @@
+//--------------------------------------------------------------------------
+#ifndef HEPMC_STREAM_INFO_H
+#define HEPMC_STREAM_INFO_H
+
+//////////////////////////////////////////////////////////////////////////
+// garren@fnal.gov, March 2009
+//
+// This class contains the extra information needed when using streaming IO
+//////////////////////////////////////////////////////////////////////////
+
+#include <string>
+#include "Units.h"
+
+namespace HepMC {
+
+/// The known_io enum is used to track which type of input is being read
+enum known_io { gen=1, ascii, extascii, ascii_pdt, extascii_pdt };
+
+//! StreamInfo contains extra information needed when using streaming IO.
+
+///
+/// \class  StreamInfo
+/// This class contains the extra information needed when using streaming IO
+/// to process HepMC GenEvents
+///
+class StreamInfo {
+public:
+    /// default constructor
+    StreamInfo( );
+    /// destructor
+    ~StreamInfo() {}
+
+    /// IO_GenEvent begin event block key
+    std::string IO_GenEvent_Key()          const { return m_io_genevent_start; }
+    /// IO_GenEvent end event block key
+    std::string IO_GenEvent_End()          const { return m_io_genevent_end; }
+
+    /// IO_Ascii begin event block key
+    /// IO_Ascii has been removed, but we want to be able to read 
+    /// existing files written by IO_Ascii
+    std::string IO_Ascii_Key()             const { return m_io_ascii_start; }
+    /// IO_Ascii end event block key
+    std::string IO_Ascii_End()             const { return m_io_ascii_end; }
+    /// IO_Ascii begin particle data block key
+    std::string IO_Ascii_PDT_Key()             const { return m_io_ascii_pdt_start; }
+    /// IO_Ascii end particle data block key
+    std::string IO_Ascii_PDT_End()             const { return m_io_ascii_pdt_end; }
+
+    /// IO_ExtendedAscii begin event block key
+    /// IO_ExtendedAscii has been removed, but we want to be able to read 
+    /// existing files written by IO_ExtendedAscii
+    std::string IO_ExtendedAscii_Key()     const { return m_io_extendedascii_start; }
+    /// IO_ExtendedAscii end event block key
+    std::string IO_ExtendedAscii_End()     const { return m_io_extendedascii_end; }
+    /// IO_ExtendedAscii begin particle data block key
+    std::string IO_ExtendedAscii_PDT_Key()             const { return m_io_extendedascii_pdt_start; }
+    /// IO_ExtendedAscii end particle data block key
+    std::string IO_ExtendedAscii_PDT_End()             const { return m_io_extendedascii_pdt_end; }
+
+    /// get IO type
+    int io_type() const { return m_io_type; }
+    /// set IO type
+    void set_io_type( int );
+
+    /// true if the stream has a file type key
+    /// has_key is true by default
+    bool has_key() const { return m_has_key; }
+    /// set to false if the stream does not have a file type key
+    void set_has_key( bool );
+    
+    /// get the I/O momentum units
+    Units::MomentumUnit io_momentum_unit() const { return m_io_momentum_unit; }
+    /// get the I/O length units
+    Units::LengthUnit io_position_unit() const { return m_io_position_unit; }
+
+    /// get the I/O stream id
+    /// This is used for sanity checking.
+    int stream_id() const { return m_stream_id; }
+    
+    /// Special information is processed the first time we use the IO
+    bool finished_first_event() const { return m_finished_first_event_io; }
+    /// Special information is processed the first time we use the IO
+    void set_finished_first_event( bool b ) { m_finished_first_event_io = b; }
+
+    /// needed when reading a file without units if those units are 
+    /// different than the declared default units 
+    /// (e.g., the default units are MeV, but the file was written with GeV)
+    /// This method is not necessary if the units are written in the file
+    void use_input_units( Units::MomentumUnit, Units::LengthUnit );
+    
+    /// reading_event_header will return true when streaming input is 
+    /// processing the GenEvent header information
+    bool reading_event_header();
+    /// set the reading_event_header flag
+    void set_reading_event_header(bool);
+
+private: // data members
+    bool        m_finished_first_event_io;
+    // GenEvent I/O method keys
+    std::string m_io_genevent_start;
+    std::string m_io_ascii_start;
+    std::string m_io_extendedascii_start;
+    std::string m_io_genevent_end;
+    std::string m_io_ascii_end;
+    std::string m_io_extendedascii_end;
+    // particle data I/O method keys
+    std::string m_io_ascii_pdt_start;
+    std::string m_io_extendedascii_pdt_start;
+    std::string m_io_ascii_pdt_end;
+    std::string m_io_extendedascii_pdt_end;
+    // io information
+    int         m_io_type;
+    bool        m_has_key;
+    // default io units - used only when reading a file with no units
+    Units::MomentumUnit m_io_momentum_unit;
+    Units::LengthUnit   m_io_position_unit;
+    // used to keep identify the I/O stream
+    unsigned int m_stream_id;
+    static unsigned int m_stream_counter;
+    // used to keep track when reading event
+    bool m_reading_event_header;
+
+};
+
+} // HepMC
+
+#endif  // HEPMC_STREAM_INFO_H
+//--------------------------------------------------------------------------
Index: unk/Utilities/HepMC/src/CommonIO.cc
===================================================================
--- /trunk/Utilities/HepMC/src/CommonIO.cc	(revision 573)
+++ 	(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: unk/Utilities/HepMC/src/IO_Ascii.cc
===================================================================
--- /trunk/Utilities/HepMC/src/IO_Ascii.cc	(revision 573)
+++ 	(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: unk/Utilities/HepMC/src/IO_PDG_ParticleDataTable.cc
===================================================================
--- /trunk/Utilities/HepMC/src/IO_PDG_ParticleDataTable.cc	(revision 573)
+++ 	(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: unk/Utilities/HepMC/src/ParticleData.cc
===================================================================
--- /trunk/Utilities/HepMC/src/ParticleData.cc	(revision 573)
+++ 	(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: unk/Utilities/HepMC/src/Units.cc
===================================================================
--- /trunk/Utilities/HepMC/src/Units.cc	(revision 573)
+++ 	(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
Index: /trunk/interface/HepMCConverter.h
===================================================================
--- /trunk/interface/HepMCConverter.h	(revision 573)
+++ /trunk/interface/HepMCConverter.h	(revision 574)
@@ -41,5 +41,5 @@
 #include "GenVertex.h"
 #include "GenEvent.h"
-#include "IO_Ascii.h"
+#include "IO_AsciiParticles.h"
 
 using namespace std;
Index: /trunk/src/HepMCConverter.cc
===================================================================
--- /trunk/src/HepMCConverter.cc	(revision 573)
+++ /trunk/src/HepMCConverter.cc	(revision 574)
@@ -44,5 +44,5 @@
 #include "GenParticle.h"
 #include "GenVertex.h"
-#include "IO_Ascii.h"
+#include "IO_AsciiParticles.h"
 #include "IO_GenEvent.h"
 
@@ -136,16 +136,20 @@
        if (index_to_particle[j]->end_vertex())
 	{
-	  //find # of 1. daughter
+	  // make sure first and last daughter are indeed the first and last
 	  int first_daughter = find_in_map( particle_to_index,*(index_to_particle[j]->end_vertex()->particles_begin(HepMC::children)));
-	  //cout <<"first_daughter "<< first_daughter <<  "num_daughters " << num_daughters << endl; 
+	  int last_daughter = 0;
+
 	  HepMC::GenVertex::particle_iterator ic;
-	  int last_daughter=0;
-	  //find # of last daughter
-	  for (ic = index_to_particle[j]->end_vertex()->particles_begin(HepMC::children);ic != index_to_particle[j]->end_vertex()->particles_end(HepMC::children); ++ic) 
-	    last_daughter= find_in_map( particle_to_index,*ic);       
-	  
+	  for (ic = index_to_particle[j]->end_vertex()->particles_begin(HepMC::children);ic != index_to_particle[j]->end_vertex()->particles_end(HepMC::children); ++ic) {
+	    int current_daughter = find_in_map( particle_to_index,*ic) ; 
+	    if (current_daughter < first_daughter)
+	      first_daughter = current_daughter;
+	    if (current_daughter > last_daughter)
+	      last_daughter = current_daughter;
+	  }
 	  if (first_daughter== 0) last_daughter = 0;
 	  da1=first_daughter;
 	  da2=last_daughter;
+
 	} 
       else 
@@ -194,8 +198,8 @@
       element->PID = pid;
       element->Status = status;
-      element->M1 = mo1;
-      element->M2 = mo2;
-      element->D1 = da1;
-      element->D2 = da2;
+      element->M1 = mo1 - 1; // added -1 as the numbering in the tree starts from 0
+      element->M2 = mo2 - 1;
+      element->D1 = da1 - 1;
+      element->D2 = da2 - 1;
 
       element->E = index_to_particle[n]->momentum().e();
