JeffersonLab / hcana

Hall C++ Analyzer
7 stars 118 forks source link

RFTime Class Updates #491

Open sjdkay opened 1 year ago

sjdkay commented 1 year ago

I've updated the RFTime class with some new additions.

I added in particle dependent corrections for each spectrometer. An offset for each particle species can also be defined an applied separately if desired too.

Attached is a series of plots showing that the RFTime, corrected by particle species, is now flat across delta. 1D distributions of the uncorrected RF time plotted against the particle specific RF time are show on page 3. The distributions after the correction all appear sharper and are shifted (hence the need for a per particle offset). Pages 4 and 6 show the particle dependent RF vs delta and MM respectively.

Q2_3p0_W2p32_loweps_15_11_22.pdf

Note, for these plots the cuts applied were as follows -

General Cuts - H.gtr.dp > -8 && H.gtr.dp < 8 && P.gtr.dp > -10 && P.gtr.dp <20 && H.cal.etottracknorm > 0.7 && H.cal.etottracknorm < 1.4 && H.cer.npeSum > 1 && abs(H.gtr.beta-1) < 0.3 PID - Positron - P.cal.etottracknorm > 0.7 && P.cal.etottracknorm < 1.4 && P.aero.npeSum > 1 && P.hgcer.npeSum > 1 Pion - P.cal.etottracknorm < 0.7 && P.aero.npeSum > 1.5 && P.hgcer.npeSum > 1 Kaon - P.cal.etottracknorm < 0.7 && P.aero.npeSum > 1.5 && P.hgcer.npeSum < 3 Proton - P.cal.etottracknorm < 0.7 && P.aero.npeSum < 3 && P.hgcer.npeSum < 5

Appropriate CT cuts (determined from pages 1 and 2) were also applied as needed.

The correction applied is simply the ToF for the particle type. This is done by determining the path length (from delta and xptar, see lines 304 and 305 - this is lifted from the CTime class by CYero), this is then simply divided by Beta * c, where Beta here has been determined for each particle type from the momentum and mass (lines 308-317). Note that this is the track momentum and not the spectrometer momentum.

The ToF is calculated in lines 319-327. This is then applied as a correction when determing the new particle RFDistributions (lines 337-349).

As mentioned, the offsets can be set individually as refelected in these calculations. By default, they will be set to the offset for the spectrometer if they are not specfied in a database file. The way this was implemented isn't great and could definitely be improved upon (I'd rather just check if the variable is specified in a database file or not, but couldn't find a nice example of this)

In addition to this, I also added in some warnings regarding the choice of the RF offset value specified.

There are still a few things I want to add, so please don't merge this in just yet (hence why it's a draft for now). This is more of a preview of what's planned. In particular, I also want to investigate the possibility of adding a set of CT corrected RFTime variables (to flatten the distributions on page 5 of the pdf earlier and remove the CT/RF correlation).

I also want to further test this across other settings before a merge.

sjdkay commented 1 year ago

Cleaned up code a bit and commented out testing of the CT corrected RF times (calculated in CoinTime class). Can remove this entirely if it's too obnoxious.

Added some additional comments in a few places. Ready to merge in if nobody has any issues with it.