- Timestamp:
- 11/01/19 14:51:25 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/mcorsika/MCorsikaRead.cc
r19848 r19850 290 290 fNumTotalEvents = 0; 291 291 292 MCorsikaRunHeader runheader; 292 bool allocated = false; 293 MCorsikaRunHeader *runheader = fRunHeader; 294 if (!runheader) 295 { 296 runheader = new MCorsikaRunHeader; 297 allocated = true; 298 } 293 299 294 300 Bool_t rc = kTRUE; 295 296 301 while (1) 297 302 { … … 314 319 { 315 320 if (blockType == 1200) 316 status = runheader .ReadEvt(fInFormat, blockLength / sizeof(Float_t));321 status = runheader->ReadEvt(fInFormat, blockLength / sizeof(Float_t)); 317 322 318 323 else if(blockType == 1201) … … 323 328 vector<Float_t> buffer(blockLength / sizeof(Float_t)); 324 329 status = fInFormat->Read(buffer.data(), blockLength); 325 status = runheader .ReadEventHeader(buffer.data());330 status = runheader->ReadEventHeader(buffer.data()); 326 331 break; 327 332 } … … 335 340 if (!fInFormat->SeekEvtEnd()) 336 341 { 337 *fLog << (fForceMode?warn:err) << "ERROR - RUNE section not found in file." << endl; 342 *fLog << (fForceMode?warn:err) << "ERROR - RUNE section not found in file." << endl; 343 if (allocated) 344 delete runheader; 338 345 if (!fForceMode) 339 346 return fForceMode ? kTRUE : kFALSE; 340 347 } 341 348 342 if (!runheader .ReadEvtEnd(fInFormat, kTRUE))349 if (!runheader->ReadEvtEnd(fInFormat, kTRUE)) 343 350 { 344 351 *fLog << (fForceMode?warn:err) << "ERROR - Reading RUNE section failed." << endl; 352 if (allocated) 353 delete runheader; 345 354 if (!fForceMode) 346 355 return kFALSE; 347 356 } 348 357 349 fNumTotalEvents += runheader .GetNumEvents()*runheader.GetNumReuse()*358 fNumTotalEvents += runheader->GetNumEvents()*runheader->GetNumReuse()* 350 359 (fTelescopeIdx<0 && fNumTelescope==0 ? fNumTelescopes : 1); 351 360 continue; … … 354 363 } 355 364 365 if (allocated) 366 delete runheader; 356 367 return rc; 357 368 }
Note:
See TracChangeset
for help on using the changeset viewer.