Skip to content
Snippets Groups Projects
Commit 0655a0be authored by FU Chengdong's avatar FU Chengdong
Browse files

fix hardcode fit-direction & memory leak

parent 39bfb2d4
No related branches found
No related tags found
No related merge requests found
...@@ -258,7 +258,9 @@ namespace MarlinTrk { ...@@ -258,7 +258,9 @@ namespace MarlinTrk {
// set the initial track parameters // set the initial track parameters
/////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
return_error = marlinTrk->initialise( *pre_fit, bfield_z, IMarlinTrack::backward ) ; //return_error = marlinTrk->initialise( *pre_fit, bfield_z, IMarlinTrack::backward ) ;
// fucd: previous fixed as IMarlinTrack::backward, can not change? using input value now
return_error = marlinTrk->initialise( *pre_fit, bfield_z, fit_backwards ) ;
if (return_error != IMarlinTrack::success) { if (return_error != IMarlinTrack::success) {
std::cout << "MarlinTrk::createFit Initialisation of track fit failed with error : " << return_error << std::endl; std::cout << "MarlinTrk::createFit Initialisation of track fit failed with error : " << return_error << std::endl;
...@@ -388,10 +390,10 @@ namespace MarlinTrk { ...@@ -388,10 +390,10 @@ namespace MarlinTrk {
return_error = marlintrk->getNDF(ndf); return_error = marlintrk->getNDF(ndf);
if ( return_error != IMarlinTrack::success) { if ( return_error != IMarlinTrack::success) {
//streamlog_out(DEBUG3) << "MarlinTrk::finaliseLCIOTrack: getNDF returns " << return_error << std::endl; //std::cout << "MarlinTrk::finaliseLCIOTrack: getNDF returns " << return_error << std::endl;
return return_error; return return_error;
} else if( ndf < 0 ) { } else if( ndf < 0 ) {
//streamlog_out(DEBUG2) << "MarlinTrk::finaliseLCIOTrack: number of degrees of freedom less than 0 track dropped : NDF = " << ndf << std::endl; //std::cout << "MarlinTrk::finaliseLCIOTrack: number of degrees of freedom less than 0 track dropped : NDF = " << ndf << std::endl;
return IMarlinTrack::error; return IMarlinTrack::error;
} else { } else {
//streamlog_out(DEBUG1) << "MarlinTrk::finaliseLCIOTrack: NDF = " << ndf << std::endl; //streamlog_out(DEBUG1) << "MarlinTrk::finaliseLCIOTrack: NDF = " << ndf << std::endl;
...@@ -543,7 +545,6 @@ namespace MarlinTrk { ...@@ -543,7 +545,6 @@ namespace MarlinTrk {
track->addToTrackStates(*trkStateAtFirstHit); track->addToTrackStates(*trkStateAtFirstHit);
} else { } else {
//streamlog_out( WARNING ) << " >>>>>>>>>>> MarlinTrk::finaliseLCIOTrack: could not get TrackState at First Hit " << firstHit << std::endl ; //streamlog_out( WARNING ) << " >>>>>>>>>>> MarlinTrk::finaliseLCIOTrack: could not get TrackState at First Hit " << firstHit << std::endl ;
delete trkStateAtFirstHit;
} }
double r_first = firstHit.getPosition()[0]*firstHit.getPosition()[0] + firstHit.getPosition()[1]*firstHit.getPosition()[1]; double r_first = firstHit.getPosition()[0]*firstHit.getPosition()[0] + firstHit.getPosition()[1]*firstHit.getPosition()[1];
...@@ -569,7 +570,7 @@ namespace MarlinTrk { ...@@ -569,7 +570,7 @@ namespace MarlinTrk {
track->addToTrackStates(*trkStateAtLastHit); track->addToTrackStates(*trkStateAtLastHit);
} else { } else {
std::cout << "ERROR>>>>>>>>>>> MarlinTrk::finaliseLCIOTrack: could not get TrackState at Last Hit " << last_constrained_hit.id() << std::endl ; std::cout << "ERROR>>>>>>>>>>> MarlinTrk::finaliseLCIOTrack: could not get TrackState at Last Hit " << last_constrained_hit.id() << std::endl ;
delete trkStateAtLastHit; //delete trkStateAtLastHit;
} }
// const EVENT::FloatVec& ma = trkStateAtLastHit->getCovMatrix(); // const EVENT::FloatVec& ma = trkStateAtLastHit->getCovMatrix();
...@@ -587,17 +588,22 @@ namespace MarlinTrk { ...@@ -587,17 +588,22 @@ namespace MarlinTrk {
// return_error = createTrackStateAtCaloFace(marlintrk, trkStateCalo, lastHit, tanL_is_positive); // return_error = createTrackStateAtCaloFace(marlintrk, trkStateCalo, lastHit, tanL_is_positive);
if ( return_error == 0 ) { if ( return_error == 0 ) {
//std::cout << "fucdout referencePoint " << trkStateCalo.referencePoint << std::endl;
trkStateCalo.location = MarlinTrk::Location::AtCalorimeter; trkStateCalo.location = MarlinTrk::Location::AtCalorimeter;
track->addToTrackStates(trkStateCalo); track->addToTrackStates(trkStateCalo);
} else { } else {
//streamlog_out( WARNING ) << " >>>>>>>>>>> MarlinTrk::finaliseLCIOTrack: could not get TrackState at Calo Face " << std::endl ; std::cout << " >>>>>>>>>>> MarlinTrk::finaliseLCIOTrack: could not get TrackState at Calo Face " << std::endl ;
//delete trkStateCalo; //delete trkStateCalo;
} }
} else { } else {
track->addToTrackStates(*atLastHit); track->addToTrackStates(*atLastHit);
track->addToTrackStates(*atCaloFace); track->addToTrackStates(*atCaloFace);
//delete trkStateAtLastHit;
} }
if(trkStateAtFirstHit) delete trkStateAtFirstHit;
if(trkStateAtLastHit) delete trkStateAtLastHit;
if(trkStateIP) delete trkStateIP;
/////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
// done // done
/////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment