BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcSagTraj.cxx
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2// File and Version Information:
3// $Id: MdcSagTraj.cxx,v 1.3 2009/12/17 00:38:40 zhangy Exp $
4//
5// Description:
6// Class MdcSagTraj
7//
8//
9//
10// Environment:
11// Software developed for the BaBar Detector at the SLAC B-Factory.
12//
13// Author List:
14// R. Stroili originator
15//
16//
17// Copyright Information:
18// Copyright (C) 1998 INFN & Padova University
19//
20// History:
21// Migration for BESIII MDC
22//
23//------------------------------------------------------------------------
24
25//-----------------------
26// This Class's Header --
27//-----------------------
28#include "MdcGeom/MdcSagTraj.h"
29
30//-------------
31// C Headers --
32//-------------
33extern "C" {
34}
35
36//---------------
37// C++ Headers --
38//---------------
39#include <assert.h>
40
41//-------------------------------
42// Collaborating Class Headers --
43//-------------------------------
44#include "MdcGeom/Trajectory.h"
45
46//-----------------------------------------------------------------------
47// Local Macros, Typedefs, Structures, Unions and Forward Declarations --
48//-----------------------------------------------------------------------
49
50// ----------------------------------------
51// -- Public Function Member Definitions --
52// ----------------------------------------
53
54//----------------
55// Constructors --
56//----------------
57MdcSagTraj::MdcSagTraj( const double sag, const HepPoint3D& start,
58 const HepPoint3D& stop )
59 : TrkGeomTraj(0.0,start.distance(stop)), _sag(sag), _start(start), _stop(stop)
60{
61 //_direction = stop - start;
62 _direction = ((CLHEP::Hep3Vector) stop) - ((CLHEP::Hep3Vector) start);
63 _length = _direction.mag();
64 assert( _length != 0 );
65
66 _direction.setMag(1.0);
67 _a = _sag*4./(_length*_length);
68 _b = -_a*_length;
69
70}
71
73 : TrkGeomTraj(0.0,other._start.distance(other._stop)),
74 _sag(other._sag), _a(other._a), _b(other._b), _length(other._length),
75 _start(other._start), _stop(other._stop),
76 _direction(other._direction)
77{}
78
80//-------------
81// Methods --
82//-------------
85{
86 return new MdcSagTraj(*this);
87}
88
89//-------------
90// Operators --
91//-------------
92//-----------------------------------------------------------------------------
95{
96 if(&other != this){
97 for(int iend=0;iend<2;iend++)
98 flightrange[iend] = other.flightrange[iend];
99 _start = other._start;
100 _stop = other._stop;
101 _sag = other._sag;
102 _a = other._a;
103 _b = other._b;
104 _length = other._length;
105 _direction = other._direction;
106 }
107 return *this;
108}
109
110Hep3Vector
111MdcSagTraj::deviation( double flightlen ) const
112{
113 // only correction in y
114// Hep3Vector deviation(0., (_a*flightlen+_b)*flightlen, 0.);
115// Hep3Vector deviaH(0.,cosh((flightlen-_length/2.)/_a_H)+_b_H,0.);
116// return deviation;
117 return Hep3Vector(0., (_a*flightlen+_b)*flightlen, 0.);
118}
119
121MdcSagTraj::position(double flightlen) const
122{
123 static HepPoint3D tmppos;
124 tmppos = _start;
125//CHANGE tmppos += _direction*flightlen;
126 tmppos += (HepPoint3D) _direction*flightlen;//yzhang TEMP
127 tmppos.setY(tmppos.y()+(_a*flightlen+_b)*flightlen);
128 return tmppos;
129}
130
131Hep3Vector
132MdcSagTraj::direction( double flightlen ) const {
133 if ( flightlen <= 0. ) return _direction;
134// Hep3Vector dir = _direction*flightlen + delDirect(flightlen);
135 static Hep3Vector tmpdir;
136 tmpdir = _direction*flightlen;
137// register double newy = tmpdir.y() + 2.*_a*flightlen+_b;
138// tmpdir.setY(newy);
139 tmpdir.setY(tmpdir.y() + 2.*_a*flightlen+_b);
140// tmpdir += delDirect(flightlen);
141 tmpdir.setMag(1.0);
142 return tmpdir;
143}
144
145Hep3Vector
146MdcSagTraj::delDirect( double /*flightlen*/ ) const
147{
148 return Hep3Vector(0., 2.*_a, 0.);
149}
150
151void
152MdcSagTraj::getInfo(double flightlen, HepPoint3D& pos, Hep3Vector& dir) const
153{
154// std::cout<<"Dyz*"<<"MdcSagTraj01 "<<std::endl;//yzhang DEBUG
155 // Written using +=, etc to avoid temporaries
156 pos = _start;
157//CHANGE pos += _direction*flightlen;
158 pos += (HepPoint3D) _direction*flightlen;
159
160 dir = _direction;
161 if ( flightlen > 0. ) {
162 pos.setY(pos.y() + deltaY(flightlen));
163 dir.setY(dir.y() + 2.*_a*flightlen+_b);
164 dir.setMag(1.0);
165 }
166}
167
168void
169MdcSagTraj::getInfo( double flightlen, HepPoint3D& pos, Hep3Vector& dir,
170 Hep3Vector& delDir ) const
171{
172// std::cout<<"Dyz*"<<"MdcSagTraj011 "<<std::endl;//yzhang DEBUG
173
174 pos = _start;
175//CHANGE pos += _direction*flightlen ;
176 pos += (HepPoint3D) _direction*flightlen ;
177
178 pos.setY( pos.y() + (_a*flightlen+_b)*flightlen) ;
179
180 dir = _direction;
181 dir.setY( dir.y() + 2*_a*flightlen+_b) ;
182 // Note: `dir' is on purpose not normalized (WDH, Jan 2003)
183
184 delDir.setX(0.);
185 delDir.setY(2.*_a);
186 delDir.setZ(0.);
187}
188
189double
190MdcSagTraj::curvature( double /*f*/ ) const
191{
192 return _sag;
193}
194
195double
196MdcSagTraj::distTo1stError(double flightlen, double tol, int pathDir) const
197{
198 double dtmp = pathDir*2.*_a*flightlen+_b;
199
200 return dtmp==0. ? 9999.e4 : fabs(tol/dtmp);
201}
202
203double
204MdcSagTraj::distTo2ndError(double /*s*/, double /*tol*/, int /*pathDir*/) const
205{
206 return 999.e4 ;
207 //return _a==0. ? 999.e4 : tol/(2.*_a);
208}
209
210// Support Visitor pattern (see TrkGeomTraj.h)
211void
213{
214 std::cout<<"ErrMsg(error)"<<"accept visitor NOT implemented yet"<<std::endl;
215}
216
HepGeom::Point3D< double > HepPoint3D
Definition: MdcSagTraj.h:51
virtual ~MdcSagTraj()
Definition: MdcSagTraj.cxx:79
HepPoint3D position(double) const
Definition: MdcSagTraj.cxx:121
double curvature(double f=0.) const
Definition: MdcSagTraj.cxx:190
MdcSagTraj & operator=(const MdcSagTraj &)
Definition: MdcSagTraj.cxx:94
MdcSagTraj * clone() const
Definition: MdcSagTraj.cxx:84
Hep3Vector delDirect(double) const
Definition: MdcSagTraj.cxx:146
void getInfo(double fltLen, HepPoint3D &, Hep3Vector &direction) const
Definition: MdcSagTraj.cxx:152
virtual double distTo2ndError(double s, double tol, int pathDir) const
Definition: MdcSagTraj.cxx:204
virtual double distTo1stError(double s, double tol, int pathDir) const
Definition: MdcSagTraj.cxx:196
MdcSagTraj(const double sag, const HepPoint3D &point1, const HepPoint3D &point2)
Definition: MdcSagTraj.cxx:57
double deltaY(double fltLen) const
Definition: MdcSagTraj.h:94
Hep3Vector direction(double) const
Definition: MdcSagTraj.cxx:132
void accept(TrkGeomTrajVisitor &visitor) const
Definition: MdcSagTraj.cxx:212
double flightrange[2]
Definition: Trajectory.h:83