CYGNUS-RD / reconstruction

Camera and scope analysis tools
0 stars 25 forks source link

Skip folders with event info if tag=MC #170

Closed pietro14 closed 2 years ago

pietro14 commented 2 years ago

When you try to run on MC data, you get this error message:

UnboundLocalError: local variable 'event' referenced before assignment

In fact, the MC root file has two folders (event_info and param_dir), so the event variable can't be defined for those.

To prevent that, you have to skip those two folders in the for loop that reads the images.

@igorabritta suggested this change.

I think @gdimperi can benefit from this as well.

emanueledimarco commented 2 years ago

@pietro14 @igorabritta did you test the change on a recent data file to check that it works fine?

pietro14 commented 2 years ago

Yes, I tested it on a data file created with the current digitization code. It works fine. But maybe @gdimperi wants to have a look at this change as well.

emanueledimarco commented 2 years ago

No, I mean on real data, not simulation, a run taken with lime

pietro14 commented 2 years ago

Now, I have also tested it with real data Data/LAB/histograms_Run04503.root (using configFile_LNF.txt). The code works well: it automatically downloads the requested root files, and then it does its job for both justPedest=True and justPedest=False.

To be honest, I haven't checked whether the final output file reco_histograms_Run04503.root is okay or not. While, for MC data, I used the final output file to reproduce Giulia's scans plots. So the reconstructed images are the same for MC data.

Should I do some other check?

emanueledimarco commented 2 years ago

Should I do some other check?

No, it's OK. You changed only the part that gets the images, so if it gets them and runs, it's OK. I will merge the PR