Belle II Software  release-08-01-10
GFRavePropagator.cc
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 
21 #include "GFRavePropagator.h"
22 #include "GFRaveConverters.h"
23 #include "Exception.h"
24 
25 #include <iostream>
26 
27 
28 namespace genfit {
29 
30 GFRavePropagator::GFRavePropagator() :
31  IdGFTrackStateMap_(nullptr)
32 {
33  //std::cout << "GFRavePropagator::GFRavePropagator() \n";
34 }
35 
36 GFRavePropagator*
37 GFRavePropagator::copy() const
38 {
39  //std::cout << "GFRavePropagator::copy() \n";
40  return new GFRavePropagator(*this);
41 }
42 
43 
44 GFRavePropagator::~GFRavePropagator()
45 {
46  //std::cout << "GFRavePropagator::~GFRavePropagator() \n";
47 }
48 
49 
50 std::pair < rave::Track, double >
51 GFRavePropagator::to ( const rave::Track & /*orig*/,
52  const ravesurf::Cylinder & /*rcyl*/ ) const
53 {
54  // todo to be implemented!!
55  Exception exc("GFRavePropagator::to (cylinder) ==> not yet implemented!",__LINE__,__FILE__);
56  throw exc;
57 }
58 
59 
60 std::pair < rave::Track, double >
61 GFRavePropagator::to ( const rave::Track & orig,
62  const ravesurf::Plane & rplane ) const
63 {
64  // will throw Exception if extrapolation does not work
65  double path = IdGFTrackStateMap_->at(orig.id()).state_->extrapolateToPlane(PlaneToGFDetPlane(rplane));
66 
67  std::pair < rave::Track, double > ret(GFTrackToTrack(IdGFTrackStateMap_->at(orig.id()), orig.id(), orig.tag()), path);
68  return ret;
69 }
70 
71 
72 rave::Track
73 GFRavePropagator::closestTo ( const rave::Track & orig,
74  const rave::Point3D & pt, bool transverse ) const
75 {
76 
77  if (transverse){
78  Exception exc("GFRavePropagator::closestTo ==> transverse is true, not implemented!",__LINE__,__FILE__);
79  throw exc;
80  }
81 
82  TVector3 point(Point3DToTVector3(pt));
83  IdGFTrackStateMap_->at(orig.id()).state_->extrapolateToPoint(point);
84 
85  return GFTrackToTrack(IdGFTrackStateMap_->at(orig.id()), orig.id(), orig.tag());
86 }
87 
88 
89 void
90 GFRavePropagator::setIdGFTrackStateMap(std::map < int, genfit::trackAndState > * map){
91  //std::cout << "GFRavePropagator::setIdGFMeasuredStateOnPlaneMap() \n";
92 
93  IdGFTrackStateMap_ = map;
94 
95  if (IdGFTrackStateMap_==nullptr) {
96  Exception exc("GFRavePropagator::setIdGFMeasuredStateOnPlaneMap ==> map is nullptr!",__LINE__,__FILE__);
97  throw exc;
98  }
99  //std::cout<<"IdGFTrackStateMap_: " << (int)IdGFTrackStateMap_ << std::endl;
100 }
101 
102 } /* End of namespace genfit */
HepGeom::Point3D< double > Point3D
3D point
Definition: Cell.h:32
Defines for I/O streams used for error and debug printing.