CGEM BOSS 6.6.5.i
BESIII Offline Software System
Loading...
Searching...
No Matches
TrkExchangeData.cxx
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2// File and Version Information:
3// $Id: TrkExchangeData.cxx,v 1.3 2010/03/25 09:56:26 zhangy Exp $
4//
5// Description:
6// Class TrkExchangeData;
7//
8// Environment:
9// Software developed for the BaBar Detector at the SLAC B-Factory.
10//
11// Copyright Infomation;
12// Copyright (C) 2000 Lawrence Berkeley Laboratory
13//
14// Author(s): Dave Brown
15//
16//------------------------------------------------------------------------
21#include "MdcGeom/Constants.h"
22#include <assert.h>
23#include <math.h>
24#define BITSPERBYTE 8
25
26
27// packing statics. Note that these define the meaning of the data
28// and should NEVER BE CHANGED. Or, if they must be changed, this
29// class will need to be subclassed and any persistent data based on it
30// have its schema 'migrated'.
31
32const ComPackSignedExpFloat TrkExchangeData::_packd0(16,6,128.0);
33const ComPackFlatFloat TrkExchangeData::_packphi0(-Constants::pi,Constants::pi,16);
34const ComPackSignedExpFloat TrkExchangeData::_packomega(16,6,0.5);
35const ComPackSignedExpFloat TrkExchangeData::_packz0(16,6,256.0);
36const ComPackFlatFloat TrkExchangeData::_packlambda(-Constants::pi/2.0,Constants::pi/2.0,16);
37
39TrkExchangeData::paramPacker(int index) {
40 switch(index) {
42 return _packd0;
44 return _packphi0;
46 return _packomega;
48 return _packz0;
50 return _packlambda;
51 default:
52 assert(0);
53 return _packd0;
54 }
55}
56
58 for(unsigned ipar=0;ipar<TrkExchangePar::nParam;ipar++)
59 _params[ipar] = 0;
60}
61
63// pack the parameters and the diagonal errors
64 assert(traj != 0);
65 for(int ipar=TrkExchangePar::ex_d0;ipar<TrkExchangePar::nParam;ipar++){
66 unsigned parpack(0);
67 const ComPackBase<double>& packpar = paramPacker(ipar);
68// convert from tandip to dip
69 double pval(0) ;
70 switch (ipar) {
72 pval = traj->d0();
73 break;
75 pval = traj->phi0();
76 break;
78 pval = traj->omega();
79 break;
81 pval = traj->z0();
82 break;
84 pval = atan(traj->tanDip());
85 break;
86 }
87 ComPackBaseBase::StatusCode pcode = packpar.pack(pval,parpack);
88 assert(pcode !=ComPackBaseBase::TAG_BAD);
89 _params[ipar] = parpack;
90 }
91}
92
94 *this = other;
95}
96
99 if(this != &other){
100 for (int ipar=TrkExchangePar::ex_d0;ipar<TrkExchangePar::nParam;ipar++)
101 _params[ipar] = other._params[ipar];
102 }
103 return *this;
104}
105
107
110// unpack the parameters and the errors
111 HepVector pvec(5,0);
112 for(int ipar=TrkExchangePar::ex_d0;ipar<TrkExchangePar::nParam;ipar++){
113 const ComPackBase<double>& packpar = paramPacker(ipar);
114 ComPackBaseBase::StatusCode pcode = packpar.unpack(_params[ipar],pvec[ipar]);
115 assert(pcode != ComPackBaseBase::TAG_BAD );
116 }
117// convert back from dip to tandip
119 return new TrkExchangePar(pvec);
120}
double tan(const BesAngle a)
Definition BesAngle.h:216
virtual StatusCode unpack(const d_ULong, T &) const =0
virtual StatusCode pack(const T, d_ULong &) const =0
static const double pi
Definition Constants.h:38
TrkExchangeData & operator=(const TrkExchangeData &)
TrkExchangePar * exchange() const
double phi0() const
double omega() const
double z0() const
double d0() const
double tanDip() const