/* Copyright 2008-2010, Technische Universitaet Muenchen,
Authors: Christian Hoeppner & Sebastian Neubert & Johannes Rauch
This file is part of GENFIT.
GENFIT is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
GENFIT is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with GENFIT. If not, see .
*/
#include "GFRaveConverters.h"
#include "Exception.h"
#include "rave/Plane.h"
#include "GFRaveTrackParameters.h"
#include
namespace genfit {
std::vector < rave::Track >
GFTracksToTracks(const std::vector < genfit::Track* > & GFTracks,
std::map& IdGFTrackStateMap,
int startID){
unsigned int ntracks(GFTracks.size());
std::vector < rave::Track > ravetracks;
ravetracks.reserve(ntracks);
for (unsigned int i=0; i genfit::Track is NULL",__LINE__,__FILE__);
throw exc;
}
// only convert successfully fitted tracks!
if (!GFTracks[i]->getFitStatus(GFTracks[i]->getCardinalRep())->isFitConverged()) continue;
if (IdGFTrackStateMap.count(startID) > 0){
Exception exc("GFTracksToTracks ==> IdGFTrackStateMap has already an entry for this id",__LINE__,__FILE__);
throw exc;
}
IdGFTrackStateMap[startID].track_ = GFTracks[i];
IdGFTrackStateMap[startID].state_ = new MeasuredStateOnPlane(GFTracks[i]->getFittedState()); // here clones are made so that the state of the original GFTracks and their TrackReps will not be altered by the vertexing process
ravetracks.push_back(GFTrackToTrack(IdGFTrackStateMap[startID], startID) );
++startID;
}
//std::cout << "IdGFTrackStateMap size " << IdGFTrackStateMap.size() << std::endl;
return ravetracks;
}
rave::Track
GFTrackToTrack(trackAndState trackAndState, int id, std::string tag){
if (trackAndState.track_ == NULL) {
Exception exc("GFTrackToTrack ==> originaltrack is NULL",__LINE__,__FILE__);
throw exc;
}
if (! trackAndState.track_->getFitStatus()->isFitConverged()) {
Exception exc("GFTrackToTrack ==> Trackfit is not converged",__LINE__,__FILE__);
throw exc;
}
TVector3 pos, mom;
TMatrixDSym cov;
trackAndState.track_->getFittedState().getPosMomCov(pos, mom, cov);
// state
rave::Vector6D ravestate(pos.X(), pos.Y(), pos.Z(),
mom.X(), mom.Y(), mom.Z());
// covariance
rave::Covariance6D ravecov(cov(0,0), cov(1,0), cov(2,0),
cov(1,1), cov(2,1), cov(2,2),
cov(3,0), cov(4,0), cov(5,0),
cov(3,1), cov(4,1), cov(5,1),
cov(3,2), cov(4,2), cov(5,2),
cov(3,3), cov(4,3), cov(5,3),
cov(4,4), cov(5,4), cov(5,5));
//std::cerr<<"create rave track with id " << id << std::endl;
//std::cerr<<" pos: "; Point3DToTVector3(ravestate.position()).Print();
//std::cerr<<" mom: "; Vector3DToTVector3(ravestate.momentum()).Print();
rave::Track ret(id, ravestate, ravecov,
trackAndState.track_->getFitStatus()->getCharge(),
trackAndState.track_->getFitStatus()->getChi2(),
trackAndState.track_->getFitStatus()->getNdf(),
static_cast(const_cast