Difference between revisions of "Brief Kinematic Fitting Example"
From GlueXWiki
Line 1: | Line 1: | ||
− | + | ==Brief summary== | |
+ | Kinematic fitting in the HallD sim-recon code is provided by the <code>DKinFit</code> class. | ||
+ | <pre> | ||
+ | DKinFit kfit; | ||
+ | </pre> | ||
+ | |||
+ | The kinematic fitter takes as its input <code>DKinematicData</code> objects, each of which contains both a 4-vector and a kinematic covariance matrix, which are the inputs to the fit. The fitter expects as input two <code>vector</code>s of <code>DKinematicData</code>, containing the initial and final state particles. | ||
+ | |||
+ | <pre> | ||
+ | vector<DKinematicData> initial; | ||
+ | vector<DKinematicData> final; | ||
+ | |||
+ | DKinematicData beam_photon,target,reconstructed_proton,reconstructed_pi1,...; | ||
+ | //fill these objects appropriately using objects from factories | ||
+ | |||
+ | initial.push_back(beam_photon); | ||
+ | initial.push_back(target); | ||
+ | |||
+ | final.push_back(reconstructed_proton); | ||
+ | final.push_back(reconstructed_pi1); | ||
+ | final.push_back(...); | ||
+ | </pre> | ||
+ | |||
+ | If there is a missing particle in the final state, use the <code>SetMissingParticle()</code> | ||
+ | |||
+ | <pre> | ||
+ | const double neutron_mass=.940 | ||
+ | kfit.SetMissingParticle(neutron_mass); | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | If there is a mass constraint (e.g. two photons from a pi0 decay), use <code>SetMassConstraint() | ||
<pre> | <pre> |
Revision as of 14:40, 15 March 2012
Brief summary
Kinematic fitting in the HallD sim-recon code is provided by the DKinFit
class.
DKinFit kfit;
The kinematic fitter takes as its input DKinematicData
objects, each of which contains both a 4-vector and a kinematic covariance matrix, which are the inputs to the fit. The fitter expects as input two vector
s of DKinematicData
, containing the initial and final state particles.
vector<DKinematicData> initial; vector<DKinematicData> final; DKinematicData beam_photon,target,reconstructed_proton,reconstructed_pi1,...; //fill these objects appropriately using objects from factories initial.push_back(beam_photon); initial.push_back(target); final.push_back(reconstructed_proton); final.push_back(reconstructed_pi1); final.push_back(...);
If there is a missing particle in the final state, use the SetMissingParticle()
const double neutron_mass=.940 kfit.SetMissingParticle(neutron_mass);
If there is a mass constraint (e.g. two photons from a pi0 decay), use SetMassConstraint()
vector<DKinematicData> initial; vector<DKinematicData> final; vector<DKinematicData> initial_post; vector<DKinematicData> final_post; //Add the beam particle to the initial state DKinematicData beam_photon; DVector3 mom(0.0, 0.0, 9.0); beam_photon.setMomentum(mom); beam_photon.setPosition(pos); beam_photon.setMass(0.0); beam_photon.setCharge(0.0); beam_photon.setMassFixed(); beam_photon.clearErrorMatrix(); initial.push_back(beam_photon); //Add the target to the initial state DKinematicData kd_targ; kd_targ.setMass(0.93827); kd_targ.setCharge(1.0); kd_targ.setMassFixed(); kd_targ.setMomentum( DVector3(0.0, 0.0, 0.0) ); kd_targ.clearErrorMatrix(); initial.push_back(kd_targ); //Add all our particles to the final state final.push_back(proton[k]); final.push_back(pip[l]); final.push_back(pip[m]); final.push_back(pim[n]); final.push_back(pim[o]); double cl=kfit.Prob();