Changeset 341014c in git for classes/DelphesSTDHEPReader.cc
- Timestamp:
- Feb 12, 2019, 9:29:17 PM (6 years ago)
- Branches:
- ImprovedOutputFile, Timing, llp, master
- Children:
- 6455202
- Parents:
- 45e58be
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
classes/DelphesSTDHEPReader.cc
r45e58be r341014c 17 17 */ 18 18 19 20 19 /** \class DelphesSTDHEPReader 21 20 * … … 28 27 #include "classes/DelphesSTDHEPReader.h" 29 28 30 #include <stdexcept>31 29 #include <iostream> 32 30 #include <sstream> 33 34 #include <stdio.h> 31 #include <stdexcept> 32 35 33 #include <errno.h> 36 34 #include <stdint.h> 35 #include <stdio.h> 37 36 #include <string.h> 38 37 38 #include "TDatabasePDG.h" 39 #include "TLorentzVector.h" 39 40 #include "TObjArray.h" 41 #include "TParticlePDG.h" 40 42 #include "TStopwatch.h" 41 #include "TDatabasePDG.h"42 #include "TParticlePDG.h"43 #include "TLorentzVector.h"44 43 45 44 #include "classes/DelphesClasses.h" … … 51 50 using namespace std; 52 51 53 static const int kBufferSize 52 static const int kBufferSize = 1000000; 54 53 55 54 //--------------------------------------------------------------------------- … … 58 57 fInputFile(0), fBuffer(0), fPDG(0), fBlockType(-1) 59 58 { 60 fBuffer = new uint8_t[kBufferSize *96 + 24];59 fBuffer = new uint8_t[kBufferSize * 96 + 24]; 61 60 62 61 fPDG = TDatabasePDG::Instance(); … … 117 116 ReadEventHeader(); 118 117 } 119 else if(fBlockType == MCFIO_STDHEPBEG || 120 fBlockType == MCFIO_STDHEPEND) 118 else if(fBlockType == MCFIO_STDHEPBEG || fBlockType == MCFIO_STDHEPEND) 121 119 { 122 120 ReadSTDCM1(); … … 170 168 uint32_t size; 171 169 fReader[0].ReadValue(&size, 4); 172 SkipBytes(size *elsize);170 SkipBytes(size * elsize); 173 171 } 174 172 … … 178 176 { 179 177 uint32_t i; 180 enum STDHEPVersion {UNKNOWN, V1, V2, V21} version; 178 enum STDHEPVersion 179 { 180 UNKNOWN, 181 V1, 182 V2, 183 V21 184 } version; 181 185 182 186 // version 183 187 fReader[0].ReadString(fBuffer, 100); 184 if(fBuffer[0] == '\0' || fBuffer[1] == '\0') version = UNKNOWN; 185 else if(fBuffer[0] == '1') version = V1; 186 else if(strncmp((char *)fBuffer, "2.01", 4) == 0) version = V21; 187 else if(fBuffer[0] == '2') version = V2; 188 else version = UNKNOWN; 188 if(fBuffer[0] == '\0' || fBuffer[1] == '\0') 189 version = UNKNOWN; 190 else if(fBuffer[0] == '1') 191 version = V1; 192 else if(strncmp((char *)fBuffer, "2.01", 4) == 0) 193 version = V21; 194 else if(fBuffer[0] == '2') 195 version = V2; 196 else 197 version = UNKNOWN; 189 198 190 199 if(version == UNKNOWN) … … 363 372 // 4 + 4 + 4 + 4 + 4 + 4 = 96*n + 24 364 373 365 fReader[0].ReadRaw(fBuffer, 96 *fEventSize + 24);374 fReader[0].ReadRaw(fBuffer, 96 * fEventSize + 24); 366 375 367 376 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);377 fReader[2].SetBuffer(fBuffer + 4 * 1 + 4 * 1 * fEventSize); 378 fReader[3].SetBuffer(fBuffer + 4 * 2 + 4 * 2 * fEventSize); 379 fReader[4].SetBuffer(fBuffer + 4 * 3 + 4 * 4 * fEventSize); 380 fReader[5].SetBuffer(fBuffer + 4 * 4 + 4 * 6 * fEventSize); 381 fReader[6].SetBuffer(fBuffer + 4 * 5 + 4 * 16 * fEventSize); 373 382 374 383 fReader[1].ReadValue(&idhepSize, 4); … … 391 400 fAlphaQCD = 0.0; 392 401 fScaleSize = 0; 393 memset(fScale, 0, 10 *sizeof(double));402 memset(fScale, 0, 10 * sizeof(double)); 394 403 } 395 404 … … 494 503 495 504 pdgParticle = fPDG->GetParticle(pid); 496 candidate->Charge = pdgParticle ? int(pdgParticle->Charge() /3.0) : -999;505 candidate->Charge = pdgParticle ? int(pdgParticle->Charge() / 3.0) : -999; 497 506 candidate->Mass = mass; 498 507
Note:
See TracChangeset
for help on using the changeset viewer.