Index: classes/DelphesPileUpReader.cc
===================================================================
--- classes/DelphesPileUpReader.cc	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ classes/DelphesPileUpReader.cc	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,23 +1,11 @@
-/*
- *  Delphes: a framework for fast simulation of a generic collider experiment
- *  Copyright (C) 2012-2014  Universite catholique de Louvain (UCL), Belgium
- *
- *  This program is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
 
 /** \class DelphesPileUpReader
  *
  *  Reads pile-up binary file
+ *
+ *
+ *  $Date$
+ *  $Revision$
+ *
  *
  *  \author P. Demin - UCL, Louvain-la-Neuve
@@ -27,12 +15,11 @@
 #include "classes/DelphesPileUpReader.h"
 
+#include <stdexcept>
 #include <iostream>
 #include <sstream>
-#include <stdexcept>
 
-#include <stdint.h>
 #include <stdio.h>
-
-#include "classes/DelphesXDRReader.h"
+#include <rpc/types.h>
+#include <rpc/xdr.h>
 
 using namespace std;
@@ -47,18 +34,17 @@
   fEntries(0), fEntrySize(0), fCounter(0),
   fPileUpFile(0), fIndex(0), fBuffer(0),
-  fInputReader(0), fIndexReader(0), fBufferReader(0)
+  fInputXDR(0), fIndexXDR(0), fBufferXDR(0)
 {
   stringstream message;
 
-  fIndex = new uint8_t[kIndexSize * 8];
-  fBuffer = new uint8_t[kBufferSize * kRecordSize * 4];
-  fInputReader = new DelphesXDRReader;
-  fIndexReader = new DelphesXDRReader;
-  fBufferReader = new DelphesXDRReader;
+  fIndex = new char[kIndexSize*8];
+  fBuffer = new char[kBufferSize*kRecordSize*4];
+  fInputXDR = new XDR;
+  fIndexXDR = new XDR;
+  fBufferXDR = new XDR;
+  xdrmem_create(fIndexXDR, fIndex, kIndexSize*8, XDR_DECODE);
+  xdrmem_create(fBufferXDR, fBuffer, kBufferSize*kRecordSize*4, XDR_DECODE);
 
-  fIndexReader->SetBuffer(fIndex);
-  fBufferReader->SetBuffer(fBuffer);
-
-  fPileUpFile = fopen(fileName, "rb");
+  fPileUpFile = fopen(fileName, "r");
 
   if(fPileUpFile == NULL)
@@ -68,9 +54,9 @@
   }
 
-  fInputReader->SetFile(fPileUpFile);
+  xdrstdio_create(fInputXDR, fPileUpFile, XDR_DECODE);
 
   // read number of events
-  fseeko(fPileUpFile, -8, SEEK_END);
-  fInputReader->ReadValue(&fEntries, 8);
+  fseek(fPileUpFile, -8, SEEK_END);
+  xdr_hyper(fInputXDR, &fEntries);
 
   if(fEntries >= kIndexSize)
@@ -81,6 +67,6 @@
 
   // read index of events
-  fseeko(fPileUpFile, -8 - 8 * fEntries, SEEK_END);
-  fInputReader->ReadRaw(fIndex, fEntries * 8);
+  fseek(fPileUpFile, -8 - 8*fEntries, SEEK_END);
+  xdr_opaque(fInputXDR, fIndex, fEntries*8);
 }
 
@@ -89,8 +75,11 @@
 DelphesPileUpReader::~DelphesPileUpReader()
 {
+  xdr_destroy(fInputXDR);
   if(fPileUpFile) fclose(fPileUpFile);
-  if(fBufferReader) delete fBufferReader;
-  if(fIndexReader) delete fIndexReader;
-  if(fInputReader) delete fInputReader;
+  xdr_destroy(fBufferXDR);
+  xdr_destroy(fIndexXDR);
+  if(fBufferXDR) delete fBufferXDR;
+  if(fIndexXDR) delete fIndexXDR;
+  if(fInputXDR) delete fInputXDR;
   if(fBuffer) delete[] fBuffer;
   if(fIndex) delete[] fIndex;
@@ -99,5 +88,5 @@
 //------------------------------------------------------------------------------
 
-bool DelphesPileUpReader::ReadParticle(int32_t &pid,
+bool DelphesPileUpReader::ReadParticle(int &pid,
   float &x, float &y, float &z, float &t,
   float &px, float &py, float &pz, float &e)
@@ -105,13 +94,13 @@
   if(fCounter >= fEntrySize) return false;
 
-  fBufferReader->ReadValue(&pid, 4);
-  fBufferReader->ReadValue(&x, 4);
-  fBufferReader->ReadValue(&y, 4);
-  fBufferReader->ReadValue(&z, 4);
-  fBufferReader->ReadValue(&t, 4);
-  fBufferReader->ReadValue(&px, 4);
-  fBufferReader->ReadValue(&py, 4);
-  fBufferReader->ReadValue(&pz, 4);
-  fBufferReader->ReadValue(&e, 4);
+  xdr_int(fBufferXDR, &pid);
+  xdr_float(fBufferXDR, &x);
+  xdr_float(fBufferXDR, &y);
+  xdr_float(fBufferXDR, &z);
+  xdr_float(fBufferXDR, &t);
+  xdr_float(fBufferXDR, &px);
+  xdr_float(fBufferXDR, &py);
+  xdr_float(fBufferXDR, &pz);
+  xdr_float(fBufferXDR, &e);
 
   ++fCounter;
@@ -122,17 +111,17 @@
 //------------------------------------------------------------------------------
 
-bool DelphesPileUpReader::ReadEntry(int64_t entry)
+bool DelphesPileUpReader::ReadEntry(quad_t entry)
 {
-  int64_t offset;
+  quad_t offset;
 
   if(entry >= fEntries) return false;
 
   // read event position
-  fIndexReader->SetOffset(8 * entry);
-  fIndexReader->ReadValue(&offset, 8);
+  xdr_setpos(fIndexXDR, 8*entry);
+  xdr_hyper(fIndexXDR, &offset);
 
   // read event
-  fseeko(fPileUpFile, offset, SEEK_SET);
-  fInputReader->ReadValue(&fEntrySize, 4);
+  fseek(fPileUpFile, offset, SEEK_SET);
+  xdr_int(fInputXDR, &fEntrySize);
 
   if(fEntrySize >= kBufferSize)
@@ -141,6 +130,6 @@
   }
 
-  fInputReader->ReadRaw(fBuffer, fEntrySize * kRecordSize * 4);
-  fBufferReader->SetOffset(0);
+  xdr_opaque(fInputXDR, fBuffer, fEntrySize*kRecordSize*4);
+  xdr_setpos(fBufferXDR, 0);
   fCounter = 0;
 
