Skip to content

New T2D function for ALERT AHDC#1178

Open
mpaolone wants to merge 2 commits intoJeffersonLab:developmentfrom
mpaolone:development
Open

New T2D function for ALERT AHDC#1178
mpaolone wants to merge 2 commits intoJeffersonLab:developmentfrom
mpaolone:development

Conversation

@mpaolone
Copy link
Copy Markdown
Collaborator

@mpaolone mpaolone commented Apr 1, 2026

Added new T2D functional form and new wire-by-wire T2D database table call: time_to_distance_wire

Removed old call to database and calculation of doca in HitReader.java. Added call to new table and a new function called T2Dfunction. This is then called in line 151 to calculate doca. In the constants loader, the new table is defined AHDC_TIME_TO_DISTANCE_WIRE... and in the AHDCEngine, the table name is added to the list of ccdb table names.

double p2 = (time2distance[2] + time2distance[3]*time);
double p3 = (time2distance[4] + time2distance[5]*time);

double t1 = 1.0/(1.0 + Math.exp(-(time - time2distance[6])/time2distance[7]));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If time2distance[7] or time2distance[9] are zero in CCDB, you get NaN from the division. A guard would be great.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Ok, I can add an excption.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ok we can assume that the CCDB table are correct no need for 0 or NaN


////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// AHDC time to distance per wire
// See implimentation and functional form in reconstruction/alert/src/main/java/org/jlab/rec/ahdc/Hit/HitReader.java
Copy link
Copy Markdown
Collaborator

@mathieuouillon mathieuouillon Apr 2, 2026

Choose a reason for hiding this comment

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

Typo "See implimentation" → "implementation".
There is no null-check on ahdc_time2distanceWire.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Besides the typo, the ahdc_time2distanceWire is handled identically to every other calibration table that is loaded in the file (no direct null-check). Maybe there is a null check upstream in manager.getConstants.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I was referring to if (ahdc_adcGains != null) { and if (ahdc_timeOverThreshold != null) {. But yes, most of the tables don't do that.

Copy link
Copy Markdown
Collaborator

@baltzell baltzell Apr 2, 2026

Choose a reason for hiding this comment

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

I'd leave those kind of checks to a hidden contract between the CCDB table and the software, e.g., just don't put data in the CCDB table that the software doesn't know how to (easily) deal with.

if (CSTLOADED) return;

IndexedTable ahdc_timeOffsets = manager.getConstants(runno, "/calibration/alert/ahdc/time_offsets");
IndexedTable ahdc_time2distance = manager.getConstants(runno, "/calibration/alert/ahdc/time_to_distance");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

AHDC_TIME_TO_DISTANCE is still fetched and populated, but HitReader no longer uses it. Is it still useful?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Not at all. I can remove.

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.

3 participants