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

Add corryvreckan converter script #41

Merged
merged 4 commits into from
Dec 18, 2024
Merged

Add corryvreckan converter script #41

merged 4 commits into from
Dec 18, 2024

Conversation

cbespin
Copy link
Collaborator

@cbespin cbespin commented Dec 12, 2024

Adds a standalone script to convert interpreted data to a format compatible with the corryvreckan EventLoaderHDF5. Supports:

  • AIDA mode (timestamp-based, "forwarding" hits to the EventLoader)
  • legacy EUDET mode (pre-built events from DAQ converted to the EventLoaderHDF5 file format).

@maxbab1 Please have a look if you spot any mistakes

@cbespin cbespin added the software Related to software label Dec 12, 2024
@cbespin cbespin requested a review from maxbab1 December 12, 2024 15:50
@cbespin cbespin self-assigned this Dec 12, 2024
@maxbab1
Copy link
Collaborator

maxbab1 commented Dec 13, 2024

Thanks for the script!

I was not able to testshi script, because after interpretation, i don't have a table 'Hits'. I only have a table 'Dut'.

Also the Dut table does not have the TLU words associated with the hits yet. I had to do this by meself in my QnD converter script.

@cbespin
Copy link
Collaborator Author

cbespin commented Dec 13, 2024

The DUT table is everything that is needed if trigger_mode="AIDA" since we do not rely on any events that the DAQ software produces. In case of trigger_mode="EUDET" we need the data that has been created wit the event building functionality in the DAQ software since the timestamps are not synchronized with other devices in the beam but only locally between TLU and DUT words. The association is done with the internal event builder.

Copy link
Collaborator

@maxbab1 maxbab1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works in the eudet mode with my custom event builder.

However when i try to use the event builder from the repo, there is an issue:

2024-12-17 12:13:29,053 [Analysis         ] - ERROR   Exception during analysis
Traceback (most recent call last):
  File "/mnt/Daten/Nosync/Schule/tj-monopix2-daq/tjmonopix2/analysis/corryvreckan_converter.py", line 93, in <module>
    a.analyze_data()
  File "/mnt/Daten/Nosync/Schule/tj-monopix2-daq/tjmonopix2/analysis/analysis.py", line 379, in analyze_data
    hist_cs_tot += cs_tot.astype(np.uint32)
ValueError: operands could not be broadcast together with shapes (256,) (512,) (256,) 
Traceback (most recent call last):
  File "/mnt/Daten/Nosync/Schule/tj-monopix2-daq/tjmonopix2/analysis/corryvreckan_converter.py", line 93, in <module>
    a.analyze_data()
  File "/mnt/Daten/Nosync/Schule/tj-monopix2-daq/tjmonopix2/analysis/analysis.py", line 379, in analyze_data
    hist_cs_tot += cs_tot.astype(np.uint32)
ValueError: operands could not be broadcast together with shapes (256,) (512,) (256,) 
  0%|                     

I am not 100% sure if the repo event builder fails because my data format is different or if this is a general issue and noone used it so far...

tjmonopix2/analysis/corryvreckan_converter.py Outdated Show resolved Hide resolved
@cbespin
Copy link
Collaborator Author

cbespin commented Dec 17, 2024

The feature has been used / is used all the time, it originates from the clusterizer that is integrated for standalone analysis. What is your TOT binning? Did you apply a charge conversion already at some point? Otherwise it might be your data format

@maxbab1
Copy link
Collaborator

maxbab1 commented Dec 17, 2024

If i use my custom event builder it works fine.

But if i just let the script interpret the h5 file we have, it fails. But my data file uses the TLU-format with only trigger number, so i guess that's why it is failing. the results would be useless anyway and that's the reason i have my custom event bulder.

@cbespin
Copy link
Collaborator Author

cbespin commented Dec 18, 2024

I guess that will be the case since the clusterizer works on event basis in this case which is not really possible with the data format you have available. I will fix the column and row numbering, would you approve the PR then?

Copy link
Collaborator

@maxbab1 maxbab1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good now! Thanks!

@cbespin cbespin merged commit 78fc6a1 into development Dec 18, 2024
3 checks passed
@cbespin cbespin deleted the analysis_scripts branch December 18, 2024 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
software Related to software
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants