Skip to content

Conversation

OwenCole04
Copy link
Contributor

Modified inv_vref scan to only scan over one selected channel in each link. Added inv_vref_align.py in ana/inv_vref to take the results of this scan and find the optimal inv_vref value for each link to attain a target adc. (also changed my old trim_inv scan and algorithm to incorporate dacb similar to Chelsea's algorithm, although this isn't really pressing since we already have a method to level pedestals).

@OwenCole04
Copy link
Contributor Author

After running the level_pedestals task, I ran the inv_vref scan with the default channels (17 and 51). Running the analysis script with a target of 50 adc and then loading the output yaml file, I was able to get this for a pedestal run:

output

I was able to attain a median adc of 55 for link 0 and 51 for link 1

@OwenCole04
Copy link
Contributor Author

Also sorry for bad commit history; started this before the tasks menu got refactored. Files of primary concern are app/tool/tasks/inv_vref_scan.cxx and ana/inv_vref/inv_vref_align.py

@OwenCole04
Copy link
Contributor Author

for reference: pedestal run with default inv_vref values after running level_pedestals on our ROC:

output

Copy link
Member

@tomeichlersmith tomeichlersmith left a comment

Choose a reason for hiding this comment

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

This looks great :) the file diff doesn't look too bad so no reason to apologize.

Are you interested in converting this logic into C++ anytime soon? I think that is the next step so the tuning can be automated and run without having to create intermediate files.

@OwenCole04
Copy link
Contributor Author

OwenCole04 commented Aug 4, 2025

This looks great :) the file diff doesn't look too bad so no reason to apologize.

Are you interested in converting this logic into C++ anytime soon? I think that is the next step so the tuning can be automated and run without having to create intermediate files.

Thanks! I would be interested in converting this to C++ soon, just realized though there's still one thing that might need some tweaking first though.

Depending on what channels you select to scan, you can sometimes get weird behavior. For example, the plot above used inv_vref values using a scan of channels 17 and 51 (which I have set as the default for the inv_vref scan). Across multiple scans using these channels I didn't encounter anything off. I scanned a bunch of different channels on our roc, and some channels seemed to work consistently while others didn't.

The pedestal run below used inv_vref settings from a scan of channels 23 and 54. In this case, channel 23 worked well and link0 hit its target adc of 100, while link1 using channel 54 didn't.

output

Looking into the scan itself, it seems sometimes there's weird outliers in the middle of the adc range that ruins the fit for inv_vref vs adc. The first plot is a scan of channel 23, which is normal, and the second plot is of channel 54 with the weird outlier:

image image

@tomeichlersmith
Copy link
Member

Interesting! Well, I'll merge this and you can write another fix for these weird outliers. I wonder if its worth looking at checking a few points "around" the target to see if we can auto-detect this outlier behavior.

@OwenCole04
Copy link
Contributor Author

Thanks sounds good! I'll keep looking into it!

Looking back on a more comprehensive scan I did a while back with every single channel (ignore the red line), it looks like it can get quite messy sometimes 😅

image image

@tomeichlersmith
Copy link
Member

Yea, it looks like it "gets messy" when the value is at an extreme causing ADC "saturation" (quotes because made up, not really sure whats happening electronically). The grouping in the linear regime is pretty well defined without any far outliers at zero for example.

@tomeichlersmith tomeichlersmith merged commit 10fd34d into main Aug 5, 2025
1 check passed
@tomeichlersmith tomeichlersmith deleted the pedestal-trimming-owen-update2 branch August 5, 2025 14:18
@taylorjcolaizzi taylorjcolaizzi restored the pedestal-trimming-owen-update2 branch August 15, 2025 15:53
@taylorjcolaizzi taylorjcolaizzi deleted the pedestal-trimming-owen-update2 branch August 15, 2025 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants