00001 #include "Helix.h"
00002 #include <iomanip.h>
00003
00004
00005
00006
00007
00008 Helix::Helix() {
00009 HepSymMatrix temp(5,0);
00010 _cov_matrix.assign(temp);
00011 }
00012
00013
00014
00015 Helix::Helix(QvecBase* track) {
00016 HepSymMatrix temp(5,0);
00017 _cov_matrix.assign(temp);
00018
00019 _charge = track->QCH();
00020 _mass = track->QM();
00021
00022
00023
00024
00025 if (track->TYPE() == TRACK || track->TYPE() == EFLOW ) {
00026
00027 QvecBase* ptrk = track;
00028 if (track->TYPE() == EFLOW) ptrk = ((AlEflw*) track)->getTrack();
00029
00030 _IR = ((AlTrack*) ptrk)->IR();
00031 _TL = ((AlTrack*) ptrk)->TL();
00032 _P0 = ((AlTrack*) ptrk)->P0();
00033 _D0 = ((AlTrack*) ptrk)->D0();
00034 _Z0 = ((AlTrack*) ptrk)->Z0();
00035
00036 int j = 0;
00037 for (int m = 1; m <= 5; m++) {
00038 for (int n = 1; n <= m; n++) {
00039 _cov_matrix(m,n) = ((AlTrack*) ptrk)->EM(++j);
00040 }
00041 }
00042
00043
00044 } else if (track->TYPE() == USERTRACK) {
00045
00046
00047
00048
00049
00050
00051 cout << "Helix::Helix: user track !" << endl;
00052
00053
00054 QvecBase* ptrk = track;
00055
00056
00057 float psum[5];
00058 psum[0] = track->QX();
00059 psum[1] = track->QY();
00060 psum[2] = track->QZ();
00061 psum[3] = sqrt(_mass*_mass + psum[0]*psum[0] +
00062 psum[1]*psum[1] + psum[2]*psum[2]);
00063 psum[4] = _mass;
00064
00065
00066 float vpsum[10];
00067 for (int j = 0; j < 10; j++) {
00068 vpsum[j] = ((AlUserTrack*)ptrk)->SIG(j);
00069 }
00070
00071
00072 float vini[3];
00073 QvrtBase* end_vertex = ((AlUserTrack*)ptrk)->getEndVertex();
00074 vini[0] = ((AlUsrVertex*) end_vertex)->QX();
00075 vini[1] = ((AlUsrVertex*) end_vertex)->QY();
00076 vini[2] = ((AlUsrVertex*) end_vertex)->QZ();
00077
00078
00079 float vvini[6];
00080 int j = 0;
00081 for (int m = 1; m <= 3; m++) {
00082 for (int n = 1; n <= m; n++) {
00083 vvini[j++] = ((AlUsrVertex*) end_vertex)->QVEM(m,n);
00084 }
00085 }
00086
00087
00088 float vpsvi[9];
00089 j = 0;
00090 for (int m = 0; m < 3; m++) {
00091 for (int n = 0; n < 3; n++) {
00092 vpsvi[j++]= ((AlUserTrack*)ptrk)->corrMatrix(m+1, n+1);
00093 }
00094 }
00095
00096 float trackpar[5];
00097 float vtrackpar[15];
00098
00099
00100 int ifail = w_YTPAR(_charge, vini, vvini, psum, vpsum, vpsvi, trackpar, vtrackpar);
00101
00102
00103 } else {
00104 cerr << "***** Helix::Helix: WARNING: Don\'t know tracks of type " <<
00105 int(track->TYPE()) << ". Track ignored !!" << endl;
00106 }
00107
00108 }
00109
00110
00111
00112 void Helix::setTrackParameters(QvecBase* track) {
00113 HepSymMatrix temp(5,0);
00114 _cov_matrix.assign(temp);
00115
00116
00117 _charge = track->QCH();
00118 _mass = track->QM();
00119
00120
00121
00122
00123
00124 if (track->TYPE() == TRACK || track->TYPE() == EFLOW ) {
00125
00126 QvecBase* ptrk = track;
00127 if (track->TYPE() == EFLOW) ptrk = ((AlEflw*) track)->getTrack();
00128
00129 _IR = ((AlTrack*)ptrk)->IR();
00130 _TL = ((AlTrack*)ptrk)->TL();
00131 _P0 = ((AlTrack*)ptrk)->P0();
00132 _D0 = ((AlTrack*)ptrk)->D0();
00133 _Z0 = ((AlTrack*)ptrk)->Z0();
00134
00135 int j = 0;
00136 for (int m = 1; m <= 5; m++) {
00137 for (int n = 1; n <= m; n++) {
00138 _cov_matrix(m,n) = ((AlTrack*)ptrk)->EM(++j);
00139 }
00140 }
00141
00142 } else if (track->TYPE() == USERTRACK) {
00143
00144
00145
00146
00147
00148
00149
00150 float psum[5];
00151 psum[0] = track->QX();
00152 psum[1] = track->QY();
00153 psum[2] = track->QZ();
00157
00158
00159 float vpsum[10];
00160 for (int j = 1; j <= 10; j++) {
00161 vpsum[j-1] = ((AlUserTrack*)track)->SIG(j);
00162 }
00163
00164
00165 float vini[3];
00166 QvrtBase* end_vertex = ((AlUserTrack*)track)->getEndVertex();
00167 vini[0] = ((AlUsrVertex*) end_vertex)->QX();
00168 vini[1] = ((AlUsrVertex*) end_vertex)->QY();
00169 vini[2] = ((AlUsrVertex*) end_vertex)->QZ();
00170
00171
00172 float vvini[6];
00173 int j = 0;
00174 for (int m = 1; m <= 3; m++) {
00175 for (int n = 1; n <= m; n++) {
00176 vvini[j++] = ((AlUsrVertex*) end_vertex)->QVEM(m,n);
00177 }
00178 }
00179
00180
00181 float vpsvi[9];
00182 j = 0;
00183 for (int m = 0; m < 3; m++) {
00184 for (int n = 0; n < 3; n++) {
00185 vpsvi[j++]= ((AlUserTrack*)track)->corrMatrix(m+1, n+1);
00186 }
00187 }
00188
00189 float trackpar[5];
00190 float vtrackpar[15];
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209 int ifail = w_YTPAR(_charge, vini, vvini, psum, vpsum, vpsvi, trackpar, vtrackpar);
00210
00211 _IR = trackpar[0];
00212 _TL = trackpar[1];
00213 _P0 = trackpar[2];
00214 _D0 = trackpar[3];
00215 _Z0 = trackpar[4];
00216
00217 j = 0;
00218 for (int m = 1; m <= 5; m++) {
00219 for (int n = 1; n <= m; n++) {
00220 _cov_matrix(m,n) = vtrackpar[j++];
00221 }
00222 }
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238 } else {
00239 cerr << "***** Helix::setTrackParameters: WARNING: Don\'t know tracks of type " <<
00240 int(track->TYPE()) << ". Track ignored !!" << endl;
00241 }
00242
00243 }
00244
00245
00246
00247
00248 int Helix::w_YTPAR(float charge, float vini[3], float vvini[6], float psum[5], float vpsum[10],
00249 float vpsvi[9], float trackpar[5], float vtrackpar[15]) {
00250
00265
00266 int ifail;
00267 W_YTPAR(charge, vini, vvini, psum, vpsum, vpsvi, trackpar, vtrackpar, ifail);
00268
00269 return ifail;
00270 }
00271