Changeset 1129 in svn for trunk/classes/DelphesSTDHEPReader.cc
- Timestamp:
- May 30, 2013, 12:47:35 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/classes/DelphesSTDHEPReader.cc
r1120 r1129 20 20 21 21 #include <stdio.h> 22 #include <errno.h> 22 23 #include <rpc/types.h> 23 24 #include <rpc/xdr.h> … … 87 88 TObjArray *partonOutputArray) 88 89 { 90 bool skipNTuples = false; 91 89 92 if(feof(fInputFile)) return kFALSE; 90 93 … … 94 97 95 98 xdr_string(fInputXDR, &fBuffer, 100); 99 if(strncmp(fBuffer, "2.00", 4) == 0) 100 { 101 skipNTuples = true; 102 } 96 103 97 104 if(fBlockType == EVENTTABLE) … … 101 108 else if(fBlockType == EVENTHEADER) 102 109 { 103 ReadSTDHEPHeader( );110 ReadSTDHEPHeader(skipNTuples); 104 111 } 105 112 else if(fBlockType == MCFIO_STDHEPBEG || … … 116 123 else if(fBlockType == MCFIO_STDHEP4) 117 124 { 118 ReadSTDHEP 4();125 ReadSTDHEP(); 119 126 AnalyzeParticles(factory, allParticleOutputArray, 120 127 stableParticleOutputArray, partonOutputArray); 128 ReadSTDHEP4(); 121 129 } 122 130 else … … 132 140 void DelphesSTDHEPReader::SkipBytes(u_int size) 133 141 { 142 int rc; 134 143 u_int rndup; 144 135 145 rndup = size % 4; 136 146 if(rndup > 0) … … 139 149 } 140 150 141 fseek(fInputFile, size + rndup, SEEK_CUR); 151 rc = fseek(fInputFile, size + rndup, SEEK_CUR); 152 153 if(rc != 0 && errno == ESPIPE) 154 { 155 xdr_opaque(fInputXDR, fBuffer, size); 156 } 142 157 } 143 158 … … 239 254 //--------------------------------------------------------------------------- 240 255 241 void DelphesSTDHEPReader::ReadSTDHEPHeader( )256 void DelphesSTDHEPReader::ReadSTDHEPHeader(bool skipNTuples) 242 257 { 243 258 SkipBytes(20); … … 247 262 248 263 u_int dimNTuples = 0; 249 if(s trncmp(fBuffer, "2.00", 4) == 0)264 if(skipNTuples) 250 265 { 251 266 SkipBytes(4); … … 261 276 262 277 // Processing blocks extraction 263 if( dimNTuples > 0 && strncmp(fBuffer, "2.00", 4) ==0)278 if(skipNTuples && dimNTuples > 0) 264 279 { 265 280 SkipArray(4); … … 342 357 { 343 358 u_int number; 344 345 ReadSTDHEP();346 359 347 360 // Extracting the event weight
Note:
See TracChangeset
for help on using the changeset viewer.