22 #include "GFRaveVertexFactory.h"
23 #include "GFRaveConverters.h"
24 #include "GFRaveVertex.h"
26 #include "GFRaveMagneticField.h"
27 #include "GFRavePropagator.h"
29 #include "Exception.h"
31 #include "rave/Propagator.h"
32 #include "rave/MagneticField.h"
33 #include "rave/VertexFactory.h"
34 #include "rave/Vertex.h"
35 #include "rave/Ellipsoid3D.h"
40 GFRaveVertexFactory::GFRaveVertexFactory(
int verbosity,
bool useVacuumPropagator) {
42 if (useVacuumPropagator) {
43 propagator_ =
new rave::VacuumPropagator();
46 propagator_ =
new GFRavePropagator();
47 (
static_cast<GFRavePropagator*
>(propagator_))->setIdGFTrackStateMap(&IdGFTrackStateMap_);
50 magneticField_ =
new GFRaveMagneticField();
52 if (verbosity > 0) ++verbosity;
54 factory_ =
new rave::VertexFactory(*magneticField_, *propagator_,
"kalman-smoothing:1", verbosity);
58 GFRaveVertexFactory::~GFRaveVertexFactory(){
60 delete magneticField_;
67 GFRaveVertexFactory::findVertices ( std::vector < genfit::GFRaveVertex* > * GFvertices,
68 const std::vector < genfit::Track* > & GFTracks,
74 RaveToGFVertices(GFvertices,
81 std::cerr << e.what();
89 GFRaveVertexFactory::findVertices ( std::vector < genfit::GFRaveVertex* > * GFvertices,
90 const std::vector < genfit::Track* > & GFTracks,
91 std::vector < genfit::MeasuredStateOnPlane* > & GFStates,
97 RaveToGFVertices(GFvertices,
98 factory_->create(
GFTracksToTracks(GFTracks, &GFStates, IdGFTrackStateMap_, 0),
104 std::cerr << e.what();
112 GFRaveVertexFactory::setBeamspot(
const TVector3 & pos,
const TMatrixDSym & cov){
113 factory_->setBeamSpot(rave::Ellipsoid3D(TVector3ToPoint3D(pos),
114 TMatrixDSymToCovariance3D(cov)));
120 size_t found = method.find(
"smoothing:1");
121 if (found==std::string::npos){
122 std::cerr <<
"GFRaveVertexFactory::setMethod(" << method <<
") ==> smoothing not turned on! GFRaveTrackParameters will be unsmoothed!" << std::endl;
124 factory_->setDefaultMethod(method);
125 std::cout <<
"GFRaveVertexFactory::setMethod ==> set method to " << factory_->method() << std::endl;
130 GFRaveVertexFactory::clearMap() {
132 for (
unsigned int i=0; i<IdGFTrackStateMap_.size(); ++i)
133 delete IdGFTrackStateMap_[i].state_;
135 IdGFTrackStateMap_.clear();
Exception class for error handling in GENFIT (provides storage for diagnostic information)
void setMethod(const std::string &method)
Set the reconstruction method.
Defines for I/O streams used for error and debug printing.
std::vector< rave::Track > GFTracksToTracks(const std::vector< genfit::Track * > &GFTracks, std::vector< genfit::MeasuredStateOnPlane * > *GFStates, std::map< int, genfit::trackAndState > &IdGFTrackStateMap, int startID=0)
Convert a vector of genfit::Tracks to rave::Tracks also builds a map of unique ids to genfit::Tracks;...