GENFIT Rev: NoNumberAvailable
Loading...
Searching...
No Matches
GFRaveVertexFactory.cc
Go to the documentation of this file.
1/* Copyright 2008-2010, Technische Universitaet Muenchen,
2 Authors: Christian Hoeppner & Sebastian Neubert & Johannes Rauch
3
4 This file is part of GENFIT.
5
6 GENFIT is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published
8 by the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 GENFIT is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with GENFIT. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#include <string>
21
22#include "GFRaveVertexFactory.h"
23#include "GFRaveConverters.h"
24#include "GFRaveVertex.h"
25
26#include "GFRaveMagneticField.h"
27#include "GFRavePropagator.h"
28
29#include "Exception.h"
30
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"
36
37
38namespace genfit {
39
40GFRaveVertexFactory::GFRaveVertexFactory(int verbosity, bool useVacuumPropagator) {
41
42 if (useVacuumPropagator) {
43 propagator_ = new rave::VacuumPropagator();
44 }
45 else {
47 (static_cast<GFRavePropagator*>(propagator_))->setIdGFTrackStateMap(&IdGFTrackStateMap_);
48 }
49
51
52 if (verbosity > 0) ++verbosity; // verbosity has to be >1 for rave
53
54 factory_ = new rave::VertexFactory(*magneticField_, *propagator_, "kalman-smoothing:1", verbosity); // here copies of magneticField_ and propagator_ are made!
55}
56
57
64
65
66void
67GFRaveVertexFactory::findVertices ( std::vector < genfit::GFRaveVertex* > * GFvertices,
68 const std::vector < genfit::Track* > & GFTracks,
69 bool use_beamspot ){
70
71 clearMap();
72
73 try{
74 RaveToGFVertices(GFvertices,
75 factory_->create(GFTracksToTracks(GFTracks, nullptr, IdGFTrackStateMap_, 0),
76 use_beamspot),
78 }
79 catch(Exception & e){
80 clearMap();
81 std::cerr << e.what();
82 }
83
84 clearMap();
85}
86
87
88void
89GFRaveVertexFactory::findVertices ( std::vector < genfit::GFRaveVertex* > * GFvertices,
90 const std::vector < genfit::Track* > & GFTracks,
91 std::vector < genfit::MeasuredStateOnPlane* > & GFStates,
92 bool use_beamspot ){
93
94 clearMap();
95
96 try{
97 RaveToGFVertices(GFvertices,
98 factory_->create(GFTracksToTracks(GFTracks, &GFStates, IdGFTrackStateMap_, 0),
99 use_beamspot),
101 }
102 catch(Exception & e){
103 clearMap();
104 std::cerr << e.what();
105 }
106
107 clearMap();
108}
109
110
111void
112GFRaveVertexFactory::setBeamspot(const TVector3 & pos, const TMatrixDSym & cov){
113 factory_->setBeamSpot(rave::Ellipsoid3D(TVector3ToPoint3D(pos),
115}
116
117
118void
119GFRaveVertexFactory::setMethod(const std::string & method){
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;
123 }
124 factory_->setDefaultMethod(method);
125 std::cout << "GFRaveVertexFactory::setMethod ==> set method to " << factory_->method() << std::endl;
126}
127
128
129void
131
132 for (unsigned int i=0; i<IdGFTrackStateMap_.size(); ++i)
133 delete IdGFTrackStateMap_[i].state_;
134
135 IdGFTrackStateMap_.clear();
136}
137
138
139} /* End of namespace genfit */
Exception class for error handling in GENFIT (provides storage for diagnostic information)
Definition Exception.h:48
virtual const char * what() const noexcept
Standard error message handling for exceptions. use like "std::cerr << e.what();".
Definition Exception.cc:52
GFRaveMagneticField class Uses the FieldManager to provide a magnetic field to rave.
GFRavePropagator class.
rave::MagneticField * magneticField_
GFRaveVertexFactory(int verbosity=0, bool useVacuumPropagator=false)
void findVertices(std::vector< genfit::GFRaveVertex * > *, const std::vector< genfit::Track * > &, bool use_beamspot=false)
rave::VertexFactory * factory_
void setMethod(const std::string &method)
std::map< int, genfit::trackAndState > IdGFTrackStateMap_
void setBeamspot(const TVector3 &pos, const TMatrixDSym &cov)
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)
rave::Covariance3D TMatrixDSymToCovariance3D(const TMatrixDSym &matrix)
void RaveToGFVertices(std::vector< GFRaveVertex * > *GFVertices, const std::vector< rave::Vertex > &raveVertices, const std::map< int, genfit::trackAndState > &IdGFTrackStateMap)
rave::Point3D TVector3ToPoint3D(const TVector3 &vec)