Index: trunk/interface/HEPMCConverter.h
===================================================================
--- trunk/interface/HEPMCConverter.h	(revision 347)
+++ trunk/interface/HEPMCConverter.h	(revision 347)
@@ -0,0 +1,48 @@
+#ifndef _HEPMCCONVERTER_H_
+#define _HEPMCCONVERTER_H_
+
+/***********************************************************************
+**                                                                    **
+**          /----------------------------------------------\          **
+**         |  Delphes, a framework for the fast simulation  |         **
+**         |       of a  generic collider experiment        |         **
+**          \-------------  arXiv:0903.2225v1  ------------/          **
+**                                                                    **
+**                                                                    **
+**   This package uses:                                               **
+**   ------------------                                               **
+**   FastJet algorithm: Phys. Lett. B641 (2006) [hep-ph/0512210]      ** 
+**   Hector: JINST 2:P09005 (2007) [physics.acc-ph:0707.1198v2]       ** 
+**   FROG: [hep-ex/0901.2718v1]                                       **
+**                                                                    **
+** ------------------------------------------------------------------ **
+**                                                                    **
+**   Main authors:                                                    **
+**   -------------                                                    **
+**                                                                    **
+**                Severine Ovyn                Xavier Rouby           ** 
+**          severine.ovyn@uclouvain.be      xavier.rouby@cern         ** 
+**                                                                    ** 
+**         Center for Particle Physics and Phenomenology (CP3)        ** 
+**                Universite catholique de Louvain (UCL)              **       
+**                     Louvain-la-Neuve, Belgium                      **            
+**                                                                    **
+**                      Copyright (C) 2008-2009,                      **
+**                        All rights reserved.                        **  
+**                                                                    **
+***********************************************************************/
+
+
+#include <string>
+#include "DataConverter.h"
+
+using namespace std;
+
+class HEPMCConverter : public DataConverter {
+  public:
+    HEPMCConverter(const string& inputFileList, const string& outputFileName, const int& Nevents=-1);
+    ~HEPMCConverter();
+
+};
+
+#endif
Index: trunk/src/HEPMCConverter.cc
===================================================================
--- trunk/src/HEPMCConverter.cc	(revision 347)
+++ trunk/src/HEPMCConverter.cc	(revision 347)
@@ -0,0 +1,120 @@
+/***********************************************************************
+**                                                                    **
+**          /----------------------------------------------\          **
+**         |  Delphes, a framework for the fast simulation  |         **
+**         |       of a  generic collider experiment        |         **
+**          \-------------  arXiv:0903.2225v1  ------------/          **
+**                                                                    **
+**                                                                    **
+**   This package uses:                                               **
+**   ------------------                                               **
+**   FastJet algorithm: Phys. Lett. B641 (2006) [hep-ph/0512210]      ** 
+**   Hector: JINST 2:P09005 (2007) [physics.acc-ph:0707.1198v2]       ** 
+**   FROG: [hep-ex/0901.2718v1]                                       **
+**                                                                    **
+** ------------------------------------------------------------------ **
+**                                                                    **
+**   Main authors:                                                    **
+**   -------------                                                    **
+**                                                                    **
+**                Severine Ovyn                Xavier Rouby           ** 
+**          severine.ovyn@uclouvain.be      xavier.rouby@cern         ** 
+**                                                                    ** 
+**         Center for Particle Physics and Phenomenology (CP3)        ** 
+**                Universite catholique de Louvain (UCL)              **       
+**                     Louvain-la-Neuve, Belgium                      **            
+**                                                                    **
+**                      Copyright (C) 2008-2009,                      **
+**                        All rights reserved.                        **  
+**                                                                    **
+***********************************************************************/
+
+
+#include <iostream>
+#include <fstream>
+#include "TLorentzVector.h"
+#include "BlockClasses.h"
+#include "ExRootTreeWriter.h"
+#include "ExRootTreeBranch.h"
+#include "HEPMCConverter.h"
+
+using namespace std;
+
+//------------------------------------------------------------------------------
+
+HEPMCConverter::~HEPMCConverter() {}
+
+//------------------------------------------------------------------------------
+
+HEPMCConverter::HEPMCConverter(const string& inputFileList, const string& outputFileName, const int& Nevents) : DataConverter(Nevents)
+{
+//  int ierr, entryType;
+//  int nevt = 0;
+
+  // export the generator-level data to the outputfile
+  ExRootTreeWriter *treeWriter = new ExRootTreeWriter(outputFileName, "GEN");
+  ExRootTreeBranch *branchGenEvent = treeWriter->NewBranch("Event", TRootGenEvent::Class());
+  ExRootTreeBranch *branchGenParticle = treeWriter->NewBranch("Particle", GenParticle::Class());
+  
+  // Open the datafile list
+  ifstream infile(inputFileList.c_str());
+  if(!infile.is_open()) {
+      cerr << left  << setw(30) <<"**   ERROR: Can't open  "<<""
+                    << left  << setw(20) << inputFileList   <<""
+                    << right << setw(19) <<"for input **"<<""<<endl;
+      exit(1);  // could not open the list : exit
+  }
+
+  string filename;
+  while(1) {
+      infile >> filename;
+      if(!infile.good()) break; // quits when the inputfile list is depleted
+
+      ifstream datafile(filename.c_str());
+      if(!datafile.good()) {  // i.e. datafile could not be opened
+             cerr << left  << setw(30) <<"**   ERROR: Can't find file  "<<""
+                  << left  << setw(20) << filename                      <<""
+                  << right << setw(19) <<"for input **"<<""<<endl;
+             continue;	      // go to the next item in the list
+      }
+     
+      // else : if the datafile was successfully opened 
+      Long64_t allEntries = Nevents;
+      if(allEntries > 0) {
+	/*
+	  // Loop over all objects
+	  Long64_t recordNumber = 1;
+	  for(Long64_t entry = 0; entry < allEntries; ++entry) {
+	      ierr = StdHepXdrRead(&entryType, istr);
+	      if(ierr != 0) {
+                  cerr << left  << setw(49) <<"**   ERROR: Unexpected end of file after"<<""
+                       << left  << setw(10) << entry                                    <<""
+                       << right << setw(10) <<"entries **"<<""<<endl;
+		  break;
+              } // if ierr !=0
+	      
+	      // analyse only entries with standard HEPEVT common block
+	      if(entryType == 1) {
+		  // add empty events for missing event numbers
+		  while(recordNumber < myhepevt.nevhep) {
+		      treeWriter->Clear();
+		      AnalyseEvent(branchGenEvent, recordNumber);
+		      treeWriter->Fill();
+		      ++recordNumber;
+		  } // while
+	*/	  
+		  treeWriter->Clear();
+	//	  AnalyseEvent(branchGenEvent, myhepevt.nevhep);
+	//	  AnalyseParticles(branchGenParticle);
+		  treeWriter->Fill();
+		  //++recordNumber;
+	//    } // if entryType == 1
+	//  } // for entry < allEntries
+      } // if allEntries
+      datafile.close();
+    } // while : loop on the list file contents
+
+  treeWriter->Write();
+  delete treeWriter;
+}
+
