Fork me on GitHub

Changes in / [4689481:fbad4c7] in git


Ignore:
Files:
4 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • .circleci/config.yml

    r4689481 rfbad4c7  
    1313            echo 'export LD_LIBRARY_PATH=$ROOTSYS/lib:$LD_LIBRARY_PATH' >> $BASH_ENV
    1414          fi
    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
     15          echo 'export PYTHIA8=/opt/pythia' >> $BASH_ENV
    2016    - run:
    2117        name: Build Delphes using make
  • CMakeLists.txt

    r4689481 rfbad4c7  
    3636if(PYTHIA8_FOUND)
    3737  include_directories(${PYTHIA8_INCLUDE_DIRS})
    38 endif()
     38endif(PYTHIA8_FOUND)
    3939
    4040if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
     
    4949  endif()
    5050endfunction()
     51
     52
    5153
    5254# Declare position of all other externals needed
     
    8587target_link_Libraries(Delphes ${ROOT_LIBRARIES} ${ROOT_COMPONENT_LIBRARIES})
    8688target_link_Libraries(DelphesDisplay ${ROOT_LIBRARIES} ${ROOT_COMPONENT_LIBRARIES})
    87 
    8889if(PYTHIA8_FOUND)
    8990  target_link_libraries(Delphes ${PYTHIA8_LIBRARIES} ${CMAKE_DL_LIBS})
    90 endif()
     91endif(PYTHIA8_FOUND)
     92
    9193
    9294install(TARGETS Delphes DelphesDisplay DESTINATION lib)
  • Makefile

    r4689481 rfbad4c7  
    1515PcmSuf = _rdict.pcm
    1616
    17 CXXFLAGS += $(ROOTCFLAGS) -Wno-write-strings -D_FILE_OFFSET_BITS=64 -DDROP_CGAL -I. -Iexternal -Iexternal/tcl
     17CXXFLAGS += $(ROOTCFLAGS) -Wno-write-strings -D_FILE_OFFSET_BITS=64 -DDROP_CGAL -I. -Iexternal -Iexternal/tcl -I/usr/include/tirpc
    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 \
    485         classes/DelphesXDRReader.h
     484        classes/DelphesPileUpReader.h
    486485tmp/classes/DelphesPileUpWriter.$(ObjSuf): \
    487486        classes/DelphesPileUpWriter.$(SrcSuf) \
    488         classes/DelphesPileUpWriter.h \
    489         classes/DelphesXDRWriter.h
     487        classes/DelphesPileUpWriter.h
    490488tmp/classes/DelphesSTDHEPReader.$(ObjSuf): \
    491489        classes/DelphesSTDHEPReader.$(SrcSuf) \
     
    493491        classes/DelphesClasses.h \
    494492        classes/DelphesFactory.h \
    495         classes/DelphesXDRReader.h \
    496493        external/ExRootAnalysis/ExRootTreeBranch.h
    497494tmp/classes/DelphesStream.$(ObjSuf): \
     
    501498        classes/DelphesTF2.$(SrcSuf) \
    502499        classes/DelphesTF2.h
    503 tmp/classes/DelphesXDRReader.$(ObjSuf): \
    504         classes/DelphesXDRReader.$(SrcSuf) \
    505         classes/DelphesXDRReader.h
    506 tmp/classes/DelphesXDRWriter.$(ObjSuf): \
    507         classes/DelphesXDRWriter.$(SrcSuf) \
    508         classes/DelphesXDRWriter.h
    509500tmp/external/ExRootAnalysis/ExRootConfReader.$(ObjSuf): \
    510501        external/ExRootAnalysis/ExRootConfReader.$(SrcSuf) \
     
    10231014        tmp/classes/DelphesStream.$(ObjSuf) \
    10241015        tmp/classes/DelphesTF2.$(ObjSuf) \
    1025         tmp/classes/DelphesXDRReader.$(ObjSuf) \
    1026         tmp/classes/DelphesXDRWriter.$(ObjSuf) \
    10271016        tmp/external/ExRootAnalysis/ExRootConfReader.$(ObjSuf) \
    10281017        tmp/external/ExRootAnalysis/ExRootFilter.$(ObjSuf) \
     
    20442033        @touch $@
    20452034
    2046 classes/DelphesSTDHEPReader.h: \
    2047         classes/DelphesXDRReader.h
    2048         @touch $@
    2049 
    20502035external/fastjet/plugins/CDFCones/fastjet/CDFMidPointPlugin.hh: \
    20512036        external/fastjet/JetDefinition.hh
  • classes/DelphesPileUpReader.cc

    r4689481 rfbad4c7  
    3333
    3434#include <stdio.h>
    35 #include <stdint.h>
    36 
    37 #include "classes/DelphesXDRReader.h"
     35#include <rpc/types.h>
     36#include <rpc/xdr.h>
    3837
    3938using namespace std;
     
    4847  fEntries(0), fEntrySize(0), fCounter(0),
    4948  fPileUpFile(0), fIndex(0), fBuffer(0),
    50   fInputReader(0), fIndexReader(0), fBufferReader(0)
     49  fInputXDR(0), fIndexXDR(0), fBufferXDR(0)
    5150{
    5251  stringstream message;
    5352
    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);
     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);
    6260
    6361  fPileUpFile = fopen(fileName, "r");
     
    6967  }
    7068
    71   fInputReader->SetFile(fPileUpFile);
     69  xdrstdio_create(fInputXDR, fPileUpFile, XDR_DECODE);
    7270
    7371  // read number of events
    7472  fseeko(fPileUpFile, -8, SEEK_END);
    75   fInputReader->ReadValue(&fEntries, 8);
     73  xdr_hyper(fInputXDR, &fEntries);
    7674
    7775  if(fEntries >= kIndexSize)
     
    8381  // read index of events
    8482  fseeko(fPileUpFile, -8 - 8*fEntries, SEEK_END);
    85   fInputReader->ReadRaw(fIndex, fEntries*8);
     83  xdr_opaque(fInputXDR, fIndex, fEntries*8);
    8684}
    8785
     
    9088DelphesPileUpReader::~DelphesPileUpReader()
    9189{
     90  xdr_destroy(fInputXDR);
    9291  if(fPileUpFile) fclose(fPileUpFile);
    93   if(fBufferReader) delete fBufferReader;
    94   if(fIndexReader) delete fIndexReader;
    95   if(fInputReader) delete fInputReader;
     92  xdr_destroy(fBufferXDR);
     93  xdr_destroy(fIndexXDR);
     94  if(fBufferXDR) delete fBufferXDR;
     95  if(fIndexXDR) delete fIndexXDR;
     96  if(fInputXDR) delete fInputXDR;
    9697  if(fBuffer) delete[] fBuffer;
    9798  if(fIndex) delete[] fIndex;
     
    100101//------------------------------------------------------------------------------
    101102
    102 bool DelphesPileUpReader::ReadParticle(int32_t &pid,
     103bool DelphesPileUpReader::ReadParticle(int &pid,
    103104  float &x, float &y, float &z, float &t,
    104105  float &px, float &py, float &pz, float &e)
     
    106107  if(fCounter >= fEntrySize) return false;
    107108
    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);
     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);
    117118
    118119  ++fCounter;
     
    123124//------------------------------------------------------------------------------
    124125
    125 bool DelphesPileUpReader::ReadEntry(int64_t entry)
     126bool DelphesPileUpReader::ReadEntry(quad_t entry)
    126127{
    127   int64_t offset;
     128  quad_t offset;
    128129
    129130  if(entry >= fEntries) return false;
    130131
    131132  // read event position
    132   fIndexReader->SetOffset(8*entry);
    133   fIndexReader->ReadValue(&offset, 8);
     133  xdr_setpos(fIndexXDR, 8*entry);
     134  xdr_hyper(fIndexXDR, &offset);
    134135
    135136  // read event
    136137  fseeko(fPileUpFile, offset, SEEK_SET);
    137   fInputReader->ReadValue(&fEntrySize, 4);
     138  xdr_int(fInputXDR, &fEntrySize);
    138139
    139140  if(fEntrySize >= kBufferSize)
     
    142143  }
    143144
    144   fInputReader->ReadRaw(fBuffer, fEntrySize*kRecordSize*4);
    145   fBufferReader->SetOffset(0);
     145  xdr_opaque(fInputXDR, fBuffer, fEntrySize*kRecordSize*4);
     146  xdr_setpos(fBufferXDR, 0);
    146147  fCounter = 0;
    147148
  • classes/DelphesPileUpReader.h

    r4689481 rfbad4c7  
    2929
    3030#include <stdio.h>
    31 #include <stdint.h>
    32 
    33 class DelphesXDRReader;
     31#include <rpc/types.h>
     32#include <rpc/xdr.h>
    3433
    3534class DelphesPileUpReader
     
    4140  ~DelphesPileUpReader();
    4241
    43   bool ReadParticle(int32_t &pid,
     42  bool ReadParticle(int &pid,
    4443    float &x, float &y, float &z, float &t,
    4544    float &px, float &py, float &pz, float &e);
    4645
    47   bool ReadEntry(int64_t entry);
     46  bool ReadEntry(quad_t entry);
    4847
    49   int64_t GetEntries() const { return fEntries; }
     48  quad_t GetEntries() const { return fEntries; }
    5049
    5150private:
    5251
    53   int64_t fEntries;
     52  quad_t fEntries;
    5453
    55   int32_t fEntrySize;
    56   int32_t fCounter;
     54  int fEntrySize;
     55  int fCounter;
    5756
    5857  FILE *fPileUpFile;
    59   uint8_t *fIndex;
    60   uint8_t *fBuffer;
     58  char *fIndex;
     59  char *fBuffer;
    6160
    62   DelphesXDRReader *fInputReader;
    63   DelphesXDRReader *fIndexReader;
    64   DelphesXDRReader *fBufferReader;
     61  XDR *fInputXDR;
     62  XDR *fIndexXDR;
     63  XDR *fBufferXDR;
    6564};
    6665
    6766#endif // DelphesPileUpReader_h
     67
     68
  • classes/DelphesPileUpWriter.cc

    r4689481 rfbad4c7  
    3333
    3434#include <stdio.h>
    35 #include <stdint.h>
    36 
    37 #include "classes/DelphesXDRWriter.h"
     35#include <rpc/types.h>
     36#include <rpc/xdr.h>
    3837
    3938using namespace std;
     
    4847  fEntries(0), fEntrySize(0), fOffset(0),
    4948  fPileUpFile(0), fIndex(0), fBuffer(0),
    50   fOutputWriter(0), fIndexWriter(0), fBufferWriter(0)
     49  fOutputXDR(0), fIndexXDR(0), fBufferXDR(0)
    5150{
    5251  stringstream message;
    5352
    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);
     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);
    6260
    6361  fPileUpFile = fopen(fileName, "w+");
     
    6967  }
    7068
    71   fOutputWriter->SetFile(fPileUpFile);
     69  xdrstdio_create(fOutputXDR, fPileUpFile, XDR_ENCODE);
    7270}
    7371
     
    7674DelphesPileUpWriter::~DelphesPileUpWriter()
    7775{
     76  xdr_destroy(fOutputXDR);
    7877  if(fPileUpFile) fclose(fPileUpFile);
    79   if(fBufferWriter) delete fBufferWriter;
    80   if(fIndexWriter) delete fIndexWriter;
    81   if(fOutputWriter) delete fOutputWriter;
     78  xdr_destroy(fBufferXDR);
     79  xdr_destroy(fIndexXDR);
     80  if(fBufferXDR) delete fBufferXDR;
     81  if(fIndexXDR) delete fIndexXDR;
     82  if(fOutputXDR) delete fOutputXDR;
    8283  if(fBuffer) delete[] fBuffer;
    8384  if(fIndex) delete[] fIndex;
     
    8687//------------------------------------------------------------------------------
    8788
    88 void DelphesPileUpWriter::WriteParticle(int32_t pid,
     89void DelphesPileUpWriter::WriteParticle(int pid,
    8990  float x, float y, float z, float t,
    9091  float px, float py, float pz, float e)
     
    9596  }
    9697
    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);
     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);
    106107
    107108  ++fEntrySize;
     
    117118  }
    118119
    119   fOutputWriter->WriteValue(&fEntrySize, 4);
    120   fOutputWriter->WriteRaw(fBuffer, fEntrySize*kRecordSize*4);
     120  xdr_int(fOutputXDR, &fEntrySize);
     121  xdr_opaque(fOutputXDR, fBuffer, fEntrySize*kRecordSize*4);
    121122
    122   fIndexWriter->WriteValue(&fOffset, 8);
     123  xdr_hyper(fIndexXDR, &fOffset);
    123124  fOffset += fEntrySize*kRecordSize*4 + 4;
    124125
    125   fBufferWriter->SetOffset(0);
     126  xdr_setpos(fBufferXDR, 0);
    126127  fEntrySize = 0;
    127 
     128       
    128129  ++fEntries;
    129130}
     
    133134void DelphesPileUpWriter::WriteIndex()
    134135{
    135   fOutputWriter->WriteRaw(fIndex, fEntries*8);
    136   fOutputWriter->WriteValue(&fEntries, 8);
     136  xdr_opaque(fOutputXDR, fIndex, fEntries*8);
     137  xdr_hyper(fOutputXDR, &fEntries);
    137138}
    138139
  • classes/DelphesPileUpWriter.h

    r4689481 rfbad4c7  
    2929
    3030#include <stdio.h>
    31 #include <stdint.h>
    32 
    33 class DelphesXDRWriter;
     31#include <rpc/types.h>
     32#include <rpc/xdr.h>
    3433
    3534class DelphesPileUpWriter
     
    4140  ~DelphesPileUpWriter();
    4241
    43   void WriteParticle(int32_t pid,
     42  void WriteParticle(int pid,
    4443    float x, float y, float z, float t,
    4544    float px, float py, float pz, float e);
     
    5150private:
    5251
    53   int64_t fEntries;
    54   int32_t fEntrySize;
    55   int64_t fOffset;
     52  quad_t fEntries;
     53  int fEntrySize;
     54  quad_t fOffset;
    5655
    5756  FILE *fPileUpFile;
    58   uint8_t *fIndex;
    59   uint8_t *fBuffer;
     57  char *fIndex;
     58  char *fBuffer;
    6059
    61   DelphesXDRWriter *fOutputWriter;
    62   DelphesXDRWriter *fIndexWriter;
    63   DelphesXDRWriter *fBufferWriter;
     60  XDR *fOutputXDR;
     61  XDR *fIndexXDR;
     62  XDR *fBufferXDR;
    6463};
    6564
    6665#endif // DelphesPileUpWriter_h
     66
     67
  • classes/DelphesSTDHEPReader.cc

    r4689481 rfbad4c7  
    3434#include <stdio.h>
    3535#include <errno.h>
    36 #include <stdint.h>
    37 #include <string.h>
     36#include <rpc/types.h>
     37#include <rpc/xdr.h>
    3838
    3939#include "TObjArray.h"
     
    4545#include "classes/DelphesClasses.h"
    4646#include "classes/DelphesFactory.h"
    47 #include "classes/DelphesXDRReader.h"
    4847
    4948#include "ExRootAnalysis/ExRootTreeBranch.h"
     
    5655
    5756DelphesSTDHEPReader::DelphesSTDHEPReader() :
    58   fInputFile(0), fBuffer(0), fPDG(0), fBlockType(-1)
    59 {
    60   fBuffer = new uint8_t[kBufferSize*96 + 24];
     57  fInputFile(0), fInputXDR(0), fBuffer(0), fPDG(0), fBlockType(-1)
     58{
     59  fInputXDR = new XDR;
     60  fBuffer = new char[kBufferSize*96 + 24];
    6161
    6262  fPDG = TDatabasePDG::Instance();
     
    6868{
    6969  if(fBuffer) delete fBuffer;
     70  if(fInputXDR) delete fInputXDR;
    7071}
    7172
     
    7576{
    7677  fInputFile = inputFile;
    77   fReader[0].SetFile(inputFile);
     78  xdrstdio_create(fInputXDR, inputFile, XDR_DECODE);
    7879}
    7980
     
    99100  TObjArray *partonOutputArray)
    100101{
    101   fReader[0].ReadValue(&fBlockType, 4);
    102 
    103102  if(feof(fInputFile)) return kFALSE;
     103
     104  xdr_int(fInputXDR, &fBlockType);
    104105
    105106  SkipBytes(4);
     
    145146//---------------------------------------------------------------------------
    146147
    147 void DelphesSTDHEPReader::SkipBytes(int size)
     148void DelphesSTDHEPReader::SkipBytes(u_int size)
    148149{
    149150  int rc;
    150   int rndup;
     151  u_int rndup;
    151152
    152153  rndup = size % 4;
     
    160161  if(rc != 0 && errno == ESPIPE)
    161162  {
    162     fReader[0].ReadRaw(fBuffer, size);
    163   }
    164 }
    165 
    166 //---------------------------------------------------------------------------
    167 
    168 void DelphesSTDHEPReader::SkipArray(int elsize)
    169 {
    170   uint32_t size;
    171   fReader[0].ReadValue(&size, 4);
     163    xdr_opaque(fInputXDR, fBuffer, size);
     164  }
     165}
     166
     167//---------------------------------------------------------------------------
     168
     169void DelphesSTDHEPReader::SkipArray(u_int elsize)
     170{
     171  u_int size;
     172  xdr_u_int(fInputXDR, &size);
    172173  SkipBytes(size*elsize);
    173174}
     
    177178void DelphesSTDHEPReader::ReadFileHeader()
    178179{
    179   uint32_t i;
     180  u_int i;
    180181  enum STDHEPVersion {UNKNOWN, V1, V2, V21} version;
    181182
    182183  // version
    183   fReader[0].ReadString(fBuffer, 100);
     184  xdr_string(fInputXDR, &fBuffer, 100);
    184185  if(fBuffer[0] == '\0' || fBuffer[1] == '\0') version = UNKNOWN;
    185186  else if(fBuffer[0] == '1') version = V1;
    186   else if(strncmp((char *)fBuffer, "2.01", 4) == 0) version = V21;
     187  else if(strncmp(fBuffer, "2.01", 4) == 0) version = V21;
    187188  else if(fBuffer[0] == '2') version = V2;
    188189  else version = UNKNOWN;
     
    206207
    207208  // Number of events
    208   fReader[0].ReadValue(&fEntries, 4);
     209  xdr_u_int(fInputXDR, &fEntries);
    209210
    210211  SkipBytes(8);
    211212
    212213  // Number of blocks
    213   uint32_t nBlocks = 0;
    214   fReader[0].ReadValue(&nBlocks, 4);
     214  u_int nBlocks = 0;
     215  xdr_u_int(fInputXDR, &nBlocks);
    215216
    216217  // Number of NTuples
    217   uint32_t nNTuples = 0;
     218  u_int nNTuples = 0;
    218219  if(version != V1)
    219220  {
    220     fReader[0].ReadValue(&nNTuples, 4);
     221    xdr_u_int(fInputXDR, &nNTuples);
    221222  }
    222223
     
    243244{
    244245  // version
    245   fReader[0].ReadString(fBuffer, 100);
    246   if(strncmp((char *)fBuffer, "1.00", 4) == 0)
     246  xdr_string(fInputXDR, &fBuffer, 100);
     247  if(strncmp(fBuffer, "1.00", 4) == 0)
    247248  {
    248249    SkipBytes(8);
     
    254255    SkipArray(4);
    255256  }
    256   else if(strncmp((char *)fBuffer, "2.00", 4) == 0)
     257  else if(strncmp(fBuffer, "2.00", 4) == 0)
    257258  {
    258259    SkipBytes(12);
     
    271272{
    272273  bool skipNTuples = false;
    273   int skipSize = 4;
     274  u_int skipSize = 4;
    274275
    275276  // version
    276   fReader[0].ReadString(fBuffer, 100);
    277   if(strncmp((char *)fBuffer, "2.00", 4) == 0)
     277  xdr_string(fInputXDR, &fBuffer, 100);
     278  if(strncmp(fBuffer, "2.00", 4) == 0)
    278279  {
    279280    skipNTuples = true;
    280281  }
    281   else if(strncmp((char *)fBuffer, "3.00", 4) == 0)
     282  else if(strncmp(fBuffer, "3.00", 4) == 0)
    282283  {
    283284    skipNTuples = true;
     
    287288  SkipBytes(20);
    288289
    289   uint32_t dimBlocks = 0;
    290   fReader[0].ReadValue(&dimBlocks, 4);
    291 
    292   uint32_t dimNTuples = 0;
     290  u_int dimBlocks = 0;
     291  xdr_u_int(fInputXDR, &dimBlocks);
     292
     293  u_int dimNTuples = 0;
    293294  if(skipNTuples)
    294295  {
    295296    SkipBytes(4);
    296     fReader[0].ReadValue(&dimNTuples, 4);
     297    xdr_u_int(fInputXDR, &dimNTuples);
    297298  }
    298299
     
    317318{
    318319  // version
    319   fReader[0].ReadString(fBuffer, 100);
     320  xdr_string(fInputXDR, &fBuffer, 100);
    320321
    321322  // skip 5*4 + 2*8 = 36 bytes
    322323  SkipBytes(36);
    323324
    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))
     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))
    327328  {
    328329    return;
     
    332333  SkipArray(1);
    333334
    334   if(strncmp((char *)fBuffer, "5.01", 4) == 0)
     335  if(strncmp(fBuffer, "5.01", 4) == 0)
    335336  {
    336337    return;
     
    344345void DelphesSTDHEPReader::ReadSTDHEP()
    345346{
    346   uint32_t idhepSize, isthepSize, jmohepSize, jdahepSize, phepSize, vhepSize;
     347  u_int idhepSize, isthepSize, jmohepSize, jdahepSize, phepSize, vhepSize;
    347348
    348349  // version
    349   fReader[0].ReadString(fBuffer, 100);
     350  xdr_string(fInputXDR, &fBuffer, 100);
    350351
    351352  // Extracting the event number
    352   fReader[0].ReadValue(&fEventNumber, 4);
     353  xdr_int(fInputXDR, &fEventNumber);
    353354
    354355  // Extracting the number of particles
    355   fReader[0].ReadValue(&fEventSize, 4);
     356  xdr_int(fInputXDR, &fEventSize);
    356357
    357358  if(fEventSize >= kBufferSize)
     
    363364  // 4 + 4 + 4 + 4 + 4 + 4 = 96*n + 24
    364365
    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);
     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));
    380374
    381375  if(fEventSize < 0 ||
     
    398392void DelphesSTDHEPReader::ReadSTDHEP4()
    399393{
    400   uint32_t number;
     394  u_int number;
    401395
    402396  // Extracting the event weight
    403   fReader[0].ReadValue(&fWeight, 8);
     397  xdr_double(fInputXDR, &fWeight);
    404398
    405399  // Extracting alpha QED
    406   fReader[0].ReadValue(&fAlphaQED, 8);
     400  xdr_double(fInputXDR, &fAlphaQED);
    407401
    408402  // Extracting alpha QCD
    409   fReader[0].ReadValue(&fAlphaQCD, 8);
     403  xdr_double(fInputXDR, &fAlphaQCD);
    410404
    411405  // Extracting the event scale
    412   fReader[0].ReadValue(&fScaleSize, 4);
     406  xdr_u_int(fInputXDR, &fScaleSize);
    413407  for(number = 0; number < fScaleSize; ++number)
    414408  {
    415     fReader[0].ReadValue(&fScale[number], 8);
     409    xdr_double(fInputXDR, &fScale[number]);
    416410  }
    417411
     
    456450
    457451  int number;
    458   int32_t pid, status, m1, m2, d1, d2;
     452  int pid, status, m1, m2, d1, d2;
    459453  double px, py, pz, e, mass;
    460454  double x, y, z, t;
    461455
     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
    462464  for(number = 0; number < fEventSize; ++number)
    463465  {
    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);
     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);
    481483
    482484    candidate = factory->NewCandidate();
  • classes/DelphesSTDHEPReader.h

    r4689481 rfbad4c7  
    2929
    3030#include <stdio.h>
    31 #include <stdint.h>
    32 
    33 #include "classes/DelphesXDRReader.h"
     31#include <rpc/types.h>
     32#include <rpc/xdr.h>
    3433
    3534class TObjArray;
     
    3837class ExRootTreeBranch;
    3938class DelphesFactory;
    40 class DelphesXDRReader;
    4139
    4240class DelphesSTDHEPReader
     
    7876    TObjArray *partonOutputArray);
    7977
    80   void SkipBytes(int size);
    81   void SkipArray(int elsize);
     78  void SkipBytes(u_int size);
     79  void SkipArray(u_int elsize);
    8280
    8381  void ReadFileHeader();
     
    9088  FILE *fInputFile;
    9189
    92   DelphesXDRReader fReader[7];
     90  XDR *fInputXDR;
    9391
    94   uint8_t *fBuffer;
     92  char *fBuffer;
    9593
    9694  TDatabasePDG *fPDG;
    9795
    98   uint32_t fEntries;
    99   int32_t fBlockType, fEventNumber, fEventSize;
     96  u_int fEntries;
     97  int fBlockType, fEventNumber, fEventSize;
    10098  double fWeight, fAlphaQCD, fAlphaQED;
    10199
    102   uint32_t fScaleSize;
     100  u_int fScaleSize;
    103101  double fScale[10];
    104102};
    105103
    106104#endif // DelphesSTDHEPReader_h
     105
     106
  • converters/pileup2root.cpp

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

    r4689481 rfbad4c7  
    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 vector<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 //---------------------------------------------------------------------------
     438pair<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
    457466
    458467int main(int argc, char *argv[])
    459468{
    460   int i, j;
    461469  char appName[] = "root2lhco";
    462470  stringstream message;
     
    466474  ExRootTreeReader *treeReader = 0;
    467475  Long64_t entry, allEntries;
    468   string jetBranchName = "Jet";
    469   vector<string> result;
     476  string  JetBranchName="Jet";
    470477
    471478  if(argc < 2 || argc > 4)
    472479  {
    473     cerr << " Usage: " << appName << " input_file" << " [output_file] [--jet-branch=Jet]" << endl;
     480    cerr << " Usage: " << appName << " input_file" << " [output_file]  [--jet-branch=Jet]" << endl;
    474481    cerr << " input_file - input file in ROOT format," << endl;
    475482    cerr << " output_file - output file in LHCO format," << endl;
    476483    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;
    477485    return 1;
    478486  }
    479487
    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;
     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
    497501
    498502  signal(SIGINT, SignalHandler);
     
    535539    {
    536540      // Create LHC Olympics converter:
    537       writer = new LHCOWriter(treeReader, outputFile, jetBranchName);
     541      writer = new LHCOWriter(treeReader, outputFile, JetBranchName);
    538542
    539543      ExRootProgressBar progressBar(allEntries - 1);
  • doc/genMakefile.tcl

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

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

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