Fork me on GitHub

Changes in / [fbad4c7:4689481] in git


Ignore:
Files:
4 added
14 edited

Legend:

Unmodified
Added
Removed
  • .circleci/config.yml

    rfbad4c7 r4689481  
    1313            echo 'export LD_LIBRARY_PATH=$ROOTSYS/lib:$LD_LIBRARY_PATH' >> $BASH_ENV
    1414          fi
    15           echo 'export PYTHIA8=/opt/pythia' >> $BASH_ENV
     15          if [[ -d /opt/pythia ]]; then
     16            echo 'export PYTHIA8=/opt/pythia' >> $BASH_ENV
     17          else
     18            echo 'export PYTHIA8=/usr' >> $BASH_ENV
     19          fi
    1620    - run:
    1721        name: Build Delphes using make
  • CMakeLists.txt

    rfbad4c7 r4689481  
    3636if(PYTHIA8_FOUND)
    3737  include_directories(${PYTHIA8_INCLUDE_DIRS})
    38 endif(PYTHIA8_FOUND)
     38endif()
    3939
    4040if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
     
    4949  endif()
    5050endfunction()
    51 
    52 
    5351
    5452# Declare position of all other externals needed
     
    8785target_link_Libraries(Delphes ${ROOT_LIBRARIES} ${ROOT_COMPONENT_LIBRARIES})
    8886target_link_Libraries(DelphesDisplay ${ROOT_LIBRARIES} ${ROOT_COMPONENT_LIBRARIES})
     87
    8988if(PYTHIA8_FOUND)
    9089  target_link_libraries(Delphes ${PYTHIA8_LIBRARIES} ${CMAKE_DL_LIBS})
    91 endif(PYTHIA8_FOUND)
    92 
     90endif()
    9391
    9492install(TARGETS Delphes DelphesDisplay DESTINATION lib)
  • Makefile

    rfbad4c7 r4689481  
    1515PcmSuf = _rdict.pcm
    1616
    17 CXXFLAGS += $(ROOTCFLAGS) -Wno-write-strings -D_FILE_OFFSET_BITS=64 -DDROP_CGAL -I. -Iexternal -Iexternal/tcl -I/usr/include/tirpc
     17CXXFLAGS += $(ROOTCFLAGS) -Wno-write-strings -D_FILE_OFFSET_BITS=64 -DDROP_CGAL -I. -Iexternal -Iexternal/tcl
    1818DELPHES_LIBS = $(shell $(RC) --libs) -lEG $(SYSLIBS)
    1919DISPLAY_LIBS = $(shell $(RC) --evelibs) -lGuiHtml $(SYSLIBS)
     
    482482tmp/classes/DelphesPileUpReader.$(ObjSuf): \
    483483        classes/DelphesPileUpReader.$(SrcSuf) \
    484         classes/DelphesPileUpReader.h
     484        classes/DelphesPileUpReader.h \
     485        classes/DelphesXDRReader.h
    485486tmp/classes/DelphesPileUpWriter.$(ObjSuf): \
    486487        classes/DelphesPileUpWriter.$(SrcSuf) \
    487         classes/DelphesPileUpWriter.h
     488        classes/DelphesPileUpWriter.h \
     489        classes/DelphesXDRWriter.h
    488490tmp/classes/DelphesSTDHEPReader.$(ObjSuf): \
    489491        classes/DelphesSTDHEPReader.$(SrcSuf) \
     
    491493        classes/DelphesClasses.h \
    492494        classes/DelphesFactory.h \
     495        classes/DelphesXDRReader.h \
    493496        external/ExRootAnalysis/ExRootTreeBranch.h
    494497tmp/classes/DelphesStream.$(ObjSuf): \
     
    498501        classes/DelphesTF2.$(SrcSuf) \
    499502        classes/DelphesTF2.h
     503tmp/classes/DelphesXDRReader.$(ObjSuf): \
     504        classes/DelphesXDRReader.$(SrcSuf) \
     505        classes/DelphesXDRReader.h
     506tmp/classes/DelphesXDRWriter.$(ObjSuf): \
     507        classes/DelphesXDRWriter.$(SrcSuf) \
     508        classes/DelphesXDRWriter.h
    500509tmp/external/ExRootAnalysis/ExRootConfReader.$(ObjSuf): \
    501510        external/ExRootAnalysis/ExRootConfReader.$(SrcSuf) \
     
    10141023        tmp/classes/DelphesStream.$(ObjSuf) \
    10151024        tmp/classes/DelphesTF2.$(ObjSuf) \
     1025        tmp/classes/DelphesXDRReader.$(ObjSuf) \
     1026        tmp/classes/DelphesXDRWriter.$(ObjSuf) \
    10161027        tmp/external/ExRootAnalysis/ExRootConfReader.$(ObjSuf) \
    10171028        tmp/external/ExRootAnalysis/ExRootFilter.$(ObjSuf) \
     
    20332044        @touch $@
    20342045
     2046classes/DelphesSTDHEPReader.h: \
     2047        classes/DelphesXDRReader.h
     2048        @touch $@
     2049
    20352050external/fastjet/plugins/CDFCones/fastjet/CDFMidPointPlugin.hh: \
    20362051        external/fastjet/JetDefinition.hh
  • classes/DelphesPileUpReader.cc

    rfbad4c7 r4689481  
    3333
    3434#include <stdio.h>
    35 #include <rpc/types.h>
    36 #include <rpc/xdr.h>
     35#include <stdint.h>
     36
     37#include "classes/DelphesXDRReader.h"
    3738
    3839using namespace std;
     
    4748  fEntries(0), fEntrySize(0), fCounter(0),
    4849  fPileUpFile(0), fIndex(0), fBuffer(0),
    49   fInputXDR(0), fIndexXDR(0), fBufferXDR(0)
     50  fInputReader(0), fIndexReader(0), fBufferReader(0)
    5051{
    5152  stringstream message;
    5253
    53   fIndex = new char[kIndexSize*8];
    54   fBuffer = new char[kBufferSize*kRecordSize*4];
    55   fInputXDR = new XDR;
    56   fIndexXDR = new XDR;
    57   fBufferXDR = new XDR;
    58   xdrmem_create(fIndexXDR, fIndex, kIndexSize*8, XDR_DECODE);
    59   xdrmem_create(fBufferXDR, fBuffer, kBufferSize*kRecordSize*4, XDR_DECODE);
     54  fIndex = new uint8_t[kIndexSize*8];
     55  fBuffer = new uint8_t[kBufferSize*kRecordSize*4];
     56  fInputReader = new DelphesXDRReader;
     57  fIndexReader = new DelphesXDRReader;
     58  fBufferReader = new DelphesXDRReader;
     59
     60  fIndexReader->SetBuffer(fIndex);
     61  fBufferReader->SetBuffer(fBuffer);
    6062
    6163  fPileUpFile = fopen(fileName, "r");
     
    6769  }
    6870
    69   xdrstdio_create(fInputXDR, fPileUpFile, XDR_DECODE);
     71  fInputReader->SetFile(fPileUpFile);
    7072
    7173  // read number of events
    7274  fseeko(fPileUpFile, -8, SEEK_END);
    73   xdr_hyper(fInputXDR, &fEntries);
     75  fInputReader->ReadValue(&fEntries, 8);
    7476
    7577  if(fEntries >= kIndexSize)
     
    8183  // read index of events
    8284  fseeko(fPileUpFile, -8 - 8*fEntries, SEEK_END);
    83   xdr_opaque(fInputXDR, fIndex, fEntries*8);
     85  fInputReader->ReadRaw(fIndex, fEntries*8);
    8486}
    8587
     
    8890DelphesPileUpReader::~DelphesPileUpReader()
    8991{
    90   xdr_destroy(fInputXDR);
    9192  if(fPileUpFile) fclose(fPileUpFile);
    92   xdr_destroy(fBufferXDR);
    93   xdr_destroy(fIndexXDR);
    94   if(fBufferXDR) delete fBufferXDR;
    95   if(fIndexXDR) delete fIndexXDR;
    96   if(fInputXDR) delete fInputXDR;
     93  if(fBufferReader) delete fBufferReader;
     94  if(fIndexReader) delete fIndexReader;
     95  if(fInputReader) delete fInputReader;
    9796  if(fBuffer) delete[] fBuffer;
    9897  if(fIndex) delete[] fIndex;
     
    101100//------------------------------------------------------------------------------
    102101
    103 bool DelphesPileUpReader::ReadParticle(int &pid,
     102bool DelphesPileUpReader::ReadParticle(int32_t &pid,
    104103  float &x, float &y, float &z, float &t,
    105104  float &px, float &py, float &pz, float &e)
     
    107106  if(fCounter >= fEntrySize) return false;
    108107
    109   xdr_int(fBufferXDR, &pid);
    110   xdr_float(fBufferXDR, &x);
    111   xdr_float(fBufferXDR, &y);
    112   xdr_float(fBufferXDR, &z);
    113   xdr_float(fBufferXDR, &t);
    114   xdr_float(fBufferXDR, &px);
    115   xdr_float(fBufferXDR, &py);
    116   xdr_float(fBufferXDR, &pz);
    117   xdr_float(fBufferXDR, &e);
     108  fBufferReader->ReadValue(&pid, 4);
     109  fBufferReader->ReadValue(&x, 4);
     110  fBufferReader->ReadValue(&y, 4);
     111  fBufferReader->ReadValue(&z, 4);
     112  fBufferReader->ReadValue(&t, 4);
     113  fBufferReader->ReadValue(&px, 4);
     114  fBufferReader->ReadValue(&py, 4);
     115  fBufferReader->ReadValue(&pz, 4);
     116  fBufferReader->ReadValue(&e, 4);
    118117
    119118  ++fCounter;
     
    124123//------------------------------------------------------------------------------
    125124
    126 bool DelphesPileUpReader::ReadEntry(quad_t entry)
     125bool DelphesPileUpReader::ReadEntry(int64_t entry)
    127126{
    128   quad_t offset;
     127  int64_t offset;
    129128
    130129  if(entry >= fEntries) return false;
    131130
    132131  // read event position
    133   xdr_setpos(fIndexXDR, 8*entry);
    134   xdr_hyper(fIndexXDR, &offset);
     132  fIndexReader->SetOffset(8*entry);
     133  fIndexReader->ReadValue(&offset, 8);
    135134
    136135  // read event
    137136  fseeko(fPileUpFile, offset, SEEK_SET);
    138   xdr_int(fInputXDR, &fEntrySize);
     137  fInputReader->ReadValue(&fEntrySize, 4);
    139138
    140139  if(fEntrySize >= kBufferSize)
     
    143142  }
    144143
    145   xdr_opaque(fInputXDR, fBuffer, fEntrySize*kRecordSize*4);
    146   xdr_setpos(fBufferXDR, 0);
     144  fInputReader->ReadRaw(fBuffer, fEntrySize*kRecordSize*4);
     145  fBufferReader->SetOffset(0);
    147146  fCounter = 0;
    148147
  • classes/DelphesPileUpReader.h

    rfbad4c7 r4689481  
    2929
    3030#include <stdio.h>
    31 #include <rpc/types.h>
    32 #include <rpc/xdr.h>
     31#include <stdint.h>
     32
     33class DelphesXDRReader;
    3334
    3435class DelphesPileUpReader
     
    4041  ~DelphesPileUpReader();
    4142
    42   bool ReadParticle(int &pid,
     43  bool ReadParticle(int32_t &pid,
    4344    float &x, float &y, float &z, float &t,
    4445    float &px, float &py, float &pz, float &e);
    4546
    46   bool ReadEntry(quad_t entry);
     47  bool ReadEntry(int64_t entry);
    4748
    48   quad_t GetEntries() const { return fEntries; }
     49  int64_t GetEntries() const { return fEntries; }
    4950
    5051private:
    5152
    52   quad_t fEntries;
     53  int64_t fEntries;
    5354
    54   int fEntrySize;
    55   int fCounter;
     55  int32_t fEntrySize;
     56  int32_t fCounter;
    5657
    5758  FILE *fPileUpFile;
    58   char *fIndex;
    59   char *fBuffer;
     59  uint8_t *fIndex;
     60  uint8_t *fBuffer;
    6061
    61   XDR *fInputXDR;
    62   XDR *fIndexXDR;
    63   XDR *fBufferXDR;
     62  DelphesXDRReader *fInputReader;
     63  DelphesXDRReader *fIndexReader;
     64  DelphesXDRReader *fBufferReader;
    6465};
    6566
    6667#endif // DelphesPileUpReader_h
    67 
    68 
  • classes/DelphesPileUpWriter.cc

    rfbad4c7 r4689481  
    3333
    3434#include <stdio.h>
    35 #include <rpc/types.h>
    36 #include <rpc/xdr.h>
     35#include <stdint.h>
     36
     37#include "classes/DelphesXDRWriter.h"
    3738
    3839using namespace std;
     
    4748  fEntries(0), fEntrySize(0), fOffset(0),
    4849  fPileUpFile(0), fIndex(0), fBuffer(0),
    49   fOutputXDR(0), fIndexXDR(0), fBufferXDR(0)
     50  fOutputWriter(0), fIndexWriter(0), fBufferWriter(0)
    5051{
    5152  stringstream message;
    5253
    53   fIndex = new char[kIndexSize*8];
    54   fBuffer = new char[kBufferSize*kRecordSize*4];
    55   fOutputXDR = new XDR;
    56   fIndexXDR = new XDR;
    57   fBufferXDR = new XDR;
    58   xdrmem_create(fIndexXDR, fIndex, kIndexSize*8, XDR_ENCODE);
    59   xdrmem_create(fBufferXDR, fBuffer, kBufferSize*kRecordSize*4, XDR_ENCODE);
     54  fIndex = new uint8_t[kIndexSize*8];
     55  fBuffer = new uint8_t[kBufferSize*kRecordSize*4];
     56  fOutputWriter = new DelphesXDRWriter;
     57  fIndexWriter = new DelphesXDRWriter;
     58  fBufferWriter = new DelphesXDRWriter;
     59
     60  fIndexWriter->SetBuffer(fIndex);
     61  fBufferWriter->SetBuffer(fBuffer);
    6062
    6163  fPileUpFile = fopen(fileName, "w+");
     
    6769  }
    6870
    69   xdrstdio_create(fOutputXDR, fPileUpFile, XDR_ENCODE);
     71  fOutputWriter->SetFile(fPileUpFile);
    7072}
    7173
     
    7476DelphesPileUpWriter::~DelphesPileUpWriter()
    7577{
    76   xdr_destroy(fOutputXDR);
    7778  if(fPileUpFile) fclose(fPileUpFile);
    78   xdr_destroy(fBufferXDR);
    79   xdr_destroy(fIndexXDR);
    80   if(fBufferXDR) delete fBufferXDR;
    81   if(fIndexXDR) delete fIndexXDR;
    82   if(fOutputXDR) delete fOutputXDR;
     79  if(fBufferWriter) delete fBufferWriter;
     80  if(fIndexWriter) delete fIndexWriter;
     81  if(fOutputWriter) delete fOutputWriter;
    8382  if(fBuffer) delete[] fBuffer;
    8483  if(fIndex) delete[] fIndex;
     
    8786//------------------------------------------------------------------------------
    8887
    89 void DelphesPileUpWriter::WriteParticle(int pid,
     88void DelphesPileUpWriter::WriteParticle(int32_t pid,
    9089  float x, float y, float z, float t,
    9190  float px, float py, float pz, float e)
     
    9695  }
    9796
    98   xdr_int(fBufferXDR, &pid);
    99   xdr_float(fBufferXDR, &x);
    100   xdr_float(fBufferXDR, &y);
    101   xdr_float(fBufferXDR, &z);
    102   xdr_float(fBufferXDR, &t);
    103   xdr_float(fBufferXDR, &px);
    104   xdr_float(fBufferXDR, &py);
    105   xdr_float(fBufferXDR, &pz);
    106   xdr_float(fBufferXDR, &e);
     97  fBufferWriter->WriteValue(&pid, 4);
     98  fBufferWriter->WriteValue(&x, 4);
     99  fBufferWriter->WriteValue(&y, 4);
     100  fBufferWriter->WriteValue(&z, 4);
     101  fBufferWriter->WriteValue(&t, 4);
     102  fBufferWriter->WriteValue(&px, 4);
     103  fBufferWriter->WriteValue(&py, 4);
     104  fBufferWriter->WriteValue(&pz, 4);
     105  fBufferWriter->WriteValue(&e, 4);
    107106
    108107  ++fEntrySize;
     
    118117  }
    119118
    120   xdr_int(fOutputXDR, &fEntrySize);
    121   xdr_opaque(fOutputXDR, fBuffer, fEntrySize*kRecordSize*4);
     119  fOutputWriter->WriteValue(&fEntrySize, 4);
     120  fOutputWriter->WriteRaw(fBuffer, fEntrySize*kRecordSize*4);
    122121
    123   xdr_hyper(fIndexXDR, &fOffset);
     122  fIndexWriter->WriteValue(&fOffset, 8);
    124123  fOffset += fEntrySize*kRecordSize*4 + 4;
    125124
    126   xdr_setpos(fBufferXDR, 0);
     125  fBufferWriter->SetOffset(0);
    127126  fEntrySize = 0;
    128        
     127
    129128  ++fEntries;
    130129}
     
    134133void DelphesPileUpWriter::WriteIndex()
    135134{
    136   xdr_opaque(fOutputXDR, fIndex, fEntries*8);
    137   xdr_hyper(fOutputXDR, &fEntries);
     135  fOutputWriter->WriteRaw(fIndex, fEntries*8);
     136  fOutputWriter->WriteValue(&fEntries, 8);
    138137}
    139138
  • classes/DelphesPileUpWriter.h

    rfbad4c7 r4689481  
    2929
    3030#include <stdio.h>
    31 #include <rpc/types.h>
    32 #include <rpc/xdr.h>
     31#include <stdint.h>
     32
     33class DelphesXDRWriter;
    3334
    3435class DelphesPileUpWriter
     
    4041  ~DelphesPileUpWriter();
    4142
    42   void WriteParticle(int pid,
     43  void WriteParticle(int32_t pid,
    4344    float x, float y, float z, float t,
    4445    float px, float py, float pz, float e);
     
    5051private:
    5152
    52   quad_t fEntries;
    53   int fEntrySize;
    54   quad_t fOffset;
     53  int64_t fEntries;
     54  int32_t fEntrySize;
     55  int64_t fOffset;
    5556
    5657  FILE *fPileUpFile;
    57   char *fIndex;
    58   char *fBuffer;
     58  uint8_t *fIndex;
     59  uint8_t *fBuffer;
    5960
    60   XDR *fOutputXDR;
    61   XDR *fIndexXDR;
    62   XDR *fBufferXDR;
     61  DelphesXDRWriter *fOutputWriter;
     62  DelphesXDRWriter *fIndexWriter;
     63  DelphesXDRWriter *fBufferWriter;
    6364};
    6465
    6566#endif // DelphesPileUpWriter_h
    66 
    67 
  • classes/DelphesSTDHEPReader.cc

    rfbad4c7 r4689481  
    3434#include <stdio.h>
    3535#include <errno.h>
    36 #include <rpc/types.h>
    37 #include <rpc/xdr.h>
     36#include <stdint.h>
     37#include <string.h>
    3838
    3939#include "TObjArray.h"
     
    4545#include "classes/DelphesClasses.h"
    4646#include "classes/DelphesFactory.h"
     47#include "classes/DelphesXDRReader.h"
    4748
    4849#include "ExRootAnalysis/ExRootTreeBranch.h"
     
    5556
    5657DelphesSTDHEPReader::DelphesSTDHEPReader() :
    57   fInputFile(0), fInputXDR(0), fBuffer(0), fPDG(0), fBlockType(-1)
    58 {
    59   fInputXDR = new XDR;
    60   fBuffer = new char[kBufferSize*96 + 24];
     58  fInputFile(0), fBuffer(0), fPDG(0), fBlockType(-1)
     59{
     60  fBuffer = new uint8_t[kBufferSize*96 + 24];
    6161
    6262  fPDG = TDatabasePDG::Instance();
     
    6868{
    6969  if(fBuffer) delete fBuffer;
    70   if(fInputXDR) delete fInputXDR;
    7170}
    7271
     
    7675{
    7776  fInputFile = inputFile;
    78   xdrstdio_create(fInputXDR, inputFile, XDR_DECODE);
     77  fReader[0].SetFile(inputFile);
    7978}
    8079
     
    10099  TObjArray *partonOutputArray)
    101100{
     101  fReader[0].ReadValue(&fBlockType, 4);
     102
    102103  if(feof(fInputFile)) return kFALSE;
    103 
    104   xdr_int(fInputXDR, &fBlockType);
    105104
    106105  SkipBytes(4);
     
    146145//---------------------------------------------------------------------------
    147146
    148 void DelphesSTDHEPReader::SkipBytes(u_int size)
     147void DelphesSTDHEPReader::SkipBytes(int size)
    149148{
    150149  int rc;
    151   u_int rndup;
     150  int rndup;
    152151
    153152  rndup = size % 4;
     
    161160  if(rc != 0 && errno == ESPIPE)
    162161  {
    163     xdr_opaque(fInputXDR, fBuffer, size);
    164   }
    165 }
    166 
    167 //---------------------------------------------------------------------------
    168 
    169 void DelphesSTDHEPReader::SkipArray(u_int elsize)
    170 {
    171   u_int size;
    172   xdr_u_int(fInputXDR, &size);
     162    fReader[0].ReadRaw(fBuffer, size);
     163  }
     164}
     165
     166//---------------------------------------------------------------------------
     167
     168void DelphesSTDHEPReader::SkipArray(int elsize)
     169{
     170  uint32_t size;
     171  fReader[0].ReadValue(&size, 4);
    173172  SkipBytes(size*elsize);
    174173}
     
    178177void DelphesSTDHEPReader::ReadFileHeader()
    179178{
    180   u_int i;
     179  uint32_t i;
    181180  enum STDHEPVersion {UNKNOWN, V1, V2, V21} version;
    182181
    183182  // version
    184   xdr_string(fInputXDR, &fBuffer, 100);
     183  fReader[0].ReadString(fBuffer, 100);
    185184  if(fBuffer[0] == '\0' || fBuffer[1] == '\0') version = UNKNOWN;
    186185  else if(fBuffer[0] == '1') version = V1;
    187   else if(strncmp(fBuffer, "2.01", 4) == 0) version = V21;
     186  else if(strncmp((char *)fBuffer, "2.01", 4) == 0) version = V21;
    188187  else if(fBuffer[0] == '2') version = V2;
    189188  else version = UNKNOWN;
     
    207206
    208207  // Number of events
    209   xdr_u_int(fInputXDR, &fEntries);
     208  fReader[0].ReadValue(&fEntries, 4);
    210209
    211210  SkipBytes(8);
    212211
    213212  // Number of blocks
    214   u_int nBlocks = 0;
    215   xdr_u_int(fInputXDR, &nBlocks);
     213  uint32_t nBlocks = 0;
     214  fReader[0].ReadValue(&nBlocks, 4);
    216215
    217216  // Number of NTuples
    218   u_int nNTuples = 0;
     217  uint32_t nNTuples = 0;
    219218  if(version != V1)
    220219  {
    221     xdr_u_int(fInputXDR, &nNTuples);
     220    fReader[0].ReadValue(&nNTuples, 4);
    222221  }
    223222
     
    244243{
    245244  // version
    246   xdr_string(fInputXDR, &fBuffer, 100);
    247   if(strncmp(fBuffer, "1.00", 4) == 0)
     245  fReader[0].ReadString(fBuffer, 100);
     246  if(strncmp((char *)fBuffer, "1.00", 4) == 0)
    248247  {
    249248    SkipBytes(8);
     
    255254    SkipArray(4);
    256255  }
    257   else if(strncmp(fBuffer, "2.00", 4) == 0)
     256  else if(strncmp((char *)fBuffer, "2.00", 4) == 0)
    258257  {
    259258    SkipBytes(12);
     
    272271{
    273272  bool skipNTuples = false;
    274   u_int skipSize = 4;
     273  int skipSize = 4;
    275274
    276275  // version
    277   xdr_string(fInputXDR, &fBuffer, 100);
    278   if(strncmp(fBuffer, "2.00", 4) == 0)
     276  fReader[0].ReadString(fBuffer, 100);
     277  if(strncmp((char *)fBuffer, "2.00", 4) == 0)
    279278  {
    280279    skipNTuples = true;
    281280  }
    282   else if(strncmp(fBuffer, "3.00", 4) == 0)
     281  else if(strncmp((char *)fBuffer, "3.00", 4) == 0)
    283282  {
    284283    skipNTuples = true;
     
    288287  SkipBytes(20);
    289288
    290   u_int dimBlocks = 0;
    291   xdr_u_int(fInputXDR, &dimBlocks);
    292 
    293   u_int dimNTuples = 0;
     289  uint32_t dimBlocks = 0;
     290  fReader[0].ReadValue(&dimBlocks, 4);
     291
     292  uint32_t dimNTuples = 0;
    294293  if(skipNTuples)
    295294  {
    296295    SkipBytes(4);
    297     xdr_u_int(fInputXDR, &dimNTuples);
     296    fReader[0].ReadValue(&dimNTuples, 4);
    298297  }
    299298
     
    318317{
    319318  // version
    320   xdr_string(fInputXDR, &fBuffer, 100);
     319  fReader[0].ReadString(fBuffer, 100);
    321320
    322321  // skip 5*4 + 2*8 = 36 bytes
    323322  SkipBytes(36);
    324323
    325   if((strncmp(fBuffer, "1.", 2) == 0) || (strncmp(fBuffer, "2.", 2) == 0) ||
    326      (strncmp(fBuffer, "3.", 2) == 0) || (strncmp(fBuffer, "4.", 2) == 0) ||
    327      (strncmp(fBuffer, "5.00", 4) == 0))
     324  if((strncmp((char *)fBuffer, "1.", 2) == 0) || (strncmp((char *)fBuffer, "2.", 2) == 0) ||
     325     (strncmp((char *)fBuffer, "3.", 2) == 0) || (strncmp((char *)fBuffer, "4.", 2) == 0) ||
     326     (strncmp((char *)fBuffer, "5.00", 4) == 0))
    328327  {
    329328    return;
     
    333332  SkipArray(1);
    334333
    335   if(strncmp(fBuffer, "5.01", 4) == 0)
     334  if(strncmp((char *)fBuffer, "5.01", 4) == 0)
    336335  {
    337336    return;
     
    345344void DelphesSTDHEPReader::ReadSTDHEP()
    346345{
    347   u_int idhepSize, isthepSize, jmohepSize, jdahepSize, phepSize, vhepSize;
     346  uint32_t idhepSize, isthepSize, jmohepSize, jdahepSize, phepSize, vhepSize;
    348347
    349348  // version
    350   xdr_string(fInputXDR, &fBuffer, 100);
     349  fReader[0].ReadString(fBuffer, 100);
    351350
    352351  // Extracting the event number
    353   xdr_int(fInputXDR, &fEventNumber);
     352  fReader[0].ReadValue(&fEventNumber, 4);
    354353
    355354  // Extracting the number of particles
    356   xdr_int(fInputXDR, &fEventSize);
     355  fReader[0].ReadValue(&fEventSize, 4);
    357356
    358357  if(fEventSize >= kBufferSize)
     
    364363  // 4 + 4 + 4 + 4 + 4 + 4 = 96*n + 24
    365364
    366   xdr_opaque(fInputXDR, fBuffer, 96*fEventSize + 24);
    367 
    368   idhepSize = ntohl(*(u_int*)(fBuffer));
    369   isthepSize = ntohl(*(u_int*)(fBuffer + 4*1 + 4*1*fEventSize));
    370   jmohepSize = ntohl(*(u_int*)(fBuffer + 4*2 + 4*2*fEventSize));
    371   jdahepSize = ntohl(*(u_int*)(fBuffer + 4*3 + 4*4*fEventSize));
    372   phepSize = ntohl(*(u_int*)(fBuffer + 4*4 + 4*6*fEventSize));
    373   vhepSize = ntohl(*(u_int*)(fBuffer + 4*5 + 4*16*fEventSize));
     365  fReader[0].ReadRaw(fBuffer, 96*fEventSize + 24);
     366
     367  fReader[1].SetBuffer(fBuffer);
     368  fReader[2].SetBuffer(fBuffer + 4*1 + 4*1*fEventSize);
     369  fReader[3].SetBuffer(fBuffer + 4*2 + 4*2*fEventSize);
     370  fReader[4].SetBuffer(fBuffer + 4*3 + 4*4*fEventSize);
     371  fReader[5].SetBuffer(fBuffer + 4*4 + 4*6*fEventSize);
     372  fReader[6].SetBuffer(fBuffer + 4*5 + 4*16*fEventSize);
     373
     374  fReader[1].ReadValue(&idhepSize, 4);
     375  fReader[2].ReadValue(&isthepSize, 4);
     376  fReader[3].ReadValue(&jmohepSize, 4);
     377  fReader[4].ReadValue(&jdahepSize, 4);
     378  fReader[5].ReadValue(&phepSize, 4);
     379  fReader[6].ReadValue(&vhepSize, 4);
    374380
    375381  if(fEventSize < 0 ||
     
    392398void DelphesSTDHEPReader::ReadSTDHEP4()
    393399{
    394   u_int number;
     400  uint32_t number;
    395401
    396402  // Extracting the event weight
    397   xdr_double(fInputXDR, &fWeight);
     403  fReader[0].ReadValue(&fWeight, 8);
    398404
    399405  // Extracting alpha QED
    400   xdr_double(fInputXDR, &fAlphaQED);
     406  fReader[0].ReadValue(&fAlphaQED, 8);
    401407
    402408  // Extracting alpha QCD
    403   xdr_double(fInputXDR, &fAlphaQCD);
     409  fReader[0].ReadValue(&fAlphaQCD, 8);
    404410
    405411  // Extracting the event scale
    406   xdr_u_int(fInputXDR, &fScaleSize);
     412  fReader[0].ReadValue(&fScaleSize, 4);
    407413  for(number = 0; number < fScaleSize; ++number)
    408414  {
    409     xdr_double(fInputXDR, &fScale[number]);
     415    fReader[0].ReadValue(&fScale[number], 8);
    410416  }
    411417
     
    450456
    451457  int number;
    452   int pid, status, m1, m2, d1, d2;
     458  int32_t pid, status, m1, m2, d1, d2;
    453459  double px, py, pz, e, mass;
    454460  double x, y, z, t;
    455461
    456   XDR bufferXDR[6];
    457   xdrmem_create(&bufferXDR[0], fBuffer + 4*1, 4*fEventSize, XDR_DECODE);
    458   xdrmem_create(&bufferXDR[1], fBuffer + 4*2 + 4*1*fEventSize, 4*fEventSize, XDR_DECODE);
    459   xdrmem_create(&bufferXDR[2], fBuffer + 4*3 + 4*2*fEventSize, 8*fEventSize, XDR_DECODE);
    460   xdrmem_create(&bufferXDR[3], fBuffer + 4*4 + 4*4*fEventSize, 8*fEventSize, XDR_DECODE);
    461   xdrmem_create(&bufferXDR[4], fBuffer + 4*5 + 4*6*fEventSize, 40*fEventSize, XDR_DECODE);
    462   xdrmem_create(&bufferXDR[5], fBuffer + 4*6 + 4*16*fEventSize, 32*fEventSize, XDR_DECODE);
    463 
    464462  for(number = 0; number < fEventSize; ++number)
    465463  {
    466     xdr_int(&bufferXDR[0], &status);
    467     xdr_int(&bufferXDR[1], &pid);
    468     xdr_int(&bufferXDR[2], &m1);
    469     xdr_int(&bufferXDR[2], &m2);
    470     xdr_int(&bufferXDR[3], &d1);
    471     xdr_int(&bufferXDR[3], &d2);
    472 
    473     xdr_double(&bufferXDR[4], &px);
    474     xdr_double(&bufferXDR[4], &py);
    475     xdr_double(&bufferXDR[4], &pz);
    476     xdr_double(&bufferXDR[4], &e);
    477     xdr_double(&bufferXDR[4], &mass);
    478 
    479     xdr_double(&bufferXDR[5], &x);
    480     xdr_double(&bufferXDR[5], &y);
    481     xdr_double(&bufferXDR[5], &z);
    482     xdr_double(&bufferXDR[5], &t);
     464    fReader[1].ReadValue(&status, 4);
     465    fReader[2].ReadValue(&pid, 4);
     466    fReader[3].ReadValue(&m1, 4);
     467    fReader[3].ReadValue(&m2, 4);
     468    fReader[4].ReadValue(&d1, 4);
     469    fReader[4].ReadValue(&d2, 4);
     470
     471    fReader[5].ReadValue(&px, 8);
     472    fReader[5].ReadValue(&py, 8);
     473    fReader[5].ReadValue(&pz, 8);
     474    fReader[5].ReadValue(&e, 8);
     475    fReader[5].ReadValue(&mass, 8);
     476
     477    fReader[6].ReadValue(&x, 8);
     478    fReader[6].ReadValue(&y, 8);
     479    fReader[6].ReadValue(&z, 8);
     480    fReader[6].ReadValue(&t, 8);
    483481
    484482    candidate = factory->NewCandidate();
  • classes/DelphesSTDHEPReader.h

    rfbad4c7 r4689481  
    2929
    3030#include <stdio.h>
    31 #include <rpc/types.h>
    32 #include <rpc/xdr.h>
     31#include <stdint.h>
     32
     33#include "classes/DelphesXDRReader.h"
    3334
    3435class TObjArray;
     
    3738class ExRootTreeBranch;
    3839class DelphesFactory;
     40class DelphesXDRReader;
    3941
    4042class DelphesSTDHEPReader
     
    7678    TObjArray *partonOutputArray);
    7779
    78   void SkipBytes(u_int size);
    79   void SkipArray(u_int elsize);
     80  void SkipBytes(int size);
     81  void SkipArray(int elsize);
    8082
    8183  void ReadFileHeader();
     
    8890  FILE *fInputFile;
    8991
    90   XDR *fInputXDR;
     92  DelphesXDRReader fReader[7];
    9193
    92   char *fBuffer;
     94  uint8_t *fBuffer;
    9395
    9496  TDatabasePDG *fPDG;
    9597
    96   u_int fEntries;
    97   int fBlockType, fEventNumber, fEventSize;
     98  uint32_t fEntries;
     99  int32_t fBlockType, fEventNumber, fEventSize;
    98100  double fWeight, fAlphaQCD, fAlphaQED;
    99101
    100   u_int fScaleSize;
     102  uint32_t fScaleSize;
    101103  double fScale[10];
    102104};
    103105
    104106#endif // DelphesSTDHEPReader_h
    105 
    106 
  • converters/pileup2root.cpp

    rfbad4c7 r4689481  
    2626#include <stdio.h>
    2727
    28 #include <rpc/types.h>
    29 #include <rpc/xdr.h>
    30 
    3128#include "TROOT.h"
    3229#include "TApplication.h"
  • converters/root2lhco.cpp

    rfbad4c7 r4689481  
    107107//------------------------------------------------------------------------------
    108108
    109 LHCOWriter::LHCOWriter(ExRootTreeReader *treeReader, FILE *outputFile, string JetBranchName) :
     109LHCOWriter::LHCOWriter(ExRootTreeReader *treeReader, FILE *outputFile, string jetBranchName) :
    110110  fTriggerWord(0), fEventNumber(1), fTreeReader(0), fOutputFile(0),
    111111  fBranchEvent(0), fBranchTrack(0), fBranchTower(0), fBranchPhoton(0),
     
    128128  fBranchMuon = fTreeReader->UseBranch("Muon");
    129129  // reconstructed jets
    130   fBranchJet = fTreeReader->UseBranch(JetBranchName.c_str());
     130  fBranchJet = fTreeReader->UseBranch(jetBranchName.c_str());
    131131  // missing transverse energy
    132132  fBranchMissingET = fTreeReader->UseBranch("MissingET");
     
    436436//---------------------------------------------------------------------------
    437437
    438 pair<string,string> stringToOption(string s) {
    439 
    440         string delimiter = "=";
    441 
    442         vector<string> vs;
    443         pair<string,string> res;
    444 
    445         size_t pos = 0;
    446         string token;
    447         while ((pos = s.find(delimiter)) != std::string::npos) {
    448             token = s.substr(0, pos);
    449             //cout << token << std::endl;
    450                         vs.push_back(token);
    451             s.erase(0, pos + delimiter.length());
    452         }
    453 
    454         //std::cout << s << std::endl;
    455         vs.push_back(s);
    456 
    457         if (vs.size()==2){
    458                 res.first=vs[0];
    459                 res.second=vs[1];
    460         }
    461 
    462         return res;
    463 
    464 }
    465 
     438vector<string> ArgSplitter(char *arg)
     439{
     440  string s = arg;
     441  string delimiter = "=";
     442  vector<string> result;
     443  size_t first = 0, last = 0;
     444
     445  while((last = s.find(delimiter, first)) != string::npos)
     446  {
     447    result.push_back(s.substr(first, last - first));
     448    first = last + delimiter.length();
     449  }
     450
     451  result.push_back(s.substr(first, last));
     452
     453  return result;
     454}
     455
     456//---------------------------------------------------------------------------
    466457
    467458int main(int argc, char *argv[])
    468459{
     460  int i, j;
    469461  char appName[] = "root2lhco";
    470462  stringstream message;
     
    474466  ExRootTreeReader *treeReader = 0;
    475467  Long64_t entry, allEntries;
    476   string  JetBranchName="Jet";
     468  string jetBranchName = "Jet";
     469  vector<string> result;
    477470
    478471  if(argc < 2 || argc > 4)
    479472  {
    480     cerr << " Usage: " << appName << " input_file" << " [output_file]  [--jet-branch=Jet]" << endl;
     473    cerr << " Usage: " << appName << " input_file" << " [output_file] [--jet-branch=Jet]" << endl;
    481474    cerr << " input_file - input file in ROOT format," << endl;
    482475    cerr << " output_file - output file in LHCO format," << endl;
    483476    cerr << " with no output_file, or when output_file is -, write to standard output." << endl;
    484     cerr << " in order to specify the jet-branch name the output_file cannot be omitted." << endl;
    485477    return 1;
    486478  }
    487479
    488   for(int iarg=3; iarg< argc    ; iarg++){
    489 
    490                 string argument=argv[iarg];
    491                 pair<string,string> option;
    492                 option=stringToOption(argument);
    493 
    494                 if ( option.first == "--jet-branch" ) {
    495       JetBranchName = option.second;
    496       cout << " Using the jet branch named " << JetBranchName << endl;
    497     }
    498         }
    499   cout << " Using the default jet branch named " << JetBranchName << endl;
    500 
     480  i = 2;
     481  while(i < argc)
     482  {
     483    result = ArgSplitter(argv[i]);
     484
     485    if(result.size() == 2 && result[0] == "--jet-branch")
     486    {
     487      jetBranchName = result[1];
     488      for(j = i + 1; j < argc; ++j) argv[j - 1] = argv[j];
     489      --argc;
     490    }
     491    else
     492    {
     493      ++i;
     494    }
     495  }
     496  cerr << "** Using the jet branch named " << jetBranchName << endl;
    501497
    502498  signal(SIGINT, SignalHandler);
     
    539535    {
    540536      // Create LHC Olympics converter:
    541       writer = new LHCOWriter(treeReader, outputFile, JetBranchName);
     537      writer = new LHCOWriter(treeReader, outputFile, jetBranchName);
    542538
    543539      ExRootProgressBar progressBar(allEntries - 1);
  • doc/genMakefile.tcl

    rfbad4c7 r4689481  
    208208PcmSuf = _rdict.pcm
    209209
    210 CXXFLAGS += $(ROOTCFLAGS) -Wno-write-strings -D_FILE_OFFSET_BITS=64 -DDROP_CGAL -I. -Iexternal -Iexternal/tcl -I/usr/include/tirpc
     210CXXFLAGS += $(ROOTCFLAGS) -Wno-write-strings -D_FILE_OFFSET_BITS=64 -DDROP_CGAL -I. -Iexternal -Iexternal/tcl
    211211DELPHES_LIBS = $(shell $(RC) --libs) -lEG $(SYSLIBS)
    212212DISPLAY_LIBS = $(shell $(RC) --evelibs) -lGuiHtml $(SYSLIBS)
  • modules/CMakeLists.txt

    rfbad4c7 r4689481  
    1414DELPHES_GENERATE_DICTIONARY(ModulesDict ${headers} LINKDEF ModulesLinkDef.h)
    1515
    16 # TODO: implement switch to enable Pythia8 if present
    17 list(REMOVE_ITEM sources ${CMAKE_CURRENT_SOURCE_DIR}/PileUpMergerPythia8.cc)
    18 
    19 add_library(modules OBJECT ${sources} FastJetDict.cxx ModulesDict.cxx)
     16if(PYTHIA8_FOUND)
     17  DELPHES_GENERATE_DICTIONARY(Pythia8Dict ${headers} LINKDEF Pythia8LinkDef.h)
     18  add_library(modules OBJECT ${sources} FastJetDict.cxx ModulesDict.cxx Pythia8Dict.cxx)
     19else()
     20  list(REMOVE_ITEM sources ${CMAKE_CURRENT_SOURCE_DIR}/PileUpMergerPythia8.cc)
     21  add_library(modules OBJECT ${sources} FastJetDict.cxx ModulesDict.cxx)
     22endif()
    2023
    2124# install headers
  • readers/CMakeLists.txt

    rfbad4c7 r4689481  
    66file(GLOB executables RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
    77
    8 # TODO: implement switch to enable CMSSW, ProMC and Pythia8 if present
     8# TODO: implement switch to enable CMSSW and ProMC if present
    99list(REMOVE_ITEM executables DelphesCMSFWLite.cpp)
    1010list(REMOVE_ITEM executables DelphesProMC.cpp)
Note: See TracChangeset for help on using the changeset viewer.