Utils for Time of Flight calculation. More...
#include <tof_tools.h>
Public Member Functions | |
| tof_tools () | |
| default constructor | |
| tof_tools (bool debug_, bool use_energy_loss_=false, bool timeerr_=false, bool fluct_=false) | |
| constructor with options on debug, energy loss, time error, laser fluctuation | |
| ~tof_tools () | |
| Default destructor. | |
| void | init_from (const datatools::utils::properties &) |
| Can be init from config file. Not used yet. | |
| void | set_debug (bool debug_) |
| debug additional output | |
| void | set_run_number (int run_number_, std::string runtype_="") |
| run number for database, usually indispensable | |
| void | set_ECorr (bool energy_loss_) |
| If taking care of energy correction. | |
| void | set_TimeErr (bool timeerr_) |
| If taking care of time error from laser. | |
| void | set_LTFluct (bool fluct_) |
| If taking care of laser fluctuation. | |
| void | set_simulation (bool simu_) |
| If the run is from simulation. | |
| void | set_nodb4simu (bool nodb_) |
| To not access to the DB for simulation. | |
| void | set_tau_sc (double ts_) |
| Custom electron scintillator transit time. | |
| void | set_tau_sc_g (double ts_) |
| Custom gamma scintillator transit time. | |
| void | set_tau_el (double ts_) |
| Custom electronics delay. | |
| void | set_Vg (double vg_) |
| Custom number of photo electron correction. | |
| void | set_run_type (std::string rt_) |
| Run type (betabeta or noalpha) | |
| bool | get_simulation () |
| is simulation set true | |
| string | get_run_type () |
| what is the run type set | |
| bool | get_dt (const track &track1_, const track &track2_, double &dt_int_, double &dt_ext_) |
| get time difference between theoretics and measured ToF of two electrons. | |
| bool | get_dt (const track &track1_, const scin_hit &scin_hit2_, double &dt_int_, double &dt_ext_, bool change_elec_energy_=false, double elec_energy_=0, double elec_length_=0) |
| get time difference between theoretics and measured ToF of an electron and a gamma. | |
| bool | get_dt (const scin_hit &scin_hit1_, const scin_hit &scin_hit2_, double &dt_) |
| get time difference between theoretics and measured ToF of two gamma. | |
| bool | get_chi2 (const track &track1_, const track &track2_, double &internal_chi2_, double &external_chi2_, bool keep_dt_=false) |
| Calculate the chi2 between two electrons for a given dt. | |
| bool | get_chi2 (const track &track_, const scin_hit &scin_hit_, double &internal_chi2_, double &external_chi2_, bool keep_dt_=false, bool change_elec_energy_=false, double elec_energy_=0, double elec_length_=0) |
| Calculate the chi2 between an electron and a gamma for a given dt. | |
| bool | get_chi2 (const scin_hit &scin_hit1_, const scin_hit &scin_hit2_, double &chi2_, bool keep_dt_=false) |
| Calculate the chi2 between two gammas scin to scin for a given dt. | |
| bool | get_chi2_1e (const scin_hit &scin_hit1_, const scin_hit &scin_hit2_, double &internal_chi2_, double &internal_prob_) |
| Calculate the chi2 for one electron scin to scin for a given times. | |
| bool | get_chi2_2e_1g (const track &track1_, const track &track2_, const scin_hit &scin_hit3_, const bool switch_, double &internal_chi2_, double &internal_prob_) |
| Calculate the chi2 between two electrons and a gamma for given times. | |
| bool | get_chi2_2e_2g (const track &track1_, const track &track2_, const scin_hit &scin_hit3_, const scin_hit &scin_hit4_, const bool switch_, double &internal_chi2_, double &internal_prob_) |
| Calculate the chi2 between two electrons and two gammas for given times. | |
| bool | get_chi2_2g (const track &track_, const scin_hit &scin_hit2_, const scin_hit &scin_hit3_, const bool switch_, double &internal_chi2_, double &internal_prob_, bool change_elec_energy_=false, double elec_energy_=0, double elec_length_=0) |
| Calculate the chi2 between one electron and two gammas for given times. | |
| bool | get_chi2_3g (const track &track_, const scin_hit &scin_hit2_, const scin_hit &scin_hit3_, const scin_hit &scin_hit4_, const bool switch_, double &internal_chi2_, double &internal_prob_, bool change_elec_energy_=false, double elec_energy_=0, double elec_length_=0) |
| Calculate the chi2 between one electron and tree gammas for given times. | |
| void | set_vera (bool vera_) |
| useless | |
Static Public Member Functions | |
| static void | get_proba (double internal_chi2_, double external_chi2_, double &internal_prob_, double &external_prob_, unsigned int freedom_=1) |
| Get probability for freedom_ degree of freedom. | |
Private Member Functions | |
| float | get_tse (int sector_, int iobt_, int fcll_, int block_) |
| internal method to get the time sigma error from N3Db | |
| float | get_ltce (int sector_, int iobt_, int fcll_, int block_) |
| internal method to get the laser time calibration error from N3Db | |
| float | get_ltfluct (int sector_, int iobt_, int fcll_, int block_) |
| internal method to get the laser time fluctuation | |
| double | Beta (double ke_, double mass_) |
| internal method to get the relativistic beta factor for an energy ke_ and a mass mass_ | |
| double | T_th (double ke_, double mass_, double trlen_) |
| internal method to get the theoretics time of flight | |
| double | ECorrTracking (double energy_, double trlen_, scin_hit_id &id_) |
| correct the energy of a particle | |
| double | SigmaE (scin_hit_id &id_, double ke_) |
| sigma from laser measurement | |
| double | SigmaTrlen (double mass_) |
| error on PM size. A bit more than size/2 | |
| double | SigmaT (scin_hit_id &id_, double ke_, bool gamma_=false) |
| Total transition time error. | |
| double | FWHM (scin_hit_id &id_) |
| Get the FWHM of the scin from N3Db. | |
| double | g_trlen (geomtools::vector_3d &vertex_, scin_hit_id &id_) |
| get track length for a gamma, from vertex to scintillator | |
| double | g_trlen (scin_hit_id &id1_, scin_hit_id &id2_) |
| get track length for a gamma from a scintillator to another scintillator | |
Private Attributes | |
| bool | __debug |
| additional verbose information | |
| bool | __use_energy_loss |
| if use energy losses for electrons | |
| bool | __use_ltfluct |
| if use laser time fluctuation | |
| bool | __use_time_err |
| if use time error from laser | |
| bool | __simulation |
| if the run is simulation | |
| bool | __vera_method |
| useless | |
| bool | __nodb4simu |
| do not you the DB for simulation | |
| int | __run_number |
| the current run number | |
| double | __t1 |
| the kept time during get_dt | |
| double | __t2 |
| the kept time during get_dt | |
| double | __t_th1_int |
| the kept time during get_dt | |
| double | __t_th2_int |
| the kept time during get_dt | |
| double | __t_th1_ext |
| the kept time during get_dt | |
| double | __t_th2_ext |
| the kept time during get_dt | |
| double | __dt_int |
| the kept dt during get_dt | |
| double | __dt_ext |
| the kept dt during get_dt | |
| double | __dt |
| the kept dt during get_dt | |
| double | __e1 |
| the kept corrected energy during get_dt | |
| double | __e2 |
| the kept corrected energy during get_dt | |
| double | __e_last |
| the kept corrected energy during get_dt | |
| string | __run_type |
| the type of the run (betabeta or noalpha) | |
Static Private Attributes | |
| static const double | kC |
| speed of light in cm.ns-1 | |
| static const double | kMe |
| electron mass in keV | |
| static const double | kSig |
| \( 2*\sqrt{2*ln 2} \) | |
| static double | kTauSc |
| decay scintillator time constant | |
| static double | kTauSc_g |
| decay scintillator time constant | |
| static double | kTauEl |
| electronic and other independant cst | |
| static double | kVg |
| number of photoelectron correc | |
| static double | fwhm_trans |
| FLUCTUATIONS IN TRANSIT TIME IN THE PMT (ns) | |
Utils for Time of Flight calculation.
tof_tools.h
Author(s):
Christophe Christophe hugon@cenbg.in2p3.fr
Sophie Blondel blondel@lal.in2p3.fr
Francois Mauger mauger@lpccaen.in2p3.fr
Arnaud Chapon chapon@lpccaen.in2p3.fr
Creation date: 2010-03-01
Last modified: 2012-03-03
Description:
Utilities for computing TOF related values.
May be used by "2e" "1e1g" ... specialized TOF algorithms.
| double nemo3::tof_tools::Beta | ( | double | ke_, |
| double | mass_ | ||
| ) | [private] |
internal method to get the relativistic beta factor for an energy ke_ and a mass mass_
| double nemo3::tof_tools::ECorrTracking | ( | double | energy_, |
| double | trlen_, | ||
| scin_hit_id & | id_ | ||
| ) | [private] |
correct the energy of a particle
The correction is based on T. Filipova's note 1999 nemoa.car FUNCTION TK_ENERGY(IT) (not well understood). In the goal to be more accurate, a new correction was developped and not yet implemented in tof_tools, but has confirm the result of Fillipova with non significant difference on the final result.
\( \Delta E = c \times length + \frac { a1 - a3 \times ( length - a2 )^2 } {E} + \frac { h1 \times E \times h1 \times E } { 1. + E / h2 } \)
with
\( c = 0.475 \)
\( h1 = 0.145 \times 10^{-5} \)
\( h2 = 6490. \)
\( a1 = 5630. \)
\( a2 = 134. \)
\( a3 = 0.404 \)
\( \Delta E = c0 + c \times length + \frac { a1 + a2 \times length } {E} + \frac { h1^2 \times E^2} { 1. + E / h2 } \)
with
\( c = 0.326 \)
\( h1 = 0.2 \times 10^{-5} \)
\( h2 = 4660. \)
\( a1 = 1800. \)
\( a2 = 27. \)
\( c0 = 15.8 \)
| bool nemo3::tof_tools::get_chi2 | ( | const track & | track1_, |
| const track & | track2_, | ||
| double & | internal_chi2_, | ||
| double & | external_chi2_, | ||
| bool | keep_dt_ = false |
||
| ) |
Calculate the chi2 between two electrons for a given dt.
keep_dt_ means keep last tof_tools::get_dt calculation result, or redo it.
In summary, it calculate dt^2/sum (sigma^2). With \( t_{thn} \) the theoritics time of tracks n in the hypothesis (internal or external) :
\( \sigma_{th}^2 = { (\frac {t_{th1} \times kMe^2} {E1 \times (E1 + kMe) \times (E1 + 2.kMe)} })^2 \times ( \sigma E ( E1 ))^2 + \frac {\sigma_{Trlen}^2 (kMe) } { ( \beta^2 (E1, kMe) \times kC )} + \sigma_T^2 ( id1, E1 ) +\\ { (\frac {t_{th2} \times kMe^2} {E2 \times (E2 + kMe) \times (E2 + 2.kMe)} })^2 \times ( \sigma E ( E2 ))^2 + \frac {\sigma_{Trlen}^2 (kMe) } { ( \beta^2 (E2, kMe) \times kC )} + \sigma_T^2 ( id2, E2 ) \)
\( \sigma_{xp}^2 = tse^2(id1) + ltce^2(id1) + ltfluct^2(id1)\\ + tse^2(id2) + ltce^2(id2) + ltfluct^2(id2) \)
| bool nemo3::tof_tools::get_chi2 | ( | const track & | track_, |
| const scin_hit & | scin_hit_, | ||
| double & | internal_chi2_, | ||
| double & | external_chi2_, | ||
| bool | keep_dt_ = false, |
||
| bool | change_elec_energy_ = false, |
||
| double | elec_energy_ = 0, |
||
| double | elec_length_ = 0 |
||
| ) |
Calculate the chi2 between an electron and a gamma for a given dt.
keep_dt_ means keep last tof_tools::get_dt calculation result, or redo it.
In summary, it calculate dt^2/sum (sigma^2). With \( t_{thn} \) the theoritics time of track and scin n in the hypothesis (internal or external) :
\( \sigma_{th}^2 = { (\frac {t_{th1} \times kMe^2} {E1 \times (E1 + kMe) \times (E1 + 2.kMe)} })^2 \times ( \sigma E ( E1 ))^2 + \frac {\sigma_{Trlen}^2 (kMe) } { ( \beta^2 (E1, kMe) \times kC )} + \sigma_T^2 ( id1, E1 ) +\\ \frac {\sigma_{Trlen}^2 (0) } { ( \beta^2 (E2, 0) \times kC )} + \sigma_T^2 ( id2, E2 ) \)
\( \sigma_{xp}^2 = tse^2(id1) + ltce^2(id1) + ltfluct^2(id1)\\ + tse^2(id2) + ltce^2(id2) + ltfluct^2(id2) \)
| bool nemo3::tof_tools::get_chi2 | ( | const scin_hit & | scin_hit1_, |
| const scin_hit & | scin_hit2_, | ||
| double & | chi2_, | ||
| bool | keep_dt_ = false |
||
| ) |
Calculate the chi2 between two gammas scin to scin for a given dt.
keep_dt_ means keep last tof_tools::get_dt calculation result, or redo it.
In summary, it calculate dt^2/sum (sigma^2). With \( t_{thn} \) the theoritics time of scins n in the hypothesis (from 1 to 2) :
\( \sigma_{th}^2 = \frac {\sigma_{Trlen}^2 (0) } { ( \beta^2 (E1, 0) \times kC )} + \sigma_T^2 ( id1, E1 ) +\ \ \frac {\sigma_{Trlen}^2 (0) } { ( \beta^2 (E2, 0) \times kC )} + \sigma_T^2 ( id2, E2 ) \)
\( \sigma_{xp}^2 = tse^2(id1) + ltce^2(id1) + ltfluct^2(id1)\\ + tse^2(id2) + ltce^2(id2) + ltfluct^2(id2) \)
| bool nemo3::tof_tools::get_chi2_1e | ( | const scin_hit & | scin_hit1_, |
| const scin_hit & | scin_hit2_, | ||
| double & | internal_chi2_, | ||
| double & | internal_prob_ | ||
| ) |
Calculate the chi2 for one electron scin to scin for a given times.
In summary, it calculate dt^2/sum (sigma^2). With sigmas:
Only the internal hypthesis is tested. Returns true if chi2 if good.
| bool nemo3::tof_tools::get_chi2_2e_1g | ( | const track & | track1_, |
| const track & | track2_, | ||
| const scin_hit & | scin_hit3_, | ||
| const bool | switch_, | ||
| double & | internal_chi2_, | ||
| double & | internal_prob_ | ||
| ) |
Calculate the chi2 between two electrons and a gamma for given times.
In summary, it calculate dt^2/sum (sigma^2). With sigmas:
Only the internal hypthesis is tested. Returns true if chi2 if good.
| bool nemo3::tof_tools::get_chi2_2e_2g | ( | const track & | track1_, |
| const track & | track2_, | ||
| const scin_hit & | scin_hit3_, | ||
| const scin_hit & | scin_hit4_, | ||
| const bool | switch_, | ||
| double & | internal_chi2_, | ||
| double & | internal_prob_ | ||
| ) |
Calculate the chi2 between two electrons and two gammas for given times.
In summary, it calculate dt^2/sum (sigma^2). With sigmas:
Only the internal hypthesis is tested. Returns true if chi2 if good.
| bool nemo3::tof_tools::get_chi2_2g | ( | const track & | track_, |
| const scin_hit & | scin_hit2_, | ||
| const scin_hit & | scin_hit3_, | ||
| const bool | switch_, | ||
| double & | internal_chi2_, | ||
| double & | internal_prob_, | ||
| bool | change_elec_energy_ = false, |
||
| double | elec_energy_ = 0, |
||
| double | elec_length_ = 0 |
||
| ) |
Calculate the chi2 between one electron and two gammas for given times.
change_elec_energy_ means that it takes the elec_energy_ instead of the energy of the associated scin, and the elec_length_ to calculate energy losses.
In summary, it calculate dt^2/sum (sigma^2). With sigmas:
Only the internal hypthesis is tested. Returns true if chi2 if good.
| bool nemo3::tof_tools::get_chi2_3g | ( | const track & | track_, |
| const scin_hit & | scin_hit2_, | ||
| const scin_hit & | scin_hit3_, | ||
| const scin_hit & | scin_hit4_, | ||
| const bool | switch_, | ||
| double & | internal_chi2_, | ||
| double & | internal_prob_, | ||
| bool | change_elec_energy_ = false, |
||
| double | elec_energy_ = 0, |
||
| double | elec_length_ = 0 |
||
| ) |
Calculate the chi2 between one electron and tree gammas for given times.
change_elec_energy_ means that it takes the elec_energy_ instead of the energy of the associated scin, and the elec_length_ to calculate energy losses.
In summary, it calculate dt^2/sum (sigma^2). With sigmas:
Only the internal hypthesis is tested. Returns true if chi2 if good.
| bool nemo3::tof_tools::get_dt | ( | const track & | track1_, |
| const track & | track2_, | ||
| double & | dt_int_, | ||
| double & | dt_ext_ | ||
| ) |
get time difference between theoretics and measured ToF of two electrons.
calculate the internal and external Theoretics time of flight based on tof_tools::ECorrTracking for energy, tof_tools::T_th for time.
It makes the difference with associated scins of track1 and 2 times in internal and external hypothesis. More the dt_int or dt_ext are close to 0, more the hypothesis seems to be true.
| bool nemo3::tof_tools::get_dt | ( | const track & | track1_, |
| const scin_hit & | scin_hit2_, | ||
| double & | dt_int_, | ||
| double & | dt_ext_, | ||
| bool | change_elec_energy_ = false, |
||
| double | elec_energy_ = 0, |
||
| double | elec_length_ = 0 |
||
| ) |
get time difference between theoretics and measured ToF of an electron and a gamma.
calculate the internal and external Theoretics time of flight based on tof_tools::ECorrTracking for energy, tof_tools::T_th for time.
It makes the difference with associated scins of track1 and scin2 times in internal and external hypothesis. More the dt_int or dt_ext are close to 0, more the hypothesis seems to be true.
| bool nemo3::tof_tools::get_dt | ( | const scin_hit & | scin_hit1_, |
| const scin_hit & | scin_hit2_, | ||
| double & | dt_ | ||
| ) |
get time difference between theoretics and measured ToF of two gamma.
This element is special, and done for gamma tracking. It do not consider a vertex, the hypothesis is between the two scintillators. The center of the scintillators are the start and stop points. It calculate the Theoretics time of flight based on tof_tools::T_th for time.
Then t makes the difference with associated scins of scin1 and 2 times for 1 to 2 hypothesis. More the dt_int or dt_ext are close to 0, more the hypothesis seems to be true.
| static void nemo3::tof_tools::get_proba | ( | double | internal_chi2_, |
| double | external_chi2_, | ||
| double & | internal_prob_, | ||
| double & | external_prob_, | ||
| unsigned int | freedom_ = 1 |
||
| ) | [static] |
Get probability for freedom_ degree of freedom.
it uses the gsl function gsl_cdf_chisq_Q:
\(p(x) dx = {1 \over 2 \Gamma(\nu/2) } (x/2)^{\nu/2 - 1} \exp(-x/2) dx\)
| double nemo3::tof_tools::SigmaE | ( | scin_hit_id & | id_, |
| double | ke_ | ||
| ) | [private] |
| double nemo3::tof_tools::SigmaT | ( | scin_hit_id & | id_, |
| double | ke_, | ||
| bool | gamma_ = false |
||
| ) | [private] |
| double nemo3::tof_tools::T_th | ( | double | ke_, |
| double | mass_, | ||
| double | trlen_ | ||
| ) | [private] |
1.8.0