Changes in / [4689481:fbad4c7] in git
- Files:
-
- 4 deleted
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
.circleci/config.yml
r4689481 rfbad4c7 13 13 echo 'export LD_LIBRARY_PATH=$ROOTSYS/lib:$LD_LIBRARY_PATH' >> $BASH_ENV 14 14 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 20 16 - run: 21 17 name: Build Delphes using make -
CMakeLists.txt
r4689481 rfbad4c7 36 36 if(PYTHIA8_FOUND) 37 37 include_directories(${PYTHIA8_INCLUDE_DIRS}) 38 endif( )38 endif(PYTHIA8_FOUND) 39 39 40 40 if(NOT DEFINED CMAKE_INSTALL_LIBDIR) … … 49 49 endif() 50 50 endfunction() 51 52 51 53 52 54 # Declare position of all other externals needed … … 85 87 target_link_Libraries(Delphes ${ROOT_LIBRARIES} ${ROOT_COMPONENT_LIBRARIES}) 86 88 target_link_Libraries(DelphesDisplay ${ROOT_LIBRARIES} ${ROOT_COMPONENT_LIBRARIES}) 87 88 89 if(PYTHIA8_FOUND) 89 90 target_link_libraries(Delphes ${PYTHIA8_LIBRARIES} ${CMAKE_DL_LIBS}) 90 endif() 91 endif(PYTHIA8_FOUND) 92 91 93 92 94 install(TARGETS Delphes DelphesDisplay DESTINATION lib) -
Makefile
r4689481 rfbad4c7 15 15 PcmSuf = _rdict.pcm 16 16 17 CXXFLAGS += $(ROOTCFLAGS) -Wno-write-strings -D_FILE_OFFSET_BITS=64 -DDROP_CGAL -I. -Iexternal -Iexternal/tcl 17 CXXFLAGS += $(ROOTCFLAGS) -Wno-write-strings -D_FILE_OFFSET_BITS=64 -DDROP_CGAL -I. -Iexternal -Iexternal/tcl -I/usr/include/tirpc 18 18 DELPHES_LIBS = $(shell $(RC) --libs) -lEG $(SYSLIBS) 19 19 DISPLAY_LIBS = $(shell $(RC) --evelibs) -lGuiHtml $(SYSLIBS) … … 482 482 tmp/classes/DelphesPileUpReader.$(ObjSuf): \ 483 483 classes/DelphesPileUpReader.$(SrcSuf) \ 484 classes/DelphesPileUpReader.h \ 485 classes/DelphesXDRReader.h 484 classes/DelphesPileUpReader.h 486 485 tmp/classes/DelphesPileUpWriter.$(ObjSuf): \ 487 486 classes/DelphesPileUpWriter.$(SrcSuf) \ 488 classes/DelphesPileUpWriter.h \ 489 classes/DelphesXDRWriter.h 487 classes/DelphesPileUpWriter.h 490 488 tmp/classes/DelphesSTDHEPReader.$(ObjSuf): \ 491 489 classes/DelphesSTDHEPReader.$(SrcSuf) \ … … 493 491 classes/DelphesClasses.h \ 494 492 classes/DelphesFactory.h \ 495 classes/DelphesXDRReader.h \496 493 external/ExRootAnalysis/ExRootTreeBranch.h 497 494 tmp/classes/DelphesStream.$(ObjSuf): \ … … 501 498 classes/DelphesTF2.$(SrcSuf) \ 502 499 classes/DelphesTF2.h 503 tmp/classes/DelphesXDRReader.$(ObjSuf): \504 classes/DelphesXDRReader.$(SrcSuf) \505 classes/DelphesXDRReader.h506 tmp/classes/DelphesXDRWriter.$(ObjSuf): \507 classes/DelphesXDRWriter.$(SrcSuf) \508 classes/DelphesXDRWriter.h509 500 tmp/external/ExRootAnalysis/ExRootConfReader.$(ObjSuf): \ 510 501 external/ExRootAnalysis/ExRootConfReader.$(SrcSuf) \ … … 1023 1014 tmp/classes/DelphesStream.$(ObjSuf) \ 1024 1015 tmp/classes/DelphesTF2.$(ObjSuf) \ 1025 tmp/classes/DelphesXDRReader.$(ObjSuf) \1026 tmp/classes/DelphesXDRWriter.$(ObjSuf) \1027 1016 tmp/external/ExRootAnalysis/ExRootConfReader.$(ObjSuf) \ 1028 1017 tmp/external/ExRootAnalysis/ExRootFilter.$(ObjSuf) \ … … 2044 2033 @touch $@ 2045 2034 2046 classes/DelphesSTDHEPReader.h: \2047 classes/DelphesXDRReader.h2048 @touch $@2049 2050 2035 external/fastjet/plugins/CDFCones/fastjet/CDFMidPointPlugin.hh: \ 2051 2036 external/fastjet/JetDefinition.hh -
classes/DelphesPileUpReader.cc
r4689481 rfbad4c7 33 33 34 34 #include <stdio.h> 35 #include <stdint.h> 36 37 #include "classes/DelphesXDRReader.h" 35 #include <rpc/types.h> 36 #include <rpc/xdr.h> 38 37 39 38 using namespace std; … … 48 47 fEntries(0), fEntrySize(0), fCounter(0), 49 48 fPileUpFile(0), fIndex(0), fBuffer(0), 50 fInput Reader(0), fIndexReader(0), fBufferReader(0)49 fInputXDR(0), fIndexXDR(0), fBufferXDR(0) 51 50 { 52 51 stringstream message; 53 52 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); 62 60 63 61 fPileUpFile = fopen(fileName, "r"); … … 69 67 } 70 68 71 fInputReader->SetFile(fPileUpFile);69 xdrstdio_create(fInputXDR, fPileUpFile, XDR_DECODE); 72 70 73 71 // read number of events 74 72 fseeko(fPileUpFile, -8, SEEK_END); 75 fInputReader->ReadValue(&fEntries, 8);73 xdr_hyper(fInputXDR, &fEntries); 76 74 77 75 if(fEntries >= kIndexSize) … … 83 81 // read index of events 84 82 fseeko(fPileUpFile, -8 - 8*fEntries, SEEK_END); 85 fInputReader->ReadRaw(fIndex, fEntries*8);83 xdr_opaque(fInputXDR, fIndex, fEntries*8); 86 84 } 87 85 … … 90 88 DelphesPileUpReader::~DelphesPileUpReader() 91 89 { 90 xdr_destroy(fInputXDR); 92 91 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; 96 97 if(fBuffer) delete[] fBuffer; 97 98 if(fIndex) delete[] fIndex; … … 100 101 //------------------------------------------------------------------------------ 101 102 102 bool DelphesPileUpReader::ReadParticle(int 32_t&pid,103 bool DelphesPileUpReader::ReadParticle(int &pid, 103 104 float &x, float &y, float &z, float &t, 104 105 float &px, float &py, float &pz, float &e) … … 106 107 if(fCounter >= fEntrySize) return false; 107 108 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); 117 118 118 119 ++fCounter; … … 123 124 //------------------------------------------------------------------------------ 124 125 125 bool DelphesPileUpReader::ReadEntry( int64_t entry)126 bool DelphesPileUpReader::ReadEntry(quad_t entry) 126 127 { 127 int64_t offset;128 quad_t offset; 128 129 129 130 if(entry >= fEntries) return false; 130 131 131 132 // read event position 132 fIndexReader->SetOffset(8*entry);133 fIndexReader->ReadValue(&offset, 8);133 xdr_setpos(fIndexXDR, 8*entry); 134 xdr_hyper(fIndexXDR, &offset); 134 135 135 136 // read event 136 137 fseeko(fPileUpFile, offset, SEEK_SET); 137 fInputReader->ReadValue(&fEntrySize, 4);138 xdr_int(fInputXDR, &fEntrySize); 138 139 139 140 if(fEntrySize >= kBufferSize) … … 142 143 } 143 144 144 fInputReader->ReadRaw(fBuffer, fEntrySize*kRecordSize*4);145 fBufferReader->SetOffset(0);145 xdr_opaque(fInputXDR, fBuffer, fEntrySize*kRecordSize*4); 146 xdr_setpos(fBufferXDR, 0); 146 147 fCounter = 0; 147 148 -
classes/DelphesPileUpReader.h
r4689481 rfbad4c7 29 29 30 30 #include <stdio.h> 31 #include <stdint.h> 32 33 class DelphesXDRReader; 31 #include <rpc/types.h> 32 #include <rpc/xdr.h> 34 33 35 34 class DelphesPileUpReader … … 41 40 ~DelphesPileUpReader(); 42 41 43 bool ReadParticle(int 32_t&pid,42 bool ReadParticle(int &pid, 44 43 float &x, float &y, float &z, float &t, 45 44 float &px, float &py, float &pz, float &e); 46 45 47 bool ReadEntry( int64_t entry);46 bool ReadEntry(quad_t entry); 48 47 49 int64_t GetEntries() const { return fEntries; }48 quad_t GetEntries() const { return fEntries; } 50 49 51 50 private: 52 51 53 int64_t fEntries;52 quad_t fEntries; 54 53 55 int 32_tfEntrySize;56 int 32_tfCounter;54 int fEntrySize; 55 int fCounter; 57 56 58 57 FILE *fPileUpFile; 59 uint8_t*fIndex;60 uint8_t*fBuffer;58 char *fIndex; 59 char *fBuffer; 61 60 62 DelphesXDRReader *fInputReader;63 DelphesXDRReader *fIndexReader;64 DelphesXDRReader *fBufferReader;61 XDR *fInputXDR; 62 XDR *fIndexXDR; 63 XDR *fBufferXDR; 65 64 }; 66 65 67 66 #endif // DelphesPileUpReader_h 67 68 -
classes/DelphesPileUpWriter.cc
r4689481 rfbad4c7 33 33 34 34 #include <stdio.h> 35 #include <stdint.h> 36 37 #include "classes/DelphesXDRWriter.h" 35 #include <rpc/types.h> 36 #include <rpc/xdr.h> 38 37 39 38 using namespace std; … … 48 47 fEntries(0), fEntrySize(0), fOffset(0), 49 48 fPileUpFile(0), fIndex(0), fBuffer(0), 50 fOutput Writer(0), fIndexWriter(0), fBufferWriter(0)49 fOutputXDR(0), fIndexXDR(0), fBufferXDR(0) 51 50 { 52 51 stringstream message; 53 52 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); 62 60 63 61 fPileUpFile = fopen(fileName, "w+"); … … 69 67 } 70 68 71 fOutputWriter->SetFile(fPileUpFile);69 xdrstdio_create(fOutputXDR, fPileUpFile, XDR_ENCODE); 72 70 } 73 71 … … 76 74 DelphesPileUpWriter::~DelphesPileUpWriter() 77 75 { 76 xdr_destroy(fOutputXDR); 78 77 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; 82 83 if(fBuffer) delete[] fBuffer; 83 84 if(fIndex) delete[] fIndex; … … 86 87 //------------------------------------------------------------------------------ 87 88 88 void DelphesPileUpWriter::WriteParticle(int 32_tpid,89 void DelphesPileUpWriter::WriteParticle(int pid, 89 90 float x, float y, float z, float t, 90 91 float px, float py, float pz, float e) … … 95 96 } 96 97 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); 106 107 107 108 ++fEntrySize; … … 117 118 } 118 119 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); 121 122 122 fIndexWriter->WriteValue(&fOffset, 8);123 xdr_hyper(fIndexXDR, &fOffset); 123 124 fOffset += fEntrySize*kRecordSize*4 + 4; 124 125 125 fBufferWriter->SetOffset(0);126 xdr_setpos(fBufferXDR, 0); 126 127 fEntrySize = 0; 127 128 128 129 ++fEntries; 129 130 } … … 133 134 void DelphesPileUpWriter::WriteIndex() 134 135 { 135 fOutputWriter->WriteRaw(fIndex, fEntries*8);136 fOutputWriter->WriteValue(&fEntries, 8);136 xdr_opaque(fOutputXDR, fIndex, fEntries*8); 137 xdr_hyper(fOutputXDR, &fEntries); 137 138 } 138 139 -
classes/DelphesPileUpWriter.h
r4689481 rfbad4c7 29 29 30 30 #include <stdio.h> 31 #include <stdint.h> 32 33 class DelphesXDRWriter; 31 #include <rpc/types.h> 32 #include <rpc/xdr.h> 34 33 35 34 class DelphesPileUpWriter … … 41 40 ~DelphesPileUpWriter(); 42 41 43 void WriteParticle(int 32_tpid,42 void WriteParticle(int pid, 44 43 float x, float y, float z, float t, 45 44 float px, float py, float pz, float e); … … 51 50 private: 52 51 53 int64_t fEntries;54 int 32_tfEntrySize;55 int64_t fOffset;52 quad_t fEntries; 53 int fEntrySize; 54 quad_t fOffset; 56 55 57 56 FILE *fPileUpFile; 58 uint8_t*fIndex;59 uint8_t*fBuffer;57 char *fIndex; 58 char *fBuffer; 60 59 61 DelphesXDRWriter *fOutputWriter;62 DelphesXDRWriter *fIndexWriter;63 DelphesXDRWriter *fBufferWriter;60 XDR *fOutputXDR; 61 XDR *fIndexXDR; 62 XDR *fBufferXDR; 64 63 }; 65 64 66 65 #endif // DelphesPileUpWriter_h 66 67 -
classes/DelphesSTDHEPReader.cc
r4689481 rfbad4c7 34 34 #include <stdio.h> 35 35 #include <errno.h> 36 #include < stdint.h>37 #include < string.h>36 #include <rpc/types.h> 37 #include <rpc/xdr.h> 38 38 39 39 #include "TObjArray.h" … … 45 45 #include "classes/DelphesClasses.h" 46 46 #include "classes/DelphesFactory.h" 47 #include "classes/DelphesXDRReader.h"48 47 49 48 #include "ExRootAnalysis/ExRootTreeBranch.h" … … 56 55 57 56 DelphesSTDHEPReader::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]; 61 61 62 62 fPDG = TDatabasePDG::Instance(); … … 68 68 { 69 69 if(fBuffer) delete fBuffer; 70 if(fInputXDR) delete fInputXDR; 70 71 } 71 72 … … 75 76 { 76 77 fInputFile = inputFile; 77 fReader[0].SetFile(inputFile);78 xdrstdio_create(fInputXDR, inputFile, XDR_DECODE); 78 79 } 79 80 … … 99 100 TObjArray *partonOutputArray) 100 101 { 101 fReader[0].ReadValue(&fBlockType, 4);102 103 102 if(feof(fInputFile)) return kFALSE; 103 104 xdr_int(fInputXDR, &fBlockType); 104 105 105 106 SkipBytes(4); … … 145 146 //--------------------------------------------------------------------------- 146 147 147 void DelphesSTDHEPReader::SkipBytes( int size)148 void DelphesSTDHEPReader::SkipBytes(u_int size) 148 149 { 149 150 int rc; 150 int rndup;151 u_int rndup; 151 152 152 153 rndup = size % 4; … … 160 161 if(rc != 0 && errno == ESPIPE) 161 162 { 162 fReader[0].ReadRaw(fBuffer, size);163 } 164 } 165 166 //--------------------------------------------------------------------------- 167 168 void DelphesSTDHEPReader::SkipArray( int elsize)169 { 170 u int32_t size;171 fReader[0].ReadValue(&size, 4);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); 172 173 SkipBytes(size*elsize); 173 174 } … … 177 178 void DelphesSTDHEPReader::ReadFileHeader() 178 179 { 179 u int32_t i;180 u_int i; 180 181 enum STDHEPVersion {UNKNOWN, V1, V2, V21} version; 181 182 182 183 // version 183 fReader[0].ReadString(fBuffer, 100);184 xdr_string(fInputXDR, &fBuffer, 100); 184 185 if(fBuffer[0] == '\0' || fBuffer[1] == '\0') version = UNKNOWN; 185 186 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; 187 188 else if(fBuffer[0] == '2') version = V2; 188 189 else version = UNKNOWN; … … 206 207 207 208 // Number of events 208 fReader[0].ReadValue(&fEntries, 4);209 xdr_u_int(fInputXDR, &fEntries); 209 210 210 211 SkipBytes(8); 211 212 212 213 // Number of blocks 213 u int32_t nBlocks = 0;214 fReader[0].ReadValue(&nBlocks, 4);214 u_int nBlocks = 0; 215 xdr_u_int(fInputXDR, &nBlocks); 215 216 216 217 // Number of NTuples 217 u int32_t nNTuples = 0;218 u_int nNTuples = 0; 218 219 if(version != V1) 219 220 { 220 fReader[0].ReadValue(&nNTuples, 4);221 xdr_u_int(fInputXDR, &nNTuples); 221 222 } 222 223 … … 243 244 { 244 245 // 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) 247 248 { 248 249 SkipBytes(8); … … 254 255 SkipArray(4); 255 256 } 256 else if(strncmp( (char *)fBuffer, "2.00", 4) == 0)257 else if(strncmp(fBuffer, "2.00", 4) == 0) 257 258 { 258 259 SkipBytes(12); … … 271 272 { 272 273 bool skipNTuples = false; 273 int skipSize = 4;274 u_int skipSize = 4; 274 275 275 276 // 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) 278 279 { 279 280 skipNTuples = true; 280 281 } 281 else if(strncmp( (char *)fBuffer, "3.00", 4) == 0)282 else if(strncmp(fBuffer, "3.00", 4) == 0) 282 283 { 283 284 skipNTuples = true; … … 287 288 SkipBytes(20); 288 289 289 u int32_t dimBlocks = 0;290 fReader[0].ReadValue(&dimBlocks, 4);291 292 u int32_t dimNTuples = 0;290 u_int dimBlocks = 0; 291 xdr_u_int(fInputXDR, &dimBlocks); 292 293 u_int dimNTuples = 0; 293 294 if(skipNTuples) 294 295 { 295 296 SkipBytes(4); 296 fReader[0].ReadValue(&dimNTuples, 4);297 xdr_u_int(fInputXDR, &dimNTuples); 297 298 } 298 299 … … 317 318 { 318 319 // version 319 fReader[0].ReadString(fBuffer, 100);320 xdr_string(fInputXDR, &fBuffer, 100); 320 321 321 322 // skip 5*4 + 2*8 = 36 bytes 322 323 SkipBytes(36); 323 324 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)) 327 328 { 328 329 return; … … 332 333 SkipArray(1); 333 334 334 if(strncmp( (char *)fBuffer, "5.01", 4) == 0)335 if(strncmp(fBuffer, "5.01", 4) == 0) 335 336 { 336 337 return; … … 344 345 void DelphesSTDHEPReader::ReadSTDHEP() 345 346 { 346 u int32_t idhepSize, isthepSize, jmohepSize, jdahepSize, phepSize, vhepSize;347 u_int idhepSize, isthepSize, jmohepSize, jdahepSize, phepSize, vhepSize; 347 348 348 349 // version 349 fReader[0].ReadString(fBuffer, 100);350 xdr_string(fInputXDR, &fBuffer, 100); 350 351 351 352 // Extracting the event number 352 fReader[0].ReadValue(&fEventNumber, 4);353 xdr_int(fInputXDR, &fEventNumber); 353 354 354 355 // Extracting the number of particles 355 fReader[0].ReadValue(&fEventSize, 4);356 xdr_int(fInputXDR, &fEventSize); 356 357 357 358 if(fEventSize >= kBufferSize) … … 363 364 // 4 + 4 + 4 + 4 + 4 + 4 = 96*n + 24 364 365 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)); 380 374 381 375 if(fEventSize < 0 || … … 398 392 void DelphesSTDHEPReader::ReadSTDHEP4() 399 393 { 400 u int32_t number;394 u_int number; 401 395 402 396 // Extracting the event weight 403 fReader[0].ReadValue(&fWeight, 8);397 xdr_double(fInputXDR, &fWeight); 404 398 405 399 // Extracting alpha QED 406 fReader[0].ReadValue(&fAlphaQED, 8);400 xdr_double(fInputXDR, &fAlphaQED); 407 401 408 402 // Extracting alpha QCD 409 fReader[0].ReadValue(&fAlphaQCD, 8);403 xdr_double(fInputXDR, &fAlphaQCD); 410 404 411 405 // Extracting the event scale 412 fReader[0].ReadValue(&fScaleSize, 4);406 xdr_u_int(fInputXDR, &fScaleSize); 413 407 for(number = 0; number < fScaleSize; ++number) 414 408 { 415 fReader[0].ReadValue(&fScale[number], 8);409 xdr_double(fInputXDR, &fScale[number]); 416 410 } 417 411 … … 456 450 457 451 int number; 458 int 32_tpid, status, m1, m2, d1, d2;452 int pid, status, m1, m2, d1, d2; 459 453 double px, py, pz, e, mass; 460 454 double x, y, z, t; 461 455 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 462 464 for(number = 0; number < fEventSize; ++number) 463 465 { 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); 481 483 482 484 candidate = factory->NewCandidate(); -
classes/DelphesSTDHEPReader.h
r4689481 rfbad4c7 29 29 30 30 #include <stdio.h> 31 #include <stdint.h> 32 33 #include "classes/DelphesXDRReader.h" 31 #include <rpc/types.h> 32 #include <rpc/xdr.h> 34 33 35 34 class TObjArray; … … 38 37 class ExRootTreeBranch; 39 38 class DelphesFactory; 40 class DelphesXDRReader;41 39 42 40 class DelphesSTDHEPReader … … 78 76 TObjArray *partonOutputArray); 79 77 80 void SkipBytes( int size);81 void SkipArray( int elsize);78 void SkipBytes(u_int size); 79 void SkipArray(u_int elsize); 82 80 83 81 void ReadFileHeader(); … … 90 88 FILE *fInputFile; 91 89 92 DelphesXDRReader fReader[7];90 XDR *fInputXDR; 93 91 94 uint8_t*fBuffer;92 char *fBuffer; 95 93 96 94 TDatabasePDG *fPDG; 97 95 98 u int32_t fEntries;99 int 32_tfBlockType, fEventNumber, fEventSize;96 u_int fEntries; 97 int fBlockType, fEventNumber, fEventSize; 100 98 double fWeight, fAlphaQCD, fAlphaQED; 101 99 102 u int32_t fScaleSize;100 u_int fScaleSize; 103 101 double fScale[10]; 104 102 }; 105 103 106 104 #endif // DelphesSTDHEPReader_h 105 106 -
converters/pileup2root.cpp
r4689481 rfbad4c7 26 26 #include <stdio.h> 27 27 28 #include <rpc/types.h> 29 #include <rpc/xdr.h> 30 28 31 #include "TROOT.h" 29 32 #include "TApplication.h" -
converters/root2lhco.cpp
r4689481 rfbad4c7 107 107 //------------------------------------------------------------------------------ 108 108 109 LHCOWriter::LHCOWriter(ExRootTreeReader *treeReader, FILE *outputFile, string jetBranchName) :109 LHCOWriter::LHCOWriter(ExRootTreeReader *treeReader, FILE *outputFile, string JetBranchName) : 110 110 fTriggerWord(0), fEventNumber(1), fTreeReader(0), fOutputFile(0), 111 111 fBranchEvent(0), fBranchTrack(0), fBranchTower(0), fBranchPhoton(0), … … 128 128 fBranchMuon = fTreeReader->UseBranch("Muon"); 129 129 // reconstructed jets 130 fBranchJet = fTreeReader->UseBranch( jetBranchName.c_str());130 fBranchJet = fTreeReader->UseBranch(JetBranchName.c_str()); 131 131 // missing transverse energy 132 132 fBranchMissingET = fTreeReader->UseBranch("MissingET"); … … 436 436 //--------------------------------------------------------------------------- 437 437 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 //--------------------------------------------------------------------------- 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 457 466 458 467 int main(int argc, char *argv[]) 459 468 { 460 int i, j;461 469 char appName[] = "root2lhco"; 462 470 stringstream message; … … 466 474 ExRootTreeReader *treeReader = 0; 467 475 Long64_t entry, allEntries; 468 string jetBranchName = "Jet"; 469 vector<string> result; 476 string JetBranchName="Jet"; 470 477 471 478 if(argc < 2 || argc > 4) 472 479 { 473 cerr << " Usage: " << appName << " input_file" << " [output_file] [--jet-branch=Jet]" << endl;480 cerr << " Usage: " << appName << " input_file" << " [output_file] [--jet-branch=Jet]" << endl; 474 481 cerr << " input_file - input file in ROOT format," << endl; 475 482 cerr << " output_file - output file in LHCO format," << endl; 476 483 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; 477 485 return 1; 478 486 } 479 487 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 497 501 498 502 signal(SIGINT, SignalHandler); … … 535 539 { 536 540 // Create LHC Olympics converter: 537 writer = new LHCOWriter(treeReader, outputFile, jetBranchName);541 writer = new LHCOWriter(treeReader, outputFile, JetBranchName); 538 542 539 543 ExRootProgressBar progressBar(allEntries - 1); -
doc/genMakefile.tcl
r4689481 rfbad4c7 208 208 PcmSuf = _rdict.pcm 209 209 210 CXXFLAGS += $(ROOTCFLAGS) -Wno-write-strings -D_FILE_OFFSET_BITS=64 -DDROP_CGAL -I. -Iexternal -Iexternal/tcl 210 CXXFLAGS += $(ROOTCFLAGS) -Wno-write-strings -D_FILE_OFFSET_BITS=64 -DDROP_CGAL -I. -Iexternal -Iexternal/tcl -I/usr/include/tirpc 211 211 DELPHES_LIBS = $(shell $(RC) --libs) -lEG $(SYSLIBS) 212 212 DISPLAY_LIBS = $(shell $(RC) --evelibs) -lGuiHtml $(SYSLIBS) -
modules/CMakeLists.txt
r4689481 rfbad4c7 14 14 DELPHES_GENERATE_DICTIONARY(ModulesDict ${headers} LINKDEF ModulesLinkDef.h) 15 15 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 17 list(REMOVE_ITEM sources ${CMAKE_CURRENT_SOURCE_DIR}/PileUpMergerPythia8.cc) 18 19 add_library(modules OBJECT ${sources} FastJetDict.cxx ModulesDict.cxx) 23 20 24 21 # install headers -
readers/CMakeLists.txt
r4689481 rfbad4c7 6 6 file(GLOB executables RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp) 7 7 8 # TODO: implement switch to enable CMSSW and ProMCif present8 # TODO: implement switch to enable CMSSW, ProMC and Pythia8 if present 9 9 list(REMOVE_ITEM executables DelphesCMSFWLite.cpp) 10 10 list(REMOVE_ITEM executables DelphesProMC.cpp)
Note:
See TracChangeset
for help on using the changeset viewer.