Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getNumberOfEvents changes the internal state of the file #65

Open
jstrube opened this issue Oct 13, 2019 · 2 comments
Open

getNumberOfEvents changes the internal state of the file #65

jstrube opened this issue Oct 13, 2019 · 2 comments
Assignees

Comments

@jstrube
Copy link

jstrube commented Oct 13, 2019

  • OS version: SLC6, Ubuntu 18.04
  • Compiler version: GCC 6.2, gcc 7.4
  • Package version: v02-12-01
  • Reproduced by: call readNextEvent(), followed by getNumberOfEvents(), followed by readNextEvent(). You have just read the same event twice!
  • Goal: It is not obvious that getNumberOfEvents leads to this behavior, nor should it. The name suggest that this is a getter method. However, it looks like the implementation changes the internal state of the file.
    Tested on /pnfs/desy.de/ilc/prod/ilc/mc-opt-3/ild/dst-merged/500-TDR_ws/2f_Z_hadronic/ILD_l5_o1_v02/v02-00-01/rv02-00-01.sv02-00-01.mILD_l5_o1_v02.E500-TDR_ws.I250114.P2f_z_h.eL.pR.n033.d_dstm_10410_96.slcio
@rete rete added the bug label Oct 14, 2019
@rete rete self-assigned this Oct 14, 2019
@rete
Copy link
Contributor

rete commented Oct 14, 2019

Thanks for reporting this.
Indeed, calling getNumberOfEvents() is doing the following:

  • ask the random access manager to read the index at the end of the file
  • populate the event map
  • reset the stream pointer to begin
    This is why you read twice the same event I guess

@gaede gaede added enhancement and removed bug labels Jul 2, 2020
@gaede
Copy link
Contributor

gaede commented Jul 2, 2020

I agree that this seems not obvious - should change the documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants