SND@LHC Software
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
63
64
65void
66GFRaveVertexFactory::findVertices ( std::vector < genfit::GFRaveVertex* > * GFvertices,
67 const std::vector < genfit::Track* > & GFTracks,
68 bool use_beamspot ){
69
70 clearMap();
71
72 try{
73 RaveToGFVertices(GFvertices,
74 factory_->create(GFTracksToTracks(GFTracks, NULL, IdGFTrackStateMap_, 0),
75 use_beamspot),
77 }
78 catch(Exception & e){
79 std::cerr << e.what();
80 }
81
82}
83
84
85void
86GFRaveVertexFactory::findVertices ( std::vector < genfit::GFRaveVertex* > * GFvertices,
87 const std::vector < genfit::Track* > & GFTracks,
88 std::vector < genfit::MeasuredStateOnPlane* > & GFStates,
89 bool use_beamspot ){
90
91 clearMap();
92
93 try{
94 RaveToGFVertices(GFvertices,
95 factory_->create(GFTracksToTracks(GFTracks, &GFStates, IdGFTrackStateMap_, 0),
96 use_beamspot),
98 }
99 catch(Exception & e){
100 std::cerr << e.what();
101 }
102
103}
104
105
106void
107GFRaveVertexFactory::setBeamspot(const TVector3 & pos, const TMatrixDSym & cov){
108 factory_->setBeamSpot(rave::Ellipsoid3D(TVector3ToPoint3D(pos),
110}
111
112
113void
114GFRaveVertexFactory::setMethod(const std::string & method){
115 size_t found = method.find("smoothing:1");
116 if (found==std::string::npos){
117 std::cerr << "GFRaveVertexFactory::setMethod(" << method << ") ==> smoothing not turned on! GFRaveTrackParameters will be unsmoothed!" << std::endl;
118 }
119 factory_->setDefaultMethod(method);
120 std::cout << "GFRaveVertexFactory::setMethod ==> set method to " << factory_->method() << std::endl;
121}
122
123
124void
126
127 for (unsigned int i=0; i<IdGFTrackStateMap_.size(); ++i)
128 delete IdGFTrackStateMap_[i].state_;
129
130 IdGFTrackStateMap_.clear();
131}
132
133
134} /* 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
Standard error message handling for exceptions. use like "std::cerr << e.what();".
Definition Exception.cc:51
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)
Matrix inversion tools.
Definition AbsBField.h:29
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)
rave::Covariance3D TMatrixDSymToCovariance3D(const TMatrixDSym &)
void RaveToGFVertices(std::vector< GFRaveVertex * > *, const std::vector< rave::Vertex > &, const std::map< int, genfit::trackAndState > &IdGFTrackStateMap)
rave::Point3D TVector3ToPoint3D(const TVector3 &)