Skip to content

Add simple time fitter - #423

Merged
JamesJieranShen merged 5 commits into
rat-pac:mainfrom
llebanowski:fitTime
Sep 18, 2026
Merged

JamesJieranShen merged 5 commits into
rat-pac:mainfrom
llebanowski:fitTime

Conversation

@llebanowski

Copy link
Copy Markdown
Contributor

This PR supercedes #421 by creating a new processor.
Notably, it uses all available hit times and offers the user a choice between two straight-line light path options:

  1. Use light_speed (default)
  2. Use the TransitTimeCalculator by specifying the photon wavelength to use.

Default:
image

TransitTimeCalculator:
image

Comment thread src/fit/src/FitTimeProc.cc Outdated

void FitTimeProc::BeginOfRun(DS::Run *run) {
DBLinkPtr table = DB::Get()->GetLink("FIT_COMMON", "");
fLightSpeed = table->GetD("light_speed");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should be updated to:

if (!WasParamSet("light_speed")) fLightSpeed = table->GetD("light_speed");

so that it doesn't overwrite a value set by procset

fitT->SetEnableTime(true);

/// Initialize FitResult parameters
fitT->SetPosition(fPosition);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

SetPosition() calls SetValidPosition(true), so validposition_fittime is always true, even if the fit fails. I guess the position is the value input by the user, so it is arguably valid. Just wanted to check if this is the desired behavior.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is exactly the intended logic.

const TVector3 pmtPos = fPMTInfo->GetPosition(pmtid);

double tt = 0;
if (fSetWavelength) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The user can set both fWavelength and fLightSpeed, but if they do, only fWavelength is used. I think it should either only allow the user to set one, or it should be stated in the documentation that if both are set, the wavelength and the TransitTimeCalculator are used, and the light speed is ignored.

Comment thread macros/examples/fittime.mac Outdated
@@ -0,0 +1,31 @@
# Example macro showing how to use quadfitter

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Typo, quadfitter->fittime

Comment thread doc/users_guide/reconstruction.rst Outdated
``event_position_z`` ``double`` Position of event in mm. Defaults to 0.
========================= ========================== ===================

Position fit information in data structure

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Position fit->time fit

Comment thread doc/users_guide/reconstruction.rst Outdated
========================= ========================== ===================
**Field** **Type** **Description**
========================= ========================== ===================
``label`` ``string`` Additional string appended to "fitcentroid"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Typo: fitcentroid->fittime

@azummo

azummo commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

All my comments have been addressed. Looks good to me.

@JamesJieranShen
JamesJieranShen merged commit ad72a62 into rat-pac:main Sep 18, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants