// $Id$ // // File: DTrackFitter.cc // Created: Tue Sep 2 09:10:48 EDT 2008 // Creator: davidl (on Darwin Amelia.local 8.11.1 i386) // #include "DTrackFitter.h" using namespace jana; //------------------- // DTrackFitter (Constructor) //------------------- DTrackFitter::DTrackFitter(JEventLoop *loop) { this->loop = loop; bfield=NULL; fit_status = kFitNotDone; DApplication* dapp = dynamic_cast(loop->GetJApplication()); if(!dapp){ _DBG_<<"Cannot get DApplication from JEventLoop! (are you using a JApplication based program?)"<GetBfield(); // this should be run number based! lorentz_def=dapp->GetLorentzDeflections(); RootGeom = dapp->GetRootGeom(); } //------------------- // ~DTrackFitter (Destructor) //------------------- DTrackFitter::~DTrackFitter() { } //------------------- // Reset //------------------- void DTrackFitter::Reset(void) { cdchits.clear(); fdchits.clear(); fit_type = kWireBased; chisq = 1.0E6; Ndof=0; cdchits_used_in_fit.clear(); fdchits_used_in_fit.clear(); fit_status = kFitNotDone; } //------------------- // AddHit //------------------- void DTrackFitter::AddHit(const DCDCTrackHit* cdchit) { cdchits.push_back(cdchit); fit_status = kFitNotDone; } //------------------- // AddHits //------------------- void DTrackFitter::AddHits(vector cdchits) { for(unsigned int i=0; icdchits.push_back(cdchits[i]); fit_status = kFitNotDone; } //------------------- // AddHit //------------------- void DTrackFitter::AddHit(const DFDCPseudo* fdchit) { fdchits.push_back(fdchit); fit_status = kFitNotDone; } //------------------- // AddHits //------------------- void DTrackFitter::AddHits(vector fdchits) { for(unsigned int i=0; ifdchits.push_back(fdchits[i]); fit_status = kFitNotDone; } //------------------- // FitTrack //------------------- DTrackFitter::fit_status_t DTrackFitter::FitTrack(const DVector3 &pos, const DVector3 &mom, double q, double mass) { input_params.setPosition(pos); input_params.setMomentum(mom); input_params.setCharge(q); input_params.setMass(mass); return FitTrack(); } //------------------- // FitTrack //------------------- DTrackFitter::fit_status_t DTrackFitter::FitTrack(const DKinematicData &starting_params) { SetInputParameters(starting_params); return FitTrack(); }